Skip to Content
Technical Articles

Excel Upload into AIF – using Hana Migration Cockpit

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): 

SE11

SE11

AIF Interface (/AIF/CUST) 

No real structure mapping here, just “Move Corresponding”

/AIF/CUST

/AIF/CUST

Action defined:

/AIF/ACTIONS

/AIF/ACTIONS

Action is calling the BAPI mentioned above:

ZAIF_BUPA_POST

ZAIF_BUPA_POST

Don´t forget to assign the action to the structure mapping:

Assign%20Actions

Assign Actions

We use XML Engine, so change the Engines to XML (Default is Proxy)

Define%20Interfaces%20%28Engine%20fields%29

Define Interfaces (Engine Fields)

 

2) Migration Cockpit Objects

Create Migration Project in transaction LTMC

LTMC

LTMC

Create wrapper function module to call AIF interface The wrapper function is using the AIF interface structure as importing parameter:

ZAIF_MIG_BUPA

ZAIF_MIG_BUPA

You might want to return the AIF Message ID in the Migration Cockpit:

ET_RETURN

ET_RETURN

Create Migration Object in SAP S/4HANA migration object modeler (transaction LTMOM)

LTMOM

LTMOM

LTMOM%20-%20Details

LTMOM – Details

Fill in the Information from the wrapper function module as target structure.

LTMOM%20-%20Target%20Structure

LTMOM – Target Structure

Add the source structures for the Excel file

LTMOM%20-%20Source%20Structure

LTMOM – Source Structure

Export the fields from the target structure to an CSV file to reduce the effort for source fields

LTMOM%20-%20Export%20CSV

LTMOM – Export CSV

Import the CSV file in the source structure

LTMOM%20-%20Import%20CSV

LTMOM – Import CSV

(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

LTMOM%20-%20Keyfield

LTMOM – Keyfield

Other fields can also be added as key fields to enable multiple rows of a structure:

LTMOM%20-%20Additional%20Keyfields

LTMOM – Additional Keyfields

Structure mapping: Move the source structures to the target structures:

LTMOM%20-%20Structure%20Mapping

LTMOM – Structure Mapping

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:

LTMOM%20-%20Field%20Proposal

LTMOM – Field Proposal

To make sure every source Field got mapped we can set a filter:

LTMOM%20-%20Show%20unmapped%20fields

LTMOM – Show unmapped fields

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.

 

3) Test

Now we can test by loading the SAP S/4HANA migration cockpit and opening the project

LTMC%20-%20Open%20Migration%20Object

LTMC – Open Migration Project

Within the Migration Project open Migration Object

LTMC%20-%20Select%20Migration%20Object

LTMC – Select Migration Object

Download EXCEL template to local desktop.

LTMC%20-%20Download%20Template

LTMC – Download Template

Open downloaded file with Excel and provide some data. Leave Central data empty.

LTMC%20-%20Provide%20Data

LTMC – Header

 

LTMC%20-%20Org%20Data

LTMC – Org Data

LTMC%20-%20Telephone

LTMC – Telephone

LTMC%20-%20Address

LTMC – Address

Save the file and upload it back into Migration Cockpit.

LTMC%20-%20Upload

LTMC – Upload

After upload activate the file and hit the button “Start Transfer”

LTMC%20-%20Activate

LTMC – Activate

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:

LTMC%20-%20Result

LTMC – Result

We can also see the messages in transaction /AIF/ERR:

AIF%20-%20Monitor

AIF – Monitor

Now let´s check if we can see the Business Partners in the Transaction BP:

Both Business Partners got created:

BP%20-%20Test1

BP – Test1

BP%20-%20Test2

BP – Test2

 

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.

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