on 06-15-2010 11:28 AM
Hi SapAll.
i have got a requirement to create a multiple records in a file based on multiple segments at sending Idoc in a File To Idoc Interface.
the Scenario is the reciever message type is mapped with fields of 3 segments in sending IDOC.
SEG01 1.....1(PARENT SEGMENT)
SEG02 0...999999(CHILD SEGMENT)
SEG03 0...9999999(CHILD SEGMENT)
in an instance where if the SEG01 exists for one time and SEG02 exists for 2 times and Seg03 Exists for 2 times PI is creating the file with 2 records in it but
when if the SEG01 exists for one time and SEG02 exists for 2 times and Seg03 Exists for 1 time it is raising the error in message mapping where it is supposed to create 2 records in a file with empty values in the fields (mapping with seg03) segment.
can anybody help me in this.
regards.
Varma
Hi
before mapping you should check if the count of SEG2 and SEG3 are equals. if true just map the corresponding value to the target field. you could use IfWithOutElse with copyPerValue standard Functions
your requierement is not clear at all. wich value will be mapped to the target structure. please explain better.
Edited by: Rodrigo Alejandro Pertierra on Jun 15, 2010 4:04 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi .
as you said i must compare the occurance of both segments A and B ,if equal then i must make the no of records in the reciever file to be same as the sender Segment A.
I just want to know that how i can do this,how we can count the occurance of both segments,how to use if conditon and what the copy per value do
will be waiitng for your response.
regards.
Varma
Hi Rodrigo.
Thanks for the answer it seems like the condition you defined is working but i need to get one more solution from you if you can.
the problem is if both segments have got same count then iam creating the records in the reciever as per the count but if the count of both segments differ then in this Instance i need to create empty (message) or empty file in the reciever.
here i just worked with Equals and IF THEN ELSE conditions so can you help me in htis.
will be waiitng for your response.
regards.
Varma
you can create a UDF after you validate if the count match. if match you create the message if not, call de UDF.
this UDF should receive two parameters -->Queue SEG2 and queue of SEG3.
then you should loop by the count of SEG2. if you find a Supress Value in the queue of SEG3 add a "" to result. for example.
for(i=0;i<=SEG2.count;i++){
If SEG3<i>.equals(ResultList.SUPPRESS) {
result.addValue(" ");
}else{result.addValue(SEG3<i>);
}
the result of UDF is a queue which should map to target field directly coz it has context changes
I think that is what you are needing. if no let me know.
RP
Edited by: Rodrigo Alejandro Pertierra on Jun 17, 2010 11:56 AM
Hi,
You can try appending the node function mapWithDefault to SEG03 before doing any context manipulations with it.
Hope this helps,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You need to do the mapping correctly as per the requirement. Might be there is issue with the context changes . Please check for the context of the source and target nodes during mapping.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
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.