cancel
Showing results for 
Search instead for 
Did you mean: 

Bapi....

vinotha_m
Participant
0 Kudos

hi,

Can anybody give me the name of the bapi to change the status of a created sales order i.e the field ABGRU.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Use BAPI_SALESORDER_CHANGE. For your scenario you have to fill 'Reason for rejection of quotations and sales orders' field in the Item table of the BAPI-

BAPISDITM-REASON_REJ with appropriate reason code. This you have to Item wise i.e. for each item. Do not forget to populate BAPISDITMX-ABGRU field with 'X'.

Hope this helps. Please reply if you still have issues.

Ramesh.

Answers (4)

Answers (4)

sreemsft
Contributor
0 Kudos

Hi,

You can see the below code, to get the better idea.

data: r_bapisditem type bapisdhd1,

r_bapisdheadx type bapisdhd1x.

data: it_bapisditem type standard table of bapisditm with header line,

it_bapisditemx type standard table of bapisditmx with header line,

it_return type standard table of bapiret2 with header line.

move: salesdocument to r_bapisditem-collect_no,

k_x to r_bapisdheadx-collect_no,

k_u to r_bapisditem-updateflag.

move: item number(posnr) to it_bapisditem-itm_number,

kbetr value to it_bapisditem-reason_rej, " pass your kbetr value

item number(posnr) to it_bapisditemx-itm_number,

k_x to it_bapisditemx-reason_rej,

k_u to it_bapisditemx-updateflag.

append it_bapisditem.

clear it_bapisditem.

*-- call fm sd_salesdocument_change

call function 'sd_salesdocument_change'

exporting

salesdocument = sales_document

order_header_in = r_bapisdhead

order_header_inx = r_bapisdheadx

call_from_bapi = k_x

tables

return = it_return

item_in = it_bapisditem

item_inx = it_bapisditemx.

Former Member
0 Kudos

Hi,

Change in the status of an item of a sales order implies that the sales order is changed. Hence Use the BAPI 'BAPI_SALESORDER_CHANGE', to change the Sales Order.

In the items table structure 'ORDER_ITEM_IN'(Structure 'BAPISDITM')mark the field 'REASON_REJ' with the reason for rejection passed to the VA02 BDC.

Point to note here is if a sales order is to be changed, then the structure 'ORDER_ITEM_INX'(Structure 'BAPISDITM') should also be populated (this is mandatory). Mark the field 'REASON_REJ' of this structure with 'X'(this means that the reason for rejection is to be updated).

The mandatory field to be populated in both tables structures 'ORDER_ITEM_IN' and 'ORDER_ITEM_INX' is 'ITM_NUMBER', which is the item number.

This would work.... Dont forget my points .

former_member181962
Active Contributor
0 Kudos

HI Vinotha,

Check the bapi BAPI_SALESORDER_CHANGE.

But I have a doubt whether we can update the status directly or not.

Regards,

ravi

manuel_bassani
Contributor
0 Kudos

Hi,

try bapi BAPI_SALESORDER_CHANGE

Manuel