Skip to Content
It was one fateful noon when I was faced with a problem of testing the mapping in my scenario. But luckily I was able to fix it the same evening. So what was the problem that I faced and how did I find the solution? Well that is what this weblog is all about.

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:

http://help.sap.com/saphelp_nw04/helpdata/en/dc/6b7f5643d711d1893e0000e8323c4f/frameset.htm

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.

image

A new entry named TESTXML was created with the required values for the field.

image

Now a little explanation on the various fields

OUTBOUND FILE TAB

  1. PORT : Name of the port
  2. Description: Description for the port.
  3. XML Format selection :
    1. Unicode (Default selected)
    2. SAP Release 46
  4. Directory: Specify the Directory where the XML file is to be created.
  5. 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.
  6. 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 don’t need them in this scenario.

Now for triggering the IDoc, go to transaction we19 and give the number for the existing IDoc.

image

Click Execute.

image

Now click on the EDIDC segment so as to specify the Receiver System Port

image

Specify the Port for Receiver by clicking the Search help button. Go to the XML File tab and select the Port TESTXML.

image

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.

image

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.

image

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.

To report this post you need to login first.

9 Comments

You must be Logged on to comment or reply to a post.

  1. Satinder Singh
    Another way would be to directly send the iDoc to IE. Now since you have not yet comepleted the configuration, message will most probably fail, but in the SXMB_MONI transaction from the payload you can download the XML file.
    (0) 
    1. Suraj S.R. Post author
      Yes that would have been a way. What I want was to generate the XML for IDOC from the R/3 system itself without touching XI server!!!!
      (0) 
      1. Anonymous
        Hi,
          Nice blog, but at times its a business Requirement and architecture Requirement to post idoc through t Rfc ports especially for ALE scenario’s. So in that case what should be done?
        I always use SXMB_MONI for the xml and save to my local disk.
        Regards,
        Anirban.
        (0) 
        1. Suraj S.R. Post author
          Thanks Anirban…
          As I have mentioned in the blog that this method is used when you have finished your design part and haven’t started the configuration. Hence for creating the XML file XML port. In fully completed ALE scenarios we can use tRFC ports. IDoc can be triggered from the R/3 and can be sent through the tRFC port.

          What I intended from this blog was to create XML file for an IDoc directly from the R/3 system without involving XI server.

          (0) 
  2. Sameer Shadab
    Good blog 🙂
    Maybe you could have tried this FM as well ‘IDOC_XML_DISPLAY’. All you have to do is pass the idoc number as input parameter.

    cheers
    Sameer

    (0) 
    1. Suraj S.R. Post author
      Thanks Sameer…
      Can you tell me whats the StyleID parameter in ‘IDOC_XML_DISPLAY’ used for? What should be its value?
      (0) 
      1. Sameer Shadab
        Suraj

        You can leave that parameter empty. Just pass the idoc number, i used that FM a lot in locally testing my XSLT mappings.
        Today i chanced upon another weblog which mentions the utilisation of this particular FM (by whoelse but the omnipresent Michal :))
        The specified item was not found.

        cheers
        Sameer

        (0) 
  3. Frank Jacobs
    Suraj,

    I have set up the scenario as described by you. Additionally I had to add a partner profile (type user) with WE20 to export the iDOC to XML.

    When running WE19 with this iDOC using the XML output port I receive the following message:
    “IDoc has been written in XML format in a file”, but I can not find my file in the directory specified in WE21 for the XML port.

    Any idea what goes wrong?

    (0) 

Leave a Reply