Central Finance Tips and Tricks #2 – Test and Debug AIF Messages
Implementing a Central Finance system can be challenging with a number of BADI’s involved with customer specific requirements, and to fill gaps in the standard SAP solution. In addition, the data is mainly being transferred by SLT where it is not apparent how to go about testing and debugging individual messages.
As a team member on a Central Finance project a key skill is understanding the application interface framework, and having skills to test and debug it for troubleshooting purposes. For those new to AIF and Central Finance I’ll provide some tips in this post on how to accomplish this.
Set Interface as synchronous
To be able to debug, the related central finance interface needs to run synchronously for you to break into debug. Here are two options you can take:
- Create a run time configuration group TST for releases up to 1610 FP2 or if note 2597249 is in your system, otherwise create run time configuration group 401 in transaction /AIF/PERS_CGR
The run time group is used by the interface test tool transaction /AIF/IFTEST. When setting this up be sure that the indicators “Run scheduled” and “Schedule packages” are not active and set the “Runtime Cfg Active” flag.
- Same as above, create a run-time group of your choosing, set as synchronous and assign it to the interface in SM30 view V_CFIN_AIF_RT_CF. All message via SLT will use this so be weary when testing because parallel processing will not take place.
Dont forget to place a break-point in the code you are looking to debug, for example your implementation of BADI_FINS_CFIN_AC_INTERFACE.
Testing a Single AIF message using technical mode
Go to AIF Monitor FINS_CFIN_AIF_IFMON – Interface Monitor and navigate to the interface that you want to test.
On the next screen enter into technical mode
Double Click on the message that you want to test with and then click Generate Test File. Take note of the file number created.
Now go to transaction /AIF/IFTEST – Interface Test Tool and select the test file from the File Number drop down (or leave blank to search for multiple messages).
Click Search and double click the file no in the bottom screen to activate the data as a selection.
Once the data is activated select the icon “Read Data” and from the next screen, select the icon Process in XML Run Time
Changing the message content
To test various scenarios you can change the message payload content using the interface test tool. Simply double click on a SRC_DATA structure and change the content of any field or internal table. In the example below the ACCIT table data can be changed. Be sure to install note 2615089 so that the tool does not short dump for structures with over 400 fields.
Testing a Single AIF message using Restart Option
One alternative to using run time configuration groups is to switch to synchronous mode in debug by setting a break-point in class at line 50
/AIF/CL_APPL_ENGINE_XML-/AIF/IF_APPLICATION_ENGINE~RESTART
Jump to line 58 when break point is reached.
You can re-start any AIF message using, for example transactions FINS_CFIN_AIF_IFMON, FINS_CFIN_AIF_ERR or /AIF/XML_RESTART to reach this break point.
Final Points
This is by no means exhaustive of the options available to test and debug AIF messages but based on my experience are the most straight forward to use.
Hi Marc,
Thank you for the detailed explanation. I was trying to debug the message from AIF/ERR monitor but the control moved to Background job automatically.
I did NOT see “Generate Test File” button in AIF/ERR monitor screen. Attached screenshot.
Thanks
Hi Vicky,
I suspect you probably have a missing authorization. Suggest you go to technical mode then run transaction SU53 to see if there are any missing authorizations reported and check with security team.
Thanks
Hi Marc,
I'm able to see the "Generate test file" after implementing the below note.
0002316097
Thanks
When trying to debug by entering a break-point in the Central Finance BAdI, it was executing a job instead. I debugged /AIF/IFTEST and found out it is looking for configuration group 401 instead of TST. /aif/cl_pers_config=>c_runtime_config_group-test_tool constant is set to 401 in form F_GET_RUN_CONF_FOR_TEST_TOOL (program FINS_CFIN_AIF_ACT_DOC_POST)
Hi Alfonzo,
Thanks for you comment. The blog was based on 1610 FP2. Since then SAP have made some changes. Runtime configuration group for the AIF test tool was hardcoded as TST, this changed if note 2597249 is in your system or you are on 1610 FP4 or higher.
Note 2578106 - Usage Restriction for Runtime Configuration Groups 400 to 499 has details.
I will update the blog details.
Thanks
Thanks! Very useful!
Hi Mark,
Is there a way to debug AIF messages that have been successfully posted?
Also is there any difference between the two methods that you have described for single processing of AIF messages .I know that the second one will process and post the document. Does the first also post the document after processing it?
Thanks.
Good Day,
Does /AIF/CL_APPL_ENGINE_XML-/AIF/IF_APPLICATION_ENGINE~RESTART trigger in case of External Interface that is Interface name FINCF -AC_DOC_EX and version 2 ) restart from /AIF/ERR ? I am trying to debug few message of this interface but no luck.
Thank,
Anil
To debug external interface messages, we can place the break-point in RESTART method of the Class /AIF/CL_APPL_ENGINE_STRU.
Thanks,
Anil
Is there an alternative to the 'trick' debug -> go to? When in productive, having that authorization is hard to get as debug -> go to is part of the debug-change authorization and that is not generally granted.
I am looking for an alternative to get into debugging, without having to do debug->goTo. The one about the runtime configuration groups is cumbersome and not feasible in production. Any help is appreciated.
Thanks!
Alfonzo
Hi Alfonzo,
This is not intended to be something that you perform in Production systems!. Instead, in Production I recommend that you go into technical mode of the AIF message, and then create a test file. In tcode /AIF/IFTEST - Interface Test Tool export the file to your PC, then run /AIF/IFTEST - Interface Test Tool in a test system and import the file, process it and it will end up in AIF monitor in the test system where you can debug etc.
Thanks
Thanks for the prompt answer, Marc. I am able to generate a test file from transaction /AIF/IFTEST but the part about "export the file to your PC and then importing in the test system":
here is what I do:
Sorry if I am asking something silly but I don't see a direct way of downloading / uploading.
Thanks!
Alfonzo