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

materials on BDC

Former Member
0 Likes
1,232

hi all,

i want learn BDC from basic .. can any anyone send any nice material so that i can learn BDC very easily

thanks

Nikesh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,142

Hi Nikesh,

Please srudy the following links. These are the best to learn BDC recording. You donot need any other material after studying these.

http://www.savefile.com/files/155324

http://www.savefile.com/files/155326

http://www.savefile.com/files/155321

Please reward appropriate points.

6 REPLIES 6
Read only

Former Member
0 Likes
1,142

Hi

BDC:

Batch Data Communication (BDC) is the process of transferring data from one SAP System to another SAP system or from a non-SAP system to SAP System.

Features :

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.

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.

Differences between Call Transaction and Sessions Method:

Session method.

1) synchronous processing.

2) can tranfer large amount of data.

3) processing is slower.

4) error log is created

5) data is not updated until session is processed.

6) generally used for back ground jobs.

7) at atime we can update to more than one screens.

Call transaction.

1) asynchronous processing

2) can transfer small amount of data

3) processing is faster.

4) errors need to be handled explicitly

5) data is updated automatically

6) for background n fore ground jobs.

7) at atime we can update to a single screen.

For BDC:

http://myweb.dal.ca/hchinni/sap/bdc_home.htm

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&;

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

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

http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm

http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm

http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html

Check these link:

http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm

http://www.sap-img.com/abap/question-about-bdc-program.htm

http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/

http://www.planetsap.com/bdc_main_page.htm

Regards

Anji

Read only

abdulazeez12
Active Contributor
0 Likes
1,142

BDC

Batch Data Communication

It is used to transfer data from Sap to Sap or from Non Sap to sap system. It uses the normal transaction codes to transfer the data.

Data Transfer Methods

You can use the following methods to transfer data:

• CALL TRANSACTION: Data consistency check with the help of screen logic.

• Batch input with batch input sessions: Data consistency check with the help of screen logic

Difference between Batch Input and CALL TRANSACTION

If the direct input cannot be used for your task, this makes creating a data transfer program easier since the underlying transactions ensure that the data consistency checks are executed.

In the case of an error during the data transfer (if data records are inconsistent, for example), you can restart the transfer at the point in the program where the error occurred.

Data Transfer Overview

Batch input methods

With the batch input method, an ABAP program reads the external data that is to be entered in the SAP system and stores the data in a “batch input session”. The session records the actions that are required to transfer data into the system using normal SAP transactions.

When the program has generated the session, you can run the session to execute the SAP transactions in it. You can explicitly start and monitor a session with the batch input management function (by choosing System  Services  Batch input), or have the session run in the background processing system.

CALL TRANSACTION methods

In the second method, your program uses the ABAP statement CALL TRANSACTION USING to run an SAP transaction. External data does not have to be deposited in a session for later processing. Instead, the entire batch input process takes place inline in your program.

Choosing Data Transfer Methods

Selecting a Data Transfer Method

When you transfer data in ABAP, you have three options to submit the data for the data transfer. Only the first two methods can be recommended without reservation. The third method, by way of CALL DIALOG, is outmoded. CALL DIALOG is less comfortable than the other methods. You should use it only if you must.

• Use the CALL TRANSACTION USING statement

Summary: With CALL TRANSACTION USING, the system processes the data more quickly than with batch input sessions. Unlike batch input sessions, CALL TRANSACTION USING does not automatically support interactive correction or logging functions.

Your program prepares the data and then calls the corresponding transaction that is then processed immediately.

The most important features of CALL TRANSACTION USING are:

o Synchronous processing

o Transfer of data from an individual transaction each time the statement CALL TRANSACTION USING is called

o You can update the database both synchronously and asynchronously

The program specifies the update type

o Separate LUW (logical units of work) for the transaction

The system executes a database commit immediately before and after the CALL TRANSACTION USING statement

o No batch input processing log

• Create a session on the batch input queue.

Summary: Offers management of sessions, support for playing back and correcting sessions that contain errors, and detailed logging.

Your program prepares the data and stores it in a batch input session. A session is a collection of transaction data for one or more transactions. Batch input sessions are maintained by the system in the batch input queue. You can process batch input sessions in the background processing system.

