Processing First Message in AIF

light111AIF  Intro & Processing First Message in AIF

The SAP Application Interface Framework (AIF)  enables to develop and monitor interfaces as well as execute error handling in a single framework .

It is mostly useful in a complex heterogeneous system landscape with SAP PI system. Business user( not technical user) can perform error monitoring and the error handling.

AIF is mostly useful when data transfer happens between different SAP systems.


For the below post use case- consider we have two systems

1. Source System which sends the data

2.Target system which receives the data via AIF and process it then

So as received message to be processed in target system via AIF, then certain AIF customizing needed.

Below step explains AIF customizing steps needed in target system.

create DDIC structure ( this is the structural format target system receives the data)

3

AIF customizing transaction codes can be found via area menu- /AIF/

1

Execute Tx- /AIF/CUST 

2

Expand the IMG tree and choose option- Define Namespace.

4

Create a namespace ‘ZDEMO’ and save it.

56


Next step is to  create Interface. Choose define Interface option.

7

Provide the above created namespace for which interface t be created.

8

Choose New Entries button.

9

Below screen appears.

10

Provide interface name as- ZFLT_XML( in AIF message can be processed in different ways like XML, Proxy etc , the below demo processes the AIF message as XML, so accordingly the interface name is adopted) and interface version as 00001.

provide the structure name we have created in the very first step as SAP Data Structure and RAW Data Structure and select the Move Corresponding structure.

For this demo, the RAW and SAP structure are same but in normal business case these two structures are different. RAW structure is what is received in the target system and then it is converted to SAP structure as per different structure mapping rules in AIF which is one of the strength of AIF. Save and go back.

45

For the namespace one interface is defined.

12


Now we have to specify which AIF processing technique to be used like XML or proxy so on. Choose option- Specify Interface Engines.

13

Provide the Namespace and continue.

14

By default settings are like below.

15

Check the options from the dropdown.

16

Choose XML for application engine and persistent engine. This means the received messages in target system AIF will be stored as XML message.

17


Once the message is received by the AIF, then it is further processed. The actions define the processing steps. Each action – has multiple steps and in each step a function module can be specified.

Choose Define Actions option.

18

Provide the Namespace.

19

Choose New Entries button.

20

Provide action name and action description and then choose Define Functions from left side panel.

21

Select New Entries.

22

Provide Function number as 1 and then press F1 to get the help. Here we have to provide a Function module which will be called by the run time execution of AIF. The FM has a specific format. The F1 help provide a template FM which can be copied and code adopted according to business process.

23

Before creating a FM create a function group.

24

Go to Tx- SE37 and Copy the FM- and create a new FM.

25

In changing section – for the parameter- curr_lien provide the associated type as our SAP structure type.

54

55

26

For FLIGHT demo, the below demo code is provided. The FM has a parameter called TESTRUN which is set when you test message in AIF for trouble shooting. This is kine some simulation mode and make sure that if TESTRUN is set no data base update happens. 

52


One the action FM is ready then mention the FM name in the AIF action. Save and go back.

28

The actions are defined on the Namespace level and now ot has to be assigned to the AIF Interface. Choose the option Define Structure Mapping.

29

Provide the namespace, interface and version and continue.

31

In interface Structure Mapping – here a lot of things can be done like mappings etc. But for this case we don’t need any thing. Now choose Assign Actions option from left side panel.

32

Choose New Entries option.

33

Provide the action number and choose namespace and the action name. Save and go back.

34

Now an action is assigned to the interface.

35


Now we have to define once the message is received in the  target system AIF, how it will be processed. It will be processed instantly online or instantly by background job  and later.  For this execute Tx- /AIF/PERS_CGR

36

provide the namespace.

37

Choose New Entries.

38

provide a Run time Config ID- ‘XML’. Provide the description and choose check box Runtime CFG Active( this means received message will be processed instantly online)

39


Till now all the AIF customizing finished in the target AIF system to process the message in XML.

For the demo we have a simple report that send flight data to AIF by calling /AIF/CL_ENABLER_XMl class method.

In a real business case- this call should happen from the source system and call to method /AIF/CL_ENABLER_XMl =>transfer_to_aif should be a part of the RFC Function module.

Important thing to be passed to this method- 

  1. The AIF interface name is dynamically decided from the Namespace and the RAW structure name.

  2. Queue_name- is the name of the runtime CFG ID that tells how and when the received message will be processed.

Execute the report.

40

41

It created a message in AIF.

42


To check the received messages in target system execute Tx- /AIF/ERR

43

Provide the name space and interface details to see the details.

44

In the monitoring tool, we have the message in error and double click on the message to see the log in the right side. Well all things worked fine. Message is received in AIF and stored in AIF message table and also processed and during processing the error message appeared from the action function module.

46


Let try to process the AIF message successfully to create a SPFLI record. Below records are present in target system.  We can create a record with CARRID = AB.

47

In the test report which sends the message to AIF, can be little adjusted to send a record with CARRID = AB. Execute the program.

48

4950


A new record is created in DB.

51

Check the AIF error monitor tool. The AIF message is a success message and it has the log success message.

53


 

Advertisements

2 thoughts on “Processing First Message in AIF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s