on 02-03-2012 6:43 AM
Hi All,
I have a requirement ,
Mapping rule is as follows:
sender structure
e1edp19
a
b
c
e1edp19
d
e
f
I have to pass only values from the second node of e1edp19 and this e1edp19 can appear multiple times (please quote from the second node , not just the second node all nodes appreaing after the first node
Regards
Hi,
Maybe you should look for a different approach? Is it really the sequence that identifies the node that you want to map? That E1EDP19 segment contains a QUALF field that tells you how to interpret that particular value - can't you use it in your mapping with an IF condition to get the right value from your IDoc?
However, if you still want a solution based on sequence, here is a little UDF that solves your problem:
int ccfound = 0;
for (int i = 0; i < inputTable.length; i++) {
if (ccfound == 1) {
if (inputTable<i>.equals(ResultList.CC)) {
exit;
}
else {
result.addValue(inputTable<i>);
}
}
if (ccfound == 0 && inputTable<i>.equals(ResultList.CC)) {
ccfound = 1;
}
}
It requires Execution Type "All Values of Queue" and a string array input parameter named inputTable.
Hope this helps,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the code , yeah we have this field based on Qualifier 004 , but the requirement is there are multiple e1edp19 segment with qualf =004 and first e1edp19 segment go into one segment (say A) in the target , rest of the eiedp19 segment values go into another segment (say B) and B repeats as e1edp19 segment repeats (i.e from second segment onwards)...
Hope the code does the the above logic will give a try and update you , thanks for your time.
Regards
Hi,
Now that you gave us more details, the coding changes a bit. UDF1, to get only values from E1EDP19 until the first context change:
int ccfound = 0;
for (int i = 0; i < inputTable.length; i++) {
if (!(inputTable<i>.equals(ResultList.CC)))
result.addValue(inputTable<i>);
else exit;
}
The other one to get values from the first context change to the end of the queue:
int ccfound = 0;
for (int i = 0; i < inputTable.length; i++) {
if (ccfound > 0)
result.addValue(inputTable<i>);
if (inputTable<i>.equals(ResultList.CC))
ccfound++;
}
Hope this solves your problem finally,
Greg
Hi,
>>>first e1edp19 segment go into one segment (say A) in the target , rest of the eiedp19 segment values go into another segment (say B) and B repeats as e1edp19 segment repeats (i.e from second segment onwards)...
means you want to pass first occurrence of node to one segment (say a) and remaining all occurences to another segment (say B). Am I right? If yes then use copyvalue(0) function to map Segment A and write UDF with execution type as "All values of Context" and use it in mapping the Segment B.
In the UDF, If you're calling it for first time i.e for the first context, suppress the result else add the input values as it is to the result. The UDF code looks something like this
Sample UDF code:
int count = 0;
String str = "";
str = container.getParameter("Param");
if(str == null){ // if the UDF is called for the first time
container.setParameter("Param", count);
for(int i=0; i<input.length; i++)
resultList.addSuppress();
}
else{
count = Integer.parseInt(str);
container.setParameter("Param", count++);
for(int j=0; j<input.length; j++)
resultList.addValue(input[j]);
}
Regards,
Priyanka
use copyValue standard function and specify the value as 1 it reads second segment value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
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.