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

0 Likes
1,430

I have a sales document and have to change material number.

Can I do this with this BAPI? How to do?

7 REPLIES 7
Read only

former_member189629
Active Contributor
0 Likes
1,228

Jorge,

Use the following FM with the below std structures. Make all the changes you need in the Header & Item Structures. Material Number can be changed in BAPISDITM-MATERIAL and passed to the FM

*--- BAPI STRUCTURES

*--- Structure to hold Communication Fields: SD Document Header

DATA: HEADER_IN LIKE BAPISDHD1,

*--- Structure to hold Checkbox Fields for SD Document Header

HEADER_IN_X LIKE BAPISDHD1X,

*--- Structure to hold Communication Fields: SD Document Item

ITEM_IN LIKE BAPISDITM OCCURS 0 WITH HEADER LINE,

*--- Structure to hold Communication Fields: SD Document Item

ITEM_IN_X LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE,

*--- Structure to hold BAPI Return Parameter

ST_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE,

*--- Structure to hold BAPI Structure of VBAK

ITEMS_EX LIKE BAPISDHD OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'SD_SALESDOCUMENT_CHANGE'

OR

CALL FUNCTION BAPI_SALESORDER_CHANGE

Pass the changed material data in to the item structure

Hope this helps...

Regards,

Karthik

Message was edited by:

Karthik

Read only

former_member150733
Contributor
0 Likes
1,228

Yes you can change it using BAPI : BAPI_SALESORDER_CHANGE.

You need to fill in the the relevant IMPORTING and TABLES parameters.

eg., for material you need to fill in the MATERIAL in ORDER_ITEM_IN table and mark an 'X' in the table ORDER_ITEM_INX for the corresponding entry that must be updated. ie., the value of which is available in ORDER_ITEM_IN table will be updated on execution. This is to be done for all the parameters that need to be updated.

But be informed that you will get all the standard checks that you would, when you do the same from the transaction for sales order change.

You also need to check for any error messges returned and if everything is ok , call the FM BAPI_COMMIT to commit the changes.

Regards,

Anish Thomas

Read only

0 Likes
1,228

Your answers not resolve my problem.

An error occurs:

--> The material in item 000010 cannot be changed.

Do you have any other idea?

Read only

0 Likes
1,228

Hi Jorge,

Has the item already been delivered?

Regards,

Chester

Read only

0 Likes
1,228

No, the item not been delivered.

Read only

0 Likes
1,228

Hi Jorge,

If you attempt to change the item in VA02 do you receive an error message?

Regards,

Chester

Read only

0 Likes
1,228

Hi, chester.

I can´t change material number direct, it´s necessary delete and insert a new item.