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
3,386

Dear Friends

I need to change a sales order delivery block VBAK-LIFSK.

I am providing the new LIFSK in the selection screen. From my analysis I have to use FM: BAPI_SALESORDER_CHANGE.

Please tell me what values I should pass to this FM to change my sales orders as above.

If there is any other FM please suggest that.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,288

Hi,

check this code


DATA: BAPISDH1X LIKE BAPISDH1X.
DATA: BAPISDH1 LIKE BAPISDH1.

PARAMETERS: P_VBELN LIKE VBAK-VBELN OBLIGATORY.
PARAMETERS: P_LIFSK  LIKE VBAK-LIFSK OBLIGATORY.

* Header 
BAPISDH1-DLV_BLOCK = p_lifsk.   " Delivery block

* header X
BAPISDH1X-DLV_BLOCK = 'X'.   " Delivery block
BAPISDH1X-UPDATEFLAG = 'U'.
 

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = P_VBELN
order_header_in   = BAPISDH1
order_header_inx = BAPISDH1X
tables
return = T_RETURN
.
 
LOOP AT T_RETURN WHERE TYPE = 'E' OR TYPE = 'A'.
  EXIT.
ENDLOOP.
 
* Check for error messages.
IF SY-SUBRC = 0.
  WRITE: / 'Sales order not updated', T_RETURN-MESSAGE.
 
ELSE.
 
* Successfully updated
  WRITE: / 'Sales order updated'.
ENDIF.
 
COMMIT WORK.

Thanks

Naren

Dear Friends

I need to change a sales order delivery block VBAK-LIFSK.

I am providing the new LIFSK in the selection screen. From my analysis I have to use FM: BAPI_SALESORDER_CHANGE.

Please tell me what values I should pass to this FM to change my sales orders as above.

If there is any other FM please suggest that.

6 REPLIES 6
Read only

Former Member
0 Likes
1,288

Hi,

Just refer to the below link.

Hope it helps.

Regards,

Atish

Read only

Former Member
0 Likes
1,288

hi

good

check with this code

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = P_VBELN

order_header_inx = BAPISDH1X

tables

return = T_RETURN

ORDER_ITEM_IN = T_ITEM

ORDER_ITEM_INX = T_ITEMX

.

LOOP AT T_RETURN WHERE TYPE = 'E' OR TYPE = 'A'.

EXIT.

ENDLOOP.

  • Check for error messages.

IF SY-SUBRC = 0.

WRITE: / 'Sales order not updated', T_RETURN-MESSAGE.

ELSE.

  • Successfully updated

WRITE: / 'Sales order updated'.

ENDIF.

thanks

mrutyun^

Read only

0 Likes
1,288

Hi Mrutyun^

Thanks for the reply. Can you tell me what will be in

BAPISDH1X

T_ITEM

T_ITEMX

Please see I have to just change the delivery block. which is in the header table VBAK-LIFSK

Read only

Former Member
0 Likes
1,289

Hi,

check this code


DATA: BAPISDH1X LIKE BAPISDH1X.
DATA: BAPISDH1 LIKE BAPISDH1.

PARAMETERS: P_VBELN LIKE VBAK-VBELN OBLIGATORY.
PARAMETERS: P_LIFSK  LIKE VBAK-LIFSK OBLIGATORY.

* Header 
BAPISDH1-DLV_BLOCK = p_lifsk.   " Delivery block

* header X
BAPISDH1X-DLV_BLOCK = 'X'.   " Delivery block
BAPISDH1X-UPDATEFLAG = 'U'.
 

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = P_VBELN
order_header_in   = BAPISDH1
order_header_inx = BAPISDH1X
tables
return = T_RETURN
.
 
LOOP AT T_RETURN WHERE TYPE = 'E' OR TYPE = 'A'.
  EXIT.
ENDLOOP.
 
* Check for error messages.
IF SY-SUBRC = 0.
  WRITE: / 'Sales order not updated', T_RETURN-MESSAGE.
 
ELSE.
 
* Successfully updated
  WRITE: / 'Sales order updated'.
ENDIF.
 
COMMIT WORK.

Thanks

Naren

Read only

Former Member
0 Likes
1,288

Hi,

Please check my reply

Thanks

Naren

Read only

former_member219399
Active Participant
0 Likes
1,288

Hi,

You can use the parameter

ORDER_HEADER_IN-DLV_BLOCK = 'X'. as export parameter.

With regards,

Vamsi

data order_header type BAPISDH1.

ORDER_HEADER-DLV_BLOCK = 'X'.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

SALESDOCUMENT = i_vbeln

ORDER_HEADER_IN = order_header

ORDER_HEADER_INX = 'U'

TABLES

RETURN = bapi_return

.