10-11-2007 7:16 AM
What is BDC ? How do I do BDC program ? Please send me with an example ..
Advantage Of BDC ?
10-11-2007 7:24 AM
Hi
BDC stand for BATCH DATA COMMUNICATION
Through this concept we transfer the data into SAP R/3 System
Legacy System -
> R/3 System
Batch input is used to transfer large amounts of data into the
SAP system. In this topic, we will learn the basics of batch input.
There are 2 types of transfers Conversions and interfaces.
Conversions: This type of transfer refers to a one-time transfer from a legacy system to the SAP system. In this case, the legacy system is the old system that is being replaced by the SAP system.
Interfaces: This type of transfer refers to an ongoing transfer from a complementary system to the SAP system. In this case, the complementary system is a system that will run along side the SAP system.
<b>the BDC program should be in this format</b>
Transaction Recorder (SHDB)
How to Upload Presentation Server Flat file to SAP R/3 system???
How to upload application server file to R/3 system?
Definition
Example - Call Transaction Method
<b>Transaction Recorder (SHDB)</b>
Before you work with the Batch Input methods, you should know the purpose of the tool
Transaction Recorder.
Use:
You can use the transaction recorder to record a series of transactions and their screens.
<b>Features:</b>
You can use the recording to create
Data transfer programs that use batch input or CALL TRANSACTION
Batch input sessions
Test data
Function modules.
Note: It doesnt record F1, F4 and Scrollbar movements
<b>Upload Flat file from Presentation Server to SAP R/3</b>
CALL FUNCTION GUI_UPLOAD'
EXPORTING
CODEPAGE = IBM'
FILENAME = P_UFILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = INT_TAB
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10 .
IF SY-SUBRC NE 0.
MESSAGE E999(FR) WITH 'ERROR IN FILE UPLOAD'.
ENDIF.
<b>Upload file from application server to SAP R/3</b>
Open the the application server file
OPEN DATASET <dsn> FOR INPUT <mode>
Read the data from application server file
READ DATASET <dsn> INTO <wa>
And then close the application server file
CLOSE DATASET <dsn>
<b>Definition- Declaring BDC Table</b>
DATA: BDC_TAB LIKE STANDARD TABLE OF
BDCDATA INITIAL SIZE 6
WITH HEADER LINE .
The internal table used to collect the transactions information must be declared LIKE BDCDATA.
<b>Filling BDC Table Method #1</b>
FORM FILL_BDC_TAB.
REFRESH BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-PROGRAM = SAPMF02K.
BDC_TAB-DYNPRO = 01016.
BDC_TAB-DYNBEGIN = X.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = RF02K-LIFNR.
BDC_TAB-FVAL = TEST1.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = RF02K-D0010.
BDC_TAB-FVAL = X.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-PROGRAM = SAPMF02K.
BDC_TAB-DYNPRO = 0110.
BDC_TAB-DYNBEGIN = X.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = LFA1-STRAS.
BDC_TAB-FVAL = 123 Main St..
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = BDC_OKCODE.
BDC_TAB-FVAL = /11.
APPEND BDC_TAB.
ENDFORM.
<b>Filling BDC Table Method #2</b>
FORM FILL_BDC_TAB.
REFRESH BDC_TAB.
PERFORM POPULATE_BDC_TAB
USING:
1 SAPMF02K 0106,
RF02K-LIFNR TEST1,
RF02K-D0010 X,
1 SAPMF02K 0110,
LFA1-STRAS, 123 Main St.,
BDC_OKCODE, /11.
ENDFORM.
FORM POPULATE_BDC_TAB USING FLAG VAR1 VAR2.
CLEAR BDC_TAB.
IF FLAG = 1.
BDC_TAB-PROGRAM = VAR1.
BDC_TAB-DYNPRO = VAR2..
BDC_TAB-DYNBEGIN = X.
ELSE.
BDC_TAB-FNAM = VAR1.
BDC_TAB-FVAL = VAR2.
ENDIF.
APPEND BDC_TAB.
ENDFORM.
This two subroutine method to fill the BDC table is preferable because the POPULATE_BDC_TABLE subroutine is reusable throughout all batch input programs.
Example #1 - Change Vendor (Call Transaction Method)
<b>Example #1- Declaration Section</b>
REPORT Y180DM10.
DATA: BDC_TAB LIKE STANDARD TABLE OF
BDCDATA INITIAL SIZE 6 WITH HEADER LINE.
INFILE(20) VALUE /tmp/bc180_file4.
DATA: BEGIN OF INREC.
VENDNUM LIKE LFA1-LIFNR.
STREET LIKE LFA1-STRAS.
END OF INREC.
PARAMETERS: DISPMODE DEFAULT A,
UPDAMODE DEFAULT S.
START-OF-SELECTION.
OPEN DATASET INFILE
FOR INPUT IN TEXT MODE.
DO.
READ DATASET INFILE INTO INREC.
IF SY-SUBRC < > 0. EXIT. ENDIF.
PERFORM FILL_BDC_TAB.
CALL TRANSACTION FK02
USING BDC_TAB
MODE DISPMODE
UPDATE UPDAMODE.
IF SY-SUBRC < > 0.
WRITE: /ERROR.
ENDIF.
ENDDO.
CLOSE DATASET INFILE.
<b>synchronous updating</b>
DO.
PERFORM FILL_BDC_TAB.
CALL TRANSACTION FK02
USING BDC_TAB
MODE N
UPDATE S.
IF SY-SUBRC < > 0.
WRITE: /ERROR.
ENDIF.
ENDDO.
With synchronous updating, we can check SY-SUBRC to determine the success of the transaction and the actual update to the database.
<b>asynchronous updating</b>
DO.
PERFORM FILL_BDC_TAB.
CALL TRANSACTION FK02
USING BDC_TAB
MODE N
UPDATE A.
IF SY-SUBRC < > 0.
WRITE: /ERROR.
ENDIF.
ENDDO.
With asynchronous updating, we can check SY-SUBRC to determine the success of the transaction only, not the actual update to the database.
<b>Error Handling</b>
Write an error report.
Send the record(s) in error to an error file.
Create a batch input session with the record(s) in error.
To store error messages ( CALL TRANSACTION )
data: begin of Tab_Mess occurs 0.
include structure bdcmsgcoll.
data : end of Tab_Mess,
CALL TRANSACTION FK02 USING BDC_TAB MODE N UPDATE S
MESSAGES INTO TAB_MESS.
IF SY-SUBRC NE 0.
WRITE: / Tab_MESS-TCODE, Tab_MESS-DYNUMB, Tab_MESS-MSGTYP ,
Tab_MESS-MSGID.
ENDIF.
i am giving you example for Change Vendor you practice for ur tcode
For our example, we will use the Change Vendor transaction (FK02) to add a street address to an already existing vendor.
<b>Step #1</b>
Use SystemStatus menu path to determine online program name (SAPMF02K), screen number (0110)
<b>Step #2</b>
Use F1 key and Technical Info pushbutton in each screen field to be filled to determine the field name.
<b>Step #3</b>
Determine how to proceed in the transaction
(save the record by clicking on the Save pushbutton or pressing the F11 key).
<b>BDC Table Contents</b>
After researching the transaction we can determine the contents of the BDC table.
PROGRAM DYNPRO DYNBEGIN FNAM FVAL
SAMPF02K 0106 X
RF02K-LIFNR TEST1
RF02K-D0110 X
SAMPF02K 0110 X
LFA1-STRAS 123 Main St.
BDC_OKCODE /11
<b>Batch Input Methods</b>
CALL TRANSACTION USING
STATEMENT
<b>Call transaction - for data transfer</b>
Processing batch input data with CALL TRANSACTION USING is the faster of the two recommended data transfer methods. In this method, legacy data is processed inline in your data transfer program.
Syntax:
CALL TRANSACTION <tcode>
USING <bdc_tab>
MODE <mode>
UPDATE <update>
A Display all
E Display errors only
N No display
S Synchronous
A Asynchronous
L Local update
<b>The process flow of CALL TRANSACTION</b>
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.
<b>Overview of Batch Input Session</b>
The first batch input method is to create a batch input session. It is the processing of this batch input session that updates the database, not the execution of the batch input program.
Reward if usefull
10-11-2007 7:17 AM
Hi,
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
BDC
http://www.sap-img.com/bdc.htm
Table control in BDC
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
BDC
http://www.sap-img.com/bdc.htm
http://www.sappoint.com/abap/bdcconcept.pdf
http://www.sap-img.com/abap/learning-bdc-programming.htm
http://www.sap-img.com/abap/question-about-bdc-program.htm
http://www.sapdevelopment.co.uk/bdc/bdchome.htm
http://www.planetsap.com/bdc_main_page.htm
http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html
Table control in BDC
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
thanks.
10-11-2007 7:21 AM
BDC (<i>Batch Data Communication</i>) is a technology used for data transfer. it is meant for transferring data thru SAP transactions itself. when u use BDC for data transfer, the sequence of steps is the same as when u use standard sap transaction screens for data upload. the only difference is that u can use different options for foreground/background processing.
<i>Programming</i>
Easiest way is to record the transaction via SHDB and then generate a sample program and adapt it to your needs.
There are also some standard SAP program that create BDC session. Look also for LSMW.
<i>Advantages</i>
Error are recorded in a protocol, and users can execute the erroneous transaction again and again from SM35.
Regards
PS: <a href="https://www.sdn.sap.com/irj/sdn/advancedsearch?query=bdcguidewhat+how&cat=sdn_all">there are already many threads to read</a>
10-11-2007 7:24 AM
Hi
BDC stand for BATCH DATA COMMUNICATION
Through this concept we transfer the data into SAP R/3 System
Legacy System -
> R/3 System
Batch input is used to transfer large amounts of data into the
SAP system. In this topic, we will learn the basics of batch input.
There are 2 types of transfers Conversions and interfaces.
Conversions: This type of transfer refers to a one-time transfer from a legacy system to the SAP system. In this case, the legacy system is the old system that is being replaced by the SAP system.
Interfaces: This type of transfer refers to an ongoing transfer from a complementary system to the SAP system. In this case, the complementary system is a system that will run along side the SAP system.
<b>the BDC program should be in this format</b>
Transaction Recorder (SHDB)
How to Upload Presentation Server Flat file to SAP R/3 system???
How to upload application server file to R/3 system?
Definition
Example - Call Transaction Method
<b>Transaction Recorder (SHDB)</b>
Before you work with the Batch Input methods, you should know the purpose of the tool
Transaction Recorder.
Use:
You can use the transaction recorder to record a series of transactions and their screens.
<b>Features:</b>
You can use the recording to create
Data transfer programs that use batch input or CALL TRANSACTION
Batch input sessions
Test data
Function modules.
Note: It doesnt record F1, F4 and Scrollbar movements
<b>Upload Flat file from Presentation Server to SAP R/3</b>
CALL FUNCTION GUI_UPLOAD'
EXPORTING
CODEPAGE = IBM'
FILENAME = P_UFILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = INT_TAB
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10 .
IF SY-SUBRC NE 0.
MESSAGE E999(FR) WITH 'ERROR IN FILE UPLOAD'.
ENDIF.
<b>Upload file from application server to SAP R/3</b>
Open the the application server file
OPEN DATASET <dsn> FOR INPUT <mode>
Read the data from application server file
READ DATASET <dsn> INTO <wa>
And then close the application server file
CLOSE DATASET <dsn>
<b>Definition- Declaring BDC Table</b>
DATA: BDC_TAB LIKE STANDARD TABLE OF
BDCDATA INITIAL SIZE 6
WITH HEADER LINE .
The internal table used to collect the transactions information must be declared LIKE BDCDATA.
<b>Filling BDC Table Method #1</b>
FORM FILL_BDC_TAB.
REFRESH BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-PROGRAM = SAPMF02K.
BDC_TAB-DYNPRO = 01016.
BDC_TAB-DYNBEGIN = X.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = RF02K-LIFNR.
BDC_TAB-FVAL = TEST1.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = RF02K-D0010.
BDC_TAB-FVAL = X.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-PROGRAM = SAPMF02K.
BDC_TAB-DYNPRO = 0110.
BDC_TAB-DYNBEGIN = X.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = LFA1-STRAS.
BDC_TAB-FVAL = 123 Main St..
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = BDC_OKCODE.
BDC_TAB-FVAL = /11.
APPEND BDC_TAB.
ENDFORM.
<b>Filling BDC Table Method #2</b>
FORM FILL_BDC_TAB.
REFRESH BDC_TAB.
PERFORM POPULATE_BDC_TAB
USING:
1 SAPMF02K 0106,
RF02K-LIFNR TEST1,
RF02K-D0010 X,
1 SAPMF02K 0110,
LFA1-STRAS, 123 Main St.,
BDC_OKCODE, /11.
ENDFORM.
FORM POPULATE_BDC_TAB USING FLAG VAR1 VAR2.
CLEAR BDC_TAB.
IF FLAG = 1.
BDC_TAB-PROGRAM = VAR1.
BDC_TAB-DYNPRO = VAR2..
BDC_TAB-DYNBEGIN = X.
ELSE.
BDC_TAB-FNAM = VAR1.
BDC_TAB-FVAL = VAR2.
ENDIF.
APPEND BDC_TAB.
ENDFORM.
This two subroutine method to fill the BDC table is preferable because the POPULATE_BDC_TABLE subroutine is reusable throughout all batch input programs.
Example #1 - Change Vendor (Call Transaction Method)
<b>Example #1- Declaration Section</b>
REPORT Y180DM10.
DATA: BDC_TAB LIKE STANDARD TABLE OF
BDCDATA INITIAL SIZE 6 WITH HEADER LINE.
INFILE(20) VALUE /tmp/bc180_file4.
DATA: BEGIN OF INREC.
VENDNUM LIKE LFA1-LIFNR.
STREET LIKE LFA1-STRAS.
END OF INREC.
PARAMETERS: DISPMODE DEFAULT A,
UPDAMODE DEFAULT S.
START-OF-SELECTION.
OPEN DATASET INFILE
FOR INPUT IN TEXT MODE.
DO.
READ DATASET INFILE INTO INREC.
IF SY-SUBRC < > 0. EXIT. ENDIF.
PERFORM FILL_BDC_TAB.
CALL TRANSACTION FK02
USING BDC_TAB
MODE DISPMODE
UPDATE UPDAMODE.
IF SY-SUBRC < > 0.
WRITE: /ERROR.
ENDIF.
ENDDO.
CLOSE DATASET INFILE.
<b>synchronous updating</b>
DO.
PERFORM FILL_BDC_TAB.
CALL TRANSACTION FK02
USING BDC_TAB
MODE N
UPDATE S.
IF SY-SUBRC < > 0.
WRITE: /ERROR.
ENDIF.
ENDDO.
With synchronous updating, we can check SY-SUBRC to determine the success of the transaction and the actual update to the database.
<b>asynchronous updating</b>
DO.
PERFORM FILL_BDC_TAB.
CALL TRANSACTION FK02
USING BDC_TAB
MODE N
UPDATE A.
IF SY-SUBRC < > 0.
WRITE: /ERROR.
ENDIF.
ENDDO.
With asynchronous updating, we can check SY-SUBRC to determine the success of the transaction only, not the actual update to the database.
<b>Error Handling</b>
Write an error report.
Send the record(s) in error to an error file.
Create a batch input session with the record(s) in error.
To store error messages ( CALL TRANSACTION )
data: begin of Tab_Mess occurs 0.
include structure bdcmsgcoll.
data : end of Tab_Mess,
CALL TRANSACTION FK02 USING BDC_TAB MODE N UPDATE S
MESSAGES INTO TAB_MESS.
IF SY-SUBRC NE 0.
WRITE: / Tab_MESS-TCODE, Tab_MESS-DYNUMB, Tab_MESS-MSGTYP ,
Tab_MESS-MSGID.
ENDIF.
i am giving you example for Change Vendor you practice for ur tcode
For our example, we will use the Change Vendor transaction (FK02) to add a street address to an already existing vendor.
<b>Step #1</b>
Use SystemStatus menu path to determine online program name (SAPMF02K), screen number (0110)
<b>Step #2</b>
Use F1 key and Technical Info pushbutton in each screen field to be filled to determine the field name.
<b>Step #3</b>
Determine how to proceed in the transaction
(save the record by clicking on the Save pushbutton or pressing the F11 key).
<b>BDC Table Contents</b>
After researching the transaction we can determine the contents of the BDC table.
PROGRAM DYNPRO DYNBEGIN FNAM FVAL
SAMPF02K 0106 X
RF02K-LIFNR TEST1
RF02K-D0110 X
SAMPF02K 0110 X
LFA1-STRAS 123 Main St.
BDC_OKCODE /11
<b>Batch Input Methods</b>
CALL TRANSACTION USING
STATEMENT
<b>Call transaction - for data transfer</b>
Processing batch input data with CALL TRANSACTION USING is the faster of the two recommended data transfer methods. In this method, legacy data is processed inline in your data transfer program.
Syntax:
CALL TRANSACTION <tcode>
USING <bdc_tab>
MODE <mode>
UPDATE <update>
A Display all
E Display errors only
N No display
S Synchronous
A Asynchronous
L Local update
<b>The process flow of CALL TRANSACTION</b>
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.
<b>Overview of Batch Input Session</b>
The first batch input method is to create a batch input session. It is the processing of this batch input session that updates the database, not the execution of the batch input program.
Reward if usefull
10-11-2007 7:28 AM
Pls refer the following link:
http://www.planetsap.com/bdc_main_page.htm
http://www.sap-img.com/abap/question-about-bdc-program.htm
http://abap-gallery.blogspot.com/2007/08/bdc-batch-data-communication-tutorial.html
http://www.sap-img.com/bdc.htm - here you can get sample codes too
http://aspalliance.com/1130_Batch_Data_Communication_BDC_in_SAP_R3
Pls reward points if useful.
10-11-2007 7:29 AM
10-11-2007 7:31 AM
Hi Dipankar,
Please go through this blog.
http://allaboutsap.blogspot.com/search/label/BDC
http://allaboutsap.blogspot.com/2007/03/bdc-explained-part-2-sample-program-for.html
Reward if helpful.
Regards,
Harini.S