on 07-23-2007 5:30 AM
Hi ,
I have an XML file which is having multiple headers with different filename and filetype and item fields. i have to generate multiple o/p files by getting the filename from the payload.here is my xml structure..
<RECORD>
<FILE1>
<FILENAME>
<FILETYPE>
<ITEM>
<ITEM1..>
<ITEM2..>
........
........
<ITEMN.>
</ITEM>
</FILE1> --->end of file1 and file is to be generated with dynamic file name from payload i.e from Filed 'FILENAME;.
<FILE2>
<FILENAME>
<FILETYPE>
<ITEM>
<ITEM1..>
<ITEM2..>
........
........
<ITEMN.>
</ITEM>
</FILE2> --->end of file2 and file is to be generated with dynamic file name from payload i.e from Filed 'FILENAME;.
</RECORD>
How to achieve this scenaio.
Thanks in advance.
Regards,
Srinivas
Hey,
This might help you
Dynamic File Name Part 1
/people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i
Dynamic File Name Part 2
/people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii
<b>Cheers,
*RAJ*
*REWARD POINTS IF FOUND USEFULL*</b>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi rajesh,
Thanks for the info.
I have gone through some blogs but a bit confused.
Take a sample scenario,where Dept name is the header value and emp name and num are the items in the input .in the input file , whenever deptname gets changed, a new file should be created with deptname as filename.
Pls give your input to achieve this scenario.
input file:
header1->CSE
ABC 123
BDC 234
CDE 456
header2->ECE
DEF 123
FCG 678
Regards,
srinivas
Hi rajesh,
Thanks for the info.
I have gone through some blogs but a bit confused.
Take a sample scenario,where Dept name is the header value and emp name and num are the items in the input .in the input file , whenever deptname gets changed, a new file should be created with deptname as filename.
Pls give your input to achieve this scenario.
input file:
header1->CSE
ABC 123
BDC 234
CDE 456
header2->ECE
DEF 123
FCG 678
Regards,
srinivas
Hi
This can be achieved using graphical mapping.You can use standard functions
Refer:www.help.sap.com
mapping -> standard functions.
regards
yugapreetha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
Any idea?
I found the below link but couldn't able to get the right point.
I tried above scenario with header record and item records but whenever header gets changed ,no new file is created and also in the first file only header and one record is generated. i am using variable substituion here.
My scenario is whenever header value i.e filename (in the header filed) gets changed, <b>file should be created with header field value with only item records.</b>.
Rgds,
Srinivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Srinivas,
ASMA does not work here (may be I made some mistakes). You need to use <a href="/people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible mapping with out BPM</a> and Variable substitution in receiver File adapter.
I have worked with similar requirement and this is how I managed to achieve the requirement.
Regards,
Jai Shankar
HI Jaishankar,
Thanks for your reply!
I dont want header details in the output file.I want to create a new file with only item records whenever filename (header field) value is changed.i am using variable substitution in recer CC but i am not using any mutlimapping.
Pls give ur valuable inputs to achieve this.
Regards,
Srinivas
>>>I dont want header details in the output file
What do you mean by details here? In the example XML you have provided, I dont see any details structure. If it is a node with some values, then ignore it in mapping. If I am wrong, give more details on what you mean by details.
>>>I want to create a new file with only item records whenever filename (header field) value is changed
Assumed, you have one file records with in a file node. If this is your requirement, the mapping can get complex. You need to use Node functions and play with contexts. Java mapping can be a option here if the logic gets very complex.
>>>but i am not using any mutlimapping
You need to use multimapping to create N msgs with out a BPM.
Regards,
Jai Shankar
Hi Jaishankar,
Below is my file structure.
<Source>
<Filename>
<File type>
<Item>
<Item1>
........
.........
<IteamN>
</Item>
<Source>
whenever 'filename' value gets changed..a new file shud be created.One more point is ,the above structure is same for file type = 'D' i.e data file.For file type 'C' ( control file)the structure is different from Type 'D;
The Input XML file contains multiple datafiles info and control file at the end i.e only one ctrl file.so based on 'filename' value change ,a new file is to be generated.
Regards,
Srinivas
Srinivas,
If I got your requirement correctly, you have 3 File types D(data), C(control) and I(Item) coming in the source XML. Of these D and I have same structure and C has a different structure? For each File (D or C or I) you need to create a FIle in target.
One qn.
In target do you have same strcucture for all 3 FIle types or 2 structures (similar to source) ?
If you have a single File structure, then you can use a xustom adapter module and achive this easily. In the adapter module, create a new node say <New File> and put a single file content with in this. If there are 2 files with same name, put them both with in a single <New FIle> node. Now in mapping, for every <New File> create a new msg (Use multi mapping to achieve this as shown in the blog).
For mapping the content take input with context set to oit parent node and do the mapping.
If you can understand this logic, it can be enhanced a little for 2 file structures at target too..
Let me know if you dont get the logic behind this...
Regards,
Jai Shankar
Hi Jaishankar,
Sorry, i have got only two file type info in input XML file.One is data file and another is Control file.Pls find the below example input str.
Filename filetype -> header
Rec1 -> Rec1 to RecN are the item records under the header.
Rec2
- -
- -
RecN
assume Filename value is 'datafile1' and type 'D'. so one text file is to be created with file name 'datafile1.txt' with content Rec1 to RecN without header data i.e filename and file type.
whenever filename value is changed to 'datafile2' ,then a new file shud be created with filename 'datafile2.txt.
at the end of these datafiles content ,i will get control data info with header has filename as'ctrl.txt' and type 'C'.this ctrl file stru could be different from above datafile structure.So my source and target data types would be combination of above two file types.
I think you got my requirement now.sorry if i confused you in earlier posts.
Regards,
Srinivas
Hey
you can acheieve this by using Multimapping and ASMA.
Thanx
Ahmad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.