Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Re:BDC

Former Member
0 Likes
615

Hi,

Iam thankful if any one could help me in telling BDC's , i need one complete example , flatfile, abap prg and steps, iam very much confused , i will execute the given prg

4 REPLIES 4
Read only

Former Member
0 Likes
571

Hi,

BDC Document Links:

Go thur these

http://help.sap.com/saphelp_erp2005/helpdata/en/fa/097119543b11d1898e0000e8322d00/frameset.htm

http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html

http://www.sap-img.com/abap/learning-bdc-programming.htm

http://www.sap-img.com/bdc.htm

http://www.sap-img.com/abap/learning-bdc-programming.htm

http://www.sapdevelopment.co.uk/bdc/bdchome.htm

http://www.planetsap.com/bdc_main_page.htm

Table Control in BDC

HI,

Refer the link:

http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm

The concept is easy: it has to indicate the index of the table control in the field name, so if you have to populate the first record of table control:

BDC-FIELDNAME = <FIELDNAME>(01).

If you fill the second row:

BDC-FIELDNAME = <FIELDNAME>(02).

and so....

Now the problem is usually on how many records you have to load, because u can fill only the rows of table control available in the screen, If you have more records than it can be displayed yuo have to simulate the command to go next page.

The number of recod can be displayed can depend on pc resolution and many program haven't command to go to next page (in this case it could be impossible create a BDC program9.

A way to create a bdc program resolution indipendent is to work on the first and second row.

- Place the first hit in the first row of bdc;

- Place the second insert in the second row of bdc;

- Place the last hit to the top of table control;

- Place the next hit in the second row;

- Place the last hit to the top of table control;

- Place the next hit in the second row;

- .... and so

For more info: Search in SDN with TABLE CONTROL IN BDC.

Will get a lot of related links.

Reward points if this Helps.

Manish

How would I Automtacally have my BDC session to process in the background and complete it without going through SM35 to process in the background.

SUBMIT rsbdcsub AND RETURN

EXPORTING LIST TO MEMORY

WITH mappe = p_sessionnanme

WITH von = w_datum

WITH bis = sy-datum

WITH z_verarb = c_true

WITH fehler = c_false.

Reward points if this helps.

Manish

**----Parameter for runtime of CALL TRANSACTION.

DATA: st_opt LIKE ctu_params.

st_opt-dismode = c_mode. " Processing mode for CALL TRANSACTION

st_opt-updmode = ''. " Update mode for CALL TRANSACTION

st_opt-defsize = ''. " Default screen size for CALL TRANS

st_opt-nobiend = ''.

*----Call transaction

CALL TRANSACTION c_tcode USING it_bdcdata

OPTIONS FROM st_opt

MESSAGES INTO it_bdcmsgcoll.

Here is the Difference between both:

- The most important aspects of the Batch session interface are:

1) Asynchronous processing

2) Transfers data for multiple transactions

3)Synchronous database update

During processing, no transaction is started until the previous transaction

has been written to the database.

4) A batch input processing log is generated for each session

5) Sessions cannot be generated in parallel

The most important aspects of the CALL TRANSACTION USING interface are:

1) Synchronous processing

2) Transfers data for a single transaction

3) Synchronous and asynchronous database updating both possible

The program specifies which kind of updating is desired.

4) Separate LUW for the transaction : The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.

5) No batch input processing log is generated

See the below article, which will show which is one is better

http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/

<b>Reward points if this helps.

Manish</b>

Read only

Former Member
0 Likes
571

What is BDC?

Batch Data Communication or BDC is a batch interfacing technique that SAP developed. It is mainly used for uploading data into the SAP R/3 system. BDC works by simulating the user input from transactional screen via an ABAP program.

The data input data file will come in the form of a flat file which the user save as file type txt file or prn file from the Microsoft Excel program. An Abaper will create a program to read the text file and upload into the SAP system.

Normally, the tcode SHDB will be used to record the transaction code the user used. After, the simulation, the Abaper can generate a sample program and modify from there. It makes the programming easier and faster.

ABAP Reference Books

want to learn how to upload data using BDC. If I have a excel data file how will upload it using BDC. I don't know the full process of doing it, if someone help me in this. I want it using BDC session process and processing that session. I was trying to upload material master other day. But could not follow the process of uploading using BDC though I know LSMW. Please explain me the BDC process in details with examples.

For a BDC upload you need to write a program which created BDC sessions.

Steps:

1. Work out the transaction you would use to create the data manually.

2. Use transaction SHDB to record the creation of one material master data.

Click the New recording button or the Menu - Recording - Create

3. Save the recording, and then go back a screen and go to the overview.

4. Select the recording and click on Edit - Create Program. Give the program a Z name, and select transfer from recording.

5. Edit the program. You will see that all the data you entered is hard-coded into the program. You need to make the following changes:

5.1 After the start-of-selection, Call ws_upload to upload the file (the excel file needs to be saved as TAB separated).

5.2 After the open-group, Loop on the uploaded data. For each line, perform validation checks on the data, then modify the perform bdc_field commands to use the file data.

5.3. After perform bdc_transaction, add the endloop.

Execute the program. It will have options to create a batch session or to process directly.

These are all my finds . Might be it will be useful to you.

Direct call of transactions, session handling:

/nxxxx This terminates the current transaction, and starts transaction xxxx

