How can we debug incoming XML message processing using SPROXY in Transportation Management?
It is useful for certain scenarios and feature development to be able to test and debug TM by injecting custom XML messages because the SAP Transportation Management (TM) is a service-oriented architecture and therefore the majority of communications between TM, ECC and other systems occur through XML messages.
Please follow the steps below in order to debug XML message processing using SPROXY in Transportation Management:
Getting Sample Message
First find the sample XML message similar to the XML message needed to be tested or debugged such as in ECC and create a sales order and send it to TM.
Or, another example, if the XML message causes a short dump, open the short dump in TA ST22 and search for a variable named ID_XI_GUID. This variable will hold the MESSAGE ID for the XML message.
You can find the messages by using two transactions it depends on your system landscape and configuration.
- For B2B (Business to Business) scenarios.
- A PI (Process Integration) server exists between the two systems. The PI server facilitates communication between applications.
- For A2A (Application to Application) scenarios.
- The two applications communicate directly with one another without the use of a PI server.
SXI_MONITOR (B2B scenario)
1) In TM, enter transaction SXI_MONITOR:
2) Now find the corresponding XML message for the sales order created by you.
3) Now click Display after selecting the message.
4) If the relevant XML message is an inbound message, navigate to XML Message > Inbound Message > Payloads, and double click > MainDocument ( application/xml ).
5) The XML message appears in Window 2. To download the XML in the window 2, click Download Window 2 (Shift-F7).
6) Give the permission to the program for accessing the file system. Save the file.
SRT_MONI (A2A scenario)
1) Enter transaction SRT_MONI in TM:
2) Find the corresponding XML message for the sales order created by you.
3) Now click the XML button after selecting the message:
4) At last, save the message
XML message Debug
Now as we have a sample message, we can simulate receiving it under your current user. It will allows us to trigger the debugger as the message will now be handled by your current work process.
1) Now please Enter transaction SPROXY.
2) Go to Enterprise Services Browser > SWCs > SAPTM SAP Transportation Management > Namespaces > www.sap.com/xi/TMS/Global > Object Types > Service Providers > Objects
you will see the TM XML requests there. Please Keep in mind that the name of the object should always differ from the XML request type name.
3) And now select the XML object needed to be debugged.
4) Now click the Test icon in order to open the test platform and Execute it.
5) Now load your XML file by clicking the Load file icon. Or you can also, click the XML editor icon in order to change to the XML editor. Copy and paste your XML to the editor.
6) Modify MessageHeader ID slightly by changing some characters [0-9A-F] because if it doesn't get modified then the system will consider it a duplicate and invalid message. Other ID's such as BaseBusinessDocumentReference also needed to be changed depending on the message and contents.
7) Now process the payload by clicking execute.
8) Now If you have set up breakpoints in the code, then the debugger should open at those breakpoints.
Note: The XML message changes will not be saved to the database. This is required while debugging because you can re-submit the same XML message repeatedly.
9) Therefore in order save the changes in the XML to the database, please click Extras > Trigger COMMIT WORK.