Entering content frame

Procedure documentation Generating ABAP Code Locate the document in its SAP Library structure

You can generate your own ABAP code from the API function modules using transaction GENC. To do this, proceed as follows:

  1. Enter the name of your program on the initial screen. Confirm your entry.
  2. You see the function structure of your program on the next screen.
  3. This structure always contains function module CALO_INIT_API (see Initializing APIs). You cannot delete this function module. The structure contains the description Initialize Logfile for this function module.

    The start and end of a function module are marked by special character strings. The description of a function module that is to be shown in the structure is entered after the string that marks the start of a function module. You can change this description if required.

    *&BPAPILogfile&:Initialize Logfile

    perform api_init_logfile.

    *&EPAPILogfile&

    You can assign additional API modules that are predefined by SAP to the program. To do this, choose Edit ® New functions. You see a dialog box showing a list of APIs according to the areas they belong to. To copy a function module across, double-click on it.

    If a function module contains optional data, you can choose which parameters you want transferred to the interface.

    For example, in characteristics maintenance functions, you can define whether the basic data, characteristic description, values, or value descriptions are transferred to the interface as parameters.

    You can also define whether you want a characteristic to be created or changed by the module. Finally, you generate the function module in order to copy it to your program.

  4. You can use the Program function to display or change the source code. For example, you can include your own functions in the program. If you want these to be entered in the function structure, mark the start and end of the function using the following character strings:

*&BPUSR&

Start of function

 

After this key, you enter the name that appears in the function structure

*&EPUSR&

End of function

  1. The data that the program requires for processing is shown as a place holder (<place holder>). The place holder must be replaced by actual values.
  2. In the Maintain characteristic module, for example, if you select basic data and characteristic values as the parameters for the interface, the following place holders must be replaced:

    * Define basic data

    perform ct_basics tables ct_characts

    using '<ct_name>'

    '<ct_type>'

    <ct_length>

    '<ct_status>'.

    * Define value

    perform ct_value tables ct_char_vals

    using '<ct_name>'

    '<ct_value>'

    '<ct_default>'.

  3. To define whether log entries are written to the database for each module, or whether all messages are collected and read at the end of the program, choose Program ® Log settings.

If you define the setting Collect messages, function module CALO_MSG_APPEND_DB_LOG must be called in order to write the log entries to the database (see APIs for the Log).

 

 

Leaving content frame