2008 Jun 03 2:27 AM
Hi guys,
I have an internal table like this :
Notru_id Remtype
NOT1 8000
NOT2 8000
NOT2 8100
NOT3 8000
where the key field is Notru_id ie : not1 , not2, not3 etc.
Now i want to filter this table such that i get all records of one Notru_id into another internal table and process t\it.
A select query can't be used since it is an internal table.
Please suggest.
Thanks and Regards,
Gayathri
Hi guys,
I have an internal table like this :
Notru_id Remtype
NOT1 8000
NOT2 8000
NOT2 8100
NOT3 8000
where the key field is Notru_id ie : not1 , not2, not3 etc.
Now i want to filter this table such that i get all records of one Notru_id into another internal table and process t\it.
A select query can't be used since it is an internal table.
Please suggest.
Thanks and Regards,
Gayathri
2008 Jun 03 3:08 AM
Hi,
Try using read table as it can read an internal table. And then if the record is found, you copy the record and put it into another internal table
READ TABLE <itab> with key <field> = <eg.not1>.
IF sy-subrc = 0.
<do you copy statement here>
ENDIF.
Regards,
Loo
2008 Jun 03 3:11 AM
Hi ...
As per your issue...Let say your internal table is like this
NOT1 345
NOT4 345
NOT5 345
NOT1 345
NOT6 345
NOT1 345
NOT2 345
NOT7 345
NOT3 345
NOT3 345 then your need all NOT1 should be in one Internal table right??like this
NOT1 345
NOT1 345
NOT1 345
If so is that then How many internal tables You need. and How do we will come to know...
Regards,
Sg
how will you come to know
2008 Jun 03 3:12 AM
Hi
Your question is not so clear.
Check the below code, if i m not wrong.
data: begin of itab occurs 0,
Notru_id type char4,
Remtype type char5,
end of itab.
data: it_out like itab occurs 0 with header line.
Assume that data is already available.
sort itab by notru_id.
read table itab with key notru_id = 'NOT4'
binary search.
if sy-subrc eq 0.
it_out = itab.
append.
endif.
As long as notru_id is key field, even no need of it_out. Because read itab itself have the values.
Reward points, if it is useful.
Regards
Raja.
2008 Jun 03 3:34 AM
Do this way:
If your internal table is not having any duplicate entries of notru_id then:
Loop at itab.
Read table itab into wa_itab index sy-tabix.
if sy-subrc = 0.
process the work area into other internal table..
append itab1 from wa_itab.
endif.
endloop.
Hope this your requirement.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |