cancel
Showing results for 
Search instead for 
Did you mean: 

splitting a file into diffeerent files based on a field

Former Member
0 Kudos

HI ALL

Input structure:

RecordSet

Record(1..n)

F1

F2

Records with identical value in F1 should come in separate file .

For every different F1 value there should be a file.

How to acheive this ? HELP NEEDED/

Thanks a lot in advance

Manohar

Accepted Solutions (0)

Answers (1)

Answers (1)

aashish_sinha
Active Contributor
0 Kudos

Hi,

You can use the Mapping Patern Duplicating Subtree for this purpose. You need to right click on the target subtree and then you will find the option of Duplicate subtree. Then you will get the exact similar structure in target.

Now use the Graphical mapping to fill the target values depending upon your conditions (ie fields you want in target file if the condition is true) and provide the context object also. And then , create interface mapping as of ur requirement.

Hope this will help you.

Regards

Aashish Sinha

PS : reward points if helpful

Former Member
0 Kudos

I got the required target structure through XSLT mapping as

RecordSet

Record

F1-r

F2---

Record

F1-r

F2---

RecordSet

Record

F1-b

F2---

Record

F1-b

F2---

now i need to get these two record sets in separate files..how?

former_member194786
Active Contributor
0 Kudos

Hi Ram,

You can go for Enhanced Reciever Determination in case u know what r the possible values for the field F1. You can provide the condition like if (F1 = r) map it to Reciever 1.

Thanks and Regards,

Sanjeev.

Former Member
0 Kudos

Hi sanjeev

In this case there is only one receiver..

all the files should be sent to only one receiver.

former_member194786
Active Contributor
0 Kudos

Hi Ram,

In that case you can go for Enhanced Interface determination where you split the message in different interfaces of the same user. You can use the node function CreateIf. It will be like create the node Msg1 if the value of F1=r.

Similarly you can give condition for each message that you gonna create on the target side.

Thanks and Regards,

Sanjeev.

aashish_sinha
Active Contributor
0 Kudos

Hi,

That is what i said you. if this is the case, only into graphical mapping you can resolve it . no need to write an udf for that. earlier i thought you need two target structure and then you ned to route it to receiver depending upon the XPATH at receiver determination. Now use graphical mapping and map the output to target structure and then using context object, determine the receiver.

regards

Aashish Sinha

PS : reward points if helpful

Former Member
0 Kudos

Hi Aashish/sanjeev

I have already got the target structure as below through graphical mapping

RecordSet

Record

F1-r

F2---

Record

F1-r

F2---

RecordSet

Record

F1-b

F2---

Record

F1-b

F2---

Now how can i send these two recordsets in two diffeent files..can u please clearly explain me.

Manohar

former_member194786
Active Contributor
0 Kudos

Hi Ram,

You can use Advanced Interface Determination along with Multi Mapping. In this we will have n receiver interfaces in the Interface Determination. In the mapping we all the n receivers on the target side. This mapping we mention in the Enhanced Interface Determination.

Check out these links :-

http://help.sap.com/saphelp_nw04/helpdata/en/42/ed364cf8593eebe10000000a1553f7/frameset.htm

/people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible

It might be helpful. Now in the mapping for each message included on the target side, give a condition using

createIf fn :-

If F1 = r create Msg1 or

If F1 = b create Msg2 or

If F1 = a create Msg3

and so on.

Thanks and Regards,

Sanjeev.

Edited by: Sanjeev Shekhar Singh on Jan 2, 2008 6:59 PM

Former Member
0 Kudos

THANKS A LOT SANJEEV AND ASISH