Skip to Content
Technical Articles
Author's profile photo Ritesh Parikh

Outbound IDocs process using the SAP Application Interface Framework

For this scenario, the following are required:

  • 2 SAP Application Interface Framework interfaces
  • A port functions.
  • An action
    • To trigger the processing in the SAP Application Interface Framework
    • To send the final IDoc to the receiver

 

Process%20Outbound%20IDoc%20Using%20the%20SAP%20Application%20Interface%20Framework

Process Outbound IDoc Using the SAP Application Interface Framework

 

Requirement :

Let’s take the example of the Material Master outbound standard IDOC (MATMAS), where we need to modify a field segment when transferring data from the source side to the receiver system.

 

As per pre-requisite, we have to create two Outbound Interfaces in AIF under namespace and define Interface engine. To create the required structure and interfaces, use the Generate IDoc Structure and Interface Definition report (transaction code /AIF/IDOC_GEN, see IDoc Structure Generation and Interface Definition). The raw and SAP data structure are identical for both interfaces.

 

AIF Interface 1 : I_MATMAS7O  ( IDOC data send from Source SAP to AIF )

 

Define Interface 1

 

 

Let’s define Interface engine for above interface

Define%20Interface%20Engine

Define Interface Engine

Now, Let’s create similar Interface 2 : I_MATMAS7. Here IDOC data send from AIF to Target Receiver. We can use same SAP and Raw data structure.

 

Next step will be Validate/assign IDOC Type  in AIF. Path : SAP Application Interface Framework->Interface Development->Additional Interface Properties->Assign IDoc Types.

Please note you can define additional logical system for AIF and use in Partner profile config. Since I’m using same Partner number ( WE20 ), I will use message variant for IDOC distinguish. We will see while configuring partner profile for IDOCs.

 

Interface%20Message%20Type%201

Interface 1 Message Type

 

 

Interface%20Message%20Type%202

Interface 2 Message Type

 

Moreover, As both interfaces have the same message type/basic type , we need define entry in Interface determination.

Path : SAP Application Interface Framework under System Configuration  Interface Determination  Define Interface Determination for IDoc Interfaces. Here we will use IDOC Control record Receiver Port ( RCVPOR ) field for determination and assign respective port value to interfaces.

Assign%20Interface

Assign Interface

Next Step ,

The SAP Application Interface Framework delivers the /AIF/SINGLE_IDOC_PORT_FUNCTION function module. In Ports in IDoc processing (transaction code WE21), you need to maintain the port function in an ABAP-PI port. You must assign this port in the partner profile (WE20 ).

 

WE21 : Port Config.

 

 

 

WE20 :  Partner Profile Setting

Port AIF_O_PORT = Send IDOC to AIF

Port A00000058 = Send IDOC to Target system

 

Partner%20Profile%20Setting

Partner Profile Setting

 

Next Step,

 

In the scenario for processing IDocs shown in the graphic above, the first IDoc is send to the AIF port function and is processed via the SAP Application Interface Framework. All mappings, checks, fix values, and value mappings must be done in the first interface, which is used for the processing of the first IDoc. To finally send the IDoc to the receiver, an action is required to trigger the sending of the IDoc.

Define%20Action

Define Action

 

 

Assign Function module to Action :

Assign%20FM%20to%20Action

Assign FM to Action

 

Action FM ABAP Code : The Customizing for the first interface contains the processing logic of the IDoc. You must maintain some mapping for the first interface. In order to be able to send the second IDoc to the correct receiver, you need to adjust the sender/receiver data of the EDIDC structure (Control Record) to the values of the final sender/receiver of the IDoc.

Please make sure, If you do not do this, the IDoc ends in a loop of creating one copy after another without sending the IDoc to the final receiver.

 

Action%20Function%20Module

Action Function Module

 

Assign Action to Interface 1 .

 

Assign%20Action%20to%20Interface

Assign Action to Interface

 

Testing :

 

  • Execute DRFOUT or (BD10/BD21) to generate MATMAS IDOC.
  • After execution, it generates two IDOCs.
    • IDOC 0000000004762048 : Send  Data to AIF
    • IDOC 0000000004761668 : Data to Target Receiver

 

WE02

WE02

 

 

Send Original IDOC 0000000004762048 data content to AIF.

 

IDOC%20Data%20Send%20to%20AIF

IDOC Data Send to AIF

Send IDOC 0000000004761668 to Target Receiver with data content modification.

 

IDOC%20data%20send%20from%20AIF%20to%20Receiver%20System

IDOC data send from AIF to Receiver System

 

We can check same in /AIF/ERR as well.

 

 

  • Interface : I_MATMAS71 : For the second interface, a pure monitoring scenario is sufficient. The interface is used to monitor the IDocs that are sent to the final receiver.

 

 

 

 

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.