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: 

BAPI_PO_CHANGE

Former Member
0 Kudos

Hi friends i am changing the purchase order data using BAPI_PO_CHANGE ,but data is not updates ple help me

i want update fowling fields data

Purchasing Document Number(ebeln)

PO Item Details

Item Number of Purchasing Document(EBELP)

Delivery Date(EEIND)

Net Price(NETPR)

PO Item Details --> Delivery Schedule

Scheduled Quantity(MENGE)

PO Item Details --> Texts

Item Text

Info Record PO Text

Material PO text

Delivery text

Info record note

Customer freight acct # note

i want to upload the above fields data from flat file to ME22n using BAPI_PO_CHANGE but my is is nou uploades into DATA BASE

here i am pasting my code

if there is any errors ple help me it's urgent

*&---------------------------------------------------------------------*

*& Report  ZBAPI_PO_ITEM1

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

REPORT  zbapi_po_item1.

*//Types delaraion

TYPES  : BEGIN OF ty_item,

         po_number LIKE bapimepoheader-po_number,

         po_item LIKE bapimepoitem-po_item,

         delivery_date LIKE bapimeposchedule-delivery_date,

         netpr LIKE bapimeposchedule-quantity,

       menge LIKE bapimepoitem-net_price,

*  ITEMTEXT LIKE BAPIMEPOTEXT,

*INFOPOTEXT LIKE BAPIMEPOTEXT,

*MaterialPOtext like BAPIMEPOTEXT,

*Deliverypotext like BAPIMEPOTEXT,

*PAYTERMS LIKE BAPIMEPOTEXT,

*FRIGHT like BAPIMEPOTEXT,

*        text_line1 LIKE bapimepotext-text_line,

*        text_line2 LIKE bapimepotext-text_line,

*        text_line3 LIKE bapimepotext-text_line,

*        text_line4 LIKE bapimepotext-text_line,

*        text_line5 LIKE bapimepotext-text_line,

*        text_line6 LIKE bapimepotext-text_line,

*       ebeln   TYPE ebeln,

*       ebelp(5)   TYPE n,

*       eeind(10)   TYPE c,

*       netpr(13)   TYPE p DECIMALS 2,

*       menge(16)   TYPE p decimals 3,

        text_line1(132) TYPE c,

       text_line2(132) TYPE c,

       text_line3(132) TYPE c,

        text_line4(132) TYPE c,

        text_line5(132) TYPE c,

        text_line6(132) TYPE c,

       END OF ty_item.

*//Internal table and work area declaration

DATA : lt_item TYPE TABLE OF ty_item,

        wa_item TYPE ty_item.

*//Varible declaration

DATA : lv_path TYPE string.

DATA : BEGIN OF wa_text.

         INCLUDE STRUCTURE bapimepotext.

DATA : END OF wa_text.

DATA : lt_text LIKE TABLE OF wa_text.

*//Selection screen design

PARAMETERS: p_file LIKE rlgrap-filename,

             e_file LIKE rlgrap-filename.

*//

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

   CALL FUNCTION 'F4_FILENAME'

     EXPORTING

       program_name  = syst-cprog

       dynpro_number = syst-dynnr

     IMPORTING

       file_name     = p_file.

   lv_path = p_file.

*//Uploading the data into internal table

   CALL FUNCTION 'GUI_UPLOAD'

     EXPORTING

       filename                      = lv_path

       filetype                      = 'ASC'

       has_field_separator           = '|'

*     HEADER_LENGTH                 = 0

*     READ_BY_LINE                  = 'X'

*     DAT_MODE                      = ' '

*     CODEPAGE                      = ' '

*     IGNORE_CERR                   = ABAP_TRUE

*     REPLACEMENT                   = '#'

*     CHECK_BOM                     = ' '

*     VIRUS_SCAN_PROFILE            =

*     NO_AUTH_CHECK                 = ' '

*   IMPORTING

*     FILELENGTH                    =

*     HEADER                        =

     TABLES

       data_tab                      = lt_item

