12-04-2007 5:05 AM
<b>Hi Friends,
I have some important bdc question... can any one please answer these questions.
advance thanks,
sekhar.
</b>
1)In BDC how can we handle Table Controls?
2)Suppose we are transfer data through BDC from leagacy to SAP and their is some duplicate data in legacy system but we don't want this in SAP system .So how can we check that this data is already exist?
3)Can we use two transaction code in one BDC like XK01 & XD01 if yes how?
4)While uploading a flat file through BDC Call Transaction, the system suddenly get CRASHED. How do I know many records have been updated?
5)In which file format will u upload data in bdc? hw will u do that?
6)Are bdc methods are interfaces or conversions? explain?
7)what is the include used for selection screen for bdc program?
8)In call transaction what is the function module to capture the errors?
9)what is session?
10)hw do u populate the BDCDATA structure?
11)what is the syntax for call transaction?
12)hw do u save data in bdc table?
13)IS it possible to use " call transaction" without a bdc table?
14)differnce between call transaction & session method?
15)what does the mesage parameter indicates?
16)what is synchrouous an asynchronous?
17)What is bdc_okcode?
18)What is the function key values of BDC_OKCODE ie '/00' what this is for?
19)Can you give me one example where we should use only bdc call transaction method
20)In the reports when you press f4 to get list is it possible to pass default value in that value...i.e suppose i have created select option on company code when the user press f4 automatically he should get the default value.
21) How to insert data in table control through bdc ....problem is every system displays different no of rows in the table control when you enter the application....for ex .. purchase order, pur req, bom....
22) Does bdc table acccept data for multiple transactions? if so how?
23) what are the advantages in batch input session?
24)what is the use of 'structure identifiers' in sap?
25)Is there any method called direct input. if so what is it?
12-04-2007 6:01 AM
Hi Sekhar,
You have lots of questions in BDC. For your questions there are already answers in fourms. so better search in Fourms Typing the key word ex: for BDC using table control type : <b>'BDC WITH TABLE CONTROL'</b> in fourms . in this way u can find the answers for your questions.
<b>hope it may be useful to you</b>.
Regards,
sunil kairam.
12-04-2007 6:04 AM
12-04-2007 6:29 AM
Hi
1)In BDC how can we handle Table Controls?
2)Suppose we are transfer data through BDC from leagacy to SAP and their is some duplicate data in legacy system but we don't want this in SAP system .So how can we check that this data is already exist?
3)Can we use two transaction code in one BDC like XK01 & XD01 if yes how?
hi,
Follow this skeleton logic:
open_group for tran1
loop at it_data1.
*Populate bddata structures
bdc_insert. for tran1
endloop.
close_group. for tran 1
open_group for tran2
loop at it_data2.
*Populate bddata structures
bdc_insert. for tran2
endloop.
close_group. for tran 2
If you want to record for two transations then you will use same method as one transation.For example if you want to execute two transations like VA01(sales order) and VL01N(delivery).Here first you can record for both transactions seperately and in the function module calling you will call BDC_INSERT two times
First function module contains Tcode as VA01 and Bdcdata table as data for the va01 transaction and second table contains tcode as VL01N and Bdcdata table conatins data which contains the record data of the delivery recorded data.
PERFORM open_batch_session USING p_sessa.
LOOP AT ltcap_int
WHERE NOT tot_inc IS initial.
ltcap_int-adj = ltcap_int-adj * -1.
CONCATENATE ltcap_int-fund '/' ltcap_int-cfc INTO zuonr.
PERFORM fill_bdc_header.
PERFORM fill_bdc_lines.
PERFORM post_entries.
PERFORM insert_batch_session USING 'FB01'.
ltcap_int-adj = ltcap_int-adj * -1.
ENDLOOP.
PERFORM close_batch_session.
perform start_batch_session using p_sessa.
Budgets
WRITE p_fy TO c_fy.
PERFORM open_batch_session USING p_sessb.
LOOP AT ltcap_int
WHERE NOT tot_inc IS initial.
PERFORM rollup_header.
PERFORM rollup_line.
PERFORM rollup_save.
PERFORM insert_batch_session USING 'FR21'.
IF NOT ltcap_int-gsef_amt IS INITIAL.
PERFORM rollup_header_gsef.
PERFORM rollup_line_gsef.
PERFORM rollup_save.
PERFORM insert_batch_session USING 'FR21'.
ENDIF.
ENDLOOP.
PERFORM close_batch_session.
perform start_batch_session using p_sessb.
We can process more than 1 transactions in session method.
For this we will create the internal tables equilant to transactions and
Between BDC_open_group and BDC_close_group we will call the BDC_Insert the no.of transactions times and populate the internal tables which contains the data pertaining to diffrent transactions.
CALL TRANSACTION:
Single transaction can be processed always.
Synchronous Processing - means Transfers data for a single transaction.
Asynchronous and Synchronous Database Update is possible.
No Session Log is created
Faster as it Asynchronous Update is possible.
Returns the SY-SUBRC value.
SESSION METHOD:
Multiple Transactions can be Processed through the same session.
Asynchronous processing - means Transfers data for multiple transactions.
Synchronous updates only possible - means no transaction is started until the previous transaction has been written to the database.
Session log is created.
Slower as it is Synchronous Update only.
Doesn't return the SY-SUBRC value.
15)what does the mesage parameter indicates?
16)what is synchrouous an asynchronous?
synchrouous
Asynchronous
17)What is bdc_okcode?
18)What is the function key values of BDC_OKCODE ie '/00' what this is for?
19)Can you give me one example where we should use only bdc call transaction method
20)In the reports when you press f4 to get list is it possible to pass default value in that value...i.e suppose i have created select option on company code when the user press f4 automatically he should get the default value.
21) How to insert data in table control through bdc ....problem is every system displays different no of rows in the table control when you enter the application....for ex .. purchase order, pur req, bom....
22) Does bdc table acccept data for multiple transactions? if so how?
Same call transaction cannot call more than one Tcode but yeah you can use two call transactions in your program
12-04-2007 7:04 AM
Hi,
I solved almost all questions of yours.Please have a look:
1)In BDC how can we handle Table Controls?
Ya you can handle table control in BDC.Check the following link and tips:
For table control in bdc declare two variable as integer.
set the variable value as 0.In the program before the line
item perform statement set the counter value as 1.
count=count+1.then u hv to use the concantenate
statementfor the line items for example
concantenate '(lfa1-banks('count'))' into cval
perform bdc using cval.
during recording for the line items we hv record for the
next page also for the line item.goto standard tool bar u
hv to press the next page button.
if count=5.
perform bdc using p+ ->this for next page
endif
clear count.
Here are the example programs
http://arthur_ong.tripod.com/xab023.htm
http://www.sap-basis-abap.com/abap/handling-table-control-in-bdc.htm
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
2)Suppose we are transfer data through BDC from leagacy to SAP and their is some duplicate data in legacy system but we don't want this in SAP system .So how can we check that this data is already exist?
While extracting data from legacy system use
"select distinct" statement.
This will avoid the duplicate entries.
3)Can we use two transaction code in one BDC like XK01 & XD01 if yes how?
Yes you can two transaction codes in BDC.
Just use recording (SHDB) for this.
In your case first of all record the transaction XK01 1st then record XD01.
Declare two separate internal tables and do the BDC as you are doing generally.
but this method should be avoided,because inconsistency may occur.
So better to use one transaction per one bdc program.
4)While uploading a flat file through BDC Call Transaction, the system suddenly get CRASHED. How do I know many records have been updated?
The records those are not being processed will be errored records in the session log...just process the session again and load the data completely.
5)In which file format will u upload data in bdc? hw will u do that?
you can upload data using notepad as well using excel sheet.
just call function module 'GUI_UPLOAD' and give the file name there.... with ASC or DAT format.It will work.
Generally in real time we use notepad.
6)Are bdc methods are interfaces or conversions? explain?
BDC is only for conversion.BAPI,IDOC are interface methods.
CONVERSION programs are the ones which have one time usage, usually when a legacy system is being replaced by a system like SAP, then the data has to be mapped from the legacy system to SAP system. Here the data to be converted is given on a flat file & is uploaded to SAP tables mostly using LSMW only. Conversions programs are BDC,BAPI and LSMW programs in which you upload all the related tables from the flat files.Those are one time programs.
Conversion Program
http://help.sap.com/saphelp_erp2005/helpdata/en/d3/a65a14e96911d1b401006094b944c8/frameset.htm
7)what is the include used for selection screen for bdc program?
include bdcrecx1.
8)In call transaction what is the function module to capture the errors?
You can check the errors by creating the session method. Try this code.
CALL TRANSACTION 'XK01' USING IT_BDCDATA
MODE P_MODE
UPDATE P_UPDATE
MESSAGES INTO IT_MESS.
IF SY-SUBRC = 0.
READ TABLE IT_MESS WITH KEY MSGTYP = 'S'.
IF SY-SUBRC = 0.
IT_SUCESS-LIFNR = IT_MESS-MSGV1.
IT_SUCESS-NAME1 = IT_VENDOR-NAME1.
APPEND IT_SUCESS.
ADD 1 TO V_SUCESS.
ENDIF.
ELSE.
READ TABLE IT_MESS WITH KEY MSGTYP = 'E'.
IF SY-SUBRC = 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = IT_ERROR-MESSAGE
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IT_ERROR-LINENO = V_INDEX.
APPEND IT_ERROR.
ADD 1 TO V_ERROR.
ENDIF.
IF V_ERR_1 EQ SPACE.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = P_EGROUP
USER = P_EUSER
KEEP = P_EKEEP
HOLDDATE = P_EHDATE.
V_ERR_1 = 'X'.
ENDIF.
9)what is session?
Hi generally a session is basically another SAP instance on your screen. Multiple sessions allow you to work on more than one task at a time. This can save you time and reduces the need to jump from screen to screen.
You can open up to six sessions, and do a different task, or even the same task, in each one. You can move around between the open sessions, and you can close any session without having to log off from the system.Each session you create is as if you logged on to the system again. Each session is independent of the others. For example, closing the first session does not cause the other sessions to close.
Refer:
http://help.sap.com/saphelp_46c/helpdata/en/73/69eb9955bb11d189680000e829fbbd/frameset.htm
http://help.sap.com/saphelp_46c/helpdata/en/73/69eb9955bb11d189680000e829fbbd/frameset.htm
http://help.sap.com/saphelp_46c/helpdata/en/73/69eb9955bb11d189680000e829fbbd/frameset.htm
http://help.sap.com/saphelp_46c/helpdata/en/73/69eb9955bb11d189680000e829fbbd/frameset.htm
But if you are asking related to BDC then,
this is nothing but to upload no of records from legacy to SAP in a batch manner
What is BDC or batch input
The Batch Input is a SAP technic that allows automating the input in transactions. It lies on a BDC (Batch Data Commands) scenario.
BDC functions:
E BDC_OPEN_GROUP : Opens a session group
E BDC_CLOSE_GROUP : Closes a session
E BDC_INSERT : Insert a BDC scenario in the session
E The ABAP statement "CALL TRANSACTION" is also called to run directly a transaction from its BDC table.
It runs the program RSBDCSUB in order to launch automatically the session. The session management is done through the transaction code SM35.
The object itself is maintanable through the transaction SE24.
BDC methods:
Method
Description
Parameters
OPEN_SESSION
Opens a session
SUBRC (Return Code ? 0 OK)
SESSIONNAME (Session to be created)
CLOSE_SESSION
Closes a session
None
RESET_BDCDATA
Resets the BDC Internal Table...
None. Normally, for internal purposec
BDC_DYNPRO
Handles a new screen
PROGNAME (Name of the program)
DYNPRONR (Screen Number)
BDC_FIELD
Puts a value on the screen
FIELDNAME (Name of the field)
FIELDVALUE (Value to be passed)
CONSTRUCTOR
Constructor - Initializes NO_DATA
NODATA (No data character). The constructor is called automatically when the object is created.
RUN_SESSION
Launches a session with RSBDCBTC
None
CALL_TRANSACTION
Calls a transaction with the current BDC Data
MODE (Display Mode)
UPDATE (Update Mode)
TCODE (Transaction to be called)
BDC_INSERT
Inserts the BDC scenario in the session
TCODE (Transaction to be called)
BDC techniques used in programs:
a) Building a BDC table and calling a transaction,
b) Building a session and a set of BDC scenarios and keeping the session available in SM35,b
c) Building a session and lauching the transaction right after closing the session.
10)hw do u populate the BDCDATA structure?
BDCDATA is a structure which consists of these fields for the processing of a transaction. So we have to declare an internal table of BDCDATA to store all this data.
BDCDATA fields:
PROGRAM -> Name of the Program
DYNPRO -> Screen No
DYNBEGIN -> At the start of a new screen we have to set it to 'X' or else ' '.
FNAM -> Name of the Screen field where data has to be entered
FVAL -> Value for Screen field
remember to clear the internal table (BDCDATA) before calling the transction .
Suppose you have a loop like this
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
loop at it_final.
CLEAR bdcdata.
REFRESH bdcdata.
PERFORM bdc_dynpro USING 'SAPMP50A' '1000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=COP'.
PERFORM bdc_field USING 'RP50G-PERNR'
it_final-pernr. "'4317'.
CALL TRANSACTION 'PA30' USING bdcdata.
endloop.
----
Start new screen *
----
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
----
Insert field *
----
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> NODATA.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.
Above includes are available in include BDCRECXX.
11)what is the syntax for call transaction?
see the following Example:
CALL TRANSACTION 'SE38' USING BDCDATA MODE 'N'
MESSAGES INTO ITAB.
12)hw do u save data in bdc table?
THIS QUESTION IS NOT CLEAR...please ask it again clearly.
13)IS it possible to use " call transaction" without a bdc table?
You should use BDCTABLE
The process flow of CALL TRANSACTION
A program that uses CALL TRANSACTION USING to process legacy data should execute thefollowing steps:
Prepare a BDCDATA structure for the transaction that you wish to run.
Prepare a internal table to store error messages Tab_Mess like structure of BDCMSGCOLL.
With a CALL TRANSACTION USING statement, call the transaction and prepare the BDCDATA structure. For example:
CALL TRANSACTION MM01' USING BDCDATA MODE 'A' UPDATE 'S'. MESSAGES INTO TAB_MESS.
IF SY-SUBRC <> 0.
<Error_handling>.
ENDIF.
Otherwise in that case the current program is suspended, the transaction specified is brought up, and a user must enter the data into the screens.
14)differnce between call transaction & session 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.
15)what does the mesage parameter indicates?
16)what is synchrouous an asynchronous?
In syncronous method you will receive acknowledgement and in asyncronous you wont get any acknowledgement.
17)What is bdc_okcode?
BDC_OKCODE: It is the Function Code , Sap provide Function code for every user action, like when user clike any button or menu item each and every thing having Function code, that is called OKcode.
u can see okcode Like: 1 single click on one button on screen & drake
ur mouse cursor down (out of sap screen) then press F1
2. U can see Function code
18)What is the function key values of BDC_OKCODE ie '/00' what this is for?
IF okcode = /00,
it means 'ENTER'
That is when u execute ur BDC in foreground, this /00 comes, implying u shud press "ENTER".
19)Can you give me one example where we should use only bdc call transaction method
any bdc program you can do in call transaction method.
And that is your wish what you want to use.
20)In the reports when you press f4 to get list is it possible to pass default value in that value...i.e suppose i have created select option on company code when the user press f4 automatically he should get the default value.
use function module for F4 entry under the event "at selection screen on value request".
and the FM is F4IF_FIELD_VALUE_REQUEST or F4IF_INT_TABLE_VALUE_REQUEST.
21) How to insert data in table control through bdc ....problem is every system displays different no of rows in the table control when you enter the application....for ex .. purchase order, pur req, bom....
Check those links I had givem for your previous question and try out.
22) Does bdc table acccept data for multiple transactions? if so how?
23) what are the advantages in batch input session?
the advantage is the session itself...bcz you can identify errors easily using the error log.
24)what is the use of 'structure identifiers' in sap?
No idea regarding this.
25)Is there any method called direct input. if so what is it?
Direct Input (DI) programs are similar to Batch Input(BI) programs. The difference being is, instead of processing screens they validate fields and directly load the data into tables using standard function modules. For this reason, DI programs are generally faster (RMDATIND - Material Master DI program works at least 5 times faster than the BDC counterpart) and so is suited for loading large volumes of data.
Please reward.
12-04-2007 7:16 AM
check the answers:
1)In BDC how can we handle Table Controls?
2)Suppose we are transfer data through BDC from leagacy to SAP and their is some duplicate data in legacy system but we don't want this in SAP system .So how can we check that this data is already exist?
so for this just validate the data before you call transaction and this is possible as:
Validating file records
FORM vendor_check.
loop for validating all records of it_src
LOOP AT it_src.
deleting blank records.
IF it_src IS INITIAL.
DELETE it_src.
v_records = v_records - 1.
CONTINUE.
ENDIF.
translating records of it_src into upper case
TRANSLATE it_src-ktokk TO UPPER CASE.
TRANSLATE it_src-land1 TO UPPER CASE.
MODIFY it_src.
g_desc = ' '.
checking blank value in vendor field of it_src
IF it_src-lifnr EQ ' '.
storing all error messages in g_desc
CONCATENATE g_desc text-039 INTO g_desc SEPARATED BY ','.
ELSE.
validating particular vendor already created or not using check table
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = it_src-lifnr
IMPORTING
output = v_lifnr.
READ TABLE it_validate_lfa1 WITH KEY lifnr = v_lifnr.
IF sy-subrc = 0.
CONCATENATE g_desc text-039 INTO g_desc SEPARATED BY ','.
ENDIF.
ENDIF.
3)Can we use two transaction code in one BDC like XK01 & XD01 if yes how?
yes just make two internal table of bdc data and call two different transactions one by one and pass related internal tables.
4)While uploading a flat file through BDC Call Transaction, the system suddenly get CRASHED. How do I know many records have been updated?
for this just put check after call transaction and check agianst sy-msgty as:
checking whether system generated any error message or not
IF sy-msgty ne 'E' and sy-subrc eq 0.
then move thta record into success file
else
move that record into error file.
endif.
5)In which file format will u upload data in bdc? hw will u do that?
prefarrably text file with tab delimited.
6)Are bdc methods are interfaces or conversions? explain?
7)what is the include used for selection screen for bdc program?
you can develop input selection screen as include which can be used in many other programs. so just call that input selection screen in your bdc program and it will design the input screen.
8)In call transaction what is the function module to capture the errors?
CALL FUNCTION 'TB_MESSAGE_BUILD_TEXT'
this will return the messages which are returned by transcation
and you can check for errors with sy-msgty and sy-subrc as expalined above.this is the best way to identify error records.
9)what is session?
it is a background job and you can attach your bdc program to it and based on priority or FIFO bdc program will be executed by own with out notifying user. and this is possible through TCODE SM36
10)hw do u populate the BDCDATA structure?
declare this
DATA: it_bdc TYPE bdcdata OCCURS 100 WITH HEADER LINE.
using PERFORM bdc_dynpro USING 'SAPMF02K' '0107'.
this will populate the bdc table with screen name and screen no.
aND PERFORM bdc_field USING 'LFA1-NAME1' it_src-name1.
this will populate the bdc data with screen field name and data for that screen from table.
&----
*& Form bdc_dynpro
&----
FORM bdc_dynpro USING screen_name screen_number.
it_bdc-program = screen_name.
it_bdc-dynpro = screen_number.
it_bdc-dynbegin = 'X'.
APPEND it_bdc.
CLEAR it_bdc.
ENDFORM. "bdc_dynpro
&----
*& Form bdc_field
*&----
FORM bdc_field USING field_name field_val.
it_bdc-fnam = field_name.
it_bdc-fval = field_val.
APPEND it_bdc.
CLEAR it_bdc.
ENDFORM. "bdc_field
this will populate your bdc table that you will pass it to call transaction and at one time it will be having data for one record.
11)what is the syntax for call transaction?
CALL TRANSACTION 'MK01'
USING it_bdcdata "internal table for bdc data
MODE 'N'
MESSAGES INTO messtab. "store returned messages into messtab.
12)hw do u save data in bdc table?
see answer no. 11
13)IS it possible to use " call transaction" without a bdc table?
no. i wont think so
14)differnce between call transaction & session method?
session is for job means your bdc program will run by its own as a background job.
15)what does the mesage parameter indicates?
for storing returned messages of transaction into message table
16)what is synchrouous an asynchronous?
sync means that it will access your internal table that you will pass sequentially and oone by one. and in asyn it will access your file records randomly and can access multiple records at a same time and pass it to call transaction .
17)What is bdc_okcode?
it is the code that tells what action you have performed after filling the data in all fields of screen or you can say the code
to move to next screen or finally leaving the screen.
18)What is the function key values of BDC_OKCODE ie '/00' what this is for?
this is for enter
19)Can you give me one example where we should use only bdc call transaction method
20)In the reports when you press f4 to get list is it possible to pass default value in that value...i.e suppose i have created select option on company code when the user press f4 automatically he should get the default value.
SELECT-OPTIONS : s_week FOR v_week NO INTERVALS NO-EXTENSION MODIF ID wk.
at selection-screen on value-request for s_week.
LOOP AT SCREEN.
IF screen-group1 = 'WK' .
s_week = 'default value'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
21) How to insert data in table control through bdc ....problem is every system displays different no of rows in the table control when you enter the application....for ex .. purchase order, pur req, bom....
22) Does bdc table acccept data for multiple transactions? if so how?
23) what are the advantages in batch input session?
24)what is the use of 'structure identifiers' in sap?
25)Is there any method called direct input. if so what is it?
plz reward points if helps.
regards,
rahul