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
911

hi friends

iam learning ABAP newly and i want to know in detail how a call transaction, session method and BDC methods works whats the difference between them.

its kindof you all if you can send me the detail procedure of each method how they should be programmed step by step.

also attach if you have any links for this

1 ACCEPTED SOLUTION
9 REPLIES 9
Read only

Former Member
0 Likes
875

Hi vamshi,

1. lsmw - no programming requried,

whereas in call transaction & bdc session,

programming required.

2. in call transaction,

no session concept

(data is updated AS SOON AS we run the prgoram)

where as in lsmw, and session,

SESSION is generated (in both cases)

Only after when we run this session,

does the data get updated.

3. In call transactin program,

we have to handle error list and take action.

whereas in lsmw, & session,

(since session is run)

flexibility is there to check and control errors.

regards,

amit m.

Read only

Former Member
0 Likes
875

Hope this link helps you.

<a href="http://sap-img.com/bdc.htm">BDC Programming</a>

Kind Regards

Eswar

Read only

Former Member
0 Likes
875

BDC is an automatic procedure.This method is used to transfer large amount of data that is available in electronic medium.

BDC can be used primarily when installing the SAP system and when transferring data from a legacy system (external system).

BDC uses normal transaction codes to transfer data.

Types of BDC :

CLASSICAL BATCH INPUT (Session Method)

CALL TRANSACTION

BATCH INPUT METHOD:

This method is also called as ‘CLASSICAL METHOD’.

Features:

Asynchronous processing.

Synchronous Processing in database update.

Transfer data for more than one transaction.

Batch input processing log will be generated.

During processing, no transaction is started until the previous transaction has been written to the database.

Steps involved in Classical Batch Input :

Analyze the data that is to be transferred to the SAP system to determine how the existing data should be mapped to the SAP data structure.

Generate SAP data structures for incorporation into the data export program (SAP provides one method called Recording to generate the SAP data structure and transaction code for this is SHDB).

Read data in, often from a sequential file that has been exported from another system or prepared by a data transfer program.

Prepare the data for batch input processing by storing the data in the batch input data structure, BDCDATA.

Generate a batch input session using the function modules BDC_OPEN_GROUP, BDC_INSERT and BDC_CLOSE_GROUP (the parameters to these function modules explained in the next slide).

Process the session from System &#61614; Services &#61614; Batch Input (Transaction code is SM35 ).

Recording (Transaction code SHDB)

Recording is a process that is provided by the SAP system to generate the SAP data structure for batch data communication.

CALL TRANSACTION METHOD :

This is another method to transfer data from the legacy system.

Features:

Synchronous processing. The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.

Updating the database can be either synchronous or asynchronous. The program specifies the update type.

Transfer data for a single transaction.

Transfers data for a sequence of dialog screens.

No batch input processing log is generated.

Have a look at

http://www.sap-img.com/abap/learning-bdc-programming.htm

http://www.sapdevelopment.co.uk/bdc/bdchome.htm

I hope it helps.

Best Regards,

Vibha Deshmukh

*Plz mark useful answers

Read only

Former Member
0 Likes
875

Hello,

Let me know your mail ID.

Regs,

Venkat

Read only

0 Likes
875

vamshi.sreerangam@gmail.com

Read only

Former Member
0 Likes
875

Hi,

BDC is used to automate some procedure.

Please understand that the basis id BDC lies in the recording that is done(using transaction SHDB).

1. Record using SHDB ->New Recording(Save the recrding)

2. Create a program from that SHDB->Program.

use this program to create the logic flow.

Note:- BDC processes everything on a screen. Each screen has 1 'OK code'(something like EVENTS in JAVA) associated with it and a list(1 or more) of screen fields.All this is appended in an internal table(generally called BDCDATA).

For BATCH INPUT we create a session using 'BDC_OPEN_GROUP'

Then insert the transactions into the session using , using BDC_INSERT(FM).

For Example:-

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = <transaction>

TABLES

DYNPROTAB = I_BDCDATA. " Internal table for BDCDATA

After all the transaction have been entered we using 'BDC_CLOSE_GROUP' to close the session.

Once this is done u can go to SM35 and process the session.

DIFF B/W SESSION and TRANSACTION.

-


The basic diff is visible in SM35.In 'call transaction' the transaction is actually being processed,while in session it is being created.

(Note that SM35 method is faster that CALL transaction).

Read only

Former Member
0 Likes
875

Hi,

Go thru this link And sample code

http://sap-img.com/bdc.htm

EX : call transaction

----


  • NAME : RAMU NEMURGOMMULA *

  • EMPID: 50583 *

  • DATE : 01/08/2005 *

----


report yramu_bdc_stvg

no standard page heading line-size 255.

----


  • INTERNAL TABLES *

----


DATA: BEGIN OF IT_KNA1 OCCURS 0,

CUSTOMER LIKE RF02D-KUNNR,

COMPANY_CODE LIKE RF02D-BUKRS,

ACCOUNT_GROUP LIKE RF02D-KTOKD,

