Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Item texts of a document (PO) while it is not yet saved

Former Member
0 Kudos

Hi Team ABAP,

i´m a little confused about those item texts.

I was searching the Forum on this and found thread

according to this i adopted my Coding, but still it wont, work. Maybe one of you guys has an Idea where i go wrong?


FORM get_article_basic_text
  USING           ebeln           TYPE ebeln
                  ebelp           TYPE ebelp
                  matnr           TYPE matnr.

  DATA:           ls_header       TYPE thead,
                  lt_lines        TYPE TABLE OF tline,
                  ls_lines        TYPE tline,
                  lv_swap         TYPE c LENGTH 3,
                  lv_line         TYPE char20.

  FIELD-SYMBOLS: <line>           TYPE tline.

  DO 30 TIMES.
    WRITE sy-index TO lv_swap.
    CONDENSE lv_swap.
    CONCATENATE 'W_LONG_TXT' lv_swap INTO lv_line.
    ASSIGN (lv_line) TO <line>.
    IF <line> IS ASSIGNED.
      CLEAR <line>.
    ENDIF.
  ENDDO.

  IF ebeln IS INITIAL.
    ebeln = 'XXXXXXXXXX'.
  ENDIF.

  CONCATENATE ebeln ebelp
  INTO        ls_header-tdname.
  ls_header-tdid      = 'F03'.
  ls_header-tdobject  = 'EKPO'.
  ls_header-tdspras   = nast-spras.
  g_tdname = ls_header-tdname.

  CALL FUNCTION 'READ_TEXT'
    EXPORTING
      id                      = ls_header-tdid
      language                = ls_header-tdspras
      name                    = ls_header-tdname
      object                  = ls_header-tdobject
    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.

I created a new PO using ME21N, added the F03 Text on item level for item 10. Then i pushed print preview and debugged right into my coding.

Values for LS_HEADER were:

ls_header-tdname = XXXXXXXXXX00010

ls_header-tdid = F03

ls_header-tdspras = D

ls_header-tdobject = EKPO

and still i got sy-subrc = 4 and no result.

Edited by: Florian Kemmer on Jun 9, 2011 9:36 AM

5 REPLIES 5

Former Member
0 Kudos

ok check your tdname in the table as may be their is some problem with leading

zeros as i have already faced the same issue.

0 Kudos

I was checking the Text in the PO itself.

Doubleclicked it, and used the Menu ->Goto->Header

Headerinformations for my Text are:

Textname: ' 00010'

TextID: 'F03'

Language: 'DE'

Textobject: 'EKPO'

trying with spaces instead of XXXXXXXXXX now., reporting back then

0 Kudos

I´m a little confused since this works, tho according to the threads i found on hewre it shouldnt.

But anyway, thx for helping me out.

Former Member
0 Kudos

Florian, Have you checked the possibility of using the BADI "ME_PROCESS_PO_CUST" to achieve this ? Most of the methods in this badi uses the parameters of type IF_PURCHASE_ORDER_MM. May be you can use the methods IF_LONGTEXTS_MMGET_TEXTOBJECT, IF_LONGTEXTS_MMGET_TYPES, IF_LONGTEXTS_MM~GET_TEXT of the interface IF_PURCHASE_ORDER_MM.

I didn't tried this with PO, but simliar kind of BADI worked properly with Purchase requisition. Wiki post [Purchase Requisition Header Long Text using Badi - ME_PROCESS_REQ_CUST|http://wiki.sdn.sap.com/wiki/display/ABAP/PurchaseReq.HeaderLongTextusingBadi-ME_PROCESS_REQ_CUST] may be helpful.

Regards, Vinod

0 Kudos

That seems like a nice approach. even tho i was able to solve my problem somehow i will try this as it seems more straight than my solution.

Thanks Vinod