2009 Feb 17 6:31 AM
Hi,
How can I read internal table with key not equal to some other field.
Basically in read statement we can read only fields equal to others fields.
2009 Feb 17 7:55 AM
Read statement does not provide you with this flexibility of providing key with not equal to.
Instead what you can do is use
You need to sort the table according to your key.
SORT ......................
LOOP at it_itab into wa_itab where field ne field.
your code here.
since in read only the first entry of given keys is fetched write an exit after your code.
EXIT.
ENDLOOP
This might serve your purpose.
Thanks & Regards,
Lalit Mohan Gupta
Hi,
How can I read internal table with key not equal to some other field.
Basically in read statement we can read only fields equal to others fields.
2009 Feb 17 6:32 AM
2009 Feb 17 6:34 AM
Shilpa,
sort itab1 by vbeln.
loop at itab1
read table itab2 with key vbeln = itab1-vbeln. binary search
if sy-subrc = 0.
your logic
endif.
endloop.
the read statement of itab2 will read the Sales order details w.r.t the sales order in itab1.
K.Kiran.
2009 Feb 17 6:35 AM
Its Not possible....in read statement at atime we can pick up only row!!
we can pick up either the least value...u can use
select ..end select
regards
sas
2009 Feb 17 6:37 AM
Read internal table with key field1 = another field binary search.
If sy-subrc NE 0.
UR code....
Endif.
2009 Feb 17 6:37 AM
Hi,
I think you can't use not equal in Read Table Because there might be possibility for more than one Record in this way so you must Specify Key Equal to Get one Record,
It work Just like Select Single.
Kind Regards,
Faisal
2009 Feb 17 6:39 AM
HI,
You can sort the itab by the required field. and use loop and endloop
sort itab by field1.
loop at itab.
if field1 <> 'value'.
<your Logic>
endif.
endloop.
2009 Feb 17 6:39 AM
Hi,
Test the following Code you can Use Loop at for this But not Read Table
DATA: BEGIN OF it_test OCCURS 10,
f1(4),
f2 TYPE i,
f3(2),
END OF it_test.
DATA: it_test2 LIKE STANDARD TABLE OF it_test WITH HEADER LINE.
it_test-f1 = '1000'.
it_test-f2 = 10.
it_test-f3 = 'B'.
APPEND it_test TO it_test.
it_test-f1 = '2000'.
it_test-f2 = 10.
it_test-f3 = 'A'.
APPEND it_test TO it_test.
it_test-f1 = '1000'.
it_test-f2 = 10.
it_test-f3 = 'B'.
APPEND it_test TO it_test.
it_test-f1 = '1000'.
it_test-f2 = 10.
it_test-f3 = 'A'.
APPEND it_test TO it_test.
it_test-f1 = '1000'.
it_test-f2 = 40.
it_test-f3 = 'A'.
APPEND it_test TO it_test.
LOOP AT it_test INTO it_test WHERE f3 NE 'A'.
WRITE: / it_test-f1, it_test-f2, it_test-f3.
ENDLOOP.Kind Regards,
Faisal
2009 Feb 17 6:40 AM
Hi,
No READ statement will not work in that case.
Instead use:-
loop at itab.
if <itab-field1> ne '<value>'. "your condition
"your code
endif.
endloop.
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir
2009 Feb 17 6:41 AM
Hi,
Use
Loop at itab into wa_itab where (ur not equal condition).
Delete itab where field = wa_itab-field.
Endloop.
2009 Feb 17 7:55 AM
Read statement does not provide you with this flexibility of providing key with not equal to.
Instead what you can do is use
You need to sort the table according to your key.
SORT ......................
LOOP at it_itab into wa_itab where field ne field.
your code here.
since in read only the first entry of given keys is fetched write an exit after your code.
EXIT.
ENDLOOP
This might serve your purpose.
Thanks & Regards,
Lalit Mohan Gupta
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |