cancel
Showing results for 
Search instead for 
Did you mean: 

Segment is not getting created in correct order

Former Member
0 Kudos

Hello All ,

I am having issue of segment getting created in correct order .Its a SHPMNT to VDA4913 mapping . In target there are 4 ,715  segment getting created based on the condition.

I have wrote a udf with 3 inputs. 3 input has diffrent condition .

udf code :


int var1=a.length;

int var2=b.length;

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

for(int j=0;j<var2;j++){
if(b[j].equals(a[i] )){


result.addValue(c[j]);

}
else {
result.addValue(ResultList.SUPPRESS);

}

}

}

in First input -- value is 10, 20, 30 .

2nd input -- 00, 10 , 20 , 30 .

When 1st and 2nd input matched 3rd input should consider.

Now 3rd input also have condition. When one X field value is S and Y field value is 2 , then 3rdt input should consider.

This mapping is absolutely working fine if there is only 010. But if there is more than 010 i.e 020 , 030 etc. then the probelm occur.

Suppose 3rd input is generate for 020 , then the segment is getting created for 010 . but the segment should get created in 010.

Please help me to solve this issue.

Thanks in advance

Accepted Solutions (0)

Answers (2)

Answers (2)

ambrish_mishra
Active Contributor
0 Kudos

Hi Rituparna,

One suggestion. Instead of detailed query, please give screenshots and briefly explain the issue with a test case with requirement.

Best way would be to give display queue screenshot of the UDF in the mapping with expectation explained.

Thanks

Ambrish

Former Member
0 Kudos

If 1st and 2nd input is matched then only 3rd one needs to consider. 3rd input based on 2 conditin match.

Input of the 3rd one is OP. it's not generating in order.

Here as you can see in Output segemnt is getting created for 010 . but it should get created for 020.

Hope this will help you Ambrish

ambrish_mishra
Active Contributor
0 Kudos

It doesn't Rituparna!

You have given the mapping done for a segment but not stated the requirement clearly. As SAP technical, I can guess from VGPOS condition that it is a case of batch split.

the screenshot shows POSNR(after VGPOS check) in one queue but POSNR coming with context changes so the loop will execute for 1st parameter with 6 values and second parameter with a value each. I hope you understand the concept of queues and context.

We also need to know what segment the fields are populated from and a good test case. Also you have use duplicate sub-tree for S_715 but not obvious from your screenshot.

you are using VELIN and SMGKN check and passing it on as constant.If that check fails, will you pass on a suppress?

Ambrish

Former Member
0 Kudos

Hello Ambrish ,

Yes I pass supressed in udf.

former_member518917
Participant
0 Kudos

Hi Rituparna,

The third queue is incorrect. It should be  as below to get the desired result

Suppress

<SomeValue>

Suppress

For that you need to correct the logic for 3rd input. You can provide the condition inside the UDF instead putting it outside of it.

....

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

for(int j=0;j<var2;j++){
if(b[j].equals(a[i] )){

     IF(<CONDTION>){       // cond for 3rd input
          result.addValue(c[j]);

     }

}
else {
result.addValue(ResultList.SUPPRESS);

}

}

}

Former Member
0 Kudos

Hello Ritu ,

Thanks for your suggestion . Itried to did so . But now it's givning Java out of memory exception.

int var1=a.length;

int var2=b.length;

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

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

if(b[j].equals(a[i] )){

for (int k = 0; k <c.length; k++)

    if(c[k].equals("S"))

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

            if(d[l].equals("2")){


result.addValue(e[j]);
}
else {
result.addValue(ResultList.SUPPRESS);

}

}

}

}

former_member518917
Participant
0 Kudos

Hi Rituparna,

Please check if any loop can be avoided. If all the inputs are coming from same segment then you can write as below (just 1 for loop)

int var1=a.length;

                    int var2=b.length;

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

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

                                        if(b[i].equals(a[i] )){

                                                  //for (int k = 0; k <c.length; k++)

                                                            if(c[i].equals("S"))

                                                                      //for (int l = 0; l < d.length; l++)

                                                                                if(d[i].equals("2")){

                                                                                          result.addValue(e[i]);

                                                                                }

                                                                                else {

                                                                                          result.addValue(ResultList.SUPPRESS);

                                                                                }

                                        }

                              //}

                    }

abhradeepbasu
Participant
0 Kudos

Hi Rituparna,

>>Suppose 3rd input is generate for 020 , then the segment is getting created for 010 . but the segment should get created in 010.

This is causing because of this statement -> result.addValue(ResultList.SUPPRESS);

Also please let us know your exact requirement on how do you want to generate your result value based on which context etc.

/AB