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

bdc

Former Member
0 Likes
587

Hi all.

using BDC can we modify the data in database table. if so how to do that.

please give me step by step procedure and code.

regards

Prajwal.k

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
539

Hi

Yes, BDC's are meant for updating the table data only using the relavent Transactions

see the doc

BDC:

Batch Data Communication (BDC) is the process of transferring data from one SAP System to another SAP system or from a non-SAP system to SAP System.

Features :

BDC is an automatic procedure.

This method is used to transfer large amount of data that is available in electronic medium.

BDC can be used primarily when installing the SAP system and when transferring data from a legacy system (external system).

BDC uses normal transaction codes to transfer data.

Types of BDC :

CLASSICAL BATCH INPUT (Session Method)

CALL TRANSACTION

BATCH INPUT METHOD:

This method is also called as ‘CLASSICAL METHOD’.

Features:

Asynchronous processing.

Synchronous Processing in database update.

Transfer data for more than one transaction.

Batch input processing log will be generated.

During processing, no transaction is started until the previous transaction has been written to the database.

CALL TRANSACTION METHOD :

This is another method to transfer data from the legacy system.

Features:

Synchronous processing. The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.

Updating the database can be either synchronous or asynchronous. The program specifies the update type.

Transfer data for a single transaction.

Transfers data for a sequence of dialog screens.

No batch input processing log is generated.

Differences between Call Transaction and Sessions 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.

For BDC:

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

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&;

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

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

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

Check these link:

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

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

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

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

SESSION METHOD

- It is one of the BDC techniques for uploading legacy data into SAP

- The data is transferring from the internal table to database table

through sessions.

- Data along with its action is stored in session.

- When the program has finished generating the session, you can run

the session to execute the transaction.

- Unless session is processed, the data is not transferred to

database tables.

- The following Function Modules are used in the session method.

1. BDC_OPEN_GROUP (Used to create the session)

Import Parameters :

USER - User Name

CLIENT - Client

GROUP - Name of the session

HOLD - The date when you want to process the session

KEEP - ‘X’ – retain session even after processing it

' ' - Delete the session after processing.

2. BDC_INSERT (Data is transferred to session)

Import Parameters :

TCODE - Transaction code

DYNPROTAB – BDCDATA table

3. BDC_CLOSE_GROUP (Used to close a session)

- Processing Steps

1. Generate the batch input session using function module

BDC_OPEN_GROUP.

2. The proceed as follows for each transaction that the session

contains:

a. In the BDCDATA structure, enter the value for all screens

and fields that must be processed in the transaction.

b. Use BDC_INSERT to transfer the transaction and the BDCDATA

structure to the session.

3. Close the batch input session with BDC_CLOSE_GROUP.

4. Start to process the generated session in T.Code SM35.

WT IS CALL TRANSACTION METHOD? WT IS SYNTAX/PROCEDURE?

CALL TRANSACTION :

1. It is compatible for small amount of data only.

2. It process the data Synchronously. i.e., The data is updated

at the time of execution.

3. It updates data both Synchronously and Asynchronously. When

we use Synchronous mode, it always verify all the data updated

successfully in the database.

When we use Asynchronous mode, the system can not wait till

all the data updated in the database.

4. It can handle only one application at a time.

5. It does not have Log file, we need to design logfile explicitly

using BDCMSGCOLL stucture.

Syntax :

CALL TRANSACTION <T.Code> USING <BDCTAB> MODE <A/N/E> UPDATE <S/A>

MESSAGES INTO <BDCMSGCOLL Int.Table>

Parameter 1 : Transaction Code

Parameter 2 : It is name of BDCDATA table.

Parameter 3 : Specifying Mode in which you execute transaction.

A - All screen mode. All the screen of transaction

are displayed.

N - No screen mode. No screen is displayed when you

execute the transaction.

E - Error screen. Only those screens are displayed

where you have error record.

