You are on page 1of 15

BDC

We Never Compromise in Quality. Would You ?


_______________________________________________________________________
_

1.What is BDC and Explain the real time scenarios where we need to write the BDC
Programs ?

Batch Data Communication (BDC ) is a batch data interfacing technique used for
uploading Bulk of data into the SAP R/3 system.

BDC Programming is an Inbound Data Transfer Technique to transfer the Data from
SAP/Non-SAP into SAP .

Inbound: Data transfer from External System into SAP.

Note: Target System is always SAP.

SAP

SAP

Non-SAP

Note : BDC works by simulating the user input from transactional screen via an
ABAP program.

Note : Any Transaction in SAP Can Create Only One Record at a time, but the
Procedure to Create any number of Records through the same transaction is
always SAME.

So Simply BDC Program is Automating the Procedure of Creating a record.

BDC REAL TIME SCENARIOS:

SCENARIO: 1
When migrating from NON-SAP to SAP all the master data should be transferred into
SAP.

SCENARIO:2
When working with third party systems like customers,vendors,banks etc.

SCENARIO:3
When transferring the data from non-SAP departments into SAP within the organisation.
Page 1 of 15 Prepared By : Ganapati Adimulam
eMAX Technologies,AmeerPet,Hyderabad
Ph : +91 40 65976727.
BDC
We Never Compromise in Quality. Would You ?
_______________________________________________________________________
_

2.List out the SAP supplied programs(Direct Input Methods) to load master data?

RM06BBI0 (Purchase Requisitions)

RMDATIND (Material Master)

RFBIKR00 (Vendor Masters)

RFBIDE00 (Customer Master)

RVINVB00 (Sales Order)

3.What are the techniques involved in using SAP supplied programs?

Identify relevant fields

Maintain transfer structure ( Predefined – first one is always session record)

Session record structure, Header Data, Item ( STYPE – record type )

Fields in session structure – STYPE, GROUP , MANDT, USERNAME , NO


DATA.

Fields in header structure – consists of transaction code also –


STYPE, BMM00, TCODE, MATNR and Fields in Item - ITEMS …

Maintain transfer file – sample data set creation

4.How do you handle errors in Call Transaction?

Error Handling in CALL TRANSACTION

When the records are uploaded in database table by Session Method error record is stored
in the log file. In Call transaction there is no such log file available. Usually we need to
give report of all the error records i.e records, which are not inserted or updated in the
database table and this can be done by following Method.

Page 2 of 15 Prepared By : Ganapati Adimulam


eMAX Technologies,AmeerPet,Hyderabad
Ph : +91 40 65976727.
BDC
We Never Compromise in Quality. Would You ?
_______________________________________________________________________
_

CALL TRANSACTION TCODE USING <IT_BDCDATA>


MODE <A/N/E>. “A – All Screens
“N - No screens
“E – Error screens
UPDATE <A/S>
MESSAGE INTO IT_BDCMSGCOLL.
“A – Asynchronous
“S - Synchronous

Note : The Status of the Call Transaction is collected into IT_BDCMSGCOLL.


But the messgae Text is Not available Only the Message No, Message Class and the
Variable text is available. But the Actual Message for the Above Information is
Maintained in Table T100.(T100-TEXT) but the TEXT also not Complete as it Contains
the Placeholders so that we need to replace the same.

Steps for the error handling in CALL TRANSACTION

1. LOOP AT IT_DATA.( i.e For each data record )


Populate IT_BDCTAB table
CALL TRANSACTION <tr.code> USING IT_BDCDATA
MODE <A/N/E>
Requirement :
UPDATE<S/A>
Uploading the Cost Center Master Data into SAP.
MESSAGES INTO IT_BDCMSGCOLL.
Recording the transaction Code KS01(Create Cost Center).
Execute SHDB
If sy-subrc <> 0. ( Call transaction returns the sy-subrc if not successful
In updation).
Provide the Recording name and transaction code .
Call function FORMAT_MESSAGE.
OR
Call Function BAPI_MESSAGE_GETDETAIL
OR
Querry the Message TEXT from the table T100 for the Messages Collected into
IT_BDCMSGCOLL.