Your program must open a session in the queue before transferring data to it, and must close it again afterwards. All of these operations are performed by making function module calls from the ABAP program.

The most important aspects of the session interface are:

o Asynchronous processing

o Transfers data for multiple transactions

o Synchronous database update

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

o A batch input processing log is generated for each session

o Sessions cannot be generated in parallel

The batch input program must not open a session until it has closed the preceding session.

Executing Data Transfer Programs

Procedure

If you are using an SAP data transfer program, follow the procedure specified in the program documentation.

If you are using a generated data transfer program, proceed as follows:

1. Start the data transfer program.

2. Decide which batch input method you want to use for the data transfer.

a) CALL TRANSACTION USING:

You must specify the:

– Processing mode: You use this parameter to specify whether processing should take place in the background or in dialog mode.

Possible values are:

A Display all

E Display only errors

N No display

– Update mode: This parameter determines how the data is to be updated:

Possible values are:

S Synchronous

A Asynchronous

L Local update

– Error session: Here you have the option to specify a session name for a batch input session in which data is to be written in the case of an error. You can use this to identify incorrect data records after the batch input program has run and to import the records into the R/3 System once you have corrected them.

If you are creating an error session, you must also specify:

– User: Specify the user with whose authorizations the sessions are processed.

– Keep session: This specifies whether or not the session should be deleted once it has been processed.

– Lock date: Specify the processing date for the error session.

b) Generate session:

– Session name: Specify a name for the batch input session to be generated.

– User: Specify the user with whose authorizations the sessions are processed.

– Keep session: This specifies whether or not the session should be deleted once it has been processed.

– Lock date: Specify the processing date for the error session.

3. Specify a character that is to be used as the NODATA character.

4. Specify the path of the data file from which the data is to be imported into the R/3 System.

5. Execute the program.

6. If you have generated a session, or if errors occurred in CALL TRANSACTION USING mode, you must now edit the generated sessions. You can find information on this in BC - System services in batch input sessions.

Creating a Session with BDC_OPEN_GROUP

Use the BDC_OPEN_GROUP function module to create a new session. Once you have created a session, then you can insert batch input data into it with BDC_INSERT.

You cannot re-open a session that already exists and has been closed. If you call BDC_OPEN_GROUP with the name of an existing session, then an additional session with the same name is created.

A batch input program may have only one session open at a time. Before opening a session, make sure that any sessions that the program closes any sessions that it previously had opened.

BDC_OPEN_GROUP takes the following EXPORTING parameters:

• CLIENT

Client in which the session is to be processed.

Default: If you don't provide a value for this parameter, the default is the client under which the batch input program runs when the session is created.

• GROUP

Name of the session that is to be created. May be up to 12 characters long.

Default: None. You must specify a session name.

• HOLDDATE

Lock date. The session is locked and may not be processed until after the date that you specify. Only a system administrator with the LOCK authorization for the authorization object Batch Input Authorizations can unlock and run a session before this date.

Format: YYYYMMDD (8 digits).

Default: No lock date, session can be processed immediately. A lock date is optional.

• KEEP

Retain session after successful processing. Set this option to the value X to have a session kept after it has been successfully processed. A session that is kept remains in the input/output queue until an administrator deletes it.

Sessions that contain errors in transactions are kept even if KEEP is not set.

Default: If not set, then sessions that are successfully processed are deleted. Only the batch input log is kept.

• USER

Authorizations user for background processing. This is the user name that is used for checking authorizations if a session is started in background processing. The user must be authorized for all of the transactions and functions that are to be executed in a session. Otherwise, transactions will be terminated with “no authorization” errors.

The user can be of type dialog or background. Dialog users are normal interactive users in the SAP system. Background users are user master records that are specially defined for providing authorizations for background processing jobs.

Advantages:

Types of BDC :

CLASSICAL BATCH INPUT (Session Method)

CALL TRANSACTION

Session method.

1) synchronous processing.

2) can tranfer large amount of data.

3) processing is slower.

4) error log is created

5) data is not updated until session is processed.

Call transaction.

1) asynchronous processing

2) can transfer small amount of data

3) processing is faster.

4) errors need to be handled explicitly

5) data is updated automatically

Regards,

Shakir

Read only

Former Member
0 Likes
1,143

Hi Nikesh,