*   EXCEPTIONS

*     FILE_OPEN_ERROR               = 1

*     FILE_READ_ERROR               = 2

*     NO_BATCH                      = 3

*     GUI_REFUSE_FILETRANSFER       = 4

*     INVALID_TYPE                  = 5

*     NO_AUTHORITY                  = 6

*     UNKNOWN_ERROR                 = 7

*     BAD_DATA_FORMAT               = 8

*     HEADER_NOT_ALLOWED            = 9

*     SEPARATOR_NOT_ALLOWED         = 10

*     HEADER_TOO_LONG               = 11

*     UNKNOWN_DP_ERROR              = 12

*     ACCESS_DENIED                 = 13

*     DP_OUT_OF_MEMORY              = 14

*     DISK_FULL                     = 15

*     DP_TIMEOUT                    = 16

*     OTHERS                        = 17

             .

   IF sy-subrc <> 0.

* Implement suitable error handling here

   ENDIF.

   IF sy-subrc EQ 0.

     WRITE : 'success'.

   ENDIF.

   DATA : BEGIN OF itab1 OCCURS 10,

itemtext LIKE bapimepotext,

infopotext LIKE bapimepotext,

materialpotext LIKE bapimepotext,

deliverypotext LIKE bapimepotext,

fright LIKE bapimepotext,

payterms LIKE bapimepotext,

END OF itab1.

   DATA : itemtext LIKE bapimepotext,

   infopotext LIKE bapimepotext,

   materialpotext LIKE bapimepotext,

   deliverypotext LIKE bapimepotext,

   fright LIKE bapimepotext,

   payterms LIKE bapimepotext.

   DATA: header LIKE bapimepoheader, " Header

   header_ind LIKE bapimepoheaderx, " Header index

   po_items LIKE bapimepoitem OCCURS 0 WITH HEADER LINE, " Item table

   items_ind LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE, " Item index table

   headertext LIKE bapimepotext ,

   priceingtype LIKE bapimepotext,

   return LIKE bapiret2 OCCURS 0 WITH HEADER LINE . " Message Return table

   DATA : itemschedule LIKE bapimeposchedule OCCURS 0 WITH HEADER LINE ,

   itemschedulex LIKE bapimeposchedulx OCCURS 0 WITH HEADER LINE .

*Structures to hold PO services data

   DATA : services LIKE bapiesllc OCCURS 0 WITH HEADER LINE .

   DATA : ctr TYPE n .

*end-of-selection.

   LOOP AT lt_item INTO wa_item.

     header-po_number   = wa_item-po_number.

     header_ind-po_number = 'X'.

     po_items-po_item = wa_item-po_item.

     po_items-quantity = wa_item-menge.

     po_items-net_price = wa_item-netpr.

     APPEND po_items.

     items_ind-po_item = wa_item-po_item.

     items_ind-quantity = 'X'.

     items_ind-net_price = wa_item-netpr.

     APPEND items_ind.

     itemschedule-delivery_date = wa_item-delivery_date.

     APPEND itemschedule.

*ITEMTEXT = WA_ITEM-ITEMTEXT.

*INFOPOTEXT = WA_ITEM-INFOPOTEXT.

*MaterialPOtext  = WA_ITEM-MaterialPOtext.

*Deliverypotext = WA_ITEM-Deliverypotext.

*FRIGHT  = WA_ITEM-FRIGHT.

*PAYTERMS  = WA_ITEM-PAYTERMS.

*APPEND ITAB1.

*ENDLOOP.

*

*LOOP AT ITAB1.

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item        = wa_item-po_item.

     wa_text-text_id        = 'F01'.

     wa_text-text_line         = wa_item-text_line1.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item        = wa_item-po_item.

     wa_text-text_id        = 'F02'.

     wa_text-text_line         = wa_item-text_line2.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item        = wa_item-po_item.

     wa_text-text_id        = 'F03'.

     wa_text-text_line         = wa_item-text_line3.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item        = wa_item-po_item.

     wa_text-text_id        = 'F04'.

     wa_text-text_line         = wa_item-text_line4.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item        = wa_item-po_item.

     wa_text-text_id        = 'F05'.

     wa_text-text_line         = wa_item-text_line5.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item        = wa_item-po_item.

     wa_text-text_id        = 'F06'.

     wa_text-text_line         = wa_item-text_line6.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     CALL FUNCTION 'BAPI_PO_CHANGE'

       EXPORTING

         purchaseorder = header-po_number

         poheader      = header

         poheaderx     = header_ind

       TABLES

         return        = return

         poitem        = po_items

         poitemx       = items_ind

*       POSCHEDULE    =

*       POSCHEDULEX   =

*       POTEXTHEADER  =

         potextitem    = lt_text.

     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

     IF NOT return IS INITIAL.

       WRITE:/ return-message.

     ENDIF.

   ENDLOOP.

   IF sy-subrc EQ 0.

     WRITE : 'SUCCESS'.

   ELSE.

     WRITE : 'Error'.

   ENDIF.

plz help me it's urgent

if u have any code plz send it to me.....

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi friends it is working fine but it is updating first record only second record onword it is not working

22 REPLIES 22

Former Member
0 Kudos

The items that you are changing should be passed in the Internal Table POITEMX as  well

Former Member
0 Kudos

Here, POITEM table contains the values that will update and POITEMX contains same fields with POITEM but as a flag. (X or space).

BAPI_PO_CHANGE will update only if POITEMX table fields are SET with ‘X’.


In short,

ITEM – Value for the fields

ITEMX – Fields in ITEM table is need to update or not (X or space)

Regards,

NIM

0 Kudos

ITEM i passed like this

  

po_items-po_item = wa_item-po_item.

     po_items-quantity = wa_item-menge.

     po_items-net_price = wa_item-netpr.

     APPEND po_items.

ITEMX I passed like this

   items_ind-po_item = 'X'.

     items_ind-quantity = 'X'.

     items_ind-net_price = 'X'.

     APPEND items_ind.

still the object is not executed

i want update ITEM data and ITEM TEXTS

ple refer my above object once......

0 Kudos

hi,

here ITEM NUMBER IS THE PRIMARY KEY,that's why it wouldn't change.Try to change the other fields rather the item number.

         and check whether u  have authorization for this or not.

former_member182546
Contributor
0 Kudos

Hi Vishnu,

   

     The Program source code is available, Please check the below link

http://wiki.sdn.sap.com/wiki/display/HOME/Abap+code+on+BAPI+PO+Change

With Regards,

Sudhir S

0 Kudos

hi sudhuir,

       i checked that link but main issue is i want to update  the PO ITEM TEXTS , ple check my above code once

0 Kudos

Hi Vishnu,

     you want to update only PO Item texts.

With Regards,

Sudhir S

0 Kudos

I want to update PO ITEM TEXTS(6 texts fields ) and Net price , Quality and ebeln, ebelp  fields ,

0 Kudos

Hi,

   Populate WA_TEXT-TEXT_FORM = '*', for all the texts you are updating in LT_TEXT.

Ex:-

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item          = wa_item-po_item.

     wa_text-text_id            = 'F03'.

     wa_text-text_form        = '*'.                          " Add this entry for the Text entries.

     wa_text-text_line         = wa_item-text_line3.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

Thanks & Regards

Bala Krishna

0 Kudos

Hi Vishnu ,

    In the Function module TABLES parameter   potextitem   is available to change the text.

Just check the data declaration for the text is 130 chracters.

With Regards,

Sudhir S

0 Kudos

hi bala krishna i tried this only still it is not working

0 Kudos

i changed length from 132 to 130 still it i not working

0 Kudos

Hi Vishnu,

Just to confirm first, do the following:

1. Manually add PO Item text in your PO.

2. call 'BAPI_PO_GETDETAIL1' and confirm the text id

3. Pass the same data of 'BAPI_PO_GETDETAIL1' to 'BAPI_PO_CHANGE'.

