SAP生产订单长文本读取、co01、co02、co03长文本读取

*读取抬头文本备注
DATA: TEXT1( 50).
DATABEGIN  OF ITB_S18  OCCURS  0.
         INCLUDE  STRUCTURE thead.
DATAEND  OF ITB_S18.
DATABEGIN  OF FLINES  OCCURS  0.
          INCLUDE  STRUCTURE TLINE.

DATAEND OF FLINES.


CONCATENATE '%' OUTPUT-AUFNR '%' INTO LV_TDNAME.
SELECT * FROM STXL
                   INTO CORRESPONDING FIELDS OF TABLE ITB_S18
               WHERE TDOBJECT = 'AUFK'
                     AND TDNAME LIKE LV_TDNAME" '888000010000559'"OUTPUT-AUFNR
                    AND TDID = 'KOPF'.

CLEAR TEXT1.
LOOP AT ITB_S18.
          CLEAR TEXT1.
          PERFORM FRM_READ_TEXT USING 'KOPF' ITB_S18-TDNAME 'AUFK'
          CHANGING TEXT1 .
ENDLOOP.

OUTPUT-QT = TEXT1.



* INCLUDE LZWMS_PRODUCTION_ORDER_INFOD...    " Local class definition
*&---------------------------------------------------------------------*
*&      Form  FRM_READ_TEXT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0326   text
*      -->P_ITB_S18_TDNAME  text
*      -->P_0328   text
*      <--P_TEXT1  text
*----------------------------------------------------------------------*
FORM FRM_READ_TEXT  USING    FID
                             FNAME
                             FOBJECT
                    CHANGING TEXT1.

 CALL FUNCTION 'READ_TEXT'
    EXPORTING
      CLIENT                        = SY-MANDT
      ID                            = FID
      LANGUAGE                      = SY-LANGU
      NAME                          = FNAME
      OBJECT                        = FOBJECT
*     ARCHIVE_HANDLE                = 0
*     LOCAL_CAT                     = ' '
*   IMPORTING
*     HEADER                        =
    TABLES
      LINES                         = FLINES
   EXCEPTIONS
     ID                            = 1
     LANGUAGE                      = 2
     NAME                          = 3
     NOT_FOUND                     = 4
     OBJECT                        = 5
     REFERENCE_CHECK               = 6
     WRONG_ACCESS_TO_ARCHIVE       = 7
     OTHERS                        = 8
            .
  IF SY-SUBRC <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
    LOOP AT FLINES.
      CONCATENATE TEXT1 FLINES-TDLINE INTO TEXT1 .

    ENDLOOP.

ENDFORM.                    " FRM_READ_TEXT

你可能感兴趣的:(abap,abap,abap,READ_TEXT,生产订单长文本读取,生产订单长文本)