on 03-19-2007 8:04 PM
Hello,
I have an IDOC structure like this:
<E1BPPRODUCTLINE SEGMENT="1">
<EAN_UPC_BASE>710980201761</EAN_UPC_BASE>
</E1BPPRODUCTLINE>
<E1BPPRODUNITPRICE SEGMENT="1">
<COND_TYPE>YIFF</COND_TYPE>
<EAN_UPC_ALTUNIT>710980201761</EAN_UPC_ALTUNIT>
<CONDITION_VALUE>0.7500</CONDITION_VALUE>
</E1BPPRODUNITPRICE>
<E1BPPRODUNITPRICE SEGMENT="1">
<COND_TYPE>YK30</COND_TYPE>
<EAN_UPC_ALTUNIT>710980201761</EAN_UPC_ALTUNIT>
<CONDITION_VALUE>41.0000-</CONDITION_VALUE>
</E1BPPRODUNITPRICE>
The EDI result should be like this:
<CTP>
<212>0.7500</212>
</CTP>
The CTP tag should exist for each product line, but the value in <212> for condition type YK30 depends on the value in condition type YIFF.
More specifically, if condition type is YK30, then what should be mapped in <212> is the condition value from YIFF if it exists.
How can I do this in XI?
Thanks,
Paula
HI,
It is very simple , write a UDF, with the input values are COND_TYPE,CONDITION_VALUE ..type queue.
for (int i=0;i<cond_type.length;i++){
if cond_type(i).equals("YK30"){
for(j=0;j<cond_type(j).length;j++){
if cond_type(J).equals("YKFF"){
result.addValue(CONDITION_VALUE(j));
break;
}
}
}
<b>Note :replace with "[]"</b>
COND_TYPE -
removecontext---\ UDF -
Splitbyvalue -- target node(212)
CONDITION_VALUE-----removecontext ---/
map the empty constant to CTP if the CTP node has the mor eoccurrences
Regards
Chilla
<i>reward points if it is helpful..</i>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Chandra,
It works the way you suggested. I just had to add a check for the EAN_UPC_ALTUNIT and it worked.
Points rewarded.
Paula
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Wojciech,
Thanks for your reply, you definitely pointed me in the right direction. Here is the code I wrote:
public void getConditionValue(String[] a, String[] b, String[] c, ResultList Result, Container container)
Map map = (Map) container.getParameter("values");
if (map == null){
map = new HashMap();
for (int i = 0; i<b.length; i++){
map.put(b<i>, c<i>);
}
container.setParameter("values", map);
}
result.addValue((String)map.get(a[0]));
}
I pass it the following:
a = YIFF (constant)
b = COND_TYPE
c = CONDITION_VALUE
COND_TYPE in my case has 7 context changes and YIFF appears 3 times.
I expected the function to return the value of YIFF everytime it occurs but it only returns the last one.
What am I doing wrong?
Thanks,
Paula
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Make an value lookup. Crete UDF function in which you will use HashMap and use COND_TYPE as a key and CONDITION_VALUE as value. Later get from this HashMap first based on key equal YIFF.
Regards,
Wojciech
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.