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 issue

Former Member
0 Likes
1,406

hello,

I am using above BAPI to update reason for rejection in sales order.

Let me take an example.

One particular order has 2 items, one item fully delivered. another item not delivered.

Now for me the result must be :

- for the first item, reason for rejection must not be changed.

- for second item, reason for rejection must be set.

but the problem is BAPI is not updating the second item. it is neglecting the whole order.

Do you have any idea where the problem is ?

hello,

I am using above BAPI to update reason for rejection in sales order.

Let me take an example.

One particular order has 2 items, one item fully delivered. another item not delivered.

Now for me the result must be :

- for the first item, reason for rejection must not be changed.

- for second item, reason for rejection must be set.

but the problem is BAPI is not updating the second item. it is neglecting the whole order.

Do you have any idea where the problem is ?

7 REPLIES 7
Read only

Former Member
0 Likes
1,171

Hi,

check if u have set the field REASON_REJ in ORDER_ITEM_INX table set that item...

its value should be 'U'

Regards,

lavanya

Read only

0 Likes
1,171

Hi,

I have set the flag 'X'.

it is working for other cases. only in the example case I mentioned, it does not work

Read only

Former Member
0 Likes
1,171

Hi,

are you able to reject item number 2 manually using VA02 ? If not then probably the item has already been delivered or invoiced or a Purchase Order has been created for this. You need to reverse these documents first.

If yes, then here are the parameters you need to pass to the BAPI :

SALESDOCUMENT

ORDER_ITEM_IN-ITM_NUMBER ( 00020 for item 2 )

ORDER_ITEM_IN-REASON_REJ

ORDER_ITEM_INX-ITM_NUMBER = ( '00020' for item 2 )

ORDER_ITEM_INX-UPDATEFLAG = 'U'

ORDER_ITEM_INX-REASON_REJ = 'X'.

regards,

Advait

Read only

0 Likes
1,171

Hi,

Thanks for the reply. Here is my code.

gs_item_in-itm_number = gs_vbap-posnr.

gs_item_in-reason_rej = gf_reason_rej.

APPEND gs_item_in TO gt_item_in.

gs_item_inx-itm_number = gs_vbap-posnr.

gs_item_inx-reason_rej = 'X'.

gs_item_inx-updateflag = 'U'.

APPEND gs_item_inx TO gt_item_inx.

Surprisingly, via VA02 I am able to reject the item. only via BAPI, I face the problem.

Read only

0 Likes
1,171

debug and see the value being passed from gs_vbap-posnr to gs_item_in-itm_number if it is what it should be

also make sure that gf_reason_rej is not blank.

do u get any return messages from the system.

Assuming you are also passing the Salesdoucment

regards,

Advait

Read only

0 Likes
1,171

hi,

I checked Reason for rejection is not blank.

Itm_number also passed correctly.

I get below messages -

Field 'ABGRU' cannot be changed, VBAPKOM 000010 ready for input

Sales document 0200001019 was not changed.

Read only

0 Likes
1,171

I think u will need to debug a bit then, check the message number, message class and setup a watchpoint on sy-msgid sy-msgno with those values after the BAPI is called.

then see the code before that, you will get the reason why it is not updating.

regards,

Advait