cancel
Showing results for 
Search instead for 
Did you mean: 

Complex requirement to generate record of file.

Former Member
0 Kudos

Hi Everyone,

I am working on Idoc to file scenario, and need to create line item on file based on below complex requirement.

The structure of IDOC is as follows:

Now the requirement is I need to check If segment Z1P1208 exists, if yes then need to check if E1P0001-->PLANS=E1P1005-->OBJID,

if true then I need to create (number of Z1P1208)*(number of E1P0001) records so in this case 2(Z1P1208)*3(E1P0001) i.e 6 records/line items in output file.

Please help me to achieve this.

Regards,

Sachi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Dubey,

Is the number of E1P1005 always the same as E1P0001? If yes, you have to create a UDF and pass the 3 parameters Z1P1208, PLANS (context of E1PITYP), and OBJID ( (context of E1PITYP). And create 2 loops and create code something like this.

for (int x = 0; X< Z1P1208.length; x++){

   for (int y = 0; y <PLANS.length; y++){

      if ( PLANS[y].equals(OBJID[y])){

            // add values you want to output using result.add().

       }

   }

}

Former Member
0 Kudos

Hi Jennilyn,

Yes in most of the times number of E1P1005 is same E1P0001, but at times when they are not equal we need not have to make records.

That is if E1P0001-->PLANS=E1P1005-->OBJID condition is not fulfilled record/line item need not to be made in output.

Regards,

Sachi

Former Member
0 Kudos

Hi Dubey,

Then create an if condition before calling the UDF:

If Z1P1208 exists AND E1P0001 (removeContext) -> count EqualsS E1P1005 (removeContext)-> count

Then, UDF.




Kind Regards,

Jenny



Former Member
0 Kudos

Hi,

I am trying this:

In getRecord the code written is:

String a = "false";

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

if(var1[i].equals("true")){

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

if(var2[j].equals("true")){

a = "true";

}

}

}

}

what I am trying is that these loops should return me number of true(here 6) so that createif will creat 6 records if it gets true from UDF.

but currently this code is returning me null. why?

Please suggest what is wrong.

Regards,

Sachi

Former Member
0 Kudos

It worked.

I missed result.addValue(a);

String a = "";

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

if(var1[i].equals("true")){

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

if(var2[j].equals("true")){

a = "true";

result.addValue(a);

}

}

}

}

Regards,

Sachi

Answers (0)