‎2007 Jul 31 2:34 PM
How we will pass the parameters to this Function Module.
What is the step by step process .
‎2007 Jul 31 3:52 PM
HI,
Check this code... Here this program is changing the delivery block for a sales order.. like this you just need to identify what you want to change and pass data to the bapi as required.
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
mahesh
‎2007 Jul 31 3:52 PM
HI,
Check this code... Here this program is changing the delivery block for a sales order.. like this you just need to identify what you want to change and pass data to the bapi as required.
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
mahesh
‎2007 Jul 31 3:54 PM