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

About using BAPI for Data Migration

Former Member
0 Likes
381

Hello,

I need the examples for using BAPIs for Data migration in place of BDCs....

I need at least the procedure to follow to solve my problem ...

Thank u...

1 REPLY 1
Read only

Former Member
0 Likes
311

Hi,

Below is an example of SO change using BAPI

  • initialize

clear: zBAPISDH1,

zBAPISDH1x.

refresh: zBAPIRET2,

zBAPISDITM,

zBAPISDITMx.

  • set header parameters for sales order update

move '911' to zBAPISDH1-ORD_REASON.

move 'X' to zBAPISDH1x-ORD_REASON.

move 'U' to zBAPISDH1x-UPDATEFLAG.

  • set item parameters for sales order update

select posnr

into vbap-posnr

from vbap

where vbeln eq itab_ord-vbeln.

clear: zBAPISDITM,

zBAPISDITMx.

move vbap-posnr to zBAPISDITM-ITM_NUMBER.

move '96' to zBAPISDITM-REASON_REJ.

append zBAPISDITM.

move vbap-posnr to zBAPISDITMx-ITM_NUMBER.

move 'X' to zBAPISDITMx-REASON_REJ.

move 'U' to zBAPISDITMx-UPDATEFLAG.

append zBAPISDITMx.

endselect.

  • update sales order

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

SALESDOCUMENT = itab_ord-vbeln

ORDER_HEADER_IN = zBAPISDH1

ORDER_HEADER_INX = zBAPISDH1X

SIMULATION = p_test

TABLES

RETURN = zBAPIRET2

ORDER_ITEM_IN = zBAPISDITM

ORDER_ITEM_INX = zBAPISDITMX.

  • commit changes

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

Rgds,

HR