Application Development and Automation 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: 
Read only

BAPI_SALESORDER_CHANGE

Former Member
0 Likes
2,163

Dear All,

Has any one successfully implemented the BAPI_SALESORDER_CHANGE Bapi to change the Z fields in a sales order ?

I have extended the corresponding structures,I have used update flag = 'U' and also passed 'X' to update the changed field...but still it is not updating the fields

I have gone through lot of threads in SDN but not able to find any thread which has solution

Can any one help me out on this issue.

Note:

1. We are able to create the Sales order with BAPI_SALESORDER_CREATEFROMDAT2 ...able to populate all the Z Fields also.

I am using 4.7EE version.

Regards,

Srinivas

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,891

Hi Srinu,

Are you calling 'BAPI_TRANSACTION_COMMIT' after?

Regards,

Chester

Dear All,

Has any one successfully implemented the BAPI_SALESORDER_CHANGE Bapi to change the Z fields in a sales order ?

I have extended the corresponding structures,I have used update flag = 'U' and also passed 'X' to update the changed field...but still it is not updating the fields

I have gone through lot of threads in SDN but not able to find any thread which has solution

Can any one help me out on this issue.

Note:

1. We are able to create the Sales order with BAPI_SALESORDER_CREATEFROMDAT2 ...able to populate all the Z Fields also.

I am using 4.7EE version.

Regards,

Srinivas

13 REPLIES 13
Read only

Former Member
0 Likes
1,891

Here´s a coding example:

It´s not for salesorder but contracts, but it works exactly the same way...

DATA: ls_vbak TYPE vbak,

ls_hcest TYPE /lig/sdt_hcest.

DATA: ls_extensionin TYPE bapiparex,

lt_extensionin TYPE bapiparextab,

ls_contract_header_in TYPE bapisdh1,

ls_contract_header_inx TYPE bapisdh1x,

lt_return TYPE tt_bapiret2,

l_return TYPE bapiret2,

ls_bape_vbak TYPE bape_vbak,

ls_bape_vbakx TYPE bape_vbakx.

DATA: l_length_key TYPE i,

l_length_data TYPE i.

  • Fill BAPI structures

ls_contract_header_inx-updateflag = 'U'.

ls_bape_vbak-vbeln = i_vbeln.

ls_bape_vbak-/lig/hccestat = i_cestat.

ls_bape_vbakx-vbeln = i_vbeln.

ls_bape_vbakx-/lig/hccestat = yhcon_true.

DESCRIBE FIELD ls_extensionin-structure LENGTH l_length_key IN CHARACTER MODE.

CLEAR: ls_extensionin, l_length_data.

ls_extensionin-structure = yhcon_bape_vbak.

DESCRIBE FIELD ls_bape_vbak LENGTH l_length_data IN CHARACTER MODE.

ls_extensionin+l_length_key(l_length_data) = ls_bape_vbak.

APPEND ls_extensionin TO lt_extensionin.

CLEAR: ls_extensionin, l_length_data.

ls_extensionin-structure = yhcon_bape_vbakx.

DESCRIBE FIELD ls_bape_vbakx LENGTH l_length_data IN CHARACTER MODE.

ls_extensionin+l_length_key(l_length_data) = ls_bape_vbakx.

APPEND ls_extensionin TO lt_extensionin.

  • Call standard BAPI to do the job

CALL FUNCTION 'BAPI_CUSTOMERCONTRACT_CHANGE'

EXPORTING

salesdocument = i_vbeln

contract_header_in = ls_contract_header_in

contract_header_inx = ls_contract_header_inx

TABLES

return = lt_return

extensionin = lt_extensionin.

Let me know if that works for you....

Regards,

Michael

Read only

Former Member
0 Likes
1,891

Did you fill-in the EXTENSIONIN structure? Please read the documentation on that parameter.

Read only

0 Likes
1,891

Dear Srinu,

I have filled EXTENSIONIN and I can see the data in that..but still not suceeded.

I debuged the code to see whether any where it is getting refreshed / deleted...but I didnt find any place where it is doing as mentioned.

Please help

Read only

0 Likes
1,891

Check the return-table for any errors or warnings....

If you have success-messages only, CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

Read only

0 Likes
1,891

I am checking the return Table and if not Error / Abort types of messages are not there then I am calling the 'BAPI_TRANSACTION_COMMIT.....it is going to this function module !!!!

Read only

Former Member
0 Likes
1,892

Hi Srinu,

Are you calling 'BAPI_TRANSACTION_COMMIT' after?

Regards,

Chester

Read only

0 Likes
1,891

Yes I am using 'BAPI_TRANSACTION_COMMIT' after calling

the Function module BAPI_SALESORDER_CHANGE

I have gone through lot of threads in SDN...but no where I find the answer, now I am searching in service.sap.com to check my luck !!!

Read only

0 Likes
1,891

In the extensioninx structure are you definitely filling the posnr structure with an item number rather than an 'X'.

This is a common mistake.

Read only

Former Member
0 Likes
1,891

You said you extended the corresponding structures, did you extend all of them?

For VBAK e.g. you need to extend

VBAK

BAPE_VBAK

BAPE_VBAKX

You need to pass the values for BAPE_VBAK and BAPE_VBAKX into your extension in order for the extension to work.

Hope that helps,

Michael

Read only

0 Likes
1,891

Yes Michael, we have extended these structures....we are able to create the Sales order by using the BAPI_SALESORDER_CREATEFROMDAT2.....in that we are populating the Z fields and there is no problem at alll....

Read only

0 Likes
1,891

Does the returntable contain any success-meesages or nothing at all?

If you don´t get ANY messages you should try to debug on a deeper level...

The BAPI calls FM SD_SALESDOCUMENT_CHANGE which also has a returntable.

I´ve had a similar problem these days where the BAPI did not return an error, but one of the FMs did...

Read only

0 Likes
1,891

K ...I will debug the code and come back to you all after some time !!!

thanx for the inputs

Read only

Former Member
0 Likes
1,891

Hi Srinivas,

Did you manage to solve this problem? I'm currently facing the same issue and have checked out other threads and also OSS but couldn't find any solutions. Would you be able to shed some light on this?

Appreciate your help.

Thanks and regards,

Adeline.