As Mr. Host Schaude already posted a blog regarding XML File input. Now i am describing here how to upload xml file if my Custom BO contains sub node ,with reference of Host’s blog.
Have a look , how to create a service integration via XML File Input.
Here I want to describe what steps need to be done if the data of a Custom Business Object shall be uploaded.
For this task we choose the service integration via XML File Input.
At the end we will be able to upload the data even periodically.
Step 1: Create the Custom Business Object
Here is a very simple Custom BO with some fields at the Root node and a sub node with a 1 to n multiplicity.
If you want not only a simple upload (= Create) but also an update (= Modify) you should provide an Alternative Key for the Root node.
There is even a navigation association based on a relationship code (which is a custom code list data type).
Have this Custom BO active before the next step.
Step 2 : Create an XML File Input Service
First choose from the context menu of the Custom BO the entry “Create Service Integration”.
Second in the upcoming window select the radio button “XML File Input” and press “Next”.
Now the fields for the basic information (e.g. receiving BO) are already filled. You may adjust only the integration name.
In the next window you can select the elements of the Custom BO which shall become part of the XML file so they can be uploaded.
As we want to do mass upload we set the flag “Mass Processing”.
Now we need to define how the Custom BO instance can be identified in case of update. For sub nodes this is done via a combination of fields.
Finally save the Service Integration and activate it.
A WebDAV folder is created which you need later to place the XML files in.
If you re-open the Service Integration you will be able to download the XSD schema definition from the “General” tab.
Step 3: Create the XML File
Use the XSD from above to create your XML files.
- One way (for Business Objects with only a Root node) is via Excel
- Menu Developer -> Click on Source -> Add the XSD via “XML Maps…”
- All entries with the red star are mandatory
- From the “MessageHeader” you need only the “CreationDateTime”
- In my example only the “MyFamily” root node is supported
- Another solution is to open the XSD in MS Visual Studio.
- From 2008 SP 1 on you can generate sample code in the XML Schema Explorer
- Make sure that you right click on the element typed the request
- In the generated code you delete from the MessageHeader tag all entries except the CreationDateTime tag
- In the List tag you will find all nodes and fields from your Custom BO.
- You may add or remove some tags for additional or superflous node instances
- You need to replace the sample data by your real data
- The third way I know is a commercial tool named Oxygen XML Editor
Now i want to describe XML file input if Your Custom business object has sub node.
Save this XML file. Open the Excel and go to the developer tab. Click on source -> click on xml map -> click on add browse and select your xml file.
Here i have taken an Example , In This i have one root node > UPLOAD and one sub node > PRODUCT
Once your file will added, your all elements will show in right side- just click on your root node ,drag and drop in the sheet.
Now your all elements will be on the sheet . your root node and your item node is now available in the sheet .
Just do one thing select your root element –means header part , copy the header partonly and select a single shell of excel and (paste special as transpose).
Once you paste it , delete the existing header element from sheet.
Now your excel sheet will look like this ->
Now We have to bind the header element from XML Source.
Now it is ready ……………………
Go to Developer Tab Export it in XML -Save it and Go to (Application And User Management) WOC Sub view -File Input and upload your xml file.