Converting Between Int. and Ext. Data Formats and Structures 

Prerequisites

This section describes how to generate function modules that are used to:

Note that conversions between internal and external data formats should only be carried out in exceptional circumstances. These exceptions are described in Internal and External Data Formats.

To generate the function modules, the relevant internal and external data formats must have been created in the ABAP Dictionary.

Procedure

To generate the function module, follow the steps below:

  1. From the SAP Easy Access menu, choose SAP standard menu ® Tools ® Business Framework ® BAPI Development ® Generate Function Module to Map Fields, or enter the transaction code BDBS.
  2. In the appropriate input fields, enter the names of the external BAPI structure and the internal working structure you are making the conversion between. Specify the required direction for mapping, i.e. is the internal structure to be mapped onto the external structure or vice versa.
  3. Choose Function module ® Generate.
  4. A dialog box is displayed in which you can enter details of the function module to be generated. The input fields for the name of the function module and the short text contain suggested values which you can accept or change.

    In the field Function group, enter the name of the function group to which the generated function module is to be added. If the function module is being used to convert currency amounts, the fixed point arithmetic for the selected function group must be switched on.

    In addition to the source text for the function module you can have a blank FORM routine added for your own program code if you have to make manual modifications. To do this, select Form to edit. The FORM routine contains the same parameters as the generated function module.

  5. Choose Continue.

A table is displayed containing suggestions for the conversion of each field of the external BAPI structure. The table contains the following columns:

Indicates if the conversion is possible or if data is missing.

Contains the field names of the external BAPI structure.

Displays the conversion type.

Displays the fields of the internal structure to which/from which mapping is to be carried out.

For more information, choose F1 help for columns Status and Conv. type.

  1. To generate the function module, choose Save.

The function module is stored in the Function Builder in the function group you specified.

Result

In a few cases it may be necessary to manually edit the source code of a function module that has been automatically generated.

It is not yet possible to use this transaction to regenerate an existing function module. To regenerate an existing function module you must first manually delete the function module and then generate it afresh.

You can incorporate the generated function modules into the source code of your BAPI as required.

The section Application Example illustrates how function modules are used.