Application Development 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: 

how we will use bapi function modules Ex. BAPI_SALESORDER_CHANGE

Former Member
0 Kudos
96

How we will pass the parameters to this Function Module.

What is the step by step process .

1 ACCEPTED SOLUTION

Former Member
0 Kudos
44

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

2 REPLIES 2

Former Member
0 Kudos
45

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

0 Kudos
44