Parameter 4 : Specifying Update type by which data base table is

updated.

S - It is for Synchronous update in which if you

change data for one table then all the relacted

tables gets updated. And then sy-subrc is returned

i.e., sy-subrc is returned for once and all.

A - It is for Asynchronous update, when you change

data of one table, the sy-subrc is returned. And

then updation of other affected tables takes place

If system fails to update other tables still

sy-subrc returned is 0.

Parameter 5 : When you update database table, operation is either

successful or unsuccessful or operation is successful

with some warning. These messages are stored in

internal table which you specify along with MESSAGE

statement. This internal table should be declared like

BDCMSGCOLL structure.

Steps for CALL TRANSACTION Method :

1. Interanal table for the data (structure similler to local file)

2. BDCTAB like BDCDATA.

3. Use UPLOAD/WS_UPLOAD/GUI_UPLOAD or DATASETS for upload data from

local file to internal table (i.e. ITAB).

4. LOOP at Itab.

Populate BDCTAB table.

CALL TRANSACTION <T.Code> USING <BDCTAB> MODE <A/N/E>

UPDATE <S/A> MESSAGES INTO <BDCMSGCOLL Int.Table>

Refresh BDCTAB.

ENDLOOP.

Regards

Anji

5 REPLIES 5
Read only

Former Member
0 Likes
540

Hi

Yes, BDC's are meant for updating the table data only using the relavent Transactions

see the doc

BDC:

Batch Data Communication (BDC) is the process of transferring data from one SAP System to another SAP system or from a non-SAP system to SAP System.

Features :

BDC is an automatic procedure.

This method is used to transfer large amount of data that is available in electronic medium.

BDC can be used primarily when installing the SAP system and when transferring data from a legacy system (external system).

BDC uses normal transaction codes to transfer data.

Types of BDC :

CLASSICAL BATCH INPUT (Session Method)

CALL TRANSACTION

BATCH INPUT METHOD:

This method is also called as ‘CLASSICAL METHOD’.

Features:

Asynchronous processing.

Synchronous Processing in database update.

Transfer data for more than one transaction.

Batch input processing log will be generated.

During processing, no transaction is started until the previous transaction has been written to the database.

CALL TRANSACTION METHOD :

This is another method to transfer data from the legacy system.

Features:

Synchronous processing. The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.

Updating the database can be either synchronous or asynchronous. The program specifies the update type.

Transfer data for a single transaction.

Transfers data for a sequence of dialog screens.

No batch input processing log is generated.

Differences between Call Transaction and Sessions 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.

For BDC:

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

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&;

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

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

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

Check these link:

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

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

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

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

SESSION METHOD

- It is one of the BDC techniques for uploading legacy data into SAP

- The data is transferring from the internal table to database table

through sessions.

- Data along with its action is stored in session.

- When the program has finished generating the session, you can run

the session to execute the transaction.

- Unless session is processed, the data is not transferred to

database tables.

- The following Function Modules are used in the session method.

1. BDC_OPEN_GROUP (Used to create the session)

Import Parameters :

USER - User Name

CLIENT - Client

GROUP - Name of the session

HOLD - The date when you want to process the session

KEEP - ‘X’ – retain session even after processing it

' ' - Delete the session after processing.

2. BDC_INSERT (Data is transferred to session)

Import Parameters :

TCODE - Transaction code

DYNPROTAB – BDCDATA table

3. BDC_CLOSE_GROUP (Used to close a session)

- Processing Steps

1. Generate the batch input session using function module

BDC_OPEN_GROUP.

2. The proceed as follows for each transaction that the session

contains:

a. In the BDCDATA structure, enter the value for all screens

and fields that must be processed in the transaction.

b. Use BDC_INSERT to transfer the transaction and the BDCDATA

structure to the session.

3. Close the batch input session with BDC_CLOSE_GROUP.

4. Start to process the generated session in T.Code SM35.