4. Check the return parameter of 'BAPI_PO_CHANGE' for any errors.

5. Ensure 'BAPI_TRANSACTION_COMMIT' return data.

If still any errors, try using FM 'SAVE_TEXT'.

Regards, Pranav.

0 Kudos

Hi Pranav,

        I tested my object based on your steps but still it is not working

0 Kudos

Hi,
   
Goto SE37, Menu Function Module>Test>Test Sequences
Give Bapis 1) BAPI_PO_CHANGE and 2) BAPI_TRANSACTION_COMMIT
Click Execute
First BAPI_PO_CHANGE will come
Give the PURCHASEORDER value in Importing parameters
In Tables Parameters goto POTEXTITEM click on details,
Give
PO_NUMBER,
PO_ITEM
TEXT_ID      ='F01'
TEXT_FORM = '*'
TEXT_LINE = 'Test PO Item text'.
Click Ok and execute.
Now BAPI_TRANSACTION_COMMIT will be ready for execution
Pass WAIT = X.
Execute.

Goto ME23N and for the PO whether the Item text is updated or not.

Also just check on your declaration of LT_TEXT.

DATA : lt_text   TYPE STANDARD TABLE OF bapimepotext,
           wa_text TYPE bapimepotext.

Thanks & Regards
Bala Krishna

0 Kudos

Hi Vishnu,

This should be a very small error that we are unable to locate because BAPI_PO_CHANGE works perfect.

Please verify if you are getting the return table with messge 'PO No. XXXXX changed successfully'?

Also, the retun parameter of BAPI_TRANSACTION_COMMIT should be initial.

Check in Debug mode for all the parameters that are passed to BAPI have the required data?

Does SAVE_TEXT raise any exceptions?

Regards, Pranav.

0 Kudos

friends  i followed all ur suggestion but still it is not updating plz refer my code once

*//Types delaraion

TYPES  : BEGIN OF ty_item,

         po_number LIKE bapimepoheader-po_number,

         po_item LIKE bapimepoitem-po_item,

         delivery_date LIKE bapimeposchedule-delivery_date,

         netpr LIKE bapimeposchedule-quantity,

       menge LIKE bapimepoitem-net_price,

         text_line1(130) TYPE c,

       text_line2(130) TYPE c,

       text_line3(130) TYPE c,

        text_line4(130) TYPE c,

        text_line5(130) TYPE c,

        text_line6(130) TYPE c,

       END OF ty_item.

*//Internal table and work area declaration

DATA : lt_item TYPE TABLE OF ty_item,

        wa_item TYPE ty_item.

*//Varible declaration

DATA : lv_path TYPE string.

DATA : BEGIN OF wa_text.

         INCLUDE STRUCTURE bapimepotext.

DATA : END OF wa_text.

DATA : lt_text LIKE TABLE OF wa_text.

*//Selection screen design

PARAMETERS: p_file LIKE rlgrap-filename,

             e_file LIKE rlgrap-filename.

*//

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

   CALL FUNCTION 'F4_FILENAME'

     EXPORTING

       program_name  = syst-cprog

       dynpro_number = syst-dynnr

     IMPORTING

       file_name     = p_file.

   lv_path = p_file.

*//Uploading the data into internal table

   CALL FUNCTION 'GUI_UPLOAD'

     EXPORTING

       filename                      = lv_path

       filetype                      = 'ASC'

       has_field_separator           = '|'

*     HEADER_LENGTH                 = 0

*     READ_BY_LINE                  = 'X'

*     DAT_MODE                      = ' '

*     CODEPAGE                      = ' '

*     IGNORE_CERR                   = ABAP_TRUE

*     REPLACEMENT                   = '#'

*     CHECK_BOM                     = ' '

*     VIRUS_SCAN_PROFILE            =

*     NO_AUTH_CHECK                 = ' '

*   IMPORTING

*     FILELENGTH                    =

*     HEADER                        =

     TABLES

       data_tab                      = lt_item

*   EXCEPTIONS

