Quantcast
Channel: SCN : Blog List - SAP Application Interface Framework
Viewing all 18 articles
Browse latest View live

Enhancement toolbar on View3 and View5 for 'Monitoring and Error Handling' in AIF - Series Ⅱ

$
0
0

I`d like to continue last bloghttp://scn.sap.com/community/aif/blog/2014/11/03/enhancement-toolbar-for-monitoring-and-error-handling-in-aif

Today i will write something about toolbar enhancement on View3 and View5 in 'Monitoring and Error Handing', TCode: /AIF/ERR.

What is View3 and View5, Maybe some new developers to AIF will have this question, here it is:

View1 is Data message view.

View2 is Data structure view.

View3 is Data view.

View4 is a technical view, you need tick 'technical mode' check box on selection screen, then it will display.

View5 is log message view.

13.PNG

First, let`s enhance View3. In '/AIF/ERROR' package, enhancement spots '/AIF/ERROR_HANDLING'.

1, To create a BADI Implementation:

1.PNG

2.PNG

2, To create a Implementing Class:

3.PNG

4.PNG

  4,  Write your logic in this two method:

         'GET_FUNC_LIST' is used to set the function code,

         'DO_ACTION' is do action when you click button on toolbar.

 

5.PNG

6.PNG

5, Activate class and BADI, the result on View3:

     7.PNG

Second, go to enhance View5.

1, To create BADI Implementation and Implementation class:

8.PNG

2,  Write your own code in below method, GET_ACT_LIST and DO_ACTION is same with View5, used to set  a button on toolbar and response it:

14.PNG

15.PNG

3, Activate Class and BADI, result like below, the new added button on toolbar of View5,

11.png

  When you double click the line item:

  12.PNG

 

Actually, each BADI have it`s own example implementation,  it`s very easy if you take a look at it .

I will soon back for other enhancement. see u.

 

regards,

Archer


Michal's Tips: AIF 3.0 - Mapping analyzer - intermediate results

$
0
0

As of October 2014 the new version of AIF (3.0) is available and with the new version lots of new functionalities are available. One of them is the new mapping Analyzer. With this new tool you can now trace single steps of a mapping execution and this way find the issues much more quickly then if the mapping program runs in a single run. This is a different approach if we compare the SAP Process Orchestration Message Mapping tool which cannot display the intermediate results of the mapping. Let's see how does it work.

 

 

Step 1

 

 

At first you need to create an interface and a mapping which can be used by this interface.

 

 

Step 2

 

 

Next you can test the interface in the "Interface test tool" - TCODE - /AIF/IFTEST/ and after you populate the data in the test structure use the new Analyze button to go open the new tool.

 

button_analize.png

 

 

Step 3

 

 

In the Process Step section you can now open each of the nodes of the Structure mapping and on the right hand side you will see the result values. As you can see in the example before the RAW_ADD_DATA_T structure is being processed the values of DATA1 and DATA2 fields contain the "pre mapping" prefix and data4 field has a value - "STANDARD".

 

before_1.png

 

 

Step 4

 

 

After we click on the DATA2 structure in the Process Step section the mapping for DATA1 and DATA2 fields will be executed and on the right hand side we will get the intermediate result for this small part of mapping execution only (in this case we remove the "pre mapping" part).

 

 

after_1.png

 

 

Step 5

 

 

The next step is to see if the value mapping for DATA4 field is working correctly and in order to do that we need to select the DATA4 field in the Process Step section and then click on the Conversion element of the DATA4 field mapping (conversion from value "STANDARD" to value "P"). This will start the value mapping of the DATA4 field and we will be able to see if the conversion was executed as expected giving the correct result in the right hand side.

 

 

after_2.png

 

 

I hope this blog has explained the new - Analyzer - feature in a simple way. In the next blogs I will try to show some more new functions of the AIF 3.0.

Enhancement changeable fields on View3 for 'Monitoring and Error Handling' in AIF - Series Ⅲ

$
0
0

In last blog, http://scn.sap.com/community/aif/blog/2014/12/26/enhancement-toolbar-on-view3-and-view5-for-monitoring-and-error-handling-in-aif,

I wrote how to enhance toolbar on View3. Today, i`d like enhance the editability of cells on View3.

As you know, we could set cells editable or not by Customizing,

/AIF/CUST -> Error Handling  -> Define Interface-Specific Features/Define Namespace-Specific Features -> Define Changeable Fields.

 

Except this, we could do more by implement BADI '/AIF/V5_CHANGEABLE_FIELDS', like according record type to set editable,

or according a certain value of other cells to set current cell editable. Let`s do it.

 

1, Create BADI Implementation,  '/AIF/V5_CHANGEABLE_FIELDS'.

2.png

 

2, There are three methods, which is independence.

3.png

4,  The Method 'INIT', it is called before every displaying data. we could write code in it like below:

  4.png

The result as below, 'ADD_DATA1' the whole column become editable. 'ADD_DATA_KEY' is editable, due to i set it in Customizing:

  5.png

5, The method 'GET_FIELDS_PER_RECTYPE', will be called for record type under structure in View2.

    CR_DATA containing the whole data of current message which you double click.

   6.PNG

   The result as below, 'ADD_DATA2' become editable:

   7.PNG

6, The method 'GET_FIELDS_PER_LINE', will be called for each data in View3. CT_DATA is current data in View3.

    How many data rows in View3, this method will be called how many times. In my example, it will be called twice.

