cancel
Showing results for 
Search instead for 
Did you mean: 

How to split outbound flat file/message to produce multiple Idocs?

Former Member
0 Kudos

I have the follwoing scenarion where flat file is passed to xi and and than xi do mapping and outputing Idocs based

on the file and based on mapping logic.

I have the following Input Stricture:


- <Header>
  <RecordType></RecordType> 
  <Field1></Field1>
  <Field2></Field2> 
  </Header>
- <Detail>
  <RecordType></RecordType> 
  <Ssn></Ssn>
  <Field1></Field1>
  <Field2></Field2>
  <Field3></Field3>
  </Detail>
- <Trailer>
  <RecordType></RecordType> 
  <Field1></Field1>
  <Field2></Field2> 
  </Trailer>

I WANT TO BE ABLE in Outbound File Adapter to split all the records so for ONE EMPLOYE and this way TO HAVE ONLY ONE IDOC generated from my mapping.

So With other word if my input flat file looks like this :


01Field1Field2    - this is the Header 
02111111111Field1Field2Field3
02111111111Field1Field2Field3 
02111111111Field1Field2Field3     6 detail records 
02222222222Field1Field2Field3
02222222222Field1Field2Field3
02333333333Field1Field2Field3  
03Field1Field2    - this is the Trialer 

where 01 Record type for header

02 Record type for Detail

03 Record type for trailer

111111111,2222222222,333333333 is SSN - Identifier for employee

My mapping is already done so one record can generate the right IDoc!

From this file I want to be able to GENERATE 1 SEPARATE IDOC FOR EACH EMPLOYEE!

So in the case above I will have to 3 Idocs - for Empl 11111111, 22222222, 33333333...

The number of record per employee will be handled by Idoc itself in the mapping - so this is not my concern.

I think if I can split somehow my file based on different employees and pass separate message to Adapter -

this wil lbe the easiest and clean way to do it.Than Mapping will generate separate Idoc for each employee and

I will not have to complikate my mapping.

Please let me know if think this can be done in Adapter in file content conversion and if it is possible - how.

Appreciate ASAP you reply!

Jon

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Check out this Blog: <a href="/people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change: IDOC bundling - the "trick" with the occurance change</a>, this could be helpful for your scenario.

Regards,

S.Santhosh Kumar

Former Member
0 Kudos

Santosh

This is excactly what I need to acheive .I hope this solution will work for me and will solve my problem. I am planning to go ahaed and try it now.I will let you know if it works. BTW - my mapping is already done and I do not want to change anything in mapping.

-Do you know if way would involve some mapping changes or not??

-If I do it this way -Are we sure that each generated separate Idoc will be in form where can be posted with no problems?

For all, in case this do not work - if someone feel and know other ways of doing it - please let me know..I am exploring all the options..

Thanks for your help!

Jon

Former Member
0 Kudos

ofcourse you need to change the mapping,reason being that you have changed the occurence of root node.

secondly it will work in your case,you will see one single XML in sxmb_moni with multiple IDOC's inside but in R/3 it will be posted as separate IDOC's

Thanx

Aamir

Former Member
0 Kudos

Aamir,

And how XI will know how many Idocs will have to generate based on Employess?Where is the logic for this ?What approach should I take to implement this logic?Please expalin this?

Thanks

J

Former Member
0 Kudos

Aamir,

Keep in mind that my SSN field is second in Detail record - the first on is Record type.This shouldn't matter I guess ....

Thanks

Former Member
0 Kudos

Hi,

Since you have created the Message mapping already,

1. Export the mapping as Mapping Template from the current Mapping object.(Select the Message Mapping, in graphical mapping editor, do CTRL + SHIFT + Right Click --> Tools -> Export Tools --> Export).

2. In the New Message Mapping object, select the source MT and target with the occurance change done.

3. Now import the Mapping template which was exported in the step 1, then change the occurance mapping for the Target node IDOC with the Node underwhich the employee field comes, so that the Number of IDOC generated equals the number of times the employee field's node occur.

Regards,

S.Santhosh Kumar

Message was edited by:

Santhosh Kumar Subramanian

Former Member
0 Kudos

you need to use formatByExample standard function to group all the IDOC's with same SSN together,once the occurence of IDOC has been changed to unbounded,XI will create as many IDOC's within a single XML as many different SSN fields you have,when its posted in R/3 it will be posted as a separate IDOC's

Thanx

Aamir

Former Member
0 Kudos

Santosh, Aamir,

Thanks guys , I am currently working on this and soon I am done will let you know how everything is going..

Thanks both !

J

Former Member
0 Kudos

Santosh

The idea that you gave me ( Michael's trick) worked great for splitting message to multiple Idocs.

It did the job and it did it great . Right now as Aamir said I am able to post many Idocs in R/3 generated from 1 message.

Of course I had to play with the mapping a bit .For me the right mapping was :

ssn->splitbyvalue(valuechange)->collapsecontext->idoc

For other interfaces of course it could differ.

Thanks a lot for your help!

Jon

Former Member
0 Kudos

Great News, Thanks for the update

Regards,

S.Santhosh Kumar

Answers (2)

Answers (2)

Former Member
0 Kudos

HI

With the logic given by experts above. I would like to add. If you want to have seperate IDOC sent to seperate applications. You can go for split mapping technique and employ seperate Reciever Determination in ID. This will send similar pay load to multiple IDOC and even seperate destinations.

Thanks

Gaurav Bhargava

Former Member
0 Kudos

Dear Jon,

from file to multiple idoc senario and setting kindly follow tha below links

http://www.sap-hefte.de/download/dateien/1156/100_leseprobe.pdf

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/877c0d53-0801-0010-3bb0-e38...

/people/prateek.shah/blog/2005/06/08/introduction-to-idoc-xi-file-scenario-and-complete-walk-through-for-starters - IDoc to File

**If useful then reward points**

regards,

Sumit gupta