2007 Jul 12 9:35 PM
Hi,
Is there a Function Module or BAPI available that can update the Delivery Block for a looping Sales Order?
Thanks,
John
2007 Jul 12 9:39 PM
Hi,
check this sample code to update delivery block..
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 Jul 12 9:37 PM
Hi,
You can use the BAPI BAPI_SALESORDER_CHANGE to update the delivery block for a given sales order
Thanks
Naren
2007 Jul 12 9:39 PM
Hi,
check this sample code to update delivery block..
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