8.PNG

  The result as below, 'ADD_DATA3' column, only the cell which 'ADD_DATA1' equal 'CNN' become editable :

9.png

 

With this BADI, you could dynamical set cells editable, it make Error Handling more flexible.

 

 

Regards,
Archer

Michal's Tips: AIF 3.0 - Serialization - parallel processing

$
0
0

Sometimes we need to post a transaction which locks a certain object and other transactions using the same or other interfaces cannot get posted at the same time. What happens in that case is that interfaces fail and only the first one gets posted as shown in the figure below.

 

parallel_test_error.png

 

 

Then the interfaces which failed need to get restarted, either manually or in some cases we can restart them automatically.

 

AIF 3.0 (new version available as of October 2014) offers a new functionality which can help to solve such issues without the necessity of restarting the interfaces which failed. The new function is called - Serialization - Paralell Processing and in this article I will try to describe the steps required to customize this new function.

 

The idea behind this functionality is that we can use a predefined locking object which can tell AIF if the transaction is currently being locked and if such a situation happens, we can wait for a predefined amount of time, before we try to process the message so it will not fail with the locking error. We can add this functionality to any of your existing AIF interfaces suffering from the locking issues using just the customizing.

 

 

Step 1

 

At first we need to define the fields of the interface which can be assigned to the locking objects. With AIF we can do that by defining the Key Fields. In order to do that we need to create a new AIF index table with all fields which will be used by the lock object as per the figure below. In this case I’m using a flight demo scenario and I will have two locking fields (AIRLINE_ID and BOOKING_NUMBER).

 

 

parallel_index_table.png

 

Step 2

 

Then we need to define both of the Key Fields in the /AIF/CUST/ - Error Handling - Define Interface-Specific Features

 

 

parallel_key_fields.png

 

Step 3

 

In the next step we can define a serialization object /AIF/CUST/ - Interface Development - Additional Interface Properties - Define Serialization Settings, where we can select the locking object and most important parameters like: wait time (time the AIF runtime needs to wait before processing the interface which was locked) and Max. No of Retries (self explanatory). In case of the flight booking scenario we can use the ESBOOK lock object as shown in the figure below.

 

serialization_object_definition.png

 

Step 4

 

Once the lock object is assigned we need to assign it to the AIF interface and we can do that in the same menu as Step 3.

 

serialization_object_definition_if_assign.png

 

Step 5

 

The last customizing step is to assign the locking fields to the AIF Key Fields (defined in Step 2). The assignment is done on the basis of the locking object fields and Key Field sequence number.

 

 

serialization_object_definition_locking.png

 

 

Once all the settings are done we can try testing the new scenario and if we send multiple messages with the same lock key at the same time this time they should not fail but stay in the processing mode (till the wait time from Step 3 is reached) as shown in figure below.

 

parallel_test_pending.png

 

 

Once the lock is free and assuming the Max. No of Retries parameter from Step 3 is not reached all of the interfaces should get posted without any issues as shown in figure below.

 

 

parallel_test_success.png

 

 

I hope that gives you an idea on how this type of AIF serialization is working. In the next articles I will try to describe other features of AIF serialization (external, internal indexes).

Michal's Tips: AIF 3.0 - tRFC monitoring (using table ARFCSSTATE)

$
0
0

When an SAP backend system is being called from another SAP backend system with the use of tRFC currently we have no ways of monitoring errors in such integration scenarios. In case the tRFC call fails on the destination system in some cases the users on the calling system would like to:

 

a) know what kind of error occured in the destination system

b) restart the tRFC call without running the initial transaction

 

AIF 3.0 (new version available as of October 2014) offers a new functionality which can help to solve both of those issues. It’s now possible to create an AIF interface which will enable monitoring of tRFC calls which ended with an error on the destination system. Furthermore with AIF 3.0 it’s also possible to restart those errors and even debug the tRFC calls on the destination system directly from the calling system. Below you can find a list of steps required to customize such an integration scenario.

 

 

Step 1

 

Create an RFC enabled function module on the destination SAP backend system or use an existing one.

 

1_rfc_dest.png

 

 

 

Step 2

 

Create the AIF interface on the SAP backend system which will be calling remotely the RFC created on the destination SAP backend system from the previous step. You can create this new AIF interface by running a new, special report: /AIF/RFC_FUNC_GEN with the following parameters:

 

  • RFC Type - select - tRFC status table


  • Original RFC Function Name - the name of the RFC enabled function module which exists only on the destination SAP backend system (from Step 1)

 

  • Prefix of New Objects - prefix for the new created objects

 

  • Playback Function Name - this module will be created in the calling SAP backend system with the same signature as the original one from the destination . We need this module for the data transformation.

 

  • Name of AIF Structure - which will be automatically generated on the basis of the structure of the RFC enabled function module

 

  • Destination for Original Func. - this is the RFC destination of the SAP backend system on which the RFC enabled function module will be executed (destination SAP backend system)

 

  • Namespace - namespace of your new AIF interface

 

  • Interface Name - interface name of your new AIF interface

 

  • Interface Version - interface version of your new AIF interface

 

 

2_trfc_generation.png

 

 

Step 3

 

Execute the report/transaction on the calling SAP backend system which will send the data to the destination SAP backend system. Only if the tRFC call fails we will be able to monitor that call in AIF. In case the call is successfull we will not see any data in the AIF monitoring transactions. As you can see on the figure below the failed tRFC calls are visible in the AIF monitoring transaction and we can even monitor the data from the RFC structures (name, data, creator).

 

