on 11-03-2009 3:02 PM
Hello Gurus,
I need help in message mapping. I have a requirement as below.
E1EDP01 segment contains many E1EDP19 segments
E1EDP19 segment contains QUALF, KTEXT and many other fields.
in the output field, for every QUALF = "002", I need the value of KTEXT of the same E1EDP19.
the output group is repeated per E1EDP01 (this is working fine)
The problem is that KTEXT segment is not coming in every E1EDP19, so the result is erratic.
the present code looks like
Qualf (context E1EDP01)--
Equals --
const-002 -- IF --Outputfield
KTEXT(context E1EDP01)--
I tried many other things as well, but result is not as expected
pls help.
Thanks
KQ
Hi,
Please use following mapping.
1. Use If then else.
u2022 If condition should be QUALF -->Map with default = constant value 002
u2022 If condition satisfies, then pass KTEXT --> Map with default
u2022 Else constant value Blank Space
2. Output of "If then else" -->Remove context -->Sort (descending Order) -->collapse context --> target field.
Please keep context of all fields E1EDP19.
Let us know output.
Warm Regards,
Gouri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gouri,
Thanks for the reply
There are couple of things
1) the context cannot be E1EDP19, cos there are multiple P19 segments in P01 and it should be done on P01, as the output is based on per P01.
2) the Qualf comes more number of times than KTEXT, so they are not "matching" at context level.
I tried and not as expected.
@pooja, already tried, mapwithdefault does not work as well..
all because of the mismatch..
any ideas from Useoneasmany??? function.. (I tried them, but may be "not properly")
thanks
KQ
Hi,
I am not sure why it is not working in your case. I developed same mapping and it is giving correct result.
Source Payload:
<E1EDP19 SEGMENT="">
<QUALF>002</QUALF>
<IDTNR/>
<KTEXT>A</KTEXT>
</E1EDP19>
<E1EDP19 SEGMENT="">
<QUALF>003</QUALF>
<IDTNR/>
</E1EDP19>
<E1EDP19 SEGMENT="">
<QUALF>003</QUALF>
</E1EDP19>
<E1EDP19 SEGMENT="">
<QUALF>002</QUALF>
<IDTNR/>
<KTEXT>SDN</KTEXT>
</E1EDP19>
Target field gets value as "SDN".
Is this your requirement?
Answers to your questions:
1) the context cannot be E1EDP19, cos there are multiple P19 segments in P01 and it should be done on P01, as the output is based on per P01.
Even if you are creating target based on line item level (E1EDP01), every E1EDP01 segment will have E1EDP19 and KTEXT with QUALF = 002. Also KTEXT of same E1EDP01 should go to target. Hence in your mapping context should be at E1EDP19 level.
2) the Qualf comes more number of times than KTEXT, so they are not "matching" at context level.
Map with default function will take care of this.
-Gouri
Try using format by example:
1. Use If then else.
u2022 If condition should be Output of format by example = constant value 002
First Input to Format by example will be QUALF --> map with default
Second Input to Format by example will be segment E1EDP19
u2022 If condition satisfies, then pass output of format by example
First Input to Format by example will be QUALF --> map with default
Second Input to Format by example will be segment E1EDP19
u2022 Else constant value Blank Space
2. Output of "If then else" -->Remove context -->Sort (descending Order) -->collapse context > Split by each value> remove context--> target field.
Please keep context of all fields E1EDP19.
Let me know where can i send you screen shots for the same.
-Gouri
All,
Thanks for your help.
Gouri's hints (FormatbyExample & context) helped alot.
but I could get the results with the same configuration as above (in my initial post), by changing the context & adding the "FormatbyExample" for both QUALF & KTEXT. Need not do all what is mentioned in Gouri's answer.
also, I think it is a type 'o' error in your second line to mention QUALF (instead of KTEXT).
thanks again
KQ
Use node function 'exists' and then use 'If then else' to check if the node doesnot exist pass a blank value for KTEXT .
This is just to prevent mismatch when you check QUALF value for 002 and corresponding KTEXT.
But while mapping to the output field, check if QUALF=002 and KTEXT != blank, then only create target field.
Edited by: nagarjuna _s on Nov 3, 2009 4:22 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> I tried "exists", but it did nt work. can you pls explain how to insert blank to KTEXT and continue to get the output.
>
Ideally the "exists" should work for your case but in case you are seeing issues with that,
you can try to use "mapWithDefault" function with the KTEXT to insert blank to KTEXT.
Pooja
whats is occurrence for E1EDP01 node?
Can you also provide a sample input and an expected output ?
Pooja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pooja,
Thanks for looking into it...
I have given the concerned part of the input as sample
1) <E1EDP01> - occurs multiple times (but thats not causing any issue)
2) <E1EDP01>...
<E1EDP19 SEGMENT="1"><QUALF>001</QUALF><IDTNR>81116080</IDTNR></E1EDP19><E1EDP19 SEGMENT="1"><QUALF>013</QUALF><IDTNR>00111016080</IDTNR></E1EDP19><E1EDP19 SEGMENT="1"><QUALF>900</QUALF><IDTNR>11T</IDTNR></E1EDP19><E1EDP19 SEGMENT="1"><QUALF>901</QUALF><KTEXT>1.000</KTEXT></E1EDP19><E1EDP19 SEGMENT="1"><QUALF>902</QUALF><IDTNR>92213047</IDTNR></E1EDP19><E1EDP19 SEGMENT="1"><QUALF>903</QUALF><IDTNR>422000</IDTNR></E1EDP19><E1EDP19 SEGMENT="1"><QUALF>002</QUALF><IDTNR>2216080</IDTNR><KTEXT>Mat desc BOX</KTEXT></E1EDP19><E1EDP19 SEGMENT="1"><QUALF>007</QUALF><IDTNR>8441000</IDTNR></E1EDP19><E1EDP19 SEGMENT="1"><QUALF>003</QUALF><IDTNR>822461067</IDTNR><KTEXT>HE</KTEXT></E1EDP19><E1EDP19 SEGMENT="1"><QUALF>011</QUALF><IDTNR>2211</IDTNR></E1EDP19>....</E1EDP01>
here in #2, if you notice KTEXT does not come in all E1EDP19 sements, my expected output is when QUALF = 002, I need the KTEXT. I tried different codes (and also the one in my initial question), but I am not getting the required output due to context changes etc...
pls help
Thanks
KQ
User | Count |
---|---|
88 | |
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.