SAP PP——生产订单的长文

可以在表STXH查询id、name、object、spras等资料

效果:

代码:

DATA: lv_aufnr TYPE aufnr VALUE '20035644',
      lv_name  TYPE tdobname,
      lv_text  TYPE string,
      lt_lines TYPE TABLE OF tline,
      ls_line  TYPE tline.

"前置补0
lv_aufnr = |{ lv_aufnr ALPHA = IN }|.

CONCATENATE sy-mandt lv_aufnr INTO lv_name.

CALL FUNCTION 'READ_TEXT'
  EXPORTING
    id                      = 'KOPF'
    language                = sy-langu
    name                    = lv_name
    object                  = 'AUFK'
  TABLES
    lines                   = lt_lines
  EXCEPTIONS
    id                      = 1
    language                = 2
    name                    = 3
    not_found               = 4
    object                  = 5
    reference_check         = 6
    wrong_access_to_archive = 7
    OTHERS                  = 8.

LOOP AT lt_lines INTO ls_line.
  CONCATENATE lv_text ls_line-tdline INTO lv_text.
ENDLOOP.

WRITE: lv_text.
posted @ 2018-05-08 20:11  鲸与海  阅读(855)  评论(0编辑  收藏  举报