Please srudy the following links. These are the best to learn BDC recording. You donot need any other material after studying these.

http://www.savefile.com/files/155324

http://www.savefile.com/files/155326

http://www.savefile.com/files/155321

Please reward appropriate points.

Read only

0 Likes
1,142

Hi

BDC allows you to perform database updates in the background using standard SAP transactions. The resultant entries will be as if the user had manually entered the data via SAP. This means that you do not bypass any of the standard SAP consistency checks, authorisations etc. There are two main methods of ABAP BDC, these are Call Transaction and Batch Input. Other methods of update include Direct update, Idoc and BAPI. Format date field for BDC screen entry

<u><b>BDC using Call Transaction</b></u>

STEP 1

Create recording using SM35(or SHDB).

STEP 2

Use recording as a basis to populate the Internal BDC table.

Check this link for creating record with screens

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

Checkthis sample coding

Code used to create BDC
*&---------------------------------------------------------------------*
*& Report  ZBDC_EXAMPLE                                                *
*&                                                                     *
*&---------------------------------------------------------------------*
*& Example BDC program, which updates net price of item 00010 of a     *
*& particular Purchase order(EBELN).                                   *
*&                                                                     *
*&---------------------------------------------------------------------*
REPORT  ZBDC_EXAMPLE  NO STANDARD PAGE HEADING
                      LINE-SIZE 132.

*-----------------------------------------------------------------------
* Data declaration
TABLES: ekko, ekpo.

TYPES: BEGIN OF t_ekko,
    ebeln TYPE ekko-ebeln,
    waers TYPE ekko-waers,
    netpr TYPE ekpo-netpr,
    err_msg(73) TYPE c,
 END OF t_ekko.

DATA: it_ekko  TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
      wa_ekko  TYPE t_ekko,
      it_error TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
      wa_error TYPE t_ekko,
      it_success TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
      wa_success TYPE t_ekko.

DATA: w_textout            LIKE t100-text.
DATA: gd_update TYPE i,
      gd_lines TYPE i.

*Used to store BDC data
DATA: BEGIN OF bdc_tab OCCURS 0.
        INCLUDE STRUCTURE bdcdata.
DATA: END OF bdc_tab.

*Used to stores error information from CALL TRANSACTION Function Module
DATA: BEGIN OF messtab OCCURS 0.
        INCLUDE STRUCTURE bdcmsgcoll.
DATA: END OF messtab.


*-----------------------------------------------------------------------
*Screen declaration
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME
                                    TITLE text-001. "Purchase order Num
SELECT-OPTIONS: so_ebeln FOR ekko-ebeln OBLIGATORY.

SELECTION-SCREEN END OF BLOCK block1.

SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME
                                    TITLE text-002. "New NETPR value
PARAMETERS:  p_newpr(14)   TYPE c obligatory.  "LIKE ekpo-netpr.
SELECTION-SCREEN END OF BLOCK block2.


************************************************************************
*START-OF-SELECTION
START-OF-SELECTION.

* Retrieve data from Purchase order table(EKKO)
  SELECT ekko~ebeln ekko~waers ekpo~netpr
    INTO TABLE it_ekko
    FROM ekko AS ekko INNER JOIN ekpo AS ekpo
      ON ekpo~ebeln EQ ekko~ebeln
   WHERE ekko~ebeln IN so_ebeln AND
         ekpo~ebelp EQ '10'.


************************************************************************
*END-OF-SELECTION
END-OF-SELECTION.

* Check data has been retrieved ready for processing
  DESCRIBE TABLE it_ekko LINES gd_lines.
  IF gd_lines LE 0.
*   Display message if no data has been retrieved
    MESSAGE i003(zp) WITH 'No Records Found'(001).
    LEAVE TO SCREEN 0.
  ELSE.
*   Update Customer master data (instalment text)
    LOOP AT it_ekko INTO wa_ekko.
      PERFORM bdc_update.
    ENDLOOP.
*   Display message confirming number of records updated
    IF gd_update GT 1.
      MESSAGE i003(zp) WITH gd_update 'Records updated'(002).
    ELSE.
      MESSAGE i003(zp) WITH gd_update 'Record updated'(003).
    ENDIF.