*     FILE_OPEN_ERROR               = 1

*     FILE_READ_ERROR               = 2

*     NO_BATCH                      = 3

*     GUI_REFUSE_FILETRANSFER       = 4

*     INVALID_TYPE                  = 5

*     NO_AUTHORITY                  = 6

*     UNKNOWN_ERROR                 = 7

*     BAD_DATA_FORMAT               = 8

*     HEADER_NOT_ALLOWED            = 9

*     SEPARATOR_NOT_ALLOWED         = 10

*     HEADER_TOO_LONG               = 11

*     UNKNOWN_DP_ERROR              = 12

*     ACCESS_DENIED                 = 13

*     DP_OUT_OF_MEMORY              = 14

*     DISK_FULL                     = 15

*     DP_TIMEOUT                    = 16

*     OTHERS                        = 17

             .

   IF sy-subrc <> 0.

* Implement suitable error handling here

   ENDIF.

   IF sy-subrc EQ 0.

     WRITE : 'success'.

   ENDIF.

   DATA : BEGIN OF itab1 OCCURS 10,

itemtext LIKE bapimepotext,

infopotext LIKE bapimepotext,

materialpotext LIKE bapimepotext,

deliverypotext LIKE bapimepotext,

fright LIKE bapimepotext,

payterms LIKE bapimepotext,

END OF itab1.

   DATA : itemtext LIKE bapimepotext,

   infopotext LIKE bapimepotext,

   materialpotext LIKE bapimepotext,

   deliverypotext LIKE bapimepotext,

   fright LIKE bapimepotext,

   payterms LIKE bapimepotext.

   DATA: header LIKE bapimepoheader, " Header

   header_ind LIKE bapimepoheaderx, " Header index

   po_items LIKE bapimepoitem OCCURS 0 WITH HEADER LINE, " Item table

   items_ind LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE, " Item index table

   headertext LIKE bapimepotext ,

   priceingtype LIKE bapimepotext,

   return LIKE bapiret2 OCCURS 0 WITH HEADER LINE . " Message Return table

   DATA : itemschedule LIKE bapimeposchedule OCCURS 0 WITH HEADER LINE ,

   itemschedulex LIKE bapimeposchedulx OCCURS 0 WITH HEADER LINE .

*Structures to hold PO services data

   DATA : services LIKE bapiesllc OCCURS 0 WITH HEADER LINE .

   DATA : ctr TYPE n .

*end-of-selection.

   LOOP AT lt_item INTO wa_item.

     header-po_number   = wa_item-po_number.

     header_ind-po_number = 'X'.

     po_items-po_item = wa_item-po_item.

     po_items-quantity = wa_item-menge.

     po_items-net_price = wa_item-netpr.

     APPEND po_items.

*    items_ind-po_item = wa_item-po_item.

*    items_ind-quantity = 'X'.

*    items_ind-net_price = wa_item-netpr.

*    APPEND items_ind.

        items_ind-po_item = 'X'.

     items_ind-quantity = 'X'.

     items_ind-net_price = 'X'.

     APPEND items_ind.

     itemschedule-delivery_date = wa_item-delivery_date.

     APPEND itemschedule.

     itemschedulex-delivery_date = 'X'.

     append itemschedulex.

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item        = wa_item-po_item.

     wa_text-text_id        = 'F01'.

       wa_text-text_form        = '*'.

     wa_text-text_line         = wa_item-text_line1.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item        = wa_item-po_item.

     wa_text-text_id        = 'F02'.

       wa_text-text_form        = '*'.

     wa_text-text_line         = wa_item-text_line2.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item        = wa_item-po_item.

     wa_text-text_id        = 'F03'.

       wa_text-text_form        = '*'.

     wa_text-text_line         = wa_item-text_line3.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item        = wa_item-po_item.

     wa_text-text_id        = 'F04'.

       wa_text-text_form        = '*'.

     wa_text-text_line         = wa_item-text_line4.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item        = wa_item-po_item.

     wa_text-text_id        = 'F05'.

       wa_text-text_form        = '*'.

     wa_text-text_line         = wa_item-text_line5.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item        = wa_item-po_item.

     wa_text-text_id        = 'F06'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_item-text_line6.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

