on 12-31-2007 6:03 AM
Hello experts,
I have a idoc to file scenario. the incoming Idoc can have multiple records in it and i have to map these records to a csv file. Now the problem is not all records has to be mapped to the file. Based on the value of a perticular file (which is not root), i need to decide if the entire record has to be processed or not. Like the idoc structure is say:
IDOC
E1WPA01 0....9999
E1WPA04 0...99
KONDART 0..1
Now for all valid E1WPA01 where the value of KONDART equals to some spacified value (known) , there has to be one record in the target csv file.
How can this be done at the root level?
One way of doing is we give empty values in the target file where the condition of KONDART is not fulfilled. Say if there are 10 records of E1WPA01 and only 4 satisfies the condition, we will ahve 10 records in the output file but only 4 records will have value and the rest 6 will be blank like (,,,,,,,). But I dont want this. I want only 4 records in the output file.
I tried mapping like this:
E1WPA01----
>Advanced -
> Root
E1WPA04-KONDART---->UDF
The problem i am facing here is if 4 records fulfill the condition, the first 4 are taken and the revelent 4.
Please help.
Regards,
Yash
HI,
U can do one thing:
Input a=KONDART take into one context.
write this UDF and map it to the root node of target file.
for(i=0;i<a.length;i++)
{
if(a{i}.equals("Specified Values"))
{
result.addValue("a{i}");
}
else
{
result.addValue("SUPPRESS");
}
}
Thanks and Regards,
Chiarg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chirag,
Root is not the place where I need to put the value of KONDART.
Root is the root of the target file and it has only to be created if that condition meet. There are other mappings to under the root node and all those mappings has to execute only on that condition.
The way which you have suggested gives me the same problem which i get with my UDF explained earlier. If condition is met 4 times, it will creat 4 root nodes irrestive of the record which fulfils the condition.
Help.
Yash
HI,
I have put the output just for generating the root node based on that condition u can try to pass the constant value as well.
I dont think it will create any problem in generating the output based on the satisfied condition.
Ur output will be for example:
Constant value
SUPPRESS
SUPPRESS
COnstant value
and the target node will be created twice.
During the mapping of
KONDART those value will be mapped whose condition is satisfied.
Can u please let me know the output of UDF.
Thnx
Chirag
Hi Chirag,
I wrote the following code in UDF:
for(i=0;i<a.length;i++)
{
if(a{i}.equals("Specified Values"))
{
result.addValue("a{i}");
}
else
{
result.addValue(ResuktList.SUPPRESS);
}
}
And its working partially. I mean the queue of the UDF looks like
1. AAAA SUPPRESS
2. <Specified value> <Specified value>
3. AAA SUPPRESS
4. AAA SUPPRESS
5. AAA SUPPRESS
6. AAA SUPPRESS
7. <Specified value> <Specified value>
8. AAA SUPPRESS
9. AAA SUPPRESS
and it creates 2 ROOT nodes. But the root nodes are created for line 2 and line 8 insteed of 7.
What can be problem??
Yash
Hi Chirag,
Even in child nodes i am getting for 2 and 8 as only those nodes are getting created. 2 is correct but note 8. AAA is any value which i dont need to be mapped.
Also i checked by giving the value of 3 input records to fulfil the condition and its giving me 3 output records where the first one is correct, in teh 2nd one its giving the next record (like 8th instead of 7th) and in the 3rd its giving the second next (like 10th instead of 8th).
Dont know where the problem is. But its following some sequence.
The exact code i wrote is (for root):
for (int i=0; i<KONDART.length; i++)
{
if (KONDART<i>.equals("ZKA2") || KONDART<i>.equals("ZKA3") || KONDART<i>.equals("ZKA4") || KONDART<i>.equals("ZKA5"))
{
result.addValue(KONDART<i>);
}
else
{
result.addValue(ResultList.SUPPRESS);
}
}
Yash
One more thing,,,,just wanted to confirm whether u have a problem with one condition or with all the condition...can u please test the code with only one condition and check the output in display queue.
Have made the changes which I have suggested...also send me the output of the same.
Waiting for both the results.
Thnx
Chirag
Hi Chirag,
Ok that sounds good to me. Let me complete the entire scenario and test it end to end and see what the result is.
I have another question, if you can please help me answer that:
I have 1 idoc and i have to send 2 files out of this 1 idoc, both compeletely independent of each other. What I have done is created two message mapping and everything else in IR. But when I create Receiver determination in ID for the second one and give the same sender interface (as the idoc inteface), it says the object already exists. How can i overcome this??
thanks,
Yash
Hi,
Its not only 2 different receivers but 2 different mappings too. Like1:n mapping. The sender interface is the same (same IDOC). So i cant have muliple receiver determination or interface detyermination in ID.
I didnt think in this much and did seperate mapping for both. One solution is to do 1:N mapping in message mapping (give both the message types in target message). But that will make me do all the mappings all over again. Lot of manual work. Is there any other better way??
Yash
HI,
If u r using two mapping then ur scenario become independet of each other but if u wnated to use only one mapping then u need to go for 1:N mapping and use conditional receiver.
I dont think there is any workarround for the same.
Have ur previous problem solved. if yes then please close the thread and let me know the result as well.
Thnx
Chirag
Reward points to helpful answers.
Hi chirag,
I was using 2 different mappings and I wanted it to be independent of each other but the problem which i faced was will creating receiver determination. When I gave the same sender interface (same idoc), it said, object already exist.
i have created a new communication channel as well as receiver agreement. Can i now use the same interface determination and receiver detmination for this 2 diffenet message or the only way i ahve in 1:N mapping?
I am asking you this in this thread ebcause unless i complete the full scenario i cannot test it and and close the issue.
Thanks,
Yash
Hi chirag,
Both the issues are solved now and i am abale to get the desired result. Thanks for your support.
Regading breaking information from 1 idoc to 2 files, i used two independent mappings and used 2 rows in interface determination.
Regarding the main problem, well the coding for the ROOT as i showed you last week was correct. The problem was in the handelling of context in one of the other field in the file. Actually one segment in the incoming idoc can appear mutiple times (which is dymanic). I have to write another advanced UDF to handle this and now its working perfect for all scenarios.
Thnaks once again. I hae awarded points to you.
If i have any other doubt, i hope i can get in touch with you.
Regards,
Yash
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.