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: 

Updating custom fields of VBAK using BAPI BAPI_SALESORDER_CHANGE

former_member216877
Participant
0 Kudos

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.

1 ACCEPTED SOLUTION

suresh_mamilla
Participant
0 Kudos

Hi,

Instead of passing the direct structure to ls_extensionin-valuepart1, just concatenate the sales doc. no. and custom field value and then pass the concatenated result to that parameter.

Also have you added the structures to VBAKKOZ, VBAKKOZX, BAPE_VBAK, BAPE_VBAKX.

Hope it resolves.

Regards,

Suresh

8 REPLIES 8

suresh_mamilla
Participant
0 Kudos

Hi,

Instead of passing the direct structure to ls_extensionin-valuepart1, just concatenate the sales doc. no. and custom field value and then pass the concatenated result to that parameter.

Also have you added the structures to VBAKKOZ, VBAKKOZX, BAPE_VBAK, BAPE_VBAKX.

Hope it resolves.

Regards,

Suresh

0 Kudos

Dear Sir ,

   i am applying all the solution u have mentioned above but still its not getting update .

Regards,

Debesh

rajkumarnarasimman
Active Contributor
0 Kudos

Hi Debesh,

I hope you can use Extension attribute in FM 'BAPI_SALESORDER_CHANGE.

Kindly refer the following Snote for custom field updation. 

143580 - Information on SD BAPIs and customer enhancement concept


Regards


Rajkumar Narasimman

raymond_giuseppi
Active Contributor
0 Kudos

Did you append your yy/zz fields to both structures BAPE_VBAK (this one seems to be ok) and VBAKKOZ?

Regards,

Raymond

0 Kudos

i have done with solution u have given

0 Kudos

Yes.. i have

0 Kudos

Also check for any BAdI or SD Exit that manage this field.

Regards,

Raymond

former_member216877
Participant
0 Kudos

Thanks  to all ,,  i am debugging the BAPI , if i will update here if i got any solution .