3_call_failed.png

 

 

Once the call failes as shown in the figure above we will be able to restart the call from AIF using the restart button or even debug the tRFC call using the debug button. Debugging will take the user from the calling SAP backend system to the destination SAP backend system on which the RFC module is being executed as shown in the figure below.

 

4_trfc_debug.png

 


Please keep in mind that once all tRFCs calls are successfully corrected all the entries from the AIF monitoring transaction will be gone and not marked as successfully completed as with other AIF scenarios.

 

 

Reference:


tRFC and qRFC - SAP Application Interface Framework - SAP Library

Speical Calendar color and tooltip for Interface Monitor in AIF

$
0
0

Today, I`d like do some enhancements on another main AIF tool - 'Interface Monitor'.

The enhancement spots '/AIF/INTERFACE_MONITOR' is in same package with 'Error handling'.

 

   1.png

1, To create an enhancement implementation and related implementing class, as below figures:

    2.PNG

    3.PNG

2, Write your code in method 'CHANGE_CAL_COLOR_TIP_BY_DATA'.

    Importing parameter 'IT_ALL_KEYS' holding all the interfaces which you are monitoring.

    Changing parameter 'CR_CALENDAR' is that Calendar`s instance. Example code as below:

   4.PNG

     In this code snippet, I specified Feb.18&19&20 with yellow and tooltip 'Spring Festival'.

 

3, Result in 'Interface Monitor', run '/n/AIF/IFMON'.

    5.png

  

NB. In my ABAP code, some grammar is news for Release 7.40, I just use it to practice.

