(5) GENERATING AN SAP DATA STRUCTURE:
You can use the ABAP/4 Dictionary to generate data structures for SAP tables in any of the following programming languages:
Cobol
PL/1
C
You can then incorporate these data structures in your data conversion program.
For most of the standard SAP batch input programs, SAP has also provided special data structure identifiers. With such an identifier, you can generate a listing of all of the table fields that are required by the corresponding batch input program. You do not need to find out which tables are required for the batch input program and generate their structures individually. If you are creating your own batch input procedure, you may be able to use the standard field listings as well.
The names of the special data structure identifiers are documented in the SAP Customizing system. For information on finding the relevant documentation, please see Batch Input Concepts(1).
Data Transfer Programs in ABAP/4
If your data transfer program is written in ABAP/4, you can include data structures of tables in your program with the TABLES instruction. The structure is then read directly from the ABAP/4 Dictionary.
In this case, you cannot use the special data structure identifiers provided by the SAP applications. The identifier names are not recognized by the TABLES instruction. Instead, you can find the required table names by checking the transactions that your batch input procedure will be using to enter data. Or you can find the table names in the listings generated by the special identifiers.
The diagram below shows the structures of transfer programs in ABAP/4 and as external programs written in other languages.
Including Table Structures in Transfer Programs: ABAP/4 and Other Languages
Procedure
To generate a data structure, do the following:
1. Choose Tools --> ABAP/4 Workbench and then ABAP/4 Dictionary.
2. In the ABAP/4 Dictionary, select Environment --> Generate table description.
With this function, you can generate the structures of one or a group of SAP tables in programming code. You can then add this code to your data transfer program.
3. Specify the programming language in which the structure should be generated and identify the tables to be included.
If you wish to use a special structure identifier for a standard SAP batch input report,then enter the identifier in the Key in TSRCG field. Example: The identifier AM-ANLA generates the data structure required for data transfers for the asset management application.
4. The system displays the data structure in list form, as in this example in PL/1 from the asset management application (AM-ANLA):
******************************************************************
* MEMBER GENERATED FROM SAP DATA DICTIONARY *
* T A B L E BALTD *
* DATE: 08.12.1995 TIME: 17:47:16 *
* PLEASE DO NOT CHANGE MANUALLY *
******************************************************************
*
01 BALTD.
*
* Client (Old Assets Data Takeover AM)
05 MANDT PIC X(3)
VALUE SPACE.
* Company code
05 BUKRS PIC X(4)
VALUE SPACE.
* Asset class
05 ANLKL PIC X(8)
VALUE SPACE.
Choose System --> List --> Save --> File to download the data structure to your workstation or PC.
6) DATA CONVERSIONS:
Use the field descriptions that you obtained in Analyzing SAP Transactions(4) or Generating an SAP Data Structure(5) to determine the following:
which fields can be taken over directly from your existing data. That is, there is a direct match between an existing data field and the corresponding SAP data field.
for which fields a conversion procedure is necessary for mapping your existing data to the requirements of the SAP System.
CoNverting Data from Old Format to SAP Format
Your program must format batch input values just as an on-line user would when typing them in. In particular:
The data must be character format.
No piece of data may be longer than its target SAP field.
If the data is shorter than the target field, you must left-justify it within the SAP field (pad it with blanks at the right end).
(7) INITIALIZING AN SAP DATA STRUCTURE:
Standard SAP batch input programs require that every field in a data structure contains either:
a value; or
a special NODATA marker, which indicates that the no batch input data is required for the field.
If you are writing your own data transfer program, you should therefore initialize all of the fields in your batch input data structure with the NODATA character. The NODATA character must occupy the first position in the field, as shown in the figure below.
By default, the NODATA character is the forward slash. To initialize a field to NODATA, you must write this character as the first character in the field value.
If a batch input program finds NODATA in a field, then the program allows the field to default to its standard value in the SAP transaction that contains the field.
Setting the NODATA marker: You can freely select another character as the NODATA marker. Define the new character in the batch input program that reads the data in the BGR00-NODATA field:
Data:
Subscribe to:
Post Comments (Atom)
0 comments
Post a Comment