BDC Interview Questions
What is BDC and why do we use BDC ?
BDC ( Batch Data
Communication ) also known as batch input is a technique by which large volumes of data
can be transferred from Non Sap or Legacy systems to SAP systems.
Example: A Legacy system that
is to be replaced by SAP has say 1000 Customers , 2000 vendors and 3000
materials. All this data needs to be transferred to SAP . In such cases , We
can use BDC.
If the old system is replaced by SAP, such a transfer is called Conversion.
If the old system runs along with SAP, in that case the transfer is called an Interface.
If the old system is replaced by SAP, such a transfer is called Conversion.
If the old system runs along with SAP, in that case the transfer is called an Interface.
The two methods for
BDC are:
- Session Method
- Call TRANSACTION Method
- CALL DIALOG (Outdated)
ABAP
interview questions on BDC:
Important:
Question 1:What is the difference between Call Transaction Method and the Session method ?
Question 1:What is the difference between Call Transaction Method and the Session method ?
Session Method |
Call Transaction |
1.Session method id generally used when the data volume is huge. |
1.Call transaction method is when the data volume is low |
2.Session method is slow as compared to Call transaction. |
2.Call Transaction method is relatively faster than Session method. |
3.SAP Database is updated when you process the sessions. You need to process the sessions separately via SM35. |
3.SAP Database is updated during the execution of the batch input program. |
4.Errors are automatically handled during the processing of the batch input session. |
4.Errors should be handled in the batch input program. |
Important:
Question
2: How
do you do BDC for a table control?
With other things as usual, there is a special trick that you have to use while doing BDC for table control.
You need to use the BDC OKCODE '=P+'.
Its the BCD_OKCODE for Page down that can be used for scrolling down in table control.
With other things as usual, there is a special trick that you have to use while doing BDC for table control.
You need to use the BDC OKCODE '=P+'.
Its the BCD_OKCODE for Page down that can be used for scrolling down in table control.
Important:
Question3: Is there any
method apart from BDC for data upload to SAP?
Apart from BDC and LSMW, you can use BAPIs to upload data into SAP.
BAPIs should be preferred over BDCs, because they process data faster than BDC.
Apart from BDC and LSMW, you can use BAPIs to upload data into SAP.
BAPIs should be preferred over BDCs, because they process data faster than BDC.
A
BAPI is faster since it updates Database "directly". Whereas BDC
calls transaction and goes through the whole screen sequence as any user
would do.
BAPI
|
BDC
|
BAPI
is faster than BDC.
|
BDC
is relatively slower than BAPI.
|
BAPI
directly updates database.
|
BDC
goes through all the screens as a normal user would do and hence it is
slower.
|
No
such processing options are available in BAPI.
|
Background
and Foreground processing options are available for BDC.
|
BAPI
would generally used for small data uploads.
|
BDCs
would be preferred for large volumes of data upload since background
processing option is available.
|
For
processing errors, the Return Parameters for BAPI should be used.This
parameter returns exception messages or success messages to the calling
program.
|
Errors
can be processed in SM35 for session method and in the batch input program
for Call Transaction method.
|
What is the difference between RFC and BAPI?
BAPI
|
RFC
|
Just
as Google offers Image/Chart/Map APIs OR Facebook offers APIs for
Comment/Like, SAP offers APIs in the form of BAPIs. BAPI
is a library of function modules released by SAP to the public so that
they can interface with SAP.
|
RFC
is nothing but a remote enabled function module. So if there is a Function
Module in SAP system 1 on server X , it can be called from a SAP system 2
residing on server Y.
|
There
is a Business Object Associated with a BAPI. So a BAPI has an Interface, Key Field,
Attributes, Methods, and Events.
|
No
Business Object is associated with a RFC.
|
Outside
world (JAVA, VB, .Net or any Non SAP system) can connect to SAP using a BAPI.
|
Non–SAP
world cannot connect to SAP using RFC.
|
Error
or Success messages are returned in a RETURN table.
|
RFC
does not have a return table.
|
Question
4:
How do you process errors in Call Transaction method ?
Let's have a look at the syntax for CALL TRANSACTION method.
Sample code:
DATA: BEGIN OF G_T_MESSTAB OCCURS 0.
INCLUDE STRUCTURE BDCMSGCOLL.
DATA: END OF G_T_MESSTAB.
CALL TRANSACTION 'MB11'
USING
G_T_BDCDATA
MODE 'E'
UPDATE 'S'
MESSAGES INTO G_T_MESSTAB.
All
the error messages will be trapped inside G_T_MESSTAB.
Question
5:
What is the use of program RSBDCSUB?
There are two ways to process the BDC sessions:
1) Go to SM35 ---> Choose session ---> hit process.
Now See Question no. 10.
2) Use program RSBDCSUB.
RSBDCSUB schedules the session to be processed in background.
Let's take an example to understand this.
The sessions are created at one point of time and processed at other point of time and this may create a problem: For example: a BDC program creates a session for updating 1500 customers in SAP. However , before this session is processed via SM35 , a user inserts 100 customers in the system manually. In this case , the session will have at least 100 errors when the session is processed from SM35.
One way to avoid this is to use the program "RSBDCSUB" in the batch input program itself so that the session is processed as soon as it is created.
RSBDCSUB schedules the session to be processed in background.
There are two ways to process the BDC sessions:
1) Go to SM35 ---> Choose session ---> hit process.
Now See Question no. 10.
2) Use program RSBDCSUB.
RSBDCSUB schedules the session to be processed in background.
Let's take an example to understand this.
The sessions are created at one point of time and processed at other point of time and this may create a problem: For example: a BDC program creates a session for updating 1500 customers in SAP. However , before this session is processed via SM35 , a user inserts 100 customers in the system manually. In this case , the session will have at least 100 errors when the session is processed from SM35.
One way to avoid this is to use the program "RSBDCSUB" in the batch input program itself so that the session is processed as soon as it is created.
RSBDCSUB schedules the session to be processed in background.
Question 6: What is the structure of the BDC table?
The BDCDATA consists of the following fields:
§ PROGRAM
[CHAR 40] - Online program name.
§ DYNPRO [NUMC 4] - Screen
number.
§ DYNBEGIN
[CHAR 1] - Flag to indicate the start of a new screen.
§ FNAM
[CHAR 132] - Field name of a screen field to be filled with data.
§ FVAL
[CHAR 132] - The actual value to be filled into the specified screen field.
Sample Screenshot:
Sample Screenshot:
BDCDATA
table structure
|
Question
7:
What is the difference between BDC_OKCODE and BDC_CURSOR?
BDC_OKCODE: is used for
storing commands during the recording. like '/00' is the command for 'ENTER'
Key.
BDC_CURSOR: contains
the cursor position. it contians the field in which cursor will be.
Example code:
perform
bdc_field using 'BDC_CURSOR'
'PROJ-PSPID'.
perform
bdc_field using 'BDC_OKCODE'
'=BU'.
Question
8:
What are the 3 methods that we use in sequence in a Batch input session
method ?
1) BDC_OPEN_GROUP for opening the Batch Input
Session
2) BDC_INSERT for inserting the transactional data into
SAP
3) BDC_CLOSE_GROUP for closing the Batch Input Session
If there are n records , the BDC_INSERT method should be called n times.
BDC_OPEN_GROUP and BDC_CLOSE_GROUP are called only once.
General Information about a session is stored in table APQI.
Transaction data for a session is stored in table APQD.
Question 9: What is your approach for writing a BDC program?
Identify the Tcode and do the recording in SHDB to populate the BDCDATA.
Once the recording is done , one can Transfer it to the Batch input program.
In the batch Input program , The transactional data is read from the file to an internal table.
Then one can loop over the transactional data in the internal table and start uploading the data in SAP either by CALL TRANSACTION method or by creating sessions through the batch input program.
Question
10:
How do you process errors in Session method ?
You
can go to Transaction SM35 , Choose the session name and click on Process.
Question
11: What
are the different modes of processing batch input sessions?
The three modes are:
Foreground
Display Errors Only
Background
Question 12: What is the difference between Synchronous and Asynchronous Update ?
In Synchronous update , the database is updated before the next transaction is taken for processing in a
batch input.
In Asynchronous update , the system doesn't wait for updating the database before
the next transaction is taken for processing in a batch input.
Question 13: What is the
transaction for Recording BDC ?
The Tcode is SHDB.
SHDB is transaction recording/ recording overview.
Question 14: How do you read files from the Application server ?
Question 14: How do you read files from the Application server ?
You can use the commands:
OPEN DATASET ---> opens the file(dataset) either in read /write mode.
READ DATASET ---> Read the file
CLOSE DATASET ---> Close the dataset once the date has been read .
Question 15: How do you read files from the presentation server ?
OPEN DATASET ---> opens the file(dataset) either in read /write mode.
READ DATASET ---> Read the file
CLOSE DATASET ---> Close the dataset once the date has been read .
Question 15: How do you read files from the presentation server ?
You can use the Function Modules
:
GUI_UPLOAD --> To read data from file into an internal table
GUI_DOWNLOAD --> To write data from internal table to a file on presentation server
GUI_UPLOAD --> To read data from file into an internal table
GUI_DOWNLOAD --> To write data from internal table to a file on presentation server
If you found the post helpful , consider hitting the Google plus button------>
ABAP
interview questions on BDC:
Session
Method
|
Call
Transaction
|
SAP Database is updated when you
process the sessions. You need to process the sessions separately via SM35.
|
SAP Database is updated during the
execution of the batch input program.
|
Asynchronous
update (COMMIT).
Synchronous update (COMMIT & WAIT).
DIALOG WORK PROCESS: A work process which is dedicated to
process screen information is called "Dialog work process"Â.Synchronous update (COMMIT & WAIT).
There will be 6 to 7 dialog work processes.
These dialog work processes are defined by basis consultant.
UPDATE WORK PROCESS: This work process is responsible for updating the data into the database.
There will be always only "1" update work process.
ASYNCHRONOUS UPDATE (COMMIT):
- In this type the call transaction screens will communicate with the update work process to update the data into database.
- It doesn"t wait for the update to be finished.
- It immediately starts to process the next record without waiting for the update to be finished.
- That"s why this process is very fast.
- It is generally not recommended for the large amount of data, because the called transaction does not return any success or error messages.
SYNCHRONOUS UPDATE (COMMIT & WAIT):
- In this mode, the called transaction communicates with the update work process to update the data into database.
- It will wait for the update to be finished.
- Once the update is finished, then it continues to process the next record.
- Thatâۉ„¢s why this process is very slow.
- It is generally recommended for large amount of data because it returns success and error messages.
MODE:
It specifies the type of the mode to execute the transaction.There are 3 options for mode
- A All screen mode(Foreground).
- E Error screen mode (only error screens will be displayed).
- N No screen mode (Background).
RECORDING METHOD:
Since, it is very difficult to find technical information of each field on the screen, we go for a method called as "Recording method".The recording method is going to record all the fields in the transaction and it generated the technical information such as program name, screen no, field name, field value for each field on the SAP screen.
By using the recording method, it is very easy to create a
BDC program.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MTART'.
perform bdc_field using 'BDC_OKCODE'
'ENTR'.
perform bdc_field using 'RMMG1-MATNR'
record-MATNR_001. "pass material no
perform bdc_field using 'RMMG1-MBRSH'
record-MBRSH_002. "pass industry sector
perform bdc_field using 'RMMG1-MTART'
record-MTART_003. "pass material type
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE' "enter
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
record-KZSEL_01_004. "basic view1 pass 'X'
perform bdc_dynpro using 'SAPLMGMM' '4004'. "calling second screen (basic view1)
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'MAKT-MAKTX'
record-MAKTX_005. "material description
perform bdc_field using 'BDC_CURSOR'
'MARA-MEINS'. "base unit of meassure
perform bdc_field using 'MARA-MEINS'
record-MEINS_006.
perform bdc_transaction using 'MM01'. "finally calling transaction
Add data declerations
Add required data declerations for material data as per flat fileTYPES: BEGIN OF TY_MARA, "user defined types as per flat file
MATNR TYPE MARA-MATNR,
MBRSH TYPE MARA-MBRSH,
MTART TYPE MARA-MTART,
MEINS TYPE MARA-MEINS,
MAKTX TYPE MAKT-MAKTX,
END OF TY_MARA.
DATA : IT_MARA TYPE TABLE OF TY_MARA, "mara internal table
WA_MARA TYPE TY_MARA. "mara work area
DATA: IT_BDCDATA TYPE TABLE OF BDCDATA . "BDCDATA
DATA: WA_BDCDATA TYPE BDCDATA . "work area BDCDATA
DATA : BDCMSG TYPE TABLE OF BDCMSGCOLL. "BDC message table
DATA:FILE TYPE STRING. "file name
PARAMETERS : P_FILE TYPE RLGRAP-FILENAME. "input parameter for file upload
Upload data from flat file
Upload data into a internal table from a flat file using GUI_UPLOAD, all BDC performs are available in standard programs, simpley double click on each perform and copy from standard program, paste at the bottom. FILE = P_FILE.
CALL FUNCTION 'GUI_UPLOAD' "upload flat file
EXPORTING
FILENAME = FILE "file name
FILETYPE = 'ASC' "file type
HAS_FIELD_SEPARATOR = 'X' "is tab delimited
TABLES
DATA_TAB = IT_MARA.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
Process records one by one to BDC
Loop through internal table and pass records to BDC call
transaction.
LOOP AT IT_MARA INTO WA_MARA. "loop all records and pass one by one to BDC
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0060'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RMMG1-MTART'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'ENTR'.
PERFORM BDC_FIELD USING 'RMMG1-MATNR'
WA_MARA-MATNR. "pass material no
PERFORM BDC_FIELD USING 'RMMG1-MBRSH'
WA_MARA-MBRSH. "pass indistry sector
PERFORM BDC_FIELD USING 'RMMG1-MTART'
WA_MARA-MTART. "pass material type
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0070'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
PERFORM BDC_FIELD USING 'MSICHTAUSW-KZSEL(01)' "select basic view1
'X'.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4004'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=BU'.
PERFORM BDC_FIELD USING 'MAKT-MAKTX'
WA_MARA-MAKTX. "pass material description
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'MARA-MEINS'.
PERFORM BDC_FIELD USING 'MARA-MEINS'
WA_MARA-MEINS. "pass base unit oe meassure
CALL TRANSACTION 'MM01' USING IT_BDCDATA "call transaction
MODE 'N' "N-no screen mode, A-all screen mode, E-error screen mode
UPDATE 'A' "A-assynchronous, S-synchronous
MESSAGES INTO BDCMSG. "messages
IF SY-SUBRC EQ 0.
WRITE :/ WA_MARA-MATNR, 'submitted to BDC'.
ENDIF.
ENDLOOP.
The filnal BDC for migrating Material Master basic data is below
REPORT ZSAPN_BDC
NO STANDARD PAGE HEADING LINE-SIZE 255.
TYPES: BEGIN OF TY_MARA, "user defined types as per flat file
MATNR TYPE MARA-MATNR,
MBRSH TYPE MARA-MBRSH,
MTART TYPE MARA-MTART,
MEINS TYPE MARA-MEINS,
MAKTX TYPE MAKT-MAKTX,
END OF TY_MARA.
DATA : IT_MARA TYPE TABLE OF TY_MARA, "mara internal table
WA_MARA TYPE TY_MARA. "mara work area
DATA: IT_BDCDATA TYPE TABLE OF BDCDATA . "BDCDATA
DATA: WA_BDCDATA TYPE BDCDATA . "work area BDCDATA
DATA : BDCMSG TYPE TABLE OF BDCMSGCOLL. "BDC message table
DATA:FILE TYPE STRING. "file name
PARAMETERS : P_FILE TYPE RLGRAP-FILENAME. "input parameter for file upload
START-OF-SELECTION.
IF P_FILE IS NOT INITIAL.
FILE = P_FILE.
CALL FUNCTION 'GUI_UPLOAD' "upload flat file
EXPORTING
FILENAME = FILE "file name
FILETYPE = 'ASC' "file type
HAS_FIELD_SEPARATOR = 'X' "is tab delimited
TABLES
DATA_TAB = IT_MARA.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
LOOP AT IT_MARA INTO WA_MARA. "loop all records and pass one by one to BDC
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0060'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RMMG1-MTART'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'ENTR'.
PERFORM BDC_FIELD USING 'RMMG1-MATNR'
WA_MARA-MATNR. "pass material no
PERFORM BDC_FIELD USING 'RMMG1-MBRSH'
WA_MARA-MBRSH. "pass indistry sector
PERFORM BDC_FIELD USING 'RMMG1-MTART'
WA_MARA-MTART. "pass material type
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0070'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
PERFORM BDC_FIELD USING 'MSICHTAUSW-KZSEL(01)' "select basic view1
'X'.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4004'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=BU'.
PERFORM BDC_FIELD USING 'MAKT-MAKTX'
WA_MARA-MAKTX. "pass material description
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'MARA-MEINS'.
PERFORM BDC_FIELD USING 'MARA-MEINS'
WA_MARA-MEINS. "pass base unit oe meassure
CALL TRANSACTION 'MM01' USING IT_BDCDATA "call transaction
MODE 'N' "N-no screen mode, A-all screen mode, E-error screen mode
UPDATE 'A' "A-assynchronous, S-synchronous
MESSAGES INTO BDCMSG. "messages
IF SY-SUBRC EQ 0.
WRITE :/ WA_MARA-MATNR, 'submitted to BDC'.
ENDIF.
ENDLOOP.
DATA : WA_BDCMSG LIKE LINE OF BDCMSG.
IF BDCMSG IS NOT INITIAL. "display messages
LOOP AT BDCMSG INTO WA_BDCMSG.
WRITE:/ WA_BDCMSG-TCODE, WA_BDCMSG-MSGTYP, WA_BDCMSG-MSGV1, WA_BDCMSG-FLDNAME .
CLEAR WA_BDCMSG.
ENDLOOP.
ENDIF.
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR WA_BDCDATA.
WA_BDCDATA-PROGRAM = PROGRAM. "program
WA_BDCDATA-DYNPRO = DYNPRO. "screen
WA_BDCDATA-DYNBEGIN = 'X'. "begin
APPEND WA_BDCDATA TO IT_BDCDATA..
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
* IF FVAL <> NODATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = FNAM. "field name ex: matnr
WA_BDCDATA-FVAL = FVAL. "field value ex: testmat001
APPEND WA_BDCDATA TO IT_BDCDATA.
* ENDIF.
ENDFORM.
ReplyDeleteSir ... Apne BDC ke bare me jankari achchhi Di hai
ReplyDeletebdc
click and get it all you want
ReplyDeleteAapka BDC se related article bahut accha laga thank you very much
ReplyDeletereally very nice artical Instagram Bio For Girls
ReplyDelete
ReplyDeleteReally very nice article thanks for sharing also read,SAP SD Course in Noida