2007 Jun 26 5:18 AM
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.
2007 Jun 26 5:27 AM
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.
2007 Jun 26 5:21 AM
2007 Jun 26 5:24 AM
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^
2007 Jun 26 5:28 AM
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
2007 Jun 26 5:27 AM
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
2007 Jun 26 5:29 AM
2007 Jun 26 5:45 AM
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
.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |