cancel
Showing results for 
Search instead for 
Did you mean: 

UDF Requiremnt

Former Member
0 Kudos

Hi Experts

Please help me in this mapping through writing a UDF

My scenario is iDOC to File

we have to count the occurance of the Segment and than map the fields.

i have one iDOC WPDBBY01 and it has segment named E1WPBB03 which initself has one more segment E1WPBB04 in which we have field MAT_NR

This segment E1WPBB03 can repeat and as per the occurance i have to map the fields accordingly

Something of this sort:

(Target FIeld) Alt1_QTY --

Take the first occurrence value of MAT_QUAN from the iDOC segment E1WPBB04

(Target Field) Alt2_QTY --

if MAT_NR from E1WPBB02 is same as MAT_NR from E1WPBB04, then take the value is "0",

elseif E1WPBB03 has second occurrence value is MAT_QUAN from the second occurance of the segment E1WPBB04

else value is "1"

(Target Field) ALt3_QTY --

if E1WPBB03 has third occurrence value is MAT_QUAN from tjhe 3rd occured segment

elseif E1WPBB03 has two occurences then value is "1",

else value is "0"

(Target Field) Alt4_QTy --

if E1WPBB03 has fourth occurrence value is MAT_QUAN from the 4th occured segment elseif E1WPBB03 has three occurences then value is "1",

else value is "0"

So on till 8th occurance...and on the

ninth

(Target Field) ALT9_QTY

if E1WPBB03 has Ninth occurrence value is "1"

else value is "0"

Can you please help me in writing a UDF for the same in which i can count the number of occurance of the segment and can map the field acoordingly

points will surely be rewarded.

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

HI aquarian sharma

Now I am bit clear with your exact requirment as compare to your previous post.

Please see if the below code will be useful for you

here Input to UDF will be

MAT_QUAN,

(I hope from previous posts you are aware to create and use UDFs)

-


(Target FIeld) Alt1_QTY --

Take the first occurrence value of MAT_QUAN from the iDOC segment E1WPBB04

---> Just map MAT_QUAN ---> Alt1_QTY

Keep the occurance of Alt1_QTY as 1.

If its of multiple occurance then create UDf UDFAlt1_QTYand

write code as

result.addValue(MAT_QUAN [0]);

MAT_QUAN ---> UDFAlt1_QTY ---> Alt1_QTY

-


For further things can you please send me the exact whole structure of you IDOC so accordingly I could creaet UDF for you.

If you have imported IDOC in XI, then just open it and you will get one XSD tab, you could export it and send as and attachement to my mail id.

swarupsawant@gmail.com.

If possible could also share that whole structure details in forum, then many guyes could analyse it.

Thanks

Swarup

Former Member
0 Kudos

Hi Swarup

I have mailed you the structure.