TITLE LIKE KNA1-ANRED,

NAME LIKE KNA1-NAME1,

SEARCH_TERM LIKE KNA1-SORTL,

STREET LIKE KNA1-STRAS,

CITY LIKE KNA1-ORT01,

POSTAL_CODE LIKE KNA1-PSTLZ,

COUNTRY LIKE KNA1-LAND1,

LANGUAGE_KEY LIKE KNA1-SPRAS,

CNTRY LIKE KNBK-BANKS,

BANK_KEY LIKE KNBK-BANKL,

BANK_ACCOUNT LIKE KNBK-BANKN,

REC_ACCOUNT LIKE KNB1-AKONT,

END OF IT_KNA1.

DATA: IT_BDCDATA TYPE BDCDATA OCCURS 0 WITH HEADER LINE.

DATA: IT_MESSAGES TYPE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

----


  • SELECTION SCREEN *

----


SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETER P_FILE TYPE RLGRAP-FILENAME DEFAULT 'C:\CUSTOMER.TXT'

OBLIGATORY.

SELECTION-SCREEN END OF BLOCK B1.

----


  • AT SELECTION SCREEN *

----


AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

PERFORM HELP_FILE USING P_FILE.

----


  • START OF SELECTION *

----


START-OF-SELECTION.

*UPLOADING THE FILE FROM WORKSTATION

PERFORM UPLOAD_FILE USING P_FILE.

*POPULATING DATA.

PERFORM POPULATE_FILE.

&----


*& Form HELP_FILE

&----


  • text

----


  • -->P_P_FILE text

----


form HELP_FILE using p_p_file.

DATA: L_FILE TYPE IBIPPARMS-PATH.

CALL FUNCTION 'F4_FILENAME'

  • EXPORTING

  • PROGRAM_NAME = SYST-CPROG

  • DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

IMPORTING

FILE_NAME = L_FILE.

P_P_FILE = L_FILE.

endform. " HELP_FILE

&----


*& Form UPLOAD_FILE

&----


  • text

----


  • -->P_P_FILE text

----


form UPLOAD_FILE using p_p_file.

CALL FUNCTION 'UPLOAD'

EXPORTING

  • CODEPAGE = ' '

  • FILENAME = 'P_P_FILE'

FILETYPE = 'DAT'

  • ITEM = ' '

  • FILEMASK_MASK = ' '

  • FILEMASK_TEXT = ' '

  • FILETYPE_NO_CHANGE = ' '

  • FILEMASK_ALL = ' '

  • FILETYPE_NO_SHOW = ' '

  • LINE_EXIT = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • SILENT = 'S'

  • IMPORTING

  • FILESIZE =

  • CANCEL =

  • ACT_FILENAME =

  • ACT_FILETYPE =

TABLES

data_tab = IT_KNA1

EXCEPTIONS

CONVERSION_ERROR = 1

INVALID_TABLE_WIDTH = 2

INVALID_TYPE = 3

NO_BATCH = 4

UNKNOWN_ERROR = 5

GUI_REFUSE_FILETRANSFER = 6

OTHERS = 7.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endform. " UPLOAD_FILE

&----


*& Form POPULATE_FILE

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form POPULATE_FILE .

DATA: L_STRING TYPE STRING,

L_COUNTER(2) TYPE N,

V_INDEX TYPE SY-TABIX.

LOOP AT IT_KNA1.

V_INDEX = SY-TABIX.

AT NEW CUSTOMER.

READ TABLE IT_KNA1 INDEX V_INDEX.

IF SY-SUBRC = 0.

perform bdc_dynpro using 'SAPMF02D' '0105'.

perform bdc_field using 'BDC_CURSOR'

'RF02D-KTOKD'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02D-KUNNR'

IT_KNA1-CUSTOMER.

perform bdc_field using 'RF02D-BUKRS'

IT_KNA1-COMPANY_CODE.

perform bdc_field using 'RF02D-KTOKD'

IT_KNA1-ACCOUNT_GROUP.

*PERFORM BDC_FIELD USING 'RF02D-D0130'

  • 'X'.

perform bdc_dynpro using 'SAPMF02D' '0110'.

perform bdc_field using 'BDC_CURSOR'

'KNA1-SPRAS'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'KNA1-ANRED'

IT_KNA1-TITLE.

perform bdc_field using 'KNA1-NAME1'

IT_KNA1-NAME.

perform bdc_field using 'KNA1-SORTL'

IT_KNA1-SEARCH_TERM.

perform bdc_field using 'KNA1-STRAS'

IT_KNA1-STREET.

perform bdc_field using 'KNA1-ORT01'

IT_KNA1-CITY.

perform bdc_field using 'KNA1-PSTLZ'

IT_KNA1-POSTAL_CODE.

perform bdc_field using 'KNA1-LAND1'

IT_KNA1-COUNTRY.

perform bdc_field using 'KNA1-SPRAS'

IT_KNA1-LANGUAGE_KEY.

perform bdc_dynpro using 'SAPMF02D' '0120'.

perform bdc_field using 'BDC_CURSOR'