/n This terminates the transaction. This generally corresponds to pressing F15 to go back.

/nend This termiantes all separate sessions and logs off (corresponds to System - Logoff).

/nex This terminates all separate sessions and logs off immediately (without any warning!).

/oxxxx This opens a new session and starts transaction xxxx in This session.

/o This lists existing sessions and allows deletion or opening of a new session.

/i This terminates the current session (corresponds to System End

/i1, /i2,... This terminates the session with the number given.

.xyzw Fast path: 'xyzw' refers to the underlined letters in the menus. This type of navigation is uncommon and is provided more for emergencies (such as a defective mouse).

Batch

The following commands can be entered in correction mode ('Process in foreground' or 'Display errors only') when processing a batch input session:

/n This terminates the current batch input transaction and characterizes it as

/bdel This deletes the current batch input transaction.

/bend This terminates batch input processing and sets the session to Failed

/bda This switches from Display errors only to Process in foreground

/bde This switches from Process in foreground to Display errors only

What is the difference between batch input and call transaction in BDC?

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.

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

What is the difference between batch input and call transaction in BDC?

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.

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

What is the difference between batch input and call transaction in BDC?

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.

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

http://www.sapdevelopment.co.uk/bdc/bdc_call.htm

Read only

mahaboob_pathan
Contributor
0 Likes
571

Hi,

REPORT ZSTEST_044 .

DATA: BEGIN OF ITAB OCCURS 0,

F1(4) TYPE C,

F2(4) TYPE C,

F3(4) TYPE C,

F4(10) TYPE C,

F5(35) TYPE C,

F6(10) TYPE C,

F7(3) TYPE C,

F8(10) TYPE C,

F9(10) TYPE C,

F10(3) TYPE C,

END OF ITAB.

DATA FILE TYPE STRING.

PARAMETER P_FILE LIKE IBIPPARMS-PATH.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = 'P_FILE'

IMPORTING

FILE_NAME = P_FILE.

START-OF-SELECTION.

FILE = P_FILE.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = FILE

FILETYPE = 'ASC'

  • HAS_FIELD_SEPARATOR = ' '

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = ITAB

  • EXCEPTIONS

  • FILE_OPEN_ERROR = 1

  • FILE_READ_ERROR = 2

  • NO_BATCH = 3

  • GUI_REFUSE_FILETRANSFER = 4

  • INVALID_TYPE = 5

  • NO_AUTHORITY = 6

  • UNKNOWN_ERROR = 7

  • BAD_DATA_FORMAT = 8

  • HEADER_NOT_ALLOWED = 9

  • SEPARATOR_NOT_ALLOWED = 10

  • HEADER_TOO_LONG = 11

  • UNKNOWN_DP_ERROR = 12

  • ACCESS_DENIED = 13

  • DP_OUT_OF_MEMORY = 14

  • DISK_FULL = 15

  • DP_TIMEOUT = 16

  • OTHERS = 17

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LOOP AT ITAB.

WRITE:/ ITAB.

ENDLOOP.

flat file:

0000005249000100010001Company Vendor 513 V513 DE 31000 A1 EUR

Read only

Former Member
0 Likes
571

Hi

the BDC program should be in this format

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

Transaction Recorder (SHDB)

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.

Features:

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 doesn’t record F1, F4 and Scrollbar movements

Upload Flat file from Presentation Server to SAP R/3

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.

Upload file from application server to SAP R/3

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>

Definition- Declaring BDC Table

DATA: BDC_TAB LIKE STANDARD TABLE OF

BDCDATA INITIAL SIZE 6

WITH HEADER LINE .

The internal table used to collect the transaction’s information must be declared “LIKE BDCDATA”.

Filling BDC Table – Method #1

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.

Filling BDC Table – Method #2

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)

Example #1- Declaration Section

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.

synchronous updating

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.

asynchronous updating

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.

Error Handling

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.

Step #1

Use “System&#61664;Status” menu path to determine online program name (SAPMF02K), screen number (0110)

Step #2

Use “F1” key and “Technical Info” pushbutton in each screen field to be filled to determine the field name.

Step #3

Determine how to proceed in the transaction

(save the record by clicking on the ‘Save’ pushbutton or pressing the ‘F11’ key).

BDC Table Contents

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

Batch Input Methods

“CALL TRANSACTION USING”

STATEMENT

Call transaction - for data transfer

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

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.

Overview of Batch Input Session

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.

check the below links also

http://help.sap.com/saphelp_47x200/helpdata/en/fa/097022543b11d1898e0000e8322d00/frameset.htm

chk this pdf file

http://www.sappoint.com/abap/bdcconcept.pdf

chk this for FAQs on BDC

http://www.sap-img.com/abap/question-about-bdc-program.htm

sample code for call transaction method

http://www.sapdevelopment.co.uk/bdc/bdc_ctcode.htm

chk this for BDC recording with screen shots

http://www.sapdevelopment.co.uk/bdc/bdc_recording.htm

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

check these..

http://www.sap-img.com/abap/learning-bdc-programming.htm

http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm

http://myweb.dal.ca/hchinni/sap/bdc_home.htm

http://www.sap-img.com/abap/learning-bdc-programming.htm

http://www.sapdevelopment.co.uk/bdc/bdchome.htm

http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm

<b>rEWARD IF USEFULL</b>