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: 

BAPI

Former Member
0 Kudos

HI,

I need help on BAPI's , can anyone provide me with the way of programming bapi's (complete).

Thanks.

Regards,

Harun.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
2 REPLIES 2

Former Member
0 Kudos

Hi,

Check this simple BAPI program.

REPORT zbapi

MESSAGE-ID aq LINE-SIZE 255 NO STANDARD PAGE HEADING.

PARAMETERS : p_vbeln LIKE vbak-vbeln DEFAULT '6001099',

p_updflg(1) default 'D'.

DATA :

logic_switch LIKE bapisdls,

order_header_in LIKE bapisdh1,

order_header_inx LIKE bapisdh1x,

order_item_inx LIKE bapisditmx OCCURS 0 WITH HEADER LINE,

order_item_in LIKE bapisditm OCCURS 0 WITH HEADER LINE,

return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,

t_schdlx LIKE bapischdlx OCCURS 0 WITH HEADER LINE,

t_condx LIKE bapicondx OCCURS 0 WITH HEADER LINE.

*

REFRESH : order_item_inx,order_item_in.

REFRESH : t_schdlx,t_condx.

t_schdlx-updateflag = 'D'.

APPEND t_schdlx.

t_condx-updateflag = 'D'.

APPEND t_condx.

*

CLEAR order_header_inx.

CLEAR order_header_in.

order_header_inx-updateflag = 'U'.

IF p_updflg = 'U'.

**************************************

  • sub item with wbs

CLEAR : order_item_inx,

order_item_in.

order_item_in-itm_number = '020100'.

APPEND order_item_in.

*

order_item_inx-itm_number = '020100'.

order_item_inx-wbs_elem = 'X'. " clear

order_item_inx-updateflag = 'U'. " delete

APPEND order_item_inx.

***************************************

************************

  • header item with wbs

CLEAR order_item_in.

order_item_in-reason_rej = 'Y6'.

order_item_in-itm_number = '020000'.

APPEND order_item_in.

*-

CLEAR order_item_inx.

order_item_inx-itm_number = '020000'.

order_item_inx-reason_rej = 'X'.

order_item_inx-wbs_elem = 'X'. " clear

  • order_item_inx-profit_ctr = 'X'. " clear

order_item_inx-updateflag = 'U'. " delete

APPEND order_item_inx.

ELSE.

  • header item with wbs

CLEAR order_item_in.

order_item_in-itm_number = '020000'.

CLEAR order_item_inx.

order_item_inx-itm_number = '020000'.

order_item_inx-updateflag = 'D'. " delete

APPEND order_item_inx.

ENDIF.

REFRESH return.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = p_vbeln

order_header_in = order_header_in

order_header_inx = order_header_inx

logic_switch = logic_switch

TABLES

return = return

order_item_in = order_item_in

order_item_inx = order_item_inx.

*

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

ULINE:/.

LOOP AT return.

WRITE:/

sy-vline,

return-type,

(04) return-id,

return-number,

sy-vline,

(100) return-message ,AT sy-linsz sy-vline.

ENDLOOP.

ULINE:/.

Regards,

Subbu

Former Member
0 Kudos