WT IS CALL TRANSACTION METHOD? WT IS SYNTAX/PROCEDURE?

CALL TRANSACTION :

1. It is compatible for small amount of data only.

2. It process the data Synchronously. i.e., The data is updated

at the time of execution.

3. It updates data both Synchronously and Asynchronously. When

we use Synchronous mode, it always verify all the data updated

successfully in the database.

When we use Asynchronous mode, the system can not wait till

all the data updated in the database.

4. It can handle only one application at a time.

5. It does not have Log file, we need to design logfile explicitly

using BDCMSGCOLL stucture.

Syntax :

CALL TRANSACTION <T.Code> USING <BDCTAB> MODE <A/N/E> UPDATE <S/A>

MESSAGES INTO <BDCMSGCOLL Int.Table>

Parameter 1 : Transaction Code

Parameter 2 : It is name of BDCDATA table.

Parameter 3 : Specifying Mode in which you execute transaction.

A - All screen mode. All the screen of transaction

are displayed.

N - No screen mode. No screen is displayed when you

execute the transaction.

E - Error screen. Only those screens are displayed

where you have error record.

Parameter 4 : Specifying Update type by which data base table is

updated.

S - It is for Synchronous update in which if you

change data for one table then all the relacted

tables gets updated. And then sy-subrc is returned

i.e., sy-subrc is returned for once and all.

A - It is for Asynchronous update, when you change

data of one table, the sy-subrc is returned. And

then updation of other affected tables takes place

If system fails to update other tables still

sy-subrc returned is 0.

Parameter 5 : When you update database table, operation is either

successful or unsuccessful or operation is successful

with some warning. These messages are stored in

internal table which you specify along with MESSAGE

statement. This internal table should be declared like

BDCMSGCOLL structure.

Steps for CALL TRANSACTION Method :

1. Interanal table for the data (structure similler to local file)

2. BDCTAB like BDCDATA.

3. Use UPLOAD/WS_UPLOAD/GUI_UPLOAD or DATASETS for upload data from

local file to internal table (i.e. ITAB).

4. LOOP at Itab.

Populate BDCTAB table.

CALL TRANSACTION <T.Code> USING <BDCTAB> MODE <A/N/E>

UPDATE <S/A> MESSAGES INTO <BDCMSGCOLL Int.Table>

Refresh BDCTAB.

ENDLOOP.

Regards

Anji

Read only

Former Member
0 Likes
539

Hi ,

You can surely update the Database Table using BDC.

One thing to understand is why we need BDC - We need it to achieve create/Change/Delete functionality of any transaction.

So if you want to Change database table then you should do the BDC for the Change Document TCode.

Hope this helps.

Manish

Read only

Former Member
0 Likes
539

hi,

first select a method which is sutiable for you. i.e. Session or Call transaction or Direct Input.

use of methods depending upon amount;

if you have run time validation while updating the data into SAP R/3 Transaction,then use BDC Call Transaction.

example : when you load the data into Sales order then you need to load the into Header text of sales order.

for this ,you have to use Update Mode 'S'.

it is online update and if you small amount of data ,then prefer this one

2. If you have huge amount of data and then prefer Session Method.

we have one more advantage in session method...

suppose file has 1,00,000 records and the if you use all the records at time,then you will get short dump like system time exceed .

then you can split the each 10,000 records into one session and will process.

3. Direct Input method : we prefer this method only few Transaction ,

this will not applicable to when system has customer fields .

The batch input program must build all of the input to execute the SAP transaction.

Two main steps are required:

• To build an internal table containing every screen and every field to be filled in during the execution of an SAP transaction.

• To pass the table to SAP for processing.

Prerequisite for Data Transfer Program

Writing a Data Transfer Program involves following prerequisites:

Analyzing data from local file

Analyzing transaction

Analyzing transaction involves following steps:

• The transaction code, if you do not already know it.

• Which fields require input i.e., mandatory.

