cancel
Showing results for 
Search instead for 
Did you mean: 

UDF query

former_member183906
Active Contributor
0 Kudos

E1EDP01 and E1EDK01 are nodes of IDOC segment.

E1EDPA1 has parent node E1EDP01.

ZE1EDKT has parent node E1EDK01.

The occurrence of E1EDPA1 and ZE1EDKT are different in idoc. E1EDPA1 may come N number of times and ZE1EDKT may come M number of times.

Condition - The PARTN field has to be equal for both segments.E1EDPA1-PARTN where E1EDPA1-PARVW is 'RS'  AND ZE1EDKT-PARTN (Context E1EDK01) is equal then target field LIN has to be created. Target field LIN has parent SG25 which is mapped to E1EDP01.

If PARTN is matching 5 times,then 5 LIN segment should come.

Can you please help in UDF for it.

Accepted Solutions (1)

Accepted Solutions (1)

vinaymittal
Contributor
0 Kudos

1) make a udf 

2)three inputs E1ED_PARTN, ZE1ED_PARTN, E1ED_PARVW

3)Execution type all values of a context

4) Pass values after removecontext to the udf

for(int i=0; i<E1ED_PARTN.length; i++) //loop runs on E1EDP01 as the parent of target is mapped to E1EDP01

{

     if(E1ED_PARVW[i].equals("RS")

     for(int j=0; j<ZE1ED_PARTN.length; j++)

     {

          if(E1ED_PARTN[i].equals(ZE1ED_PARTN[j])

          {

               result.addValue("");

               break;

          }

     }

}

Mapp the udf's output to Target LIN

a)if 5 LIN's have to come in same parent dont use splitbyValue

b)if LIN's have to be generated one in each node than use splitbyvalue before mapping to target

Regards

Vinay

former_member183906
Active Contributor
0 Kudos

Hi

This UDF is not working as per my requirement.Its giving only 1st value of PARTN match.Can you please provide more inputs.

Regards

vinaymittal
Contributor
0 Kudos

can you share the screenshot of udf/DisplayQueue/Graphical mapping

former_member183906
Active Contributor
0 Kudos

Hi

ZE1EDKA2-PARTN (Context E1EDK01) values -

0000100532 - I want output for this in one node of output M1

0000100547 - I want output for this in another node of output M2

0000100532 is having 2 values and 0000100547 is having 2 values.

Current output is putting 0000100532 1st output in M1 and 2nd output in M2.

I need both output of 0000100532 to come in M1 node.

vinaymittal
Contributor
0 Kudos

for(int i=0; i<ZE1ED_PARTN.length; i++)

{

     for(int j=0; j<E1ED_PARTN.length; j++)

     {

          if(E1ED_PARTN[j].equals(ZE1ED_PARTN[i]) && E1ED_PARVW[j].equals("RS"))

          {

               result.addValue("");

               break;

          }

     }

     if(i+1!=ZE1ED_PARTN.length)

          result.addValue(ResultList.CC);

}

map this to the target field without using splitbyvalue or remove context. also share the screenshot of the graphical mapping you have done and the target structure with occurence

vinaymittal
Contributor
0 Kudos

Hi

Is the new code working for you

former_member183906
Active Contributor
0 Kudos

yeah,its working.thanks vinay

vinaymittal
Contributor
0 Kudos

Welcome

Answers (4)

Answers (4)

former_member183906
Active Contributor
0 Kudos

I will explain in detail.

The scenario is INVOICE IDOC to receiver xsd message.

Sender Invoice idoc is attached as "SCN Invoice.xsd"

Receiver message type -

Logic we have to put is -

Create an instance of S_LIN group for every E1EDP01 segment in the Idoc.ZE1EDKA2-PARTN field is in sender invoice idoc and fetch E1EDP01 which have sub-segments matching E1EDPA1-PARTN where E1EDPA1-PARVW is 'XY'.

Thus -

E1EDP01 and E1EDK01 are nodes of IDOC segment.

E1EDPA1 has parent node E1EDP01.

ZE1EDKA2 has parent node E1EDK01.

The occurrence of E1EDPA1 and ZE1EDKA2 are different in idoc. E1EDPA1 may come N number of times and ZE1EDKA2 may come M number of times.

Condition - The PARTN field has to be equal for both segments.E1EDPA1-PARTN where E1EDPA1-PARVW is 'RS'  AND ZE1EDKA2-PARTN (Context E1EDK01) is equal then target field LIN has to be created. Target field LIN has parent SG22 which is mapped to E1EDP01.

Any help in UDF will be appreciated.

Please save attachment as xsd file.

RaghuVamseedhar
Active Contributor
0 Kudos

Vijayant,

Please create UDF similar to Grouping section of this blog

apu_das2
Active Contributor
0 Kudos

Hi,

Can you please be more specific and elaborate your requirement so that I can try to help you.

Its very difficult to understand what kind of mapping are you trying to do.

Thanks,

Apu

sahithi_moparthi
Contributor
0 Kudos

Hi,

Can you please share your IDOC payload.