In this scenario, IDocs are processed using the SAP Application Interface Framework and a BAPI is called in an action.
You need to create an SAP Application Interface Framework interface and you have to maintain a raw and an SAP data structure.
Use the Generate IDoc Structure and Interface Definition
report (transaction code /AIF/IDOC_GEN) to create the raw data structure based on the IDoc basic type (see IDoc Structure Generation and Interface Definition).
You have to create the SAP data structure manually and this structure depends on the action's functions. Since the raw and SAP data structure differs in most cases for this scenario, you have to create a structure mapping including, for example, field mappings and value mappings.
Process IDoc Using the SAP Application Interface Framework and Calling BAPI in Action
In the scenario for processing IDocs shown in the graphic above, the IDoc from the legacy system is processed by the SAP Application Interface Framework, where functionality such as index tables, checks, and mapping can be used.
In order to process the IDoc with the SAP Application Interface Framework, a generic process function is provided. A new process code and message type is required. The generic process function transforms the IDoc data to the raw structure of the interface. Afterwards, the SAP Application Interface Framework is called to process the data.
In this scenario, you have to create an action to process the data. Within the action function, the BAPI is called to process the data.
In this scenario, the following are possible in the SAP Application Interface Framework:
Displaying messages in Monitoring and Error Handling
Supporting the field link from the Log Messages view to the Data Content view, if an error occurred while processing the IDoc
Maintaining index tables
Creating checks, value mappings, and field mappings
Grouping messages by key fields in the Data Messages view
Creating an interface-specific selection screen
If an interface-specific sub selection screen was customized, this screen can be used to facilitate a selection of messages.
You have to assign engines to interfaces in Customizing for SAP Application Interface Framework
(transaction code /AIF/CUST) under as follows:
Application engine for IDocs
Persistence engine for IDocs
Selection engine for index tables
Logging engine for application log