The Text in T100-TEXT would be maintained with Place Holders(&1,&2,&3,&4) or


(&,&,&,&).
Replace the Place Holders with Variable Texts from IT_BDCMSGCOLL(MSGV1,
MSGV2, MSGV3, MSGV4).
5) What is difference between session method and Call Transaction?
Either APPEND the error message to another Internal table IT_ERROR and Display it
Page 3 of 15 Prepared By : Ganapati Adimulam
eMAX Technologies,AmeerPet,Hyderabad
Ph : +91 40 65976727.
BDC
We Never Compromise in Quality. Would You ?
_______________________________________________________________________
_

5. Difference Between Call Transaction and Session Method ?

Call Transaction Session Method

Single transaction Can be Processed Multiple Transaction Can be Processed


Always. Through the Same Session.

Synchronous processing. Asynchronous processing.


Which means Transfers data for a single Which Means Transfers data for multiple
transaction. transactions

Asynchronous and Synchronous update. Synchronous update.


Synchronous and asynchronous database Means no transaction is started until the
updating both possible. previous transaction has been written to the
database.

No session log is created Session log is created


Faster as it Asynchronous Update also Slower as it is Synchronous Update
Return the SY-SUBRC Doesn’t Return the SY-SUBRC

Update :

Asynchronous Update : it will update transaction level and lt goes next record.
later it updates database level.
synchronous Update - It will update transaction level and it goes database level.Then it it goes
to the Next Record.

Processing :

Synchronous - Only after a particular transaction is completed you can do the next Transaction

Asynchronous - Any no of transactions can be done simultaneously without depending on the


first job to get completed

6.What is the Importance Of BDCDATA and BDCMSGCOLL Structures in Call


Transaction and also list out the Fields From each Structure ?

Page 4 of 15 Prepared By : Ganapati Adimulam


eMAX Technologies,AmeerPet,Hyderabad
Ph : +91 40 65976727.
BDC
We Never Compromise in Quality. Would You ?
_______________________________________________________________________
_

BDCDATA is to Declare IT_BDCDATA is an Internal Table to Maintain the Screen,


field, OK Code Details i.e. Simply the Procedure to run the transaction so that the same
procedure can be used to Create any no of records in BDC Programming.

BDCMSGCOLL is to Declare IT_BDCMSGCOLL is an Internal table to Collect


The Status Of Call Transaction and Process the Errors if any after the Call Transaction.

BDCDATA:

FIELD NAME SHORT TEXT


PROGRAM BDC module pool
DYNPRO BDC Screen number
DYNBEGIN BDC screen start
FNAM Field name
FVAL BDC field value

BDCMSGCOLL:

FIELD NAME SHORT TEXT


TCODE BDC Transaction code
DYNAME Batch input module name
DYNUMB Batch input screen number
MSGTYP Batch input message type
MSGSPRA Language ID of a message
MSGID Batch input message ID
MSGNR Batch input message number
MSGV1 Variable part of a message
MSGV2 Variable part of a message
MSGV3 Variable part of a message
MSGV4 Variable part of a message
ENV Batch input monitoring activity
FLDNAME Field name

7.Steps to Work with BDC Program in Detail ?

STEP1: Analyze the SAP Transaction i.e. to Be automated , to find out the
procedure to run the transaction i.e. find out list of screens, Screen numbers ,Order of
screens and screen field name for the fields for which data is to be transferred.

Page 5 of 15 Prepared By : Ganapati Adimulam


eMAX Technologies,AmeerPet,Hyderabad
Ph : +91 40 65976727.
BDC
We Never Compromise in Quality. Would You ?
_______________________________________________________________________
_

NOTE :Along with input field names we should also find out the screen field names for
ENTER ,SAVE,ACTIVATE,CREATE etc.

STEP2:Declaring internal tables.


a) IT_DATA according to the source file structure.
b) IT_BDCDATA like table of BDCDATA. ( to collect the procedure to run the
transaction ).
STEP3:Transferring data from flat file to internal table (IT_DATA).