* Display Success Report
* **********************
*   Check Success table
    DESCRIBE TABLE it_success LINES gd_lines.
    IF gd_lines GT 0.
*     Display result report column headings
      PERFORM display_column_headings.
*     Display result report
      PERFORM display_report.
    ENDIF.

* Display Error Report
* ********************
*   Check errors table
    DESCRIBE TABLE it_error LINES gd_lines.
*   If errors exist then display errors report
    IF gd_lines GT 0.
*     Display errors report
      PERFORM display_error_headings.
      PERFORM display_error_report.
    ENDIF.
  ENDIF.


*&---------------------------------------------------------------------*
*&      Form  DISPLAY_COLUMN_HEADINGS
*&---------------------------------------------------------------------*
*       Display column headings
*----------------------------------------------------------------------*
FORM display_column_headings.
  WRITE:2 ' Success Report '(014) COLOR COL_POSITIVE.
  SKIP.
  WRITE:2 'The following records updated successfully:'(013).
  WRITE:/ sy-uline(42).
  FORMAT COLOR COL_HEADING.
  WRITE:/      sy-vline,
          (10) 'Purchase Order'(004), sy-vline,
          (11) 'Old Netpr'(005), sy-vline,
          (11) 'New Netpr'(006), sy-vline.
  WRITE:/ sy-uline(42).
ENDFORM.                    " DISPLAY_COLUMN_HEADINGS


*&---------------------------------------------------------------------*
*&      Form  BDC_UPDATE
*&---------------------------------------------------------------------*
*       Populate BDC table and call transaction ME22
*----------------------------------------------------------------------*
FORM bdc_update.
  PERFORM dynpro USING:
      'X'   'SAPMM06E'        '0105',
      ' '   'BDC_CURSOR'      'RM06E-BSTNR',
      ' '   'RM06E-BSTNR'     wa_ekko-ebeln,
      ' '   'BDC_OKCODE'      '/00',                      "OK code

      'X'   'SAPMM06E'        '0120',
      ' '   'BDC_CURSOR'      'EKPO-NETPR(01)',
      ' '   'EKPO-NETPR(01)'  p_newpr,
      ' '   'BDC_OKCODE'      '=BU'.                      "OK code

* Call transaction to update customer instalment text
  CALL TRANSACTION 'ME22' USING bdc_tab MODE 'N' UPDATE 'S'
         MESSAGES INTO messtab.
* Check if update was succesful
  IF sy-subrc EQ 0.
    ADD 1 TO gd_update.
    APPEND wa_ekko TO it_success.
  ELSE.
*   Retrieve error messages displayed during BDC update
    LOOP AT messtab WHERE msgtyp = 'E'.
*     Builds actual message based on info returned from Call transaction
      CALL FUNCTION 'MESSAGE_TEXT_BUILD'
           EXPORTING
                msgid               = messtab-msgid
                msgnr               = messtab-msgnr
                msgv1               = messtab-msgv1
                msgv2               = messtab-msgv2
                msgv3               = messtab-msgv3
                msgv4               = messtab-msgv4
           IMPORTING
                message_text_output = w_textout.
    ENDLOOP.

*   Build error table ready for output
    wa_error = wa_ekko.
    wa_error-err_msg = w_textout.
    APPEND wa_error TO it_error.
    CLEAR: wa_error.
  ENDIF.

* Clear bdc date table
  CLEAR: bdc_tab.
  REFRESH: bdc_tab.
ENDFORM.                    " BDC_UPDATE


*---------------------------------------------------------------------*
*       FORM DYNPRO                                                   *
*---------------------------------------------------------------------*
*       stores values to bdc table                                    *
*---------------------------------------------------------------------*
*  -->  DYNBEGIN                                                      *
*  -->  NAME                                                          *
*  -->  VALUE                                                         *
*---------------------------------------------------------------------*
FORM dynpro USING    dynbegin name value.
  IF dynbegin = 'X'.
    CLEAR bdc_tab.
    MOVE:  name TO bdc_tab-program,
           value TO bdc_tab-dynpro,
           'X'  TO bdc_tab-dynbegin.
    APPEND bdc_tab.
  ELSE.
    CLEAR bdc_tab.
    MOVE:  name TO bdc_tab-fnam,
           value TO bdc_tab-fval.
    APPEND bdc_tab.
  ENDIF.
