cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping : 1Idoc to multiple XML files

former_member611341
Participant
0 Kudos

I'm receiving  IDocs from ECC , based on that I have to generate a XML and put it in a target directory.

Question: In IDoc, if one specific node occurs multiple times I need to generate multiple XML files. How can I achieve this?

Hope I'm clear with the question.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

  Not very clear at which level you need help, however it is a common question, check SDN for blogs on specific information

below doc/ links/ sub links may help you achieve it.

note : in the target structure, for the node that needs to repeat, you have to make the occurrence as (0..unbounded)

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/90dcc6f4-0829-2d10-b0b2-c892473f1...

http://help.sap.com/saphelp_nw73ehp1/helpdata/en/18/fa87311cea41e49dc9d931a3b67703/content.htm

http://help.sap.com/saphelp_nwpi711/helpdata/en/42/f3b31d48fb1bc8e10000000a11466f/content.htm

Regards

Vishnu

Answers (5)

Answers (5)

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

I recommend you, go to signature tab and in the target structure modify the occorrance to 0....ounbouded. Later go back to the signature tab and you will see that 2 additional nodes where added to the original structures - Messages and Message1. dont care about this because are dummy nodes that wont be send to the backend system

once you do this create map the node of the IDOC with the node of  Message1 of the target structure.

then you will need to change the mapping of each field. i reccomend you to use the standar funtion INDEX under constant Functions(if i not wrong).

every field should look like:

<field1>--->INDEX(0)---<rest of mapping>

the use of this function will allow you the get the value of the field for each time that the node of the IDOC repeat.

Try this and let me know.

Regards

Rodrigo

former_member611341
Participant
0 Kudos

Thanks for all you replies.

I'm following the below blog to do it, everything looks good so far and I could generate multiple files.

http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/04/09/multiple-idoc-segment-occurance-t...

For every 'subnode' occurrence in source, a XML file should be created. i.e. if there are 3 'subnodes' 3 XML files should be generated.

In below case I could  successfully generate multiple XML files:

But when I change the mapping of  'tg_fld1'  to 'src_fld1' , I'm getting an error: see mapping below ( circled in black ) ...

Below is the error :

Please advice. Thanks in advance !!

former_member184789
Active Contributor
0 Kudos

Hi,

The occurrence of subnode is 1, so why are u creating its duplicate. In order to generate multiple instances of target 'test_msg' which is unbounded, map it to a node which occurs multiple times i.e 'node' in ur source.

former_member611341
Participant
0 Kudos

Subnode Occurrence is N , not 1. I have attached a wrong image.

Here is the correct mapping screen shot:

Error Message:

        Cannot create target element /ns0:Messages/ns0:Message1/ns1:test_msg[2]/tg_node/tg_fld1. Values missing in queue context. Target XSD requires a value for this element, but the target-field mapping does not create one. Check whether the XML instance is valid for the source XSD, and whether the target-field mapping fulfils the requirement of the target XSD

See error logs for details    

Thanks !!

former_member611341
Participant
0 Kudos

I could resolve the error. I have changed the context for both 'subnode' and 'src_field' to 'test_source_org' .

Thanks for all your replies .

former_member184789
Active Contributor
0 Kudos

Hi,

Since the subnode  is mapped to target_msg & the field src_field is on upper level of subnode, You should use UseOneAsMany for this in which first input will be src_field & for 2nd & 3rd input input will be 'subnode'

praveen_sutra
Active Contributor
0 Kudos

Hi Aday,

you can map the specific Idoc node with the root node of the target field to genrate the same number of xml files.

PFB the link with similar scenario for clear understanding.

http://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=202080406

thanks and regards,

Praveen T

aashish_sinha
Active Contributor
0 Kudos

Hi,

Follow below blog for 1:N mapping for your requirement. You have to achieve this by multimapping.

http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/04/09/multiple-idoc-segment-occurance-t...

Regards

Aashish Sinha

ambrish_mishra
Active Contributor
0 Kudos

Hi Aday,

You can do multi-mapping (1:n) in PI to generate multiple files. There are multiple blogs on this topic. Concept remains the same.

Ambrish