You`d better use old grammar to avoid syntax error.

 

Regards,

Archer 

Creating application log sub object in SLG0

$
0
0

In SAP back-end system the newly created AIF custom interface fails to display log in transaction /AIF/ERR. This is because the application log sub object is not created in the system.

 

For example: In transaction /AIF/CUST -> Interface Development -> Define Interfaces, a newly created interface IC0029 belonging to namespace ZHR.

 

Sub-objects3.PNG

 

Step 1: Go to transaction SLG0.

 

Step 2: Select the entry "/AIF/LOG" and double-click on "Sub-objects".

Sub-objects1.PNG

 

Step 3: Go to edit mode and create a new entry for interface IC0029 along with its namespace and Save.


Sub-objects4.PNG

 

An entry for IC0029 gets created in SLG0.

 

Sub-objects5.PNG

AIF field mapping for nested structure

$
0
0

Requirement: To map child level field in a nested structure in AIF.

 

Source field: StreetPostalCode   --> (/Supplier/AddressInformation/Address/PhysicalAddress/StreetPostalCode)

Target field:  RegionName          -->(/Supplier/AddressInformation/Address/PhysicalAddress/RegionName)

 

Solution:

 

Step 1: Root level structure mapping.

 

Assign "Supplier" as the source and target structure.

 

10.PNG

 

The next segment in the target structure after Supplier is "AddressInformation".

So, select "AddressInformation" as the field in destination structure and assign it as a Sub-Table as well.

 

11.PNG

 

Step 2: First level structure mapping.


Assign "AddressInformation" as the source and target structure. This time "Indirect Mapping" checkbox is selected as well.


12.PNG


The next segment in the target structure after AddressInformation is "Address".

So, select "Address" as the field in destination structure and assign it as a Sub-Table as well.

 

13.PNG

 

Step 3: Second level structure mapping.


Assign "Address" as source and target structure. This time as well "Indirect Mapping" checkbox is selected.


14.PNG

 

The next segment in the target structure after Address is "PhysicalAddress".

So, select PhysicalAddress as the field in destination structure and assign it as a Sub-Table as well.

 

15.PNG

 

Step 4:  Third level structure mapping.


Assign "PhysicalAddress" as the source and target structure. This time as well "Indirect Mapping" checkbox is selected.


16.PNG


Map the target field "RegionName" with the source field "StreetPostalCode".

 

18.PNG


Michal’s Tips: AIF 3.0 value mappings integrated with BRFPlus/DSM

$
0
0

SAP AIF with release 3.0 has got many new features and one of them is a much tighter integration with SAP rule engine - BRFPlus/DSM. In this video presentation you can find out why it’s worth using AIF together with BRFPlus/DSM: SAP Application Interface Framework with SAP NetWeaver Decision Service Management

 

The main topic of this article will be to show how quickly and easily can a BRFPlus rule be used in the AIF value mapping from the development point of view. For a start we need to design a BRFPlus function which can later be used within AIF. There are however two important things to be considered here:

 

a) if you’re building a new BRFPlus function together with a new BRFPlus expression (for example a decision table) you can try building it according to the AIF requirements (for input parameters). This basically means that the BRFPlus function can be used in the „Functional mode” with just one top expression (for example - decision table) which has the same input/output parameters

 

b) if the BRFPlus expression is already developed you have to develop a BRFPlus function according to the AIF requirements (for input parameters) but you may need to go for a function with "Event mode” so you can map the AIF required input and output parameters to the existing expression within the BRFPlus Ruleset (assigned to the function)

 

In this article we will only concentrate on the first approach (so both the BRFPlus function and expression are new). The first step would be to create a BRFPlus function with required input parameters which need to can have names listed as per the figure below which would correspond to the fields (Field1…Field5) from the AIF structure mapping later on. The output value does not need to have any specific name.

 

figure_1_AIF_BRF.png

 

Next we need to prepare the BRFPlus expression (for example decision table) which will be used in the scenario and assign it to the BRFPlus function. It would be wise to test the function from the BRFPlus workbench to see it working using the start simulation button.

 

The rest of the customizing steps can be done within AIF and we need to start by defining a new value mapping where we need to select which BRFPlus application and function we will be using as shown in the figure below.

 

figure_2_AIF_BRF.png

 

In order to use the new value mapping you need to add it in the AIF structure mapping keeping in mind that selected source fields will be used by the BRFPlus function exactly as shown in figure below.

 

figure_3_AIF_BRF.png

 

 

After all of the mentioned steps are done you can try and test the end to end scenario and if you did everything as explained the value from the AIF interface should get mapped using the BRFPlus.

 

Note:

BRFPlus can also be used in AIF structure mapping and AIF checks and not only with AIF value mapping.

 

Reference:

Business Rules Framework Plus Integration from help.sap.com

New SAP Press book (E-bite series): Serializing Interfaces in SAP AIF

$
0
0

As of AIF 3.0 a new, fantastic feature has been introduced - AIF serialization. Together with my two colleagues from Int4 - Michal Michalski and Krzysztof Luka we've decided to describe how do different options of AIF serialization work as we believe it's usage can be a vital part of almost every AIF implementation due to it's unique benefits.

 

SAP Press has published our book with it's new format - E-bite. E-bites are supposed to be smaller books available only in electronic format and they need to concentrate on a single topic only - in our case serialization. Our book contains step-by-step instructions and screenshots that will enable you to explore your serialization options in SAP Application Integration Framework in no time, starting from the configuration up to monitoring and troubleshooting of the AIF serialization.

 

book_AIF.png

 

Where to buy:

 

SAP Press - Serializing Interfaces with SAP AIF

 

Reference:

 

My first book on AIF topic for business users - SOA Integration - Enterprise Service Monitoring (LIE, FEH/ECH, AIF)

Michal’s Tips: ECH monitoring for Enterprise Services in AIF

$
0
0

Most of the SAP delivered Enterprise Services use the Error and Conflict Handler (ECH) to handle messages which end up with errors. AIF seems to be integrated with ECH but there are many ways to enable this integration. We can either turn off ECH to monitor ECH completely in AIF (ECH will not be used at all) or we can make AIF use ECH error status messages. The second approach is much better in cases where the SAP delivered Enterprise Service used some other ECH functionalities which would stop working if ECH is completely turned off. The only difficulty is that you need two AIF interfaces to monitor a single interface:

 

a) one for monitoring ECH messages

b) one for monitoring successfull proxies

 

Let me demonstrate the idea of using the AIF for the second case.

 

Prerequisite

 

OSS note  2094472 - Support of standard enterprise services

 

 

Step 1

 

 

As per OSS note you need to define two AIF interfaces for the same inbound proxy class: one for ECH and one for Proxy. The main difference will be the Interface engine configuration where for proxy interface you can use the default values but for ECH you need to use ECH for all engines:

 

Application Engine = ECH

Persistence Engine = ECH

Selection Engine = ECH

Logging Engine = ECH

 

 

Step 2

 

 

In step 2 you need to assign the correct ECH component to the ECH AIF interface - Interface Development -> Additional Interface Properties -> Assign ECH Component

 

 

Step 3

 

 

You also need to perform all of the manual steps from the OSS note: 

 

a) create the implementation for two enhancement spots /AIF/ERROR_HANDLING and /AIF/ENGINES

 

b) perform the manual post customizing which includes creating a custom function. This function will allow you to navigate between the AIF message of the proxy interface to the same AIF message in the ECH interface. This way you can not only work with specific functions of two monitors but also drill down to both of them (to proxy monitor from proxy interface  and to ECH monitor from the ECH interface). You can find the information on how to create the custom function on the screenshots below. 

 

 

ech_function1.png

Figure 1 - Custom function for ECH monitoring

 

 

ech_function2.png

Figure 2 - Parameters for custom function for ECH monitoring

 

 

How does it work

 

 

Now when you try to monitor your message AIF you only need to open the proxy version of your interface as it will always contain both types of messages (correctly processed and incorrectly processed). For the ones which failed you will see a status message saying that the error is in ECH and by using the arror you can drill down to the ECH version of the AIF interface from where you can perform all ECH related activities. 

 

 

ech_final.png

Figure 3 - ECH drilldown from AIF Proxy interface

 

 

References: 

 

You can find some more info on ECH, proxy monitoring and AIF in my book - SAP SOA Integration - Enterprise Service Monitoring

 

 

Special thanks:

 

Verena Woerner for helping me with customizing of this functionality.

Implementation of 'New WebService' engine in AIF

$
0
0

Greetings,

 

The purpose of this document is to show the implementation steps in SAP ECC for the 'New WebService' engine in AIF 702.


Message for a outbound interface will be sent from SAP ECC via WebService using SOA to other system (for example: SAP PI). The messages can be monitored in SOAMANAGER via /AIF/ERR. (I have used SAP note 2010881 for reference)


1. Assign the 'New WebService' engine to the Interface (AIF IMG-> Interface Development -> Additional Interface Properties -> Specify Interface Engines)

 

        2.jpg

2. In transaction SOAMANAGER, create a Logical Port for the Interface of new WS

 

       3.jpg

 

3. In the ABAP program for sending the messages, use FM '/AIF/SEND_WITH_PROXY' and assign the Logical Port as an exporting parameter.

    (We copied /AIF/SEND_WITH_PROXY into our custom FM to cater to our requirement)

 

    4.jpg

4. In /AIF/ERR, AIF message was logged,

 

       5.jpg

 

and from /AIF/ERR we could navigate to Monitoring in SOAMANAGER


6.jpg



How to use Automatic Reprocessing in AIF

$
0
0

Prerequisites:

  • You would like to implement AIF interface with automatic reprocessing of messages.


I would like to show you how to set up an automatic reprocessing for your AIF-interface.

I will use simplified interface BP_IN for business partner with the same SAP and RAW structures ZBPSTRUC:

interface_bp.jpg


For automatic reprocessing, we have to use a runtime group, created for our interface.

Use Tcode /n/AIF/PERS_CGR to create a runtime group, say RT1:


rt1.jpg

Don't remember about checkboxs "Runtime Configuration Group Active" and "Run Scheduled".

 

Then I create an Action...

action.jpg

 

...that uses a Function Module

actionFM.jpg

 

First, we just use a Break Point to make sure our interface is working

FM1.jpg

 

Then I create a simple report to call AIF Interface:


REPORT Z_AIF_SEND_BP.

 

DATA:

ls_input type ZBPSTRUC.   "our AIF structure

 

*Fill the structure with dummy data:

ls_input-BP-TITLE = 'Mr'.

ls_input-BP-NAME_FIRST = 'Mark'.

ls_input-BP-NAME_LAST = 'Levinson'.

 

/aif/cl_enabler_xml=>transfer_to_aif(

  EXPORTING

     is_any_structure = ls_input

     IV_QUEUE_NS = 'BP'

     IV_QUEUE_NAME = 'RT1' ).

 

I don't use AIF test tool because of Runtime Group specification in call.

Now let's try to check if all is Ok and run our report. Then check /n/AIF/ERR:

ERR1.jpg

Yoo-hoo! It works!

 

Now lets try to setup an automatic reprocessing.

First, we need to define reprocessing action, using Tcode /n/AIF/REP_AC_DEF

restart_action.jpg

Take a look, that we need to use a function module /AIF/RESTART_MSG and our Runtime Group created above.

 

Than, we need to assign a reprocessing action in Tcode /n/AIF/REP_AC_ASGN:

 

assign_restart_action.jpg

Tips:

  • You can select a special message class and message, so only messages with specified errors will be restarted
  • You can define in what time period your message will be restarted. As shown, this message will be restarted in 5 minutes.

Also, you can define an intermediate status, for exapmle "In process", "Application error" and others.

Now you can have some experiments with your AIF message, for example with changing time or Intermediate Status.

 

Hope this blog was useful for you.

Monitor and manage smart simple interfaces with SAP Application Interface Framework: Webcast for Business Users

$
0
0

AIF Webcast.jpg

If you missed our Webcast on March 8 here's your chance to join us!  See the replay of how the SAP Application Interface Framework tool makes life easier for business users by empowering businesses to monitor and troubleshoot processing issues on their own.  The tool improves the visibility of business rules and validations, performs interface-related monitoring with minimal IT involvement, and helps to increase operational efficiency.

 

Click HERE to see a replay of the Webcast.

Interface Variants with AIF

$
0
0

Introduction and Use Case

You might have already experienced a situation in which you have to make slight changes to the customizing of an existing interface in AIF. Examples for such situations are:

  • Your interfaces are defined globally. However, in certain scenarios the processing of a message needs to be slightly different. E.g. if data is coming from a certain plant.
  • You have an interface that is delivered by SAP. Interfaces delivered by SAP cannot be changed on a customer system. However, you would like to enhance the interface with some own logic, for example you would like to add an additional check or fix value.

How can you enhance the interface’s customizing without changing the original interface or without creating an additional interface? Or how can you even change the customizing of SAP-owned interfaces of other applications, which usually are protected for changes?

Since AIF 1.0 you can use the variant-feature to tackle this. E.g. you can simply add or change a fixed value without changing the original interface. The only thing that changes is the variant. From my experiences, interface variants are commonly unknown, but could be used in so many situations (just two mentioned at the beginning). For this reason I wrote this blog post, which explains the usage of interface variants in AIF by using a simple example with the FLBOOKING interface in namespace /AIF/. We are going to add a new fixed value and replace the create-booking-action by a different action.

 

 

Preparation

To overwrite the existing action we need to have a different action. We will now create an action that always throws an error message.

To create a new action go to /AIF/CUST and expand Interface Development to select Define Actions. Enter one of your namespaces (to create a new namespace go to Define Namespace first / in our example we will use the namespace Z_FZ5). Create a new entry. Use ALWAYS_ERROR as the action’s name and use any description. Your customizing should look like the following:

1.png

Then click on Define Functions on the left and create a new entry. Use 10 as the function number and enter a ZALWAYS_ERROR as the function module name and confirm by pressing enter. Use the forward navigation to create the function module. You can use the following code snippet for the function module:

  " Error message
  CALL FUNCTION '/AIF/UTIL_ADD_MSG'
    EXPORTING
      msgty      = 'E'
      msgid      = '/AIF/MES'
      msgno      = '000'
      msgv1      = 'This error message gets thrown every time!'
    TABLES
      return_tab = return_tab.

Your customizing should look like in this screenshot:

2.png

 

 

How to enable interface to support variants

Interfaces have to be prepared to support variants. The preparation is basically the setup of the variant assigning table. This table describes which variants should be applied to an interface (and which keyfields should be used for the determination). To create a new variant assigning table, go to the se11 to copy the template called /AIF/VAR_AS_TMPL. Use ZVAR_AS_FLBOOKIN as name and use any description.

3.png

In our example we only want to use the variant if the carrier-field is set to a specific value. Therefore add an entry called CARRID with the type S_CARR_ID to the list. The table should look like the following:

4.png

Then go to tab Delivery and Maintenance and set the Data Browser/Table View Maint. field to Display/Maintenance Allowed (Alternatively you could create a dedicated maintenance view). Save and activate the newly created table. In general one assigning table could be used for multiple interfaces.

In addition the variant assigning table has to be connected to your interface. Therefore go to transaction /AIF/CUST and expand Interface Development, Interface Variants to select the node Define Assigning Tables. Then enter the namespace of your interface (in our example we will use the FLBOOKING interface (version 1) in the /AIF/ namespace) and you will see a maintenance view. Add the name of your newly created variant assigning table to your interface. Save your changes and you are done.

5.png

 

 

How to create a new variant

To create a new variant go to transaction /AIF/CUST and expand Interface Development, Interface Variants to select the node Define Interface Variants. Enter a namespace for your new variant (our example uses the namespace Z_FZ5). The used namespace can be different than the one used for the interface – this does make sense if you want to create a variant for a SAP-owned interface in a locked namespace (e.g. /AIF/ namespace). In the maintenance view create a new entry and insert the variant’s name (e.g. TESTVARIANT) and description. Save your changes and you are done.

 

 

Create a new fixed value

In the following we are going to add a new fixed value. In general the corresponding maintenance views give a good overview on what you can do with a variant. Therefore go to transaction /AIF/CUST and expand Interface Development, Interface Variants to select the node Define Variant Mappings. Enter your namespace and the name of your variant.

Select Select Interface on the left side and create a new entry. Enter /AIF/ as namespace, FLBOOKING as interface name and 1 as version.

6.png

Then click on Add/Select Structure Mapping and create a new entry. It is basically the same thing as the structure mapping of an interface. In our example leave the source structure field empty (meaning we are selecting the root of the raw structure) and enter 10 as number for this mapping. The number is the mapping’s identifier. If you choose a number that already exists in the structure mapping of the interface you can change or enhance the behavior of this specific mapping (we will see that in more detail when defining the action). Then click on Assign Fix Values on the left side and add a new entry. Enter 10 as fix value, choose CUSTOMER_DATA-LANGU as field name, enter EN as value and save your changes. This fixed value will fill the CUSTOMER_DATA-LANGU field of the SAP-structure with the value EN.

7.png

 

 

Overwrite an action

Now we are going to overwrite the standard create-booking-action. Therefore select Assign Action on the left side and create a new entry. Use 10 as the action number. Because the number 10 refers to an action, which already exists in the interface, this will override/replace the existing action in the interface’s customizing. Enter the namespace and the name of your action you created before.

8.png

 

 

How to apply a variant to an interface?

In order to enable the variant determination by a dedicated keyfield (in our example: CARRID), you have to define this keyfield. Therefore go to /AIF/CUST and expand Interface Development, Interface Variants and select the node Define Interface Key Fields. Then enter the namespace of your interface (in our example we will use the FLBOOKING interface (version 1) in the /AIF/ namespace) and you will see a maintenance view. Add a new row and use 10 as the key field number and CARRID as Interface Variant Key Field (refers to the column name in the variant assigning table) and Field Name (refers to the field in the raw structure). Save your changes. The customizing should now look like the following:

9.png

To apply the created variant to the FLBOOKING interface, we need an entry in the variant assignment table. This is the table you created before. Therefore go to se16, enter ZVAR_AS_FLBOOKIN as table name and create a new entry. Enter the interface you want to apply the variant to. In our example we want to use the FLBOOKING interface (version 1) in namespace /AIF/. Then enter the namespace and the name of your variant. In our example we only want to apply the variant if the CARRID keyfield is set to FZ. Therefore enter FZ in the CARRID field and save all changes. The table now should look like the following:

10.png

 

 

Test our example

To test our example we can use the test tool. Therefore go to transaction /AIF/IFTEST and press the Search-Button. Then create a new test file and choose the FLBOOKING-interface (version 1) in /AIF/ namespace. Enter any description and save the file. Next press the Read Data button to load the file. Enter FZ as CARRID and use any values for the remaining fields of the raw structure. Finally press Process in XML Runtime. This will send a new message to AIF.

Please note: The Transform-Button in the test tool won’t respect any variants. This feature only applies the interface’s customizing. Instead, the Process in XML Runtime button will really send a message to AIF and AIF performs all steps including the look up for variants.

11.png

To see this message, go to transaction /AIF/ERR and enter /AIF/ as namespace. You will find one message in status error. It should have one log message originated from the overwritten action.

12.png

To see the result of the fixed value mapping, switch to Technical Mode (button in the upper left corner), double click on the message and click the Transform button (lower left part of the screen). Then select the CUSTOMER_DATA substructure. The data content will contain the value EN in the LANGU field.

13.png

 

 

Summary

This blog post gave an introduction on how to use interface variants. It showed that variants can be used in many situations to gain flexibility and to modify the existing behavior of an interface for all or some messages.

 

PS: I am happy to receive your feedback to this blog post.


Recipient Determination by Keyfields

$
0
0

Introduction and Use Case

 

I recently talked to an AIF-customer, who has to process millions of messages. Because of the expected load and the diversity of the errors' root causes, he wants to delegate the monitoring to different teams. They already use the error-category-feature to assign a message to a recipient by using the log message (e.g. a message with a financial-error get assigned to one recipient, whereas a message with an error in the master data gets assigned to different recipient). Now he wants to further dispatch the messages between the recipient by using a keyfield. Let me explain the requirement by giving you a concrete example:

In this blog post I used the flightbooking scenario. Let's assume the load of processing the erronous messages increased and the process of fixing an error depends on the ariline/carrier. In this case it would be great to have one team to process erronous bookings for LH, one for AA, one for DL and one for all the other airlines. This can be achieved by using different recipients and configuring the recipient determination by keyfields. Dependending on a keyfield, a new message gets assigned to a specifc recipient.

 

 

Preparation

As preparation I created an own namespace called Z_FZ9 and copied the standard FLBOOKING interface of namespace /AIF/ via transaction /AIF/CUST_SMAP_COPY. In addition I adjusted the interface determination, in order to receive messages on this interface.

Furthermore I created the following five recipients (/AIF/CUST -> Error Handling -> Namespace-Specifc Features -> Define Recipients):

01.png

 

How to Configure

Create Recipient Assignment Table

The assignment of keyfield values to a specific recipient is managed with a recipient assignment table. The table layout depends on the used keyfields and therefore is customer-specific. To create new recipient assignment table go to se11 and copy the template table /AIF/RECA_TMPL (if you did not use error categories, you alternatively could use the /AIF/T_ALRT_DEF table). In this example I named the new table Z_FZ9_RECIPIENTS. Now you need to add a column for each keyfield, you want to use in the recipient determination. In our example I added a column called CARRID (of type S_CARRID). Save and activate the table.

02.png

Now you can fill the recipient assignment table. Therefore go to transaction se16 and create the following records:

05.png

With this configuration the ALL-recipient receives all messages sent to the interface - independent of the actual keyfield value. The specifc recipients for AA-, DL- and LH-bookings will only be considered, if the CARRID-keyfield has the corresponding value. If no specific recipient can be determined by using the keyfield, the fallback-recipient, RECIPIENT_FOR_OTHER_BOOKINGS, will be used.

 

 

Change Customizing

As the next step, you have to change the customizing to let the interface use the newly created recipient assignment table during the recipient determination. Therefore go to /AIF/CUST -> Error Handling -> Define Namespace-Specific Features -> Configure Alerts and enter the recipient assignment table as shown in the following screenshot:

03.png

Furthermore you have to connect the CARRID-keyfield with the added column of the recipient assignment table. Therefore go to /AIF/CUST -> Error Handling -> Define Interface-Specifc Features -> Define Key Fields for Multiple Search and edit the CARRID-keyfield. Enter the name of the column and tick the checkbox Relevant for Recipient Determination as shown in the following screenshot:

04.png

 

Test the Example

In order to be able to test the example, you have to assign the recipients to your user. This can be done in transcation /AIF/MYRECIPIENTS. (If you want to assign a recipient to a different user, you can use transaction /AIF/RECIPIENT). Assign your user to all those recipients and tick the Overview-checkbox as shown in the picture:

06.png

Go to the Interface Monitor to check if all recipients show up. Then you can use the test-tool (/AIF/IFTEST) to send some messages to the interface and observe the recipients' behaviour. Let's have a look at the following examples:

 

1. Send an erroneous message with carrier LH: The message will be assigned to the LH-recipient and the ALL-recipient.

11.png

 

2. Send an erroneous message with carrier AA: The message will be assigned to the AA-recipient and the ALL-recipient.

12.png

 

3. Send four erroneous and one succesful messages with carrier DL: All five messages will be assigned to the DL-recipient and the ALL-recipient.

13.png

 

4. Send one erronous message with carrier BA: The message will be assigned to the OTHER-recipient and the ALL-recipient.

14.png

 

Further Information

  • Please note: If you previously assigned the interface to an recipient via the customizing (/AIF/CUST -> Error Handling -> Interface-Specifc Features -> Assign Recipients Without Key Fields), this assignment will get ignored as soon as a recipient assignment table is used. To keep the assignment, they manually have to be entered into the recipient assignment table.
  • This example showed how to assign a recipient to exactly one keyfield value. But it is also possible to assign two keyfield values to the same recipient. Just assume the following example: With the LH-recipient you not only want to cover LH-flight, but also 4U-flights (IATA-code of German Wings). Therefore you have to perform one change: The keyfield-column of the recipient assignment table has to be a part of the table's primary key.

 

Summary

This blog post gave an introduction on how to use keyfields for the recipient determination. By using a recipient assignment table, the recipient determination can be influenced by specifc values of the keyfields. For instance, this can be used to dispatch message to different processing teams.

 

PS: I am happy to receive your feedback to this blog post.

Michal’s Tips: AIF mappings explained - #1 - Multiple qualifiers

$
0
0

In this mapping series I will try to explain how to do different types of structure mappings in AIF. AIF’s mapping engine works in a different way as SAP PO, Service/SOA Mapping Tool (SMT) and Business Connector so it would be good to understand how to use it properly in your new integration projects. In case you’d know a different way (easier/better, etc.) to solve the same requirement as shown in the article please post a comment so we will have a single source where all AIF mapping best practice is shown.

 

Requirement

 

There are situations where we need to create two or more lines from a single input line. A typical example of such a case might be when we need to map an input structure to an IDOC with multiple qualifiers. How to do this sort of mapping in AIF ?

 

Example

 

Imagine we have a table structure with two types of rates - rate type M and rate type B are available in a single row or this structure as shown on Figure below. I’m using the exchange rate example as it’s available on most of the SAP application systems.

 

 

picture_1.png

 

 

We need to map this to the standard IDOC with exchange rates where each rate needs to be mapped as a single row with a rate type (M or B) as a segment qualifier.

 

 

picture_2.png

 

 

This means that for each row of the input structure we need to create two rows in the IDOC struture - E1BP1093_0.

 

 

Step 1

 

We need to start by creating a target structure for E1EXCHANGE_RATE as shown in Figure below.

 

 

picture_3.png

 

 

Step 2

 

In the Field mapping for this structure we need to define how many times should the E1BP1093_0 structure be created. In our case we want to create it as many times as rows in the RATES table so we need to define this in the subtable. Subtable works in such a way that for every entry in the subtable a destination structure will be created.

 

 

picture_4.png

 

 

Step 3

 

 

In the next step we need to define the two indirect mappings one for each rate type (M and B). This is because we want to create twice as many times target structures E1BP1093_0 as source RATE structures (one for each rate qualifier).

 

 

picture_5.png

 

 

Step 4

 

 

Now for each of the indirect mappings we need to do the „real” field mapping. For the example we will only map "rate type" and „from currency” fields. The figure below shows the mapping of rate type M but you’d need to do the same for rate type B in the second indirect mapping of E1BP1093_0.

 

 

picture_6.png

 

 

Testing

 

After we’d done with the mapping we can use the AIF testing tool to test if the mapping works correctly. The source structure contains two rows, each with two types of rates (M and B) as shown in figure below.

 

 

Picture_7.png

 

 

The target structure contains twice as many rows as the source structure due due to the requirement which was saying that each of the rate types needs to be created as a seperate segment E1BP1093_0.

 

 

Picture_8.png

 

 

I hope the example will be useful for those starting with AIF mappings and if you’d have any comments please do let me know.

 

 

Other AIF mapping resources:

 

Interface builder by Nicole Goeddelmann


AIF field mapping for nested structure by Mateen Popatia

 


Further reading on AIF:

 

SAP Integration Enterprise Service Monitoring - SOA/AIF/FEH monitoring for business/module consultants

 

Serializing Interfaces in SAP AIF - for technical consultants/developers

Michal’s Tips: AIF - alert recipient based on error message class and message ID

$
0
0

When integration related error handling needs to be solved quickly we need to make sure correct users are getting notified. When AIF is correctly implemented (with a clear guidelines on what kind of integration patterns should be done in SAP PO and what needs to be done in SAP AIF) we already have the first level of speeding up the error handling as technical users don’t receive any alerts from SAP AIF since they go directly to the business users. Sometimes however it’s not enough to send all SAP AIF alerts even from a single interface to a single specific person or group as a single IDOC can have many times of errors like master data, SD customizing, MM customizing, FI related. With SP04 for SAP AIF SAP has came up to the rescue in such cases. We can now create AIF alerts for different support groups and assign only specific error messages to each of them.

 

Steps required for setting up this new funcionality will require creating a new, custom alert category which will be used to receive the alerts by e-mail, creating a new recipient assignment table, creating a new message category (which in this case will hold all sales module related errors), assigning error message classes and error message IDs to the message category, populating recipient assignment table and assining the configuration in AIF customizing.

 

Step 1

 

Create a new alert category of type SAP Application Interface Framework with transaction ALRTCATDEF and populate it with some text which will help the business users to understand which message is the one they should be looking similarly as per figure below.

 

picture_1.png

 

 

Step 2

 

Next step is to create a new recipient assignment table by copying the template table /AIF/RECA_TMPL which will store the assignments created in further steps.

 

picture_2.png

 

 

Step 3

 

Transaction /AIF/MSG_CAT_DEF allows us to create a new message category like SALES_ERRORS which will be later assigned to the AIF recipient.

 

picture_3.png

 

 

Step 4

 

Transaction /AIF/MSG_CAT_ASGN is used to assign all message classes and respective message numbers to the AIF message category created in the previous step as shown in figure below.

 

picture_4.png

 

 

Step 5

 

As the next customizing step we need to create a new alert customizing where we will assign the recipient assignment table and custom alert category. This step can be done using the following menu: /AIF/CUST -> Error Handling -> Define Namespace-Specific Features -> Configure Alerts

 

picture_5.png

 

 

Step 6

 

We also need to create as many recipients as different teams which will be receiving the alerts as shown in the figure below.

 

picture_6.png

 

 

Step 7

 

As the last customizing activity we can populate the recipient assignment table with interface related info, message category and recipient who will receive all alerts from a specified message category as shown in figure below.

 

picture_7.png

 

 

Result


As a result each time your interface will encouter any of the errors specified in step 4 an recipient of type specified in step 6 will be triggred and the users assigned to this recipient will receive an e-mail customized in step 1.

 

 

Further information:

 

SAP page about this configuration - help.sap.com

Viewing all 18 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>