Some time ago we have checked the functionality of SAP Application Interface Framework (AIF) File Adapter to upload Excel Files into AIF (see Excel Upload using AIF File Adapter). Due to design of the AIF File Adapter it is not possible to provide complex structures within the excel. Also one outcome was that a header/item dependency cannot get customized and further development is needed within AIF to merge header/item data again. This articel shows some more comprehensive way of performing excel uploads into an AIF interface. Excel Uploads in general are provided with SAP S/4HANA migration cockpit. There are bunches of standard excel templates already provided to load data into the system. This blog post will explain how to create an own custom Hana Migration Object and connect it to an AIF interface. This allows you to upload data with the structures you have defined for your AIF Interfaces performing all the checks and value mappings (or any other custom data enrichments) that got implemented within the custom AIF interface.
In the blog post we will look at all the required steps that are needed to build up such a scenario. We are using in this blog post an AIF interface using the XML persistence of AIF. For a custom migration object all you need is a function that does the posting of the data you want to upload. This can be a BAPI e.g. or an own function. Our function will call the AIF Interface. Please expect a high level walkthrough.
This blog post was a co-work together with my colleague Alex Pfeil. Thank you Alex for your support putting together the scenario for this demonstration.
So lets start…
We will build up a scenario for a Business Partner Interface within SAP S/4HANA.
1) AIF Interface
AIF Structure defined (Structures from BAPI BAPI_BUPA_FS_CREATE_FROM_DATA2):
AIF Interface (/AIF/CUST)
No real structure mapping here, just “Move Corresponding”
Action is calling the BAPI mentioned above:
Don´t forget to assign the action to the structure mapping:
We use XML Engine, so change the Engines to XML (Default is Proxy)
2) Migration Cockpit Objects
Create Migration Project in transaction LTMC
Create wrapper function module to call AIF interface The wrapper function is using the AIF interface structure as importing parameter:
You might want to return the AIF Message ID in the Migration Cockpit:
Create Migration Object in SAP S/4HANA migration object modeler (transaction LTMOM)
Fill in the Information from the wrapper function module as target structure.
Add the source structures for the Excel file
Export the fields from the target structure to an CSV file to reduce the effort for source fields
Import the CSV file in the source structure
(Tipp: In column group text you can group fields together)
Additional field MESSAGE_ID (for sending multiple AIF messages with 1 file) added and marked as key field + additional field TIMESTAMP in HEADER structure
Other fields can also be added as key fields to enable multiple rows of a structure:
Structure mapping: Move the source structures to the target structures:
As we exported and imported the technical field names the source field names match with the target field names, so we can use the proposals feature in the field mapping:
To make sure every source Field got mapped we can set a filter:
MESSAGE_ID is not mapped, but only used to assign different lines in the Excel to an AIF message. TIMESTAMP is necessary for the HANA Migration Cockpit to assess whether the file is unique, so for every test it has to be changed. Alternatively you can implement some small logic to create new timestamp automatically with every upload.
Now we can test by loading the SAP S/4HANA migration cockpit and opening the project
Within the Migration Project open Migration Object
Download EXCEL template to local desktop.
Open downloaded file with Excel and provide some data. Leave Central data empty.
Save the file and upload it back into Migration Cockpit.
After upload activate the file and hit the button “Start Transfer”
Now in the migration wizard just go through the steps by clicking “Next” (Simulate import can be skipped)
As a result we see that the Migration Cockpit has sent 2 messages to AIF:
We can also see the messages in transaction /AIF/ERR:
Now let´s check if we can see the Business Partners in the Transaction BP:
Both Business Partners got created:
With the information shown above you have seen an example of how to create an own migration object and use it to upload data into an own interface using SAP S/4HANA migration cockpit and SAP Application Interface Framework without doing comprehensive coding.
If you have any questions about SAP Application Interface Framework also refer to our Q&A.