How do I seperate a doc into multiple files?


I have a situation where I will be receiving an IDOC that has multiple files in it. Each file is seperated by EDI_DC. How can I loop through each IDOC, then publish each individual file?


You cannot break each individual IDOC automatically…Basically you have to loop thru IDOC and create a temp_IDOC document (with each EDI_DC40 init) and with in the loop publish it and drop the temp IDOC.

Another option would be you have to map each iteration of to target document (Canonical/EDI/XML depends on your requirement) and publish the canonical downstream etc…


Thanks for your response. But my question then is how can I distinguish within the loop? How do I tell the loop when to begin and end?

Basically in your custom subscribed service,you have to loop on /IDOC and map (one to one of each each segment/fields including EDI_DC) to a temp document called (extract_singleIDOC) and publish it at that moment and drop the temp and it continue next iterations which will perform same above steps and once all iterations done it will end the loop.So make sure you have all the individual publishes happened.

Sorry If I misunderstood your question above:


The thing is, we receive the document. In that document there are multiple records. Each individual record is seperated by a line that starts with EDI_DC. How can I seperate each record by this line?

I apologize for the ambiguity of my question before.

Thank you!

Are you receiving raw idoc file from SAP to a folder or ALE notification mechanism?

Basically you should first parse the receiving IDOC (subscibed in the subscribed service: and the document will have the IDOC list of documents.Make sense?