Application Development and Automation 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: 
Read only

Regarding using BAPI s

Former Member
0 Likes
394

Dear Friends,

Can anyone tell how to use BAPI s in our programs as i have knowledge in creating a bapi.

I know what BAPI s are, and have founded no information how to use it externally to connect other external systems or to use it in a single client for data transfer.

Can u please give a demo example using systems BAPI s .

Thanking you

2 REPLIES 2
Read only

Former Member
0 Likes
373

Hope following code will help you

  • Fill header level details

CLEAR: LS_ORDER,

LS_ORDERX.

LS_ORDER-SALES_ORG = SO_VKORG.

LS_ORDER-DISTR_CHAN = SO_VTWEG.

LS_ORDERX-UPDATEFLAG = 'U'.

  • Assign Docno to Temp Doc no.

  • delete Sales item

LS_ITEM-ITM_NUMBER = LS_VBAP-POSNR.

LS_ITEM-MATERIAL = LS_VBAP-MATNR.

LS_ITEMX-ITM_NUMBER = LS_VBAP-POSNR.

LS_ITEMX-UPDATEFLAG = 'D'.

APPEND LS_ITEM TO LT_ITEM.

APPEND LS_ITEMX TO LT_ITEMX.

*else . fill itab .continue.

  • Call BAPI to delete item of the sales order

CALL FUNCTION 'BAPI_SALESDOCUMENT_CHANGE'

EXPORTING

SALESDOCUMENT = L_SALESDOCUMENT

ORDER_HEADER_IN = LS_ORDER

ORDER_HEADER_INX = LS_ORDERX

  • INT_NUMBER_ASSIGNMENT = int_num_assign

  • SIMULATION = ' '

TABLES

RETURN = LT_RETURN

ITEM_IN = LT_ITEM

ITEM_INX = LT_ITEMX.

DESCRIBE TABLE LT_RETURN LINES L_LINES.

READ TABLE LT_RETURN INTO LS_RETURN INDEX L_LINES.

IF NOT LS_RETURN-TYPE EQ 'E'.

  • Commit work

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'

IMPORTING

return = l_subrc.

reward Points

regards..

Read only

Former Member
0 Likes
373

Hi Sujeel,

Parameters whatever ur entering in the bapi while calling the bapi should be populated first.

Regards,

Nagaraju