cancel
Showing results for 
Search instead for 
Did you mean: 

To create multiple data record based on the condition related with 2segment

Former Member
0 Kudos

Hi experts,

I am doing an idoc to file scenario whose idoc structre is given below

EIMARM(parent segment)

EAN11(field)

EIMARMM(child segment)

EAN11(field)

EIVKEMM(child segmnet)

VKORJ(field)

i have to generate datarecord for each VKORJ in E2MVKEM :If EAN11 is present in E2MARAM and if EAN11 is present in E2MARMM.

for ex:. if EIMVKEM segment come twice and EIMARMM SEGMENT 4 time then total 8 data records to be created.The E1MARM SEGMENT (first one) is the parent segment and it will come only once.

Please guide me how to proceed .Its bit urgent...............

Regards

Neha

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Vijay

I used the above udf using remove context funcion before giving the input it worked.But as I have mentioned I have to take only those E1MARM SEGMENT which have EAN1 field so i just put an if condition that

if EAN1(context change to upper lavel) exits

then take

E1MARMM after that ,same output of if coditon i am passing as the input to the udf along with E1MVKEM.the output is showing in display queue is correct but while creating record its taking value from those E1MARMM also which do not have ean1 field.I hope some context related problem plz guide me .

Regards

Neha

Former Member
0 Kudos

Neha, For this better to create the UDF with the folloing logic

1. Take the EIMVKEM & EIMARMM both as input parameters

2. Use queus as the UDF Type

3. first loop with EIMVKEM elements and inside that loop with EIMARMM elements then add the elements result.addValue( " " );

4. then you will get the required values in resultset

<b>Logic:</b>for(int i=0; i<EIMVKEM.length; I++)

{

if( EIMVKEM<i>.equals(ResultList.CC)) continue;

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

{

if( EIMVKEM<i>.equals(ResultList.CC)) continue;

result.addValue{“ “);

}

}

This logic takes 2 elements of EIMVKEM & 4 elements of EIMARMM then it give the output as 8 elemenets. if you need the context change then use the splitbyvalue node function to insert the context change for each element.

Warm Regards,

Vijay

Message was edited by:

Gangisetty Vijaya Bhaskarudu