‎2012 Jan 26 12:54 PM
Hello,
my requirement is to check multiple plants on saving the purchase order but I dont know how to compare several lines.
In Include ZXM06U43
Position 1 Plant XXX
Position 2 Plant XXY
Now I have to loop the internal table like wa_ekpo but how can I write the if-check for several lines comparing the first line?
Thanks & best regards,
Nino
‎2012 Jan 26 1:06 PM
Hi Vuckovic,
You can use this:
loop at it_ekpo into wa_ekpo.
If wa_ekpo-att1 = 'Position' and wa_ekpo-att2 = '01' or wa_ekpo-att4 = 'XXYX' .
Endif.
endloop.You can use sy-index inside the loop to determine which line has the same attributes (Position 01 XXYX) with the first one. You can change conditions according to your choice.
‎2012 Jan 26 1:01 PM
Do you want to check all other plants with the first line or subsequent lines such as 1 & 2, 2 & 3, 3 & 4 etc.??
you could loop at TEKPO and use a read table again on TEKPO to read at index with which u may want to compare
‎2012 Jan 26 1:06 PM
Hi Vuckovic,
You can use this:
loop at it_ekpo into wa_ekpo.
If wa_ekpo-att1 = 'Position' and wa_ekpo-att2 = '01' or wa_ekpo-att4 = 'XXYX' .
Endif.
endloop.You can use sy-index inside the loop to determine which line has the same attributes (Position 01 XXYX) with the first one. You can change conditions according to your choice.
‎2012 Jan 26 1:13 PM
> You can use sy-index inside the loop to determine which line has the same attributes (Position 01 XXYX) with the first one. You can change conditions according to your choice.
Just to correct you its sy-tabix and not sy-index
‎2012 Jan 26 1:28 PM
Hello Nino
You can use 2 variables. First one to store and keep value from first collumn and then you can start the loop comparing with varibalbes
Best Regards