Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Import XML format IDOC to SAP

Former Member
0 Kudos

Hi guys. Please, does anyone know how to set up PORT for receiving an xml idco file and process the inbound idoc in SAP ? I know how to send an idoc in XML : IN WE21 I created a XML PORT (type XML FILE), have configured the RFC destination and I can clearly see the xml idoc files I have created that are store in a particular path of the system. Now I must receive xml idocs from legacy systems....Do I have to create a PORT to receive IDOCS ? In partner profiles (WE20 I see that for an inbound idoc I do not have to specefy a port, just a process code for the function module that process the idoc...So I do not know how to set up inbound xml idoc files. Can you help me on this one ? Also I found a function module called "IDOCS_XML_FROM_FILE" but how do I implement this with WE20/WE21 ? thanks !!!!!!

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
0 Kudos

You need to look into the function module EDI_DATA_INCOMING

Here is the function module documentation

Functionality

The function module EDI_DATA_INCOMING executes IDoc inbound processing for transferred IDocs which were imported from a file. That is, the IDocs are stored in the IDoc database and then inbound processing is triggered for every IDoc corresponding to the control configured. The control is essentially derived from the EDI partner profile.

The transfer of IDocs is made via a file, the name of which the function module determines from the parameters transferred.

Teamwork of both parameters for the determination of a file name:

If the parameter 'PATHNAME' has been transferred, this is used as the file name. If this is not the case, the name of the file to be used is determined from the port definition of the file port transferred in parameter 'PATHNAME'. The parameter 'PATHNAME' therefore overrides the parameter 'PORT' regarding the name of the file to be used. Also, when parameter 'PATHNAME' has been transferred, a valid port must always be transferred.

Example

The function module is used in the test program for IDoc inbound processing.

Usage example:

data: complete_filename like edi_path-pthnam,

portname like edipo-port.

  • Assign values to an actual parameter

complete_filename = '/usr/sap/C11/SYS/idoc/idocs.inb'.

portname = 'EDIPORT'.

  • Call FM

call function 'EDI_DATA_INCOMING'

exporting

pathname = complete_filename

port = portname

exceptions

others = 1.

4 REPLIES 4

former_member194669
Active Contributor
0 Kudos

You need to look into the function module EDI_DATA_INCOMING

Here is the function module documentation

Functionality

The function module EDI_DATA_INCOMING executes IDoc inbound processing for transferred IDocs which were imported from a file. That is, the IDocs are stored in the IDoc database and then inbound processing is triggered for every IDoc corresponding to the control configured. The control is essentially derived from the EDI partner profile.

The transfer of IDocs is made via a file, the name of which the function module determines from the parameters transferred.

Teamwork of both parameters for the determination of a file name:

If the parameter 'PATHNAME' has been transferred, this is used as the file name. If this is not the case, the name of the file to be used is determined from the port definition of the file port transferred in parameter 'PATHNAME'. The parameter 'PATHNAME' therefore overrides the parameter 'PORT' regarding the name of the file to be used. Also, when parameter 'PATHNAME' has been transferred, a valid port must always be transferred.

Example

The function module is used in the test program for IDoc inbound processing.

Usage example:

data: complete_filename like edi_path-pthnam,

portname like edipo-port.

  • Assign values to an actual parameter

complete_filename = '/usr/sap/C11/SYS/idoc/idocs.inb'.

portname = 'EDIPORT'.

  • Call FM

call function 'EDI_DATA_INCOMING'

exporting

pathname = complete_filename

port = portname

exceptions

others = 1.

0 Kudos

Thanks man.

Actually I tested that FM and for the PORT parameter I entered a XML port type name. Then inside this FM there is another fucntion that reads the port type, if the port is a XML type, then it executes some performs to convert form the xml file and save the idoc into SAP tables. Now I have other problem...but I will create a new question for that..thanks again !!!

0 Kudos

Hi Eduardo,

I am sorry to pick up a thread which is clearly quite old now but I am having a similar issue and wondered if you could help clarify.

Unfortunately I am not so technical at the Function Module side.

For an Inbound XML, do you have to create a normal "File" port and set the inbound directory in that? .. for the XML File port you can only set an Outbound file path

And regarding the FM mentioned "IDOC XML to IDOC" .. where do you place this FM moduel name so that it is run?

Many thanks for any tips

Lee

Former Member
0 Kudos

I am inclined to believe that the function module IDX_XML_TO_IDOC linked to the process code will enable receipt of an XML IDOC.