• Which fields can you allow to default to standard values.

• The names, types, and lengths of the fields that are used by a transaction.

• Screen number and Name of module pool program behind a particular transaction.

To analyze a transaction::

• Start the transaction by menu or by entering the transaction code in the command box.

(You can determine the transaction name by choosing System – Status.)

• Step through the transaction, entering the data will be required for processing your batch input data.

• On each screen, note the program name and screen (dynpro) number.

(dynpro = dyn + pro. Dyn = screen, pro = number)

• Display these by choosing System – Status. The relevant fields are Program (dynpro) and Dynpro number. If pop-up windows occur during execution, you can get the program name and screen number by pressing F1 on any field or button on the screen.

The technical info pop-up shows not only the field information but also the program and screen.

• For each field, check box, and radio button on each screen, press F1 (help) and then choose Technical Info.

Note the following information:

- The field name for batch input, which you’ll find in its own box.

- The length and data type of the field. You can display this information by double clicking on the Data Element field.

• Find out the identification code for each function (button or menu) that you must execute to process the batch-input data (or to go to new screen).

Place the cursor on the button or menu entry while holding down the left mouse button. Then press F1.

In the pop-up window that follows, choose Technical info and note the code that is shown in the Function field.

You can also run any function that is assigned to a function key by way of the function key number. To display the list of available function keys, click on the right mouse button. Note the key number that is assigned to the functions you want to run.

Once you have program name, screen number, field name (screen field name), you can start writing.

DATA TRANSFER program.

Declaring internal table

First Integral Table similar to structure like local file.

Declaring internal table like BDCDATA

The data from internal table is not transferred directly to database table, it has to go through transaction. You need to pass data to particular screen and to particular screen-field. Data is passed to transaction in particular format, hence there is a need for batch input structure.

The batch input structure stores the data that is to be entered into SAP system and the actions that are necessary to process the data. The batch input structure is used by all of the batch input methods. You can use the same structure for all types of batch input, regardless of whether you are creating a session in the batch input queue or using CALL TRANSACTION.

This structure is BDCDATA, which can contain the batch input data for only a single run of a transaction. The typical processing loop in a program is as follows:

• Create a BDCDATA structure

• Write the structure out to a session or process it with CALL TRANSACTION USING; and then

• Create a BDCDATA structure for the next transaction that is to be processed.

Within a BDCDATA structure, organize the data of screens in a transaction. Each screen that is processed in the course of a transaction must be identified with a BDCDATA record. This record uses the Program, Dynpro, and Dynbegin fields of the structure.

The screen identifier record is followed by a separate BDCDATA record for each value, to be entered into a field. These records use the FNAM and FVAL fields of the BDCDATA structure. Values to be entered in a field can be any of the following:

• Data that is entered into screen fields.

• Function codes that are entered into the command field. Such function codes execute functions in a transaction, such as Save or Enter.

The BDCDATA structure contains the following fields:

• PROGRAM: Name of module pool program associated with the screen. Set this field only for the first record for the screen.

• DYNPRO: Screen Number. Set this field only in the first record for the screen.

• DYNBEGIN: Indicates the first record for the screen. Set this field to X, only for the first record for the screen. (Reset to ‘ ‘ (blank) for all other records.)

• FNAM: Field Name. The FNAM field is not case-sensitive.

• FVAL: Value for the field named in FNAM. The FVAL field is case-sensitive. Values assigned to this field are always padded on the right, if they are less than 132 characters. Values must be in character format.

Transferring data from local file to internal table

Data is uploaded to internal table by UPLOAD of WS_UPLOAD function.

Population of BDCDATA

For each record of internal table, you need to populate Internal table, which is similar to BDCDATA structure.

All these five initial steps are necessary for any type of BDC interface.

DATA TRANSFER program can call SESSION METHOD or CALL TRANSACTION. The initial steps for both the methods are same.

First step for both the methods is to upload the data to internal table. From Internal Table, the data is transferred to database table by two ways i.e., Session method and Call transaction.

SESSION METHOD

About Session method

In this method you transfer data from internal table to database table through sessions.

In this method, an ABAP/4 program reads the external data that is to be entered in the SAP System and stores the data in session. A session stores the actions that are required to enter your data using normal SAP transaction i.e., Data is transferred to session which in turn transfers data to database table.

Session is intermediate step between internal table and database table. Data along with its action is stored in session i.e., data for screen fields, to which screen it is passed, the program name behind it, and how the next screen is processed.

When the program has finished generating the session, you can run the session to execute the SAP transactions in it. You can either explicitly start and monitor a session or have the session run in the background processing system.

Unless session is processed, the data is not transferred to database table.

BDC_OPEN_GROUP

You create the session through program by BDC_OPEN_GROUP function.

Parameters to this function are:

• User Name: User name

• Group: Name of the session

• Lock Date: The date on which you want to process the session.

• Keep: This parameter is passed as ‘X’ when you want to retain session after

processing it or ‘ ‘ to delete it after processing.

BDC_INSERT

This function creates the session & data is transferred to Session.

Parameters to this function are:

• Tcode: Transaction Name

• Dynprotab: BDC Data

BDC_CLOSE_GROUP

This function closes the BDC Group. No Parameters.

Some additional information for session processing

When the session is generated using the KEEP option within the BDC_OPEN_GROUP, the system always keeps the sessions in the queue, whether it has been processed successfully or not.

However, if the session is processed, you have to delete it manually. When session processing is completed successfully while KEEP option was not set, it will be removed automatically from the session queue. Log is not removed for that session.

If the batch-input session is terminated with errors, then it appears in the list of INCORRECT session and it can be processed again. To correct incorrect session, you can analyze the session. The Analysis function allows to determine which screen and value has produced the error. If you find small errors in data, you can correct them interactively, otherwise you need to modify batch input program, which has generated the session or many times even the data file.

CALL TRANSACTION

About CALL TRANSACTION

A technique similar to SESSION method, while batch input is a two-step procedure, Call Transaction does both steps online, one after the other. In this method, you call a transaction from your program by

Call transaction <tcode> using <BDCTAB>

Mode <A/N/E>

Update <S/A>

Messages into <MSGTAB>.

Parameter – 1 is transaction code.

Parameter – 2 is name of BDCTAB table.

Parameter – 3 here you are specifying mode in which you execute transaction

A is all screen mode. All the screen of transaction are displayed.

N is no screen mode. No screen is displayed when you execute the transaction.

E is error screen. Only those screens are displayed wherein you have error record.

Parameter – 4 here you are specifying update type by which database table is updated.

S is for Synchronous update in which if you change data of one table then all the related Tables gets updated. And sy-subrc is returned i.e., sy-subrc is returned for once and all.

A is for Asynchronous update. When you change data of one table, the sy-subrc is returned. And then updating of other affected tables takes place. So if system fails to update other tables, still sy-subrc returned is 0 (i.e., when first table gets updated).

Parameter – 5 when you update database table, operation is either successful or unsuccessful or operation is successful with some warning. These messages are stored in internal table, which you specify along with MESSAGE statement. This internal table should be declared like BDCMSGCOLL, a structure available in ABAP/4. It contains the following fields:

1. Tcode: Transaction code

2. Dyname: Batch point module name

3. Dynumb: Batch input Dyn number

4. Msgtyp: Batch input message type (A/E/W/I/S)

5. Msgspra: Batch input Lang, id of message

6. Msgid: Message id

7. MsgvN: Message variables (N = 1 - 4)

For each entry, which is updated in database, table message is available in BDCMSGCOLL. As BDCMSGCOLL is structure, you need to declare a internal table which can contain multiple records (unlike structure).

Steps for CALL TRANSACTION method

1. Internal table for the data (structure similar to your local file)

