Show TOC

Procedure documentationEnhancing Outbound Function Modules

 

For each enhancement segment, there is a customer enhancement in the coding of the outbound function module, which enters the application data in the enhancement segment.

Prerequisites

You must have completed the required steps in Enhancing an IDoc Type.

Procedure

  1. You write the customer extension of the corresponding function modules via a function or user exit in the project management: On the initial screen of the ABAP Workbench, choose Start of the navigation path Utilities Next navigation step Extensions Next navigation step Project Management. End of the navigation path Enter a project name (note the customer namespace!) and choose Attributes (radio button) and Create (Create). Enter a short text and save it.

    Note Note

    For more information about enhancement projects, see the following SAP Library topic: Changes to the SAP Standard

    End of the note.
  2. Return to the initial project management screen and select the Enhancements Allocation sub-objects. Choose Change (Change) to assign SAP enhancements to your project. Use the F4 Help to find the SAP enhancements. Save your entries.

    An SAP enhancement contains as components function exits (function modules), from which you will choose those required in the next step.

  3. Now choose the Components sub-object in the initial project management screen. Choose Change (Change).

    A list of all the function exits is output. By selecting Enhancement (Enhancement), documentation on the individual Exits is displayed.

  4. Double-clicking the required function exit calls up the ABAP Editor.

  5. The function exit contains the line include <customer include>. Create this include by double-clicking the name (confirm system prompts). Enter your source text and then save your entries.

    Caution Caution

    You do not have to maintain fields HLEVEL (hierarchy level of the segment) and PSGNUM (number of the parent segment) in the IDoc data record. This is done by the IDoc Interface, which can obtain the information about the position of the segment in the IDoc type from the definition of the enhancement.

    End of the caution.
  6. You must now define your new enhancement segments as global structures in the customer-specific TOP include. In the ABAP Editor, choose Start of the navigation path Goto Next navigation step Global Data End of the navigation path.

    The TOP program is displayed.

  7. Create the customer TOP Include by double-clicking on the name (confirm system queries). Enter your enhancement segments as TABLES data declarations.

    If you have activated the segment before, there should be no problems with the syntax check ( ). You should never create the segment directly in the Dictionary. Always use the segment editor.

  8. Activate your entire project. To do this access the initial project management screen and select .

Example Example

In the example, enhance the function module IDOC_OUTPUT_ORDERS in the additional project ZM06E001.

SAP extension

MM06E001

Function exit

EXIT_SAPLEINM_002 (Customer enhancement of data segments for outbound purchasing document)

Include

ZXM06U02

Segment

Z1TEST1

Framework program

SAPLXM06

TOP program

LXM06TOP

Customer Top Include

ZXM06TOP

End of the example.

The source text is as follows:

Syntax Syntax

  1. DATA segnam(27).
    segnam = int_edidd-segnam.
    CASE segnam.
      WHEN 'E1EDP19'.
        CLEAR int_edidd.         "Arbeitsbereich leeren
        int_edidd-segnam = 'Z1TEST1'.  "Name des Kundensegmentes
        z1test1-kontinent = 'Europa'.
        int_edidd-sdata = z1test1.    "Übrige Felder von int_edidd
          "können übernommen werden
        APPEND int_edidd.
    ENDCASE.
    
End of the code.

Note Note

The CASE instruction in the source text is essential because the same customer exit is called for each segment in the function module IDOC_OUTPUT_ORDERS. For this reason, the new include must first determine whether the call came from the correct parent segment.

End of the note.