ENDFORM.                               " DYNPRO


*&---------------------------------------------------------------------*
*&      Form  DISPLAY_REPORT
*&---------------------------------------------------------------------*
*       Display Report
*----------------------------------------------------------------------*
FORM display_report.
  FORMAT COLOR COL_NORMAL.
* Loop at data table
  LOOP AT it_success INTO wa_success.
    WRITE:/      sy-vline,
            (10) wa_success-ebeln, sy-vline,
            (11) wa_success-netpr CURRENCY wa_success-waers, sy-vline,
            (11) p_newpr, sy-vline.
    CLEAR: wa_success.
  ENDLOOP.
  WRITE:/ sy-uline(42).
  REFRESH: it_success.
  FORMAT COLOR COL_BACKGROUND.
ENDFORM.                    " DISPLAY_REPORT


*&---------------------------------------------------------------------*
*&      Form  DISPLAY_ERROR_REPORT
*&---------------------------------------------------------------------*
*       Display error report data
*----------------------------------------------------------------------*
FORM display_error_report.
  LOOP AT it_error INTO wa_error.
    WRITE:/      sy-vline,
            (10) wa_error-ebeln, sy-vline,
            (11) wa_error-netpr CURRENCY wa_error-waers, sy-vline,
            (73) wa_error-err_msg, sy-vline.
  ENDLOOP.
  WRITE:/ sy-uline(104).
  REFRESH: it_error.
ENDFORM.                    " DISPLAY_ERROR_REPORT


*&---------------------------------------------------------------------*
*&      Form  DISPLAY_ERROR_HEADINGS
*&---------------------------------------------------------------------*
*       Display error report headings
*----------------------------------------------------------------------*
FORM display_error_headings.
  SKIP.
  WRITE:2 ' Error Report '(007) COLOR COL_NEGATIVE.
  SKIP.
  WRITE:2 'The following records failed during update:'(008).
  WRITE:/ sy-uline(104).
  FORMAT COLOR COL_HEADING.
  WRITE:/      sy-vline,
          (10) 'Purchase Order'(009), sy-vline,
          (11) 'Netpr'(010), sy-vline,
          (73) 'Error Message'(012), sy-vline.
  WRITE:/ sy-uline(104).
  FORMAT COLOR COL_NORMAL.
ENDFORM.                    " DISPLAY_ERROR_HEADINGS

<u><b>bdc session development</b></u>

Depending on the type of material, the list of selection screens (Basic

1, Basic 2,...Storage 1..) changes so that it causes havoc when trying

to run a BDC to change a value on "Storage 1". Is there a function or

does someone have a way in which they can determine the correct line

number for Storage 1 irregardless of the material type?

It will also help us between clients as in one client "Storage 1" will

be on line 8 while the same material in QAS it will be on line 13.

use this to delete sessions

Schedule the session with RSBDCSUB Program

Regards

Pavan

Read only

Former Member
0 Likes
1,142

report zbdc05 .

tables: ztrg_em05.

data: begin of itab occurs 0,

emplno(6),

empl_name like ztrg_em05-empl_name,

deptno(3),

end of itab.

data: bdctab like bdcdata occurs 0 with header line.

call function 'WS_UPLOAD'

exporting

filename = 'C:\DEMO.TXT'

filetype = 'DAT'

tables

data_tab = itab

exceptions

-


call function 'BDC_OPEN_GROUP'

exporting

client = sy-mandt

group = 'TEST'

user = sy-uname

exceptions

loop at itab.

refresh bdctab.

clear bdctab.

perform bdcfill using : 'X' '9000' 'SAPMZ705',

' ' 'BDC_OKCODE' '/5',

'X' '9000' 'SAPMZ705',

' ' 'ZTRG_EM05-EMPLNO' itab-emplno,

' ' 'ZTRG_EM05-EMPL_NAME' itab-empl_

' ' 'ZTRG_EM05-DEPTNO' itab-deptno,

'X' '9000' 'SAPMZ705',

' ' 'BDC_OKCODE' '/11'.

call function 'BDC_INSERT'

exporting

tcode = 'Z705'

tables

dynprotab = bdctab

exceptions

-


write 'BDC inserted'.

endloop.

call function 'BDC_CLOSE_GROUP'

exceptions