2. BDCTAB like BDCDATA

3. UPLOAD or WS_UPLOAD function to upload the data from local file to itab. (Considering file is local file)

4. Loop at itab.

Populate BDCTAB table.

Call transaction <tcode> using <BDCTAB>

Mode <A/N/E>

Update <S/A>.

Refresh BDCTAB.

Endloop.

(To populate BDCTAB, You need to transfer each and every field)

The major differences between Session method and Call transaction are as follows:

SESSION METHOD CALL TRANSACTION

1. Data is not updated in database table unless Session is processed. Immediate updation in database table.

2. No sy-subrc is returned. Sy-subrc is returned.

3. Error log is created for error records. Errors need to be handled explicitly

4. Updation in database table is always synchronous Updation in database table can be synchronous Or Asynchronous.

Error Handling in CALL TRANSACTION

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

Steps for the error handling in CALL TRANSACTION

1. Internal table for the data (structure similar to your local file)

2. BDCTAB like BDCDATA

3. Internal table BDCMSG like BDCMSGCOLL

4. Internal table similar to Ist internal table

(Third and fourth steps are for error handling)

5. UPLOAD or WS_UPLOAD function to upload the data from the local file to itab. (Considering file is local file)

6. Loop at itab.

Populate BDCTAB table.

Call transaction <tr.code> using <Bdctab>

Mode <A/N/E>

Update <S/A>

Messages <BDCMSG>.

Perform check.

Refresh BDCTAB.

Endloop.

7 Form check.

IF sy-subrc <> 0. (Call transaction returns the sy-subrc if updating is not successful).

Call function Format_message.

(This function is called to store the message given by system and to display it along with record)

Append itab2.

Display the record and message.

DIRECT INPUT

About Direct Input

In contrast to batch input, this technique does not create sessions, but stores the data directly. It does not simulate the online transaction. To enter the data into the corresponding database tables directly, the system calls a number of function modules that execute any necessary checks. In case of errors, the direct input technique provides a restart mechanism. However, to be able to activate the restart mechanism, direct input programs must be executed in the background only. Direct input checks the data thoroughly and then updates the database directly.

You can start a Direct Input program in two ways;

Start the program directly

This is the quickest way to see if the program works with your flat file. This option is possible with all direct input programs. If the program ends abnormally, you will not have any logs telling you what has or has not been posted. To minimize the chance of this happening, always use the check file option for the first run with your flat file. This allows you to detect format errors before transfer.

Starting the program via the DI administration transaction

This transaction restarts the processing, if the data transfer program aborts. Since DI document are immediately posted into the SAP D/B, the restart option prevents the duplicate document posting that occurs during a program restart (i.e., without adjusting your flat file).

Direct input is usually done for standard data like material master, FI accounting document, SD sales order and Classification for which SAP has provided standard programs.

First time you work with the Direct Input administration program, you will need to do some preparation before you can transfer data:

- Create variant

- Define job

- Start job

- Restart job

Common batch input errors

- The batch input BDCDATA structure tries to assign values to fields which do not exist in the current transaction screen.

- The screen in the BDCDATA structure does not match the right sequence, or an intermediate screen is missing.

- On exceptional occasions, the logic flow of batch input session does not exactly match that of manual online processing. Testing the sessions online can discover by this.

- The BDCDATA structure contains fields, which are longer than the actual definition.

- Authorization problems.

RECORDING A BATCH INPUT

A B recording allows you to record a R/3 transaction and generate a program that contains all screens and field information in the required BDC-DATA format.

You can either use SHDB transaction for recording or

SYSTEM ? SERVICES ? BATCH INPUT ? EDIT

And from here click recording.

Enter name for the recording.

(Dates are optional)

Click recording.

Enter transaction code.

Enter.

Click Save button.

You finally come to a screen where, you have all the information for each screen including BDC_OKCODE.

• Click Get Transaction.

