cancel
Showing results for 
Search instead for 
Did you mean: 

XML to IDOC with occurrence 1...unbounded

Former Member
0 Kudos

Hi,

I have a scenario File (xml) to IDOC. My problem is that the Idoc Type that I have imported from SAP has an occurrence of 1...1, but I need of an occurrence 1...unbounded, because I want XI to map more than oen IDOC contemporanealy. My XML has a structure like this:

<users>

<user>

...

</user>

<user>

...

</user>

<user>

...

</user>

</users>

I want to create an IDOC for each <user> instance. I have already tried to use an XSD external definition that has the same structure of the IDOC in order to obtain an IDOC structure with 1...unbounded occurrence, but I receive an error from IDOC adapter in XI Monitor.

Thanks to all!

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Gabriele,

This is surely possible.

You are ont he right track when you changedthe occurence of the Idoc tag to 0 to unbounded.

This concept is called :"Idoc Packaging" and works fine.

Can you let us know what the error was in the MONI when you tried this?

Regards

Bhavesh

Former Member
0 Kudos

HI Bhavesh,

you are very competent! This is the error that I receive:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

- <!-- Call Adapter

-->

- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">

<SAP:Category>XIAdapter</SAP:Category>

<SAP:Code area="IDOC_ADAPTER">ATTRIBUTE_WRONG_INTF</SAP:Code>

<SAP:P1>MI_INBOUND</SAP:P1>

<SAP:P2 />

<SAP:P3 />

<SAP:P4 />

<SAP:AdditionalText />

<SAP:ApplicationFaultMessage namespace="" />

<SAP:Stack>Unable to interpret IDoc interface MI_INBOUND</SAP:Stack>

<SAP:Retry>M</SAP:Retry>

</SAP:Error>

Thanks!

bhavesh_kantilal
Active Contributor
0 Kudos

You have created an Inbound Interface containing this XSD and that is what the error is.

1. Use the idoc itself as the Inbound Interface.

2. In the interface mapping,<b> use the manual help to select the message mapping , make the Target message type as ANY</b> and you will be able to select the Message Mapping with the Idoc itself as the Inbound interface.

3. In the interface determination also make the Idoc as the inbound Interface and things will work absolutely fine.

This is a standard error all of us make I made the same mistake as well.

Regards

Bhavesh

Former Member
0 Kudos

Gabriele,

Would recommend you take a look into Michal's blog

/people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change

especially step 6.

Regards,

jai Shankar

Former Member
0 Kudos

Hi Bhavesh,

but... if I do this, how it is possible to generate one IDOC for each <user> instance? If I use the idoc structure imported from SAP, it has an occurrence 1...1 !!!!! Can You explain me more?

Thanks and regards!

bhavesh_kantilal
Active Contributor
0 Kudos

Gabriele,

Beleive me it works the way I have described it.

Change the Interface Mapping like i have pointed above

1.with the Idoc as the Inbound Interface, and mauual selection of the message mapping.and test it in the IR. You will find that the Idoc is still created with multiple IDOC tags.

2. Please note, that the Message Mapping will continue to use your XSD as the Target Message Type, just that the Interface Mapping will use the Idoc as the Inbound Interface.

The reason you should use the Idoc itself as the Inbound Interface in the interface mapping as the Idoc Name is used to load the Idoc Metadata in the Runtime and if you use your own Inbound Interface then the runtime will not identify this as an idoc and will not be able to load the Idoc metadata .

Make the changes as I have pointed and things will work the way they are supposed to!

Regards

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

I have solved, thanks to you!

Thanks also to all!

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

If you have imported the IDoc in XI, export the IDOC XSD on your local machine.

Edit that and change the occurence as follows.

From

<xsd:element name="IDOC" type="CREMAS.CREMAS03" />

to

<xsd:element name="IDOC" type="CREMAS.CREMAS03" maxOccurs="unbounded"/>

import this as external defintion in XI in your message mapping as the target message type.

and you are done..

If you need any thing more, let me know. It works..

you can create multiple Idocs from the single source message

Regards

Pushkar