'KNA1-LIFNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02D' '0130'.

PERFORM BDC_FIELD USING 'RF02D-D0130'

'X'.

perform bdc_field using 'BDC_CURSOR'

'KNBK-BANKN(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_dynpro using 'SAPMF02D' '0210'.

perform bdc_field using 'BDC_CURSOR'

'KNB1-AKONT'.

perform bdc_field using 'BDC_OKCODE'

'=UPDA'.

perform bdc_field using 'KNB1-AKONT'

IT_KNA1-REC_ACCOUNT.

perform bdc_dynpro using 'SAPLRSFH' '0100'.

perform bdc_field using 'BDC_OKCODE'

'/EBACK'.

perform bdc_field using 'BDC_CURSOR'

'RSIODYNP4-LOW(01)'.

ENDIF.

ENDAT.

L_COUNTER = L_COUNTER + 1.

CLEAR L_STRING.

CONCATENATE 'KNBK-BANKS(' L_COUNTER ')' INTO L_STRING.

PERFORM BDC_FIELD USING L_STRING

IT_KNA1-CNTRY.

CLEAR L_STRING.

CONCATENATE 'KNBK-BANKL(' L_COUNTER ')' INTO L_STRING.

PERFORM BDC_FIELD USING L_STRING

IT_KNA1-BANK_KEY.

CLEAR L_STRING.

CONCATENATE 'KNBK-BANKN(' L_COUNTER ')' INTO L_STRING.

PERFORM BDC_FIELD USING L_STRING

IT_KNA1-BANK_ACCOUNT.

AT END OF CUSTOMER.

READ TABLE IT_KNA1 INDEX V_INDEX.

IF SY-SUBRC = 0.

CALL TRANSACTION 'FD01' USING IT_BDCDATA MODE 'A' UPDATE 'S' MESSAGES

INTO IT_MESSAGES.

IF SY-SUBRC <> 0.

PERFORM EMPLOYEEID_ERROR.

*ELSE.

ENDIF.

WRITE: SY-SUBRC.

perform message_format_write.

*ENDIF.

*WRITE: SY-SUBRC.

CLEAR IT_BDCDATA.

REFRESH IT_BDCDATA.

ENDIF.

ENDAT.

ENDLOOP.

endform. " POPULATE_FILE

&----


*& Form bdc_dynpro

&----


  • text

----


  • -->P_0224 text

  • -->P_0225 text

----


form bdc_dynpro using value(p_0224)

value(p_0225).

IT_BDCDATA-PROGRAM = P_0224.

IT_BDCDATA-DYNPRO = P_0225.

IT_BDCDATA-DYNBEGIN = 'X'.

APPEND IT_BDCDATA.

CLEAR IT_BDCDATA.

endform. " bdc_dynpro

&----


*& Form bdc_field

&----


  • text

----


  • -->P_0229 text

  • -->P_0230 text

----


form bdc_field using value(p_0229)

value(p_0230).

IT_BDCDATA-FNAM = P_0229.

IT_BDCDATA-FVAL = P_0230.

APPEND IT_BDCDATA.

CLEAR IT_BDCDATA.

endform. " bdc_field

&----


*& Form EMPLOYEEID_ERROR

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form EMPLOYEEID_ERROR .

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

  • DEST = FILLER8

GROUP = 'Z50583_REC1'

  • HOLDDATE = FILLER8

KEEP = 'X'

USER = SY-UNAME

  • RECORD = FILLER1

  • PROG = SY-CPROG

  • IMPORTING

  • QID =

EXCEPTIONS

CLIENT_INVALID = 1

DESTINATION_INVALID = 2

GROUP_INVALID = 3

GROUP_IS_LOCKED = 4

HOLDDATE_INVALID = 5

INTERNAL_ERROR = 6

QUEUE_ERROR = 7

RUNNING = 8

SYSTEM_LOCK_ERROR = 9

USER_INVALID = 10

OTHERS = 11.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'FD01'

  • POST_LOCAL = NOVBLOCAL

  • PRINTING = NOPRINT

  • SIMUBATCH = ' '

  • CTUPARAMS = ' '

TABLES

dynprotab = IT_BDCDATA

EXCEPTIONS

INTERNAL_ERROR = 1

NOT_OPEN = 2

QUEUE_ERROR = 3

TCODE_INVALID = 4

PRINTING_INVALID = 5

POSTING_INVALID = 6

OTHERS = 7.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'BDC_CLOSE_GROUP'

EXCEPTIONS

NOT_OPEN = 1

QUEUE_ERROR = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endform. " EMPLOYEEID_ERROR

&----


*& Form message_format_write

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form message_format_write .

DATA: L_MSG(200).

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = SY-MSGID

LANG = SY-LANGU

NO = SY-MSGNO

V1 = SY-MSGV1

V2 = SY-MSGV2

V3 = SY-MSGV3

V4 = SY-MSGV4

IMPORTING

MSG = L_MSG

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2.

WRITE: / L_MSG.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endform. " message_format_write

Thanks

Sunil