• Return to BI.

• Click overview.

• Position the cursor on the just recorded entry and click generate program.

• Enter program name.

• Click enter

SESSION:

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

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&;

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

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

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

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

About Session method

In this method you transfer data from internal table to database table through sessions.

In this method, an ABAP/4 program reads the external data that is to be entered in the SAP System and stores the data in session. A session stores the actions that are required to enter your data using normal SAP transaction i.e., Data is transferred to session which in turn transfers data to database table.

Session is intermediate step between internal table and database table. Data along with its action is stored in session i.e., data for screen fields, to which screen it is passed, the program name behind it, and how the next screen is processed.

When the program has finished generating the session, you can run the session to execute the SAP transactions in it. You can either explicitly start and monitor a session or have the session run in the background processing system.

Unless session is processed, the data is not transferred to database table.

BDC_OPEN_GROUP

You create the session through program by BDC_OPEN_GROUP function.

Parameters to this function are:

• User Name: User name

• Group: Name of the session

• Lock Date: The date on which you want to process the session.

• Keep: This parameter is passed as ‘X’ when you want to retain session after

processing it or ‘ ‘ to delete it after processing.

BDC_INSERT

This function creates the session & data is transferred to Session.

Parameters to this function are:

• Tcode: Transaction Name

• Dynprotab: BDC Data

BDC_CLOSE_GROUP

This function closes the BDC Group. No Parameters.

Some additional information for session processing

When the session is generated using the KEEP option within the BDC_OPEN_GROUP, the system always keeps the sessions in the queue, whether it has been processed successfully or not.

However, if the session is processed, you have to delete it manually. When session processing is completed successfully while KEEP option was not set, it will be removed automatically from the session queue. Log is not removed for that session.

If the batch-input session is terminated with errors, then it appears in the list of INCORRECT session and it can be processed again. To correct incorrect session, you can analyze the session. The Analysis function allows to determine which screen and value has produced the error. If you find small errors in data, you can correct them interactively, otherwise you need to modify batch input program, which has generated the session or many times even the data file.

For BDC:

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

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&;

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

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

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

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

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

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

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

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

Also, check these links:

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

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

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

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

http://www.planetsap.com/bdc_main_page.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

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

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

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&;

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

Read only

Vijay
Active Contributor
0 Likes
539

hi

just check this example , will help you out.

-


Requirement:

Choose a transaction and write a Batch Input program with 'Call Transaction'. Do not use the Messagetab feature of 'Call Transaction'. In this case the last error message will be at the SY-MSG* system fields. Recreate the complete error message from table T100! (This example is also used by the demonstration of SY-MSG* system fields)

Solution:

REPORT ZSYSTEM LINE-SIZE 255.

TABLES: T100.

  • Batch-input data

DATA: BEGIN OF G_BDCDATA OCCURS 100.

INCLUDE STRUCTURE BDCDATA.

DATA: END OF G_BDCDATA.

DATA: G_MESSAGE(200).

PERFORM FILL_BDCDATA.

CALL TRANSACTION 'FI01' USING G_BDCDATA MODE 'N'.

  • of course it is nicer with a message itab, but this example

  • should also demostrate the use of system variables.

SELECT SINGLE * FROM T100 WHERE

SPRSL = 'E'

AND ARBGB = SY-MSGID

AND MSGNR = SY-MSGNO.

G_MESSAGE = T100-TEXT.

PERFORM REPLACE_PARAMETERS USING SY-MSGV1

SY-MSGV2

SY-MSGV3

SY-MSGV4

CHANGING G_MESSAGE.

WRITE: / 'System variables:'.

SKIP.

WRITE: / ' Sy-msgty:', SY-MSGTY.

WRITE: / ' Sy-msgid:', SY-MSGID.

WRITE: / ' Sy-msgno:', SY-MSGNO.

WRITE: / ' Sy-msgv1:', SY-MSGV1.

