Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Updating custom fields of VBAK using BAPI BAPI_SALESORDER_CHANGE

Dear Expert ,

     My requirement is to update a Z field ,which is a header field  in VA02 Tcode and i have to update through BAPI .

for that i have written  below code but value is not getting update and in return parameter success message is coming   .  please help to solve me to solve it .

   ls_bape_vbak-vbeln = lv_sales_document.

   ls_bape_vbak-yyclmstat = 'X'.

   ls_extensionin-structure = 'BAPE_VBAK'.

   ls_extensionin-valuepart1 = ls_bape_vbak.

   APPEND ls_extensionin TO it_extensionin.

   CLEAR ls_extensionin.

   CLEAR ls_bape_vbak.

   ls_bape_vbakx-vbeln = lv_sales_document.

   ls_bape_vbakx-yyclmstat = 'X'.

   ls_extensionin-structure = 'BAPE_VBAKX'.

   ls_extensionin-valuepart1 = ls_bape_vbakx.

   APPEND ls_extensionin TO it_extensionin.

   CLEAR ls_extensionin.

   CLEAR ls_bape_vbakx.

   SELECT SINGLE vkorg vtweg spart

                                  INTO (lv_vkorg, lv_vtweg, lv_spart)

                                  FROM vbak

                                  WHERE vbeln = lv_sales_document.

   ls_header-sales_org = lv_vkorg.

   ls_header-distr_chan = lv_vtweg.

   ls_header-division = lv_spart.

   ls_header_x-updateflag = 'U'.

   ls_header_x-sales_org = 'X'.

   ls_header_x-distr_chan = 'X'.

   ls_header_x-division = 'X'.

   CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

     EXPORTING

       salesdocument            = lv_sales_document

       order_header_in          = ls_header

       order_header_inx         = ls_header_x

*     SIMULATION               = ' '

     TABLES

       return                   = it_return

*      schedule_lines           = it_schedule

*      schedule_linesx          = it_schedule_x

       extensionin              = it_extensionin.

   WAIT UP TO 2 SECONDS.

   CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

     EXPORTING

       wait = lv_wait.

Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question