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: 

How to upload/update header and item long text to Purchase Tran ME21N?

Former Member
0 Kudos

Hi Sap Gurus,

I need some information over header and item long text updation into ME21n using BDC reocrding.

And that is too with respect to their respective header selection and item selection.

Here, iam passing header data with respect to 'header text' , 'Header Note', 'Pricing Types' , 'Deadlines' (Header selection)etc.., separately,

and

iam passing item text data with respect to 'Item Text', 'Info record PO text' , 'Material PO text' etc..,separately

how i can pass these header and item long text with respect to their selection?

Pls give me the solution asap.

thank in advance.

Message was edited by:

siri

4 REPLIES 4

gopi_narendra
Active Contributor
0 Kudos

You will have to use the FM's CREATE_TEXT SAVE_TEXT to create long texts

and EDIT_TEXT SAVE_TEXT in order to change long texts

See the sample code below which create long text if does not exist and will change the long text if already exists

  if not IT_POITEM_ENTRY[] is initial.
    read table IT_POITEM_ENTRY into IS_POITEM_ENTRY index IND.
    if SY-SUBRC = 0.
**      concatenate IS_POITEM_ENTRY-ES_PO_NO IS_POITEM_ENTRY-ES_PO_LN into ITEM_TDNAME.

      STTDOBJECT = 'ZES_PO'.
*      STTDNAME   = ITEM_TDNAME.
      STTDNAME  = IS_POITEM_ENTRY-ES_PO_NO.
      STTDID     = 'Z02'.
      STTDSPRAS  = SY-LANGU.


      call function 'SELECT_TEXT'
        exporting
          ID         = STTDID
          LANGUAGE   = SY-LANGU
          NAME       = STTDNAME
          OBJECT     = STTDOBJECT
        importing
          ENTRIES    = TFILL
        tables
          SELECTIONS = SELECTION.

      if TFILL = 0.
        call function 'INIT_TEXT'
          exporting
            ID       = STTDID
            LANGUAGE = SY-LANGU
            NAME     = STTDNAME
            OBJECT   = STTDOBJECT
          importing
            HEADER   = STHEADER
          tables
            LINES    = STLINES
          exceptions
            ID       = 1
            LANGUAGE = 2
            NAME     = 3
            OBJECT   = 4.

      else.
        call function 'READ_TEXT'
          exporting
            ID              = STTDID
            LANGUAGE        = SY-LANGU
            NAME            = STTDNAME
            OBJECT          = STTDOBJECT
          importing
            HEADER          = STHEADER
          tables
            LINES           = STLINES
          exceptions
            ID              = 1
            LANGUAGE        = 2
            NAME            = 3
            NOT_FOUND       = 4
            OBJECT          = 5
            REFERENCE_CHECK = 6.

      endif.
      call function 'EDIT_TEXT'
        exporting
          HEADER = STHEADER
          SAVE   = 'X'
        tables
          LINES  = STLINES.

      call function 'SAVE_TEXT'
        exporting
          HEADER          = STHEADER
          SAVEMODE_DIRECT = 'X'
        tables
          LINES           = STLINES.

    endif.
  endif.

Regards

Gopi

0 Kudos

Thank u for ur reply.

I need some info over this.i am going to use SAVE_TEXT fm.

here my problem is i have text OBJECT and text OBJECT ID but

i dont know how to pass text based on their selection(header: if it is realed to HEADER NOTE or PRICING TYPES and DEAD LINES ect.,

) and also i dont know the OBJECT NAME so

what is the actul procedure to create text accordig to their selection.

Pls give me with clear explaination.

0 Kudos

Hi Siri,

open a PO using ME23N.

There Under the Item --> Texts Tab,

just double click on any of the item text controls.

This takes you to a screen as SAP Script Editor.

Under that screen Goto --> Header, which displays you the Text Object Text ID Text Name.

All these entries are stored in table STXH,

you can get the entries by seeing the table in SE11 --> STXH --> Display Contents

Give

Text ID -->F01 Item text

Text object-->EKPO Purchasing doc. item texts

Language -->EN

Textname -->PO Number+PO Item Number(always)

This shows you the entries for long text.

But in order to read long text you have to use READ_TEXT Function module.

Also see table TTXID

Regards

Gopi

0 Kudos

Thank u very much for ur answer .

I understood that for item.But very small doubt.In case if it is Header data

How would be the TEXTNAME.

and is SAVE_TEXT ok to create po?

If i get the anwser for this i can get evrythig over this .

Pls give reply.

Message was edited by:

siri