endloop.

SORT lt_text BY po_item text_id.

     CALL FUNCTION 'BAPI_PO_CHANGE'

       EXPORTING

         purchaseorder = header-po_number

         poheader      = header

         poheaderx     = header_ind

       TABLES

         return        = return

         poitem        = po_items

         poitemx       = items_ind

         POSCHEDULE    = ITEMSCHEDULE

         POSCHEDULEX   = ITEMSCHEDULEX.

*       POTEXTHEADER  =

          potextitem    = lt_text.

     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

     IF NOT return IS INITIAL.

       WRITE:/ return-message.

     ENDIF.

*  ENDLOOP.

   IF sy-subrc EQ 0.

     WRITE : 'SUCCESS'.

   ELSE.

     WRITE : 'Error'.

   ENDIF.

Former Member
0 Kudos

Hi friends it is working fine but it is updating first record only second record onword it is not working

0 Kudos

Hi Vishnu,

The problem is in the loop then.

Check for clearing of all work areas and internal tables.

Also add a WAIT parameter to 'BAPI_TRANSACTION_COMMIT'

Your error messages should also give an error for not updating second record. Check in Debug mode.

Regards, Pranav.

0 Kudos

problem is in LOOP , but cleared all the internal tables and work areas before processing the second record but still it not uploading the second record

here i am pasting my code in between loop.......endloop

LOOP AT lt_item INTO wa_item.

     CLEAR : header-po_number,header_ind-po_number,header.

     REFRESH : po_items[], items_ind[],itemschedule[],itemschedulex[].

     header-po_number   = wa_item-po_number.

     header_ind-po_number = 'X'.

     po_items-po_item = wa_item-po_item.

     po_items-quantity = wa_item-menge.

     po_items-net_price = wa_item-netpr.

     APPEND po_items.

*    items_ind-po_item = wa_item-po_item.

*    items_ind-quantity = 'X'.

*    items_ind-net_price = wa_item-netpr.

*    APPEND items_ind.

     items_ind-po_item = wa_item-po_item.

     items_ind-quantity = 'X'.

     items_ind-net_price = 'X'.

     APPEND items_ind.

     itemschedule-delivery_date = wa_item-delivery_date.

     APPEND itemschedule.

     itemschedulex-delivery_date = 'X'.

     APPEND itemschedulex.

     REFRESH lt_text.

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item        = wa_item-po_item.

     wa_text-text_id        = 'F01'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_item-text_line1.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item        = wa_item-po_item.

     wa_text-text_id        = 'F02'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_item-text_line2.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item        = wa_item-po_item.

     wa_text-text_id        = 'F03'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_item-text_line3.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item        = wa_item-po_item.

     wa_text-text_id        = 'F04'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_item-text_line4.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item        = wa_item-po_item.

     wa_text-text_id        = 'F05'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_item-text_line5.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_item-po_number.

     wa_text-po_item        = wa_item-po_item.

     wa_text-text_id        = 'F06'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_item-text_line6.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

*SORT lt_text BY po_item text_id.

     CALL FUNCTION 'BAPI_PO_CHANGE'

       EXPORTING

         purchaseorder = header-po_number

         poheader      = header

         poheaderx     = header_ind

       TABLES

         return        = return

         poitem        = po_items

         poitemx       = items_ind

         poschedule    = itemschedule

         poschedulex   = itemschedulex

*       POTEXTHEADER  =

         potextitem    = lt_text.

     IF sy-subrc EQ 0.

     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

      EXPORTING

        WAIT          = '2'

*     IMPORTING

*       RETURN        =

               .

     ENDIF.

   ENDLOOP.

0 Kudos

Hi Vishnu,

In your code search for text REFRESH lt_text and replace it with REFRESH lt_text[].

Regards, Pranav.

Former Member
0 Kudos

Finally i got the result