on 12-07-2008 5:31 PM
Hello,
I looking for the way to use with first constant in <TEXT_LINE>
Until the <ItemNum> changing.
Here is the source:
<QuotationTexts>
<QuotationText>
<ItemNum>10</ItemNum>
<TEXT_ID>0001</TEXT_ID>
<TEXT_LINE>elad</TEXT_LINE>
</QuotationText>
<QuotationText>
<ItemNum>10</ItemNum>
<TEXT_ID>0006</TEXT_ID>
<TEXT_LINE>aaaaaa</TEXT_LINE>
</QuotationText>
<QuotationText>
<ItemNum>10</ItemNum>
<TEXT_ID>0005</TEXT_ID>
<TEXT_LINE>bbbbb</TEXT_LINE>
</QuotationText>
<QuotationText>
<ItemNum>10</ItemNum>
<TEXT_ID>0004</TEXT_ID>
<TEXT_LINE>ccccc</TEXT_LINE>
</QuotationText>
<QuotationText>
<ItemNum>20</ItemNum>
<TEXT_ID>0001</TEXT_ID>
<TEXT_LINE>peleg</TEXT_LINE>
</QuotationText>
<QuotationText>
<ItemNum>20</ItemNum>
<TEXT_ID>0006</TEXT_ID>
<TEXT_LINE>aaaaaa</TEXT_LINE>
</QuotationText>
<QuotationText>
<ItemNum>20</ItemNum>
<TEXT_ID>0005</TEXT_ID>
<TEXT_LINE>bbbbb</TEXT_LINE>
</QuotationText>
<QuotationText>
<ItemNum>20</ItemNum>
<TEXT_ID>0004</TEXT_ID>
<TEXT_LINE>ccccc</TEXT_LINE>
</QuotationText>
</QuotationTexts>
Here is what I'm expecting to accept to receive:
<QuotationTexts>
<QuotationText>
<ItemNum>10</ItemNum>
<TEXT_ID>0001</TEXT_ID>
<TEXT_LINE>elad</TEXT_LINE>
</QuotationText>
<QuotationText>
<ItemNum>10</ItemNum>
<TEXT_ID>0006</TEXT_ID>
<TEXT_LINE> elad </TEXT_LINE>
</QuotationText>
<QuotationText>
<ItemNum>10</ItemNum>
<TEXT_ID>0005</TEXT_ID>
<TEXT_LINE> elad </TEXT_LINE>
</QuotationText>
<QuotationText>
<ItemNum>10</ItemNum>
<TEXT_ID>0004</TEXT_ID>
<TEXT_LINE> elad </TEXT_LINE>
</QuotationText>
<QuotationText>
<ItemNum>20</ItemNum>
<TEXT_ID>0001</TEXT_ID>
<TEXT_LINE>peleg</TEXT_LINE>
</QuotationText>
<QuotationText>
<ItemNum>20</ItemNum>
<TEXT_ID>0006</TEXT_ID>
<TEXT_LINE>peleg</TEXT_LINE>
</QuotationText>
<QuotationText>
<ItemNum>20</ItemNum>
<TEXT_ID>0005</TEXT_ID>
<TEXT_LINE>peleg</TEXT_LINE>
</QuotationText>
<QuotationText>
<ItemNum>20</ItemNum>
<TEXT_ID>0004</TEXT_ID>
<TEXT_LINE> peleg </TEXT_LINE>
</QuotationText>
</QuotationTexts>
Thank you very much.
Elad
Hi,
Using following UDF you can achieve your requirement.
Put execution type = Queue.
1st parameter = TEXT_LINE tpye string.
2nd parameter = ItemNum tpye string.
Mapping
TEXT_LINE --> RemoveContext -->
UDF --> SplitByValue(Each Value) --> TEXT_LINE
ItemNum --> RemoveContext --> SplitByValue-->
(Value Change)
UDF
int j;
int cnt = 0;
for(int i =0;i < TEXT_LINE.length;i++)
{
for( j = i;j < ItemNum.length;j++)
{
if(cnt > 0)
{
j = j + 1;
cnt = 0;
}
if(ItemNum[j].equals(ResultList.CC))
{
cnt++;
i = j - 1;
break;
}
else
{
result.addValue(TEXT_LINE<i>);
}
if(j == (ItemNum.length - 1))
{
i = j;
}
}
}
-Rohit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I checked again this scenario and I found a problem:
The function work OK but forward with 2 numbers.
For example:
The <TEXT_LINE> of the <ItemNum> 150 in the source appear in correct way but in <ItemNum> 130 in the target.
Elad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I found here 2 options to solve my problem but they both not working:
1. Jag solution bring me the value __cC1_ after the second item.
2. Rohit solution work but bring the text line 2 item line before the time that need to be.
I tried all the good recommendations from the tread without succeed.
I'll be happy to hear more options
Elad
Hi Elad,
I have create a mapping using the SplitByValue and a small UDF to achieve the desired output structure.
I have uploaded the UDF as well as the screen shot of output generated in MM.
Here is the linke : http://picasaweb.google.com/pooja13pandey/SDNSAPComForum#slideshow
Code :
//write your code here
int j=0;
for(int i=0; i<item_num.length;i++)
if (item_num<i>.equals(ResultList.CC))
j=i;
else
result.addValue(text_line[j]);
Let me know if you still face issue in creating the desired output.
Thanks,
Pooja
Hi Elad,
I am providing one solution for your requirement.
Just go through the following screen shots and do the mapping as i specified.
http://picasaweb.google.com.au/jag.int/MappingSolution#
I have created only one UDF i.e GenerateConstant rest are Standard functions only.
Here is the code
al.add(new String(a[0]));
for(int j=0; j<a.length; j++)
{
if(a[j] == ResultList.CC)
al.add(new String(a[j+1]));
}
for(int k=0;k < al.size();k++)
{
for(int m=0 ; m < (Integer.parseInt(b[k])); m++ )
result.addValue((String)al.get(k));
}
Please let me know if you need further details about this mapping.
Thanks,
Jag
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Jag,
Thank you very very mach about your help.
I tried to implement this scenario and I received this error:
13:46:31 Start of test
Source code has syntax error:
L:/usr/sap/XID/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapea96fcb1c51d11ddae87001635c5b25f/source/com/sap/xi/tf/_PLM_Out_MM_.java:476: cannot resolve symbol
symbol : variable aj
location: class com.sap.xi.tf._PLM_Out_MM_
al.add(new String(aj+1));
^
1 error
Source code has syntax error:
L:/usr/sap/XID/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapea96fcb1c51d11ddae87001635c5b25f/source/com/sap/xi/tf/_PLM_Out_MM_.java:476: cannot resolve symbol
symbol : variable aj
location: class com.sap.xi.tf._PLM_Out_MM_
al.add(new String(aj+1));
^
1 error
13:46:33 End of test
Elad
User | Count |
---|---|
85 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.