STEP4:For each record that is to be created

LOOP AT IT_DATA INTO WA_DATA.


* APPEND one record to IT_BDCDATA for first screen.
( ie )WA_BDCDATA-PROGRAM = < program>.
WA_BDCDATA-DYNPRO = < SCREEN NUMBER>.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA to IT_BDCDATA.

* APPEND one record for each field in the above screen.


WA_BDCDATA-FNAM = <field name>
WA_BDCDATA-Fval = <field value>
APPEND WA_BDCDATA TO IT_BDCDATA.

NOTE:Repeat the append procedure for all the screens in the order of
the screens and also for all the fields for which the data has to be transferred .
NOTE:After completion of the append procedure we get all the
information required to run the transaction in ITAB i.e. (IT_BDCDATA).
STEP5:
IF Session Method,
Insert the IT_BDCDATA into the session by calling the Function
module BDC_INSERT.

ELSEIF CALL TRANSACTION METHOD.


CALL TRANSACTION <tcode> USING IT_BDCDATA
MESSAGES INTO IT_BDCMSGCOLL.
ENDIF.

ENDLOOP.(FOR IT_DATA).

8.What is the importance of Recording (SHDB) in BDC Programs ?

Page 6 of 15 Prepared By : Ganapati Adimulam


eMAX Technologies,AmeerPet,Hyderabad
Ph : +91 40 65976727.
BDC
We Never Compromise in Quality. Would You ?
_______________________________________________________________________
_

SHDB is a transaction to record all the steps while executing the session method.
Instead of collecting all the Screen no and Screen Field Names by Pressing F1 on the
required field -> Technical Information, we can simply record all the details through
recording.

Through recording, we can generate the Source code for BDC Programs and we change
the same according to our requirements.

9.How to Process More than ONE Transaction through Session Method ?

Open the Session Once.


Call FM : BDC_OPEN_GROUP.

*FOR IST TRANSACTION.


*For Each Record to be Created .
LOOP AT IT_XD01. “Customers
“Insert the Transaction and it’s Corresponding Screen and Field Details
“Internal Table into the Session
Call FM : BDC_INSERT.
ENDLOOP.

*FOR SECOND TRANSACTION.


*For Each Record to be Created .

LOOP AT IT_MK01. “Vendors


“Insert the Transaction and it’s Corresponding Screen and Field Details
“Internal Table into the Session
Call FM : BDC_INSERT.
ENDLOOOP.

Note : Repeat the above LOOP-ENDLOOP Procedure for each transaction to be


processed through the same Session.

Close the Session.


Call FM : BDC_CLOSE_GROUP.

10.What are different Display modes of Call Transaction method and explain them?

There are three modes of Call Transaction method:

A – Display All Screens


E - Display Errors
Page 7 of 15 Prepared By : Ganapati Adimulam
eMAX Technologies,AmeerPet,Hyderabad
Ph : +91 40 65976727.
BDC
We Never Compromise in Quality. Would You ?
_______________________________________________________________________
_

N – Background Processing (No Screens)

11.How to Run the Session in Background ?

Schedule RSBDCSUB to run periodically in one or more background jobs through


transaction SM36.

(OR)

We Can also SUBMIT the Program RSBDCSUB within the BDC Session
Program itself.

Input For the Program RSBDCSUB:

• session name

• date and time of generation

• status: ready to run or held in the queue because


of errors

Result Of Submitting the Program :

Batch input sessions are started automatically rather than by hand. The RSBDCSUB
program can be set up to start all sessions that arrive in an R/3 System, or it can be fine-
tuned to start only batch input sessions that you expect.

12.What do you do with errors in BDC batch sessions?

We look into the list of incorrect session and process it again to correct incorrect session,
we analyze the session to determine which screen and value produced the error. For small
errors in data we correct them interactively otherwise modify batch input program that
has generated the session(If Required) or many times even the data file.

13.Explain the Steps to Work with Session Method ?

STEPS TO WORK WITH SESSION METHOD:

NOTE:Since both Call Transaction & session method works based on


