Editing XML in XI
Occasionally you may need to edit a complicated XML document. I realized I needed to do this for the input XML data for my How to Support Industry Standards in XI (Part I of III) – Interfaces of weblogs entitled “How to Support Industry Standards in XI”. We use a fantastic tool from Altova called XMLSpy for working with XML. Unfortunately, our license agreement only allows 1 concurrent user on the network. =(
I needed to edit an Open Applications Group (OAG) ProcessPurchaseOrder XML file. I didn’t want to do this with Notepad (sorry Microsoft) and I had to wait for my developer colleague , Yukai Shi (aka Captain Steven), to get out of XMLSpy so I could use it (gee… thanks Altova for policing use of your product so i was forced to use XI more). So instead of waiting, I wrote this weblog to show you how we can do this in XI.
- XI 3.0 SP14 Note: Pre-SP14 your gui will look slightly different.
- Existing XI Message Mapping
- Sample XML file
In general, I would not recommend using XI as an IDE for XML. For quick and dirty fixes Notepad or any text editor is fine for really simple XML files. But XI can also come in handy for viewing and maintaining values in your complicated XML files in a graphical format (i.e. table or tree).
- Navigate to your XI Message Mapping in the Integration Repository.
see my How to Support Industry Standards in XI (Part I of III) – Interfaces for instructions on how to create a Message Mapping.
- Navigate to the Test tab.
- Notice that an empty instance of the interface (i.e. ProcessPurchaseOrder) is available. From here, one can edit the various values of the fields using the table view feature of XI. This is essentially what I wanted to highlight. This feature of XI allows you to edit the values of any valid XML file in a graphical grid format.
What follows are the recommended steps for creating the appropriate input file for the testing section of my How to Support Industry Standards in XI (Part II of III) – Mapping.
- Please complete the 5 steps listed above.
- Notice that the “Value” column is no longer blank.
With the newly loaded example instance of the OAG ProcessPurchaseOrder, you can now generate an IDOC Information on IFR… “shell” in the Integration Repository.
- Check the results in the right-hand panel of the of the “Test” tab.
Note: Believe it or not, this is actually enough to create a Sales Order in my instance of SAP R/3 4.6C SD!!! But all the interesting (some may say important) items, like purchase order number, line item, part number, quantity are missing in the resulting SD document. Let’s go put those data points in our sample XML file…
- Maintain the values in the sample XML instance expected at runtime in the Message Mapping for “ProcessPurchaseOrder_OrdersOrders05”. We’ll use XI’s grid tool to populate our input file. Again, for more complicated XML files use XMLSpy, for something simple and well-documented like this example use Notepad. What follows is the sledgehammer-to-nail approach when all you need is a thumbtack. =P !https://weblogs.sdn.sap.com/weblogs/images/297/THUMB.jpg|height=25|alt=image|width=30|src=https://weblogs.sdn.sap.com/weblogs/images/297/THUMB.jpg|border=0!
- Navigate to: /ns0:ProcessPurchaseOrder/ns0:ApplicationArea/ns0:Sender/ns0:AuthorizationId
This value is extremely important as it must represent two valid things:
- the Partner in the ALE/EDI Partner Profile.
- the Customer in the SD Customer Master.
- Navigate to: /ns0:ProcessPurchaseOrder/ns0:ApplicationArea/ns0:Sender/ns0:ReferenceId
Enter Value: JG_TEST123 Any alphanumeric value will work here. Pick what ever you like.
- Navigate to: /ns0:ProcessPurchaseOrder/ns0:DataArea/ns0:PurchaseOrder/ns0:Header/ns0:PromisedDeliveryDate
Enter Value: 2006-03-28 Any date will work, I just like this date as it’s my birthday…
- Navigate to: /ns0:ProcessPurchaseOrder/ns0:DataArea/ns0:PurchaseOrder/ns0:Header/ns0:DocumentDateTime
Enter Value: 2006-03-28T00:00:00Z Same as above.
- Navigate to: /ns0:ProcessPurchaseOrder/ns0:DataArea/ns0:PurchaseOrder/ns0:Line/ns0:LineNumber
Enter Value: 0010
- Navigate to: /ns0:ProcessPurchaseOrder/ns0:DataArea/ns0:PurchaseOrder/ns0:Line/ns0:OrderItem/ns0:ItemStatus/ns0:Code
Enter Value: 001
- Navigate to: /ns0:ProcessPurchaseOrder/ns0:DataArea/ns0:PurchaseOrder/ns0:Line/ns0:OrderQuantity
Enter Value: 2
- Navigate to: /ns0:ProcessPurchaseOrder/ns0:DataArea/ns0:PurchaseOrder/ns0:Line/ns0:OrderQuantity/@uom
Enter Value: EA
Note: This should be the unit of measure associated with the material in the Material Master (MM).
- Navigate to: /ns0:ProcessPurchaseOrder/ns0:DataArea/ns0:PurchaseOrder/ns0:Line/ns0:OrderItem/ns0:ItemIds/ns0:ItemId/ns0:Id
Enter Value: BMW
Note: This value is extremely important as it must be a valid MM item.
Save your data
- The sample XML input file has been created and filled with the necessary elements for the SAP R/3 SD Sales Order. From here you have a choice:
- I recommend that you save the XML instance to your local file directory, as it will be used by a simple application that sends to your XI system.
I hope you found this info useful. It turns out someone is still in our 1-concurrent license of Altova’s XMLSpy , I guess I have to write more SDN Blogs or figure out other ways to get more out of XI….