SAP 獲取採購訂單表頭長文字

dicksonjyl560101發表於2020-03-10

SAP 獲取採購訂單表頭長文字

 

 

長文字不是直接存在某個table中,你在(me23n)可以雙擊該文字,然後選擇選單goto->header,檢視該文字的技術資訊,然後透過function module 'read_text',輸入相關的技術資訊,取得該文字。

 

DATA: BEGIN OF T_LINES OCCURS 50.

  INCLUDE STRUCTURE TLINE.

DATA: END OF T_LINES.

 

DATA: BEGIN OF HTEXT.

        INCLUDE STRUCTURE THEAD.

DATA: END OF HTEXT.

 

DATA: TNAME LIKE THEAD-TDNAME.

DATA: S_LINE(100) TYPE C.

 

   TNAME = open_po-ebeln.    " 將採購單號碼付給變數

   S_LINE = ''.

   CLEAR T_LINES.

   REFRESH T_LINES.

 

*-- 採購表頭長文字

 

 CALL FUNCTION 'READ_TEXT'

       EXPORTING

          CLIENT                     = SY-MANDT

          ID                               = 'F01'

          LANGUAGE             = '1'

          NAME                        = TNAME

          OBJECT                   = 'EKKO'

         ARCHIVE_HANDLE          = 0

     IMPORTING

          HEADER                  = HTEXT

     TABLES

          LINES                       = T_LINES

     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.

 

      LOOP AT T_LINES.

        IF T_LINES-TDLINE NE ''.

          CONCATENATE S_LINE T_LINES-TDLINE INTO S_LINE.

        ENDIF.

        ENDLOOP.

       open_po-LTEXT =  S_LINE.

 

 

    ENDIF.

 

 

 

 

https://mp.weixin.qq.com/s/mX_V6VoZEUt09RGseGyCfA

 

 

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29829936/viewspace-2679366/,如需轉載,請註明出處,否則將追究法律責任。

相關文章