screen sequences, all the steps are common except the Call Transaction statement.
Page 8 of 15 Prepared By : Ganapati Adimulam
eMAX Technologies,AmeerPet,Hyderabad
Ph : +91 40 65976727.
BDC
We Never Compromise in Quality. Would You ?
_______________________________________________________________________
_

Step 1:Create session , Call F.M:BDC_OPEN_GROUP

Step 2:Insert the Transaction code and the corresponding screen &field details
(IT_BDCDATA) to process the transportation into the Session.

Call FM: BDC_INSERT

Note:Repeat BDC_INSERT for each new transaction code to be processed


with the <transaction code> and its corresponding <IT_BDCDATA>.

Step 3:Close the Session BDC_CLOSE_GROUP.


Close the session since we can't process the already open session.

Step 4:Process or run the session through SM35 to process the session Manually or
Schedule the Program RSBDCSUB to Schedule it in Background.

14.Complete Syntax For Call Transaction ?

CALL TRANSACTION <TCODE> “transaction code

USING <IT_BDCDATA> "internal table of structure BDCDATA

MODE <A/E/N> "display mode

UPDATE <A/S> "update mode

MESSAGES INTO <IT_BDCMSGCOLL>.

15.Explain the Role Of CTU_PARAMS Structure in Call Transaction ?

It is to Consider the Default Screen Resolution (standard screen size) . Because While
Working with Table Control in BDC , the Source Code depends on the No of lines
visible and which depends on the Screen resolution and to make sure the source code
works in the same way in all the systems, we set the Default Size option to ‘X’.

CTU_PARAMS:
FIELD NAME SHORT TEXT
DISMODE Display Mode (A/E/N)
UPDMODE Update mode for CALL TRANSACTION
USING(A/S)
CATTMODE CATT mode for CALL TRANSACTION
Page 9 of 15 Prepared By : Ganapati Adimulam
eMAX Technologies,AmeerPet,Hyderabad
Ph : +91 40 65976727.
BDC
We Never Compromise in Quality. Would You ?
_______________________________________________________________________
_

USING...
DEFSIZE Default screen size

* Structure for Screen Resolution option in BDC


DATA WA_OPT TYPE CTU_PARAMS.

WA_OPT-UPDMODE = ‘S’. “Synchronous


WA_OPT-DEFSIZE = ‘X’.
WA_OPT-DISMODE = ‘N’. “No Screens

CALL TRANSACTION <Tcode> " Transaction Name


USING <IT_BDCDATA> "Screen & Field Internal Table
OPTION FROM WA_OPT. " screen resolution option.

16.Explain how to Handle the Table Control in BDC ?

Table Control is used to Input multiple records.


Observe the Screen from Customer Master Creation without Table Control.

Screen Field Description


KNA1-NAME1 Name
KNA1-SORTL Search key
KNA1-STRAS Street
KNA1-ORT01 City
KNA1-LAND1 Country
KNA1-SPRAS Language

Note : The Screen Field Names are Fixed i.e. KNA1-NAME1,KNA1-SORTL etc.

Page 10 of 15 Prepared By : Ganapati Adimulam


eMAX Technologies,AmeerPet,Hyderabad
Ph : +91 40 65976727.
BDC
We Never Compromise in Quality. Would You ?
_______________________________________________________________________
_

Screen with Table Ctrl For Customer Bank Details:

KNBK-BANKS(01) - Bank Country Key


KNBK-BANKL(01) - Bank Key
KNBK-BANKN(01) - Bank Account
Observe (01) for each filed , This is to Identify the Row from the Table
Control and for the 2nd row it is (02) etc.

i.e the row index is added at the end of each of field.

