BDC FAQ - Frequently Asked Questions

Explain BDC.

BDC stands for batch data communication is used to tranfer data from non sap system to sap system. 
There are two method used 2 transfer data using BDC 
1 DIRECT METHOD
2 BATCH INPUT METHOD it is also of two type :-
i) CALL TRANSACTION METHOD
ii) SESSION METHOD

The major difference b/w call transaction and session method is that in call transaction method data is updated Synchronously but session method is asynchronously session is generated in session method but session is not generated in call transaction method

BDC is all about automating the screen flow.  for example, lets say we send an IDoc to external system using transcation we19. If the requirement is to automate it , then BDC can be used.
Procedure:
1. record the transaction with tcode shdb
2. copy the transaction recording program code from where you want to execute it 
3. use the method to call : call transaction or session method

The above are the ways to automate those screen flows for which recording is performed.

Once you are done.. in the field values of BDC recording, put the values as input values whatever you want to mention.

How to handle errors in call transaction method and session method.

You can try this code to handle your BDC errors and display the corresponding error messages:

if session ne 'X'.
   call transaction tcode using itab_bdc mode 'N' UPDATE 'S' MESSAGES INTO i_errors.

* N - no display
* E - errors only
* A - display ALL screens
elseif session = 'X'.
   call function 'BDC_INSERT'
        exporting
            tcode = tcode
                tables
                   dynprotab = itab_bdc
                exceptions
                   internal_error = 1
                   not_open = 2
                   queue_error = 3
                   tcode_invalid = 4
                   printing_invalid = 5
                   posting_invalid = 6
                   others = 7

*Check SY-SUBRC
    if sy-subrc <> 0. "Unsuccessful
       loop at i_errors.
           MESSAGE ID i_errors-msgid TYPE i_errors-msgtyp NUMBER
            i_errors-msgnr WITH i_errors-msgv1 i_errors-msgv2
            i_errors-msgv3 i_errors-msgv4 INTO i_error_messages-message.

             append i_error_messages.
        endloop.
    endif.
endif.

More BDC Tips

ABAP Books List
ABAP/4 Certification, Programming, Smartforms, Sapscripts and Object Oriented Programming Books

ABAP Menu:
ABAP Example Hints and Tips

Return to :-
SAP ABAP/4 Programming, Basis Administration, Configuration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.  The site www.gotothings.com is in no way affiliated with SAP AG.
Any unauthorised copying or mirroring is prohibited.