How to Upload Mass Data 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
Step 4: Create a File Input Run
Go to the “Application and User Management” -> “File Input”
and create a new run based on the previous created Service Integration.
Finally set it to Active (via “Actions” button), save, and close it.
Step 5: Upload your XML File to the WebDAV Folder
Switch to the “Unprocessed Files” query and press “Add” to add your XML file to the WebDAV folder.
Upload your file with the upcoming dialog
If you need this upload to be executed periodically you can also map the WebDAV folder to you system.
Now your uploaded file is listed under the unprocessed files.
Step 6: Schedule the File Input Run
Switch to the “Active Runs” query, select your File Input Run and press the “Schedule” button.
You can schedule it to start immediately or plan it for a later start or even run it periodically.
Via the button “View Jobs” you can verify if and when the job has been executed.
Step 7: Verify the Data
An OWL will now list the uploaded instances.
That’s all, folks.