‎2009 Feb 23 8:50 PM
READ TABLE internal table with KEY matnr = <fs>-matnr
werks = <fs>-werks
erfme = <fs>-erfme
lgort <> SPACE.
This code does not compile because of the lgort negative condition. Is there aonther wa I can find the index of the internal table meeting all of the conditions above?
‎2009 Feb 23 9:13 PM
You should sort the table in matnr, werks, erfme ascending and lgort descending, then:
READ TABLE internal table with KEY matnr = <fs>-matnr
werks = <fs>-werks
erfme = <fs>-erfme
binary search.If there is a record that has lgort NE SPACE, it will be picked, but if there is only a record with LGORT = SPACE, it will also be picked, so you have to check after the read the value of LGORT.
I am assuming that since you haven't stated otherwise, you are using a standard table.
Rob
Edited by: Rob Burbank on Feb 23, 2009 4:14 PM
‎2009 Feb 23 9:07 PM
May be this way
loop at internal table where matnr = <fs>-matnr
and werks = <fs>-werks
and erfme = <fs>-erfme
and lgort SPACE..
v_tabix = sy-tabix.
exit
endloop.
a®
‎2009 Feb 23 9:13 PM
You should sort the table in matnr, werks, erfme ascending and lgort descending, then:
READ TABLE internal table with KEY matnr = <fs>-matnr
werks = <fs>-werks
erfme = <fs>-erfme
binary search.If there is a record that has lgort NE SPACE, it will be picked, but if there is only a record with LGORT = SPACE, it will also be picked, so you have to check after the read the value of LGORT.
I am assuming that since you haven't stated otherwise, you are using a standard table.
Rob
Edited by: Rob Burbank on Feb 23, 2009 4:14 PM
‎2009 Feb 23 9:14 PM
Hi, Gregory.
Please try following
data: indx like sy-tabix.
Loop at it into it where matnr EQ <fs>-matnr and werks EQ <fs>-werks and erfme EQ <fs>-erfme and lgort NE ''.
indx = sy-tabix.
exit.
endloop.
write: indx.Hope will Solve out your problem,
Please Reply if any issue,
Kind Regards,
Faisal