WRITE: / ' Sy-msgv2:', SY-MSGV2.

WRITE: / ' Sy-msgv3:', SY-MSGV3.

WRITE: / ' Sy-msgv4:', SY-MSGV4.

SKIP.

WRITE: / 'The transaction was called with a wrong country code.'.

WRITE: / 'The error message should be either that or that you have'.

WRITE: / ' no authorisation to execute the transaction'.

SKIP.

WRITE: / 'Message:'.

SKIP.

WRITE: / SY-MSGTY, G_MESSAGE.

----


  • Build up the BDC-table *

----


FORM FILL_BDCDATA.

REFRESH G_BDCDATA.

PERFORM BDC_DYNPRO USING 'SAPMF02B' '0100'.

PERFORM BDC_FIELD USING 'BNKA-BANKS' 'ZZZ'.

PERFORM BDC_FIELD USING 'BDC_OKCODE' 'QQQQQ'.

ENDFORM.

----


  • FORM BDC_DYNPRO *

----


  • Batchinput: Start new Dynpro *

----


FORM BDC_DYNPRO USING P_PROGRAM P_DYNPRO.

CLEAR G_BDCDATA.

G_BDCDATA-PROGRAM = P_PROGRAM.

G_BDCDATA-DYNPRO = P_DYNPRO.

G_BDCDATA-DYNBEGIN = 'X'.

APPEND G_BDCDATA.

ENDFORM. " BDC_DYNPRO

----


  • FORM BDC_FIELD *

----


  • Batchinput: Feld hinzufugen *

----


FORM BDC_FIELD USING P_FNAM P_FVAL.

CLEAR G_BDCDATA.

G_BDCDATA-FNAM = P_FNAM.

G_BDCDATA-FVAL = P_FVAL.

APPEND G_BDCDATA.

ENDFORM. " BDC_FIELD

----


  • FORM REPLACE_PARAMETERS *

----


  • ........ *

----


  • --> P_PAR_1 *

  • --> P_PAR_2 *

  • --> P_PAR_3 *

  • --> P_PAR_4 *

  • --> P_MESSAGE *

----


FORM REPLACE_PARAMETERS USING P_PAR_1

P_PAR_2

P_PAR_3

P_PAR_4

CHANGING P_MESSAGE.

  • erst mal pruefen, ob numerierte Parameter verwendet wurden

DO.

REPLACE '&1' WITH P_PAR_1 INTO P_MESSAGE.

IF SY-SUBRC <> 0.

EXIT.

ENDIF.

ENDDO.

DO.

REPLACE '&2' WITH P_PAR_2 INTO P_MESSAGE.

IF SY-SUBRC <> 0.

EXIT.

ENDIF.

ENDDO.

DO.

REPLACE '&3' WITH P_PAR_3 INTO P_MESSAGE.

IF SY-SUBRC <> 0.

EXIT.

ENDIF.

ENDDO.

DO.

REPLACE '&4' WITH P_PAR_4 INTO P_MESSAGE.

IF SY-SUBRC <> 0.

EXIT.

ENDIF.

ENDDO.

  • falls keine numerierten Parameter vorh., ersetzen wie gehabt

REPLACE '&' WITH P_PAR_1 INTO P_MESSAGE.

CONDENSE P_MESSAGE.

IF SY-SUBRC EQ 0.

REPLACE '&' WITH P_PAR_2 INTO P_MESSAGE.

CONDENSE P_MESSAGE.

IF SY-SUBRC EQ 0.

REPLACE '&' WITH P_PAR_3 INTO P_MESSAGE.

CONDENSE P_MESSAGE.

IF SY-SUBRC EQ 0.

REPLACE '&' WITH P_PAR_4 INTO P_MESSAGE.

CONDENSE P_MESSAGE.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. "replace_parameters

-


<b>reward points if helpfull.</b>

regards

vijay

Read only

Former Member
0 Likes
539

thanks to all