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

BDC

Former Member
0 Likes
585

Hi !!

In BDC Seshen methord we can use two Transaction ??

Explain and any example if possble send.

thanks

Ahmed

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
565

Hi Ahmed,

You can call multiple transaction for Session method ,use BDC_INSERT FM Mutiple times.

One thing i am sure that it is meaningless to call multiple transaction for Session method since it is not online updation.

Note that when ever you have online updation then we call multiple transactions,session method will not support Online updation.

We use call transaction to call multiple transaction since it is online updation.

I have one simple example - assume that you have one screen ,it has customer number,material # ,Qty and so on.

when user enter the data on this screen,it should create sales order and it should create delivery ,in this case session method is not possible.

so we use call transcation and Update Mode should Synchronous

Thanks

Seshu

4 REPLIES 4
Read only

Former Member
0 Likes
565

Hi,

yes you can use two transactions but for that you need to call the session twice in the program.

Regards,

Atish

Read only

0 Likes
565

it means two diffrent transaction in one repore

can au give me any example please....

thanks

Read only

Former Member
0 Likes
566

Hi Ahmed,

You can call multiple transaction for Session method ,use BDC_INSERT FM Mutiple times.

One thing i am sure that it is meaningless to call multiple transaction for Session method since it is not online updation.

Note that when ever you have online updation then we call multiple transactions,session method will not support Online updation.

We use call transaction to call multiple transaction since it is online updation.

I have one simple example - assume that you have one screen ,it has customer number,material # ,Qty and so on.

when user enter the data on this screen,it should create sales order and it should create delivery ,in this case session method is not possible.

so we use call transcation and Update Mode should Synchronous

Thanks

Seshu

Read only

Former Member
0 Likes
565

Hi,

You can use Two Transactions in BDC Session Method.

This is Achieved by using 'BDC_INSERT'.

Sample BDC Program (Session Method):

REPORT Zreport1.

DATA: I_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF RECORD OCCURS 0, “Declaration of the data that is to be uploaded from the file

LIFNR_001(016),

KTOKK_002(004),

NAME1_003(035),

SORTL_004(010),

LAND1_005(003),

SPRAS_006(002),

END OF RECORD.

START-OF-SELECTION.

PERFORM OPEN_GROUP.

*Uploading data from the local file C:\Vendor1.txt

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME = 'C:\VENDOR1.TXT '

FILETYPE = 'DAT'

TABLES

DATA_TAB = RECORD.

IF SY-SUBRC <> 0.

WRITE 'ERROR IN UPLOAD'.

ENDIF.

LOOP AT RECORD. “Filling the BDC table with data

PERFORM BDC_DYNPRO USING 'SAPMF02K' '0107'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'RF02K-KTOKK'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'RF02K-LIFNR'

RECORD-LIFNR_001.

PERFORM BDC_FIELD USING 'RF02K-KTOKK'

RECORD-KTOKK_002.

PERFORM BDC_DYNPRO USING 'SAPMF02K' '0110'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'LFA1-SORTL'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'LFA1-NAME1'

RECORD-NAME1_003.

PERFORM BDC_FIELD USING 'LFA1-SORTL'

RECORD-SORTL_004.

PERFORM BDC_FIELD USING 'LFA1-LAND1'

RECORD-LAND1_005.

PERFORM BDC_FIELD USING 'LFA1-SPRAS'

RECORD-SPRAS_006.

PERFORM BDC_DYNPRO USING 'SAPMF02K' '0120'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'LFA1-KUNNR'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'LFBK-BANKS(01)'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=ENTR'.

PERFORM BDC_DYNPRO USING 'SAPLSPO1' '0300'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=YES'.

PERFORM BDC_TRANSACTION USING 'MK01'.

ENDLOOP.

PERFORM CLOSE_GROUP. “ Closing the BDC session

FORM OPEN_GROUP.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = 'SESSION1'

USER = SY-UNAME

KEEP = 'X'.

IF SY-SUBRC <> 0.

WRITE 'ERROR IN OPEN_GROUP'.

ENDIF.

ENDFORM.

FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR I_BDCDATA.

I_BDCDATA-PROGRAM = PROGRAM.

I_BDCDATA-DYNPRO = DYNPRO.

I_BDCDATA-DYNBEGIN = 'X'.

APPEND I_BDCDATA.

ENDFORM.

FORM BDC_FIELD USING FNAM FVAL.

CLEAR I_BDCDATA.

I_BDCDATA-FNAM = FNAM.

I_BDCDATA-FVAL = FVAL.

APPEND I_BDCDATA.

ENDFORM.

FORM BDC_TRANSACTION USING TCODE.

CALL FUNCTION 'BDC_INSERT'

EXPORTING TCODE = TCODE

TABLES DYNPROTAB = I_BDCDATA.

ENDFORM.

FORM CLOSE_GROUP.

CALL FUNCTION 'BDC_CLOSE_GROUP'.

ENDFORM. " CLOSE_GROUP

Regards,

Padmam.