Note : Here in the table control, field names depends on the no of Bank details for each
DATA : V_INDEX(2) TYPE N.
customer , DATA
i.e. theV_FNAM
row no in eachBDCDATA-FNAM.
LIKE field name is Dynamic.
LOOP AT IT_BANKS INTO WA_BANKS.
Processing Logic to build the field names in the table Control.
*IS INCEMENTED BY 1 EACH TIME FOR ALL RECORDS
Ex : IT_KNB1 is V_INDEX
the table =for
SY-TABIX. “LOOP COUNTER
list of Customer bank details.
Result of
*FOR BANKS
CONCATENATE ‘KNBK-BANKS(‘ V_INDEX ‘)’ INTO
CONCATENATE
V_FNAM. Is KNNK-BANKS(01)
1st record
Page 11 WA_BDCDATA-FNAM
of 15 = V_FNAM. Prepared By :for
Ganapati
KNNK-BANKS(02)
Adimulam
for
WA_BDCDATA-FVAL = WA_BANKS-BANKS.
eMAX Technologies,AmeerPet,Hyderabad
APPEND WA_BDCDATA TO IT_BDCDATA. 2 nd
record
Ph : +91 40 65976727. Etc..
*NOTE : REPEAT THE SAME PROCEDURE FOR ALL FIELDS
IN THE ROW OF THE TABLE CONTROL.
ENDLOOP.
BDC
We Never Compromise in Quality. Would You ?
_______________________________________________________________________
_

DGFFSDFFD

Note : While incrementing the V_INDEX, we need to Check for the Max no of records
for the Current Page, Once reached, We need to Click On Next Page so that the
OK_CODE , ‘=P+’ should be APPENDed to IT_BDCDATA and Initialize the Counter
V_INDEX.

17.While uploading a flat file through BDC Call Transaction, the system
suddenly get CRASHED. How do I know many records have been updated?

Even though it is bulk data processing, but updating the database is always record by
record only . So After Calling the Transaction , Maintain the Status of the Calling
transaction into one Custom Table including the record details.

So that We can check the Custom table for the latest details.

18.List Of Useful OK CODEs while Processing the records through


BDC programming ?

OK Codes and their Functionalities :.

Page 12 of 15 Prepared By : Ganapati Adimulam


eMAX Technologies,AmeerPet,Hyderabad
Ph : +91 40 65976727.
BDC
We Never Compromise in Quality. Would You ?
_______________________________________________________________________
_

19 .What is BDCRECX1 ?

Is a standard Program, Generated from recording which contains all the re-usable
delcerations and also the re-usable Subroutine Definitions for all the BDC Programs.

20.How can you PRINT a session log file?

Execute RSBDCLOG.

21.How to Export the Session ?


From SM35 -> Utilities->Export Session.

Page 13 of 15 Prepared By : Ganapati Adimulam


eMAX Technologies,AmeerPet,Hyderabad
Ph : +91 40 65976727.
BDC
We Never Compromise in Quality. Would You ?
_______________________________________________________________________
_

EXERCISES:-

Theory :

1) Explain the types Of BDC Programming Techniques ?


2) Explain the Different Ways to Process/Run the Session ?
3) What is Direct Input method and List out the Standard programs Available ?

Practical :

1. Write a BDC Program to Upload Cost Centers through Call


Transaction ? (Tcode : KS01 )

2. Write a BDC Program to Upload Purchasing Info Records through


Session Method ? ((Tcode : ME11 )

3. Write a BDC Program to upload General Ledger Accounts through


Call Transaction and Push the Un Successful Records into Session Method ?

Page 14 of 15 Prepared By : Ganapati Adimulam


eMAX Technologies,AmeerPet,Hyderabad
Ph : +91 40 65976727.
BDC
We Never Compromise in Quality. Would You ?
_______________________________________________________________________
_

4. Write a BDC Program to Upload the Employee Previous-Expiernce


Details ? (Infotype 0023, Tocde PA30)

5. Write a BDC Program to Upload the Bill Of Materials through Both


Call Transaction and Session Method ? (Tcode : CS01)

6. Upload Customer Credit Master Records (FD32)?

7. Upload the Purchase Orders (ME21N) ?

8. Upload the Sales Orders (VA01N) ?

9. Upload Bank Master Data(FI01) ?

10. Upload the Customer Master with Bank Details (XD01) ?

Page 15 of 15 Prepared By : Ganapati Adimulam


eMAX Technologies,AmeerPet,Hyderabad
Ph : +91 40 65976727.

You might also like