I was doing an IDoc to File scenario, with all the design part complete and I was eager to test the mapping. But since the sender was IDoc, I had to either wait for the test data from the client or had to create it myself. I went for the second alternative, but was in a dilemma as to how to create it. I knew that it was possible to make XSD of an IDoc from the transaction, but I did not have an idea as how to create XML file which can be given as the input for testing the mapping
I started my research there. I went through some forum replies, weblogs, other sap sites, etc. But all those were of little help. It was by chance that I found a link in help.sap.com which talks about some XML port type for IDoc processing:
I started my search and went to transaction we21 Ports In IDoc Processing . There were different types of ports present there. Since my intention was to create a XML file for testing the mapping, I went for XML File Port Type.
A new entry named TESTXML was created with the required values for the field.
Now a little explanation on the various fields
OUTBOUND FILE TAB
- PORT : Name of the port
- Description: Description for the port.
- XML Format selection :
- Unicode (Default selected)
- SAP Release 46
- Directory: Specify the Directory where the XML file is to be created.
- Functional Module: To generate the file names, choose an appropriate function module using F4 Help. Its recommend that you do not use a static file name, since this file is overwritten each time a new IDoc is sent. SAP recommends that you use the function module EDI_PATH_CREATE_CLIENT_DOCNUM. Perform an access test for your directory.
- Outbound File: Here you can specify a fixed name for the file, in which the IDocs are transferred. As a result there is the risk that a file that has not yet been processed will be overwritten. For this reason SAP recommends the use of a function module which generates dynamic file names.
OUTBOUND: TRIGGER TAB
Leave all the fields blank. You dont need them in this scenario.
Now for triggering the IDoc, go to transaction we19 and give the number for the existing IDoc.
Now click on the EDIDC segment so as to specify the Receiver System Port
Specify the Port for Receiver by clicking the Search help button. Go to the XML File tab and select the Port TESTXML.
Now click on the Standard Outbound Processing Button. You can see that the Receiver Port, Port type and File name. Since the field Outbound file was left blank, functional module EDI_PATH_CREATE_CLIENT_DOCNUM created a new file name O_045_0000000000216547.xml.
Press the Check button and you can see that IDoc was sent successfully, unless otherwise some configuration errors are there.
Now go to the prescribed directory and select your file. Bingo!! You have the XML file which contains all the needed values for each field. Just import the file in the test tab of the Message Mapping, click execute and test your mapping.
This might not be new information for ABAP developers but from the perspective of a XI developer who has a little knowledge of ABAP, this should be of great help.