Powered By

Free XML Skins for Blogger

Powered by Blogger

Tuesday, October 7, 2008

SAP ABAP Batch Input Recording for inbound Idoc

The batch input (BTCI) recorder (SHDB) is a precious tool to develop inbound IDocs. It records any transaction like a macro recorder. From the recording, an ABAP fragment can be created.

This lets you easily create data input programs without coding new transactions.

The BTCI recorder lets you record the screen sequences and values entered during a
transaction. It is one of the most precious tools in R/3 since release 3.1. It allows a fruitful cooperation between programmer and application consultant.

The section below will show you an example of how the transaction SHDB works.
With the recording, you can easily create an ABAP which is able to create BTCI
files.

You will be asked for a session name and the name of the transaction to record.
Then you can enter the data into the transaction as usual.

After you finished the recording, you have the possibility to generate ABAP coding
from it. This will be a sequence of statements which can generate a batch input
session, which is an exact replay of the recorded one.

The generated program contains an include BDCRECXX which contains all the
FORM routines referenced.

To make the recorded code usable for other programs, you should make a function
module out of it. Starting with release 4.5A the recorded code provides a feature to
automatically generate such a function module.

How to Use the Recorder Efficiently

This routine replaces BDCRECXX to allow executing the program generated by SHDB via a call transaction instead of generating a BTCI file.

The SHDB transaction creates an ABAP from the recording. When you run this
ABAP, it will generate a BTCI group file, with exactly the same data as in the
recording.

The recorder is able to generate an ABAP. Releases before 4.5A include a routine
BDCRECXX. This include contains FORM routines which fill the BDCDATA table
and execute the routines BDC_OPEN_GROUP and BDC_CLOSE_GROUP. These
are the routines which create batch input files.

If we modify this FORM routines a little bit, we can make the ABAP replay the
recording online via a CALL TRANSACTION, which is much more suitable for our
development and testing purposes. If you replace the standard include BDCRECXX
with the shown one ZZBDCRECXX, you can replay the recording online.

Starting with release 4.5A you can create a function module from the recording.
This function module replaces the recorded constants with parameters and gives you
the option to choose between a batch input file or a direct call transaction.

A remark on screen processing, if there are table controls (scroll areas). If you enter many lines or try to extend a list, it will be impossible to tell where to place the cursor. Therefore, most transactions provide a menu option that positions the list in a calculable manner. If you choose a new item, most transactions will either pop up a detail screen or will position the list, so that the next free line is always line 2.

If this feature is not provided in a transaction, it is regarded as a malfunction by SAP and can be reported to SAPNET/OSS.

ZZBRCRECXX_FB_GEN: Generate a Function from Recording

The ABAP generated by SHDB is a very useful tool for developers. However, it
does not replace the recorded constants by variables.

The following routine generates a function module from the recording. All you have
to do is put the coding below in an include.

Give it the name ZZBDCRECXX_FBGEN.

Then replace the include BDCRECXX in the recording with ZZBDCRECXX_FBGEN.

When you execute the ABAP, a function module in an existing function group will
be created. The created function will contain the recording with all the constants
replaced by variables, which show in the function module interface.

The following useful routine is written for releases up to 4.0B. In release 4.5B a
similar functionality is provided. You can generate a function module from the
recording transaction directly.

Before you generate the function, a function group must exist. This you have to do
manually. The function group must also contain the include ZZBDCRECXX to have the declarations of the referenced FORM routines.

The created function module should work without modification for testing at least.
However, you probably will need to modify it, e.g. by adding a loop for processing
multiple entries in a table control (scroll area).

No comments:

Archives