on 09-20-2007 3:57 PM
Hi ,
I have source xml file which has multiple records in it and I want to get multiple seperate flat files for it.
this is my source structure
<root>
<Header1 fld1=1234 fld2="name1" fld3='SAP1"
fld4='000" fld5=0 fld6="sdn1"></header>...............no line items here
<Header2 fld1=123 fld2="name" fld3='SAP"
fld4='00" fld5=0 fld6="sdn" ><line fld7=value1 fld8=value2 fld9=value3 /line><line fld7=value4 fld8=value5 fld9=value6 /line></header>.....two line items here
<Header3 fld1=123 fld2="name" fld3='SAP"
fld4='00" fld5=0 fld6="sdn" ><line fld7=value7 fld8=value8 fld9=value9 /line></header>......one line item here
Header4 fld1=12345 fld2="name2" fld3='SAP2"
fld4='0006" fld5=01 fld6="sdn2"</header>.......no line items here
-
-
-
</root>
I am trying to get flat files as many time the <b>header</b> values occur that many target files should appear in the target.
like
file1:
1234name1SAP10000~sdn1
file2:
123nameSAp000~sdn
value1value2valu3
valu4value5value6
file3:
123namesap000~sdn
value7valu8value9
file4:
12345name2SAP2000601~SDN2
here I have 4 headers so i need to get 4 output files ,similarly for 'n' headers I need to get 'n' output flat files. the above mentioned source xml file is just one file,like that I might get somany sourc xml files which has similar structure in it.
and also it is important to get the line items,if exists to the header, for the corresponding headers.
how can I achieve this?do I need to use BPM or any mappings other than Graphical?
please suggest me.
thank you.
Babu
sorry,output file structure changed
Babu
Babu,
Your source is fine. We can achieve it without using BPM and using simple Graphical mapping. But the main concern is give the exact output u needed as per ur source structure given.
What is that value1value2value3 where u are getting this value from the source?
Give the exact o/p needed as per ur source given, so that it would be easy for us to suggest.
raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raj,
basically I have the source structure like this
<root>
header (1.....unbounded)
|
|----LINE(0.....unbounded) (note: line is substructure of heade not at the same level of Header)
</root>
so LINE items might happen or might not ,if LINE happens in the header then output flat file should have all lines(multple times depending on the number of times they occr in the source),if not then just the header values in the target structure.
any idea now?
Babu
The files(1,2,3,4...) are my target files with the structure mentione under it.
file1:
1234name1SAP10000~sdn1(header only no line items)
file2:
123nameSAp000~sdn(header)
value1value2valu3
valu4value5value6(two line items)
file3:
123namesap000~sdn(header)
value7valu8value9(one line item)
file4:
12345name2SAP2000601~SDN2(again no line items ,just header)
hope clearer now.
thank you,
Babu
Babu,
See the Mapping and the logic.
Make sure your target message occurrence:http://www.flickr.com/photo_zoom.gne?id=1412748793&size=o
Check out for source and target structure
http://www.flickr.com/photo_zoom.gne?id=1412748803&size=o
http://www.flickr.com/photo_zoom.gne?id=1412748809&size=o
http://www.flickr.com/photo_zoom.gne?id=1412748815&size=o
http://www.flickr.com/photo_zoom.gne?id=1412748825&size=o
Results:http://www.flickr.com/photo_zoom.gne?id=1412748799&size=o
Note:
While creating Interface determination choose it as Enhanced/Extended
The Receiver Content conversion - For field separator and line separator give 'nl' , coz we concatenated all of them using ~ in mapping.
If you find any discrepancy in the above logic , please let me know.
raj.
Raj,
thank you very much for your help,I really appreciate your effort in this regard.
but
1)does this generate multiple files for every occurence of the header values?
2)"~" mentioned are just for example delimiter .but in my actual scenario I need fixed lengths.
3)and attributes you have mentioned are not mandatory they are optional in my actual scenario.
and while looking at your screen shots I got another thing in my mind ,
based on this link /people/narendra.jain/blog/2005/12/30/various-multi-mappings-and-optimizing-their-implementation-in-integration-processes-bpm-in-xi
and approach can generate multiple target files from just one source file and I want to try without BPM.
what do you say?
thank you,
Babu
Raj,
are you talking about the approach in the link
/people/narendra.jain/blog/2005/12/30/various-multi-mappings-and-optimizing-their-implementation-in-integration-processes-bpm-in-xi
or in your approach?
if you are talking about the link then ,can I achieve my target mutliple files without BPM or do I need BPM?
thank you,
Babu
Babu,
You can follow the approach which I suggested, hope fully if i'm not wrong!!
Babu, Multimapping will split the messages and send it to the receivers as separate message. If you don't want to concantenate then use the concept for splitting the messages alone and do the rest in content conversion. It's like normal File to File, only thing is u have to choose Extended Interface determination.
Start and give a try, if it doesn't helps, let us know. You can't use Multimapping for IDOC/HTTP rest all the receivers can use Multimapping.
raj.
Hi Raj,
I am able to get the just one out put xml file for the multiple header values ,but it able to split the structure in the required format when I have done the map as shown in the link,not able to convert into multiple flat files.
http://www.flickr.com/photos/13958044@N06/1417550095/
and I have used just standard interface determination.when I tried to use Enhanced Interface determination it doesn't give me any input values,greyed out.
so I tried to change the MM and go to Message tab and then changed my target occurence to 0---unbounded and it inserted "message1" in the map,I dont know why.at this point also it doesnt give me any in the interface determ.greyed out.
with standard Inter Determ ,it gives just blank valu in SXMB_MONi after MM step.
and I have defined my target structure just one MT with substructures in it,do I need to define MTs like header_Mt,clm_MT,clm_ln_MT seperately and if so how can I incorporate them into one Message map?
I think I am doing some where wrong.
please guide me..
thank you,
babu
>>the reason purposefully Noted in the image is to make the target occurrence to 0..Unbounded
if I do that it inserts another level like "Message1" just below the top node in MM ,is this ok?
yes ,in the Interface determ its greyed out.even it doesnt give me any input when I use help option.
what about my target structure is that ok,if I create the structure as one and substructures?
and in the map I make occured the MT to repeate as many times as my header occures in the source by mapping between them.
thank you.
>>if I do that it inserts another level like "Message1" just below the top node in MM ,is this ok?
Yes Its ok. But while testing when u keep the source file in the folder you need to remove the Messages element from the file. That we can see later.
Ok the next thing did u changed the occurrence for Interface mapping too? Please change the occurrence for target Interface in Interface mapping. Now try it, I'm sure you will see the interface mapping in Interface determination.
raj.
Babu, try this, will also work:
create multiple inbound interfaces (on receiver side). create mapping for each - one (always the same source interface to one target).
In Configuration:
For each file create independent file receiver adapter.
Create multiple interface determination - each for each file.
Create multiple receiver agreements. (each target interface, other file receiver adapter).
Other objects are same as in simple scenario.
This approach let's you create multiple files and each can have different structure, because of separate receiver adapters.
Peter
Babu,
I don't know how u did the mapping? Can u confirm whenu run the test in message mapping u are getting the desire output. Babu see u need to split the message on root node level. I mean as many headers are there as many root messages needs to be created. As I discussed in my earlier messages.
Can u show the result message of the Test message results in Mapping editor.
raj.
Peter,
please look my target output requirement ,my first messages.
we can get the multiple message,but it creates different files with for each target MI we create.
lets say ,i have header(1--unbound)
| Trailer(0--unbounded)
I can create a o/p files one for header and other for trailer but that is not my requirement,
I want multiple files as many times as header occures,containing both header values as well as trailer values,multiple trailer values if header has multiple trailer values.
may be confusing..difficult to explain in words though.
what do you suggest now ?
Raj,
I am trying different options with the message mapping.I will update .
looks like going to work out.
______________________________________
Update:
Raj it worked,I could able to generate multiple files as many times as the header line occurs.but,is there any way I can add key field values to the header and line values in the receiver file adapter?cos,I want to differentiate the header and the line values,at the beging of the values, in the output files by specifying some key(01 etc) or a value?
I can add an extra field in the inbound interface and hard code something like HEADER,LINE(assign CONSTANT function in MM) ,but can we handle key field in the receiver file adapter too?
Raj, if u want to create 100 files of 2 types, u need only 2 communication channels. Of course, if u want to create 100 different fule types, u have to create 100 comm channels. However, this way u can produce different file types (diff struct) from 1 source message. With multimapping & 1 comm channel u cant. You'll have to always foolow this 1 struct.
Peter
p.s. however, ur right, in this case this isn't the right solution
Message was edited by:
Peter Jarunek
infact req changed from what I have asked in the "UPDATE" above.
now,we want to get target files like this ,for the above corresponding source values
file1:
1234name1SAP10000~sdn1
file2:
123nameSAp000~sdn
LINE01value1value2~valu3
LINE02valu4value5~value6
file3:
123namesap000~sdn
LINE01value7valu8~value9
file4:
12345name2SAP2000601~SDN2
I opened another thread for that
even the problem in the link solved
thank you,
babu
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.