Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Selecting values from internal table

Former Member
0 Likes
1,461

HI

there is an interanble with some values. Now i want to select only particular records from that table and want to put into same internal table depending on some selection criteria?

can anybody suggest me please?

10 REPLIES 10
Read only

Former Member
0 Likes
1,412

hi,

use this code .

READ TABLE ITAB WITH KEY FILED-NAME = RE_FILE-NAME.

IF SY-SUBRC = 0.

DO WHAT U WANT .

ENDIF.

HOPE IT WILL HELP U .

~LINGANNA

Read only

Former Member
0 Likes
1,412

Hi,

If u want particulare from an internal table on some condition use READ statement. press F1 on READ in ABAP EDITOR u ill understand how to use it...

if you want to move to another internal table use APPEND statement.press F1 on APPEND in ABAP EDITOR

Eg:

READ table itab index sy-index.

if sy-subrc eq 0 & cond1 = X.

append itab to itab1.

endif.

Hope it helps!!

Rgds,

Pavan

Read only

0 Likes
1,412

HI,

Actually my requirement is i want to filter out that internal table at a particular point ans use that table at all other points in the program. Instead of writing the read statement every time.

are there any suggestions?

Read only

0 Likes
1,412

Loop at interanble into wa where condition.

append wa to internaltable2.

endloop.

Read only

0 Likes
1,412

hi ,

if u want to filter internal table

loop at itab1 where field-name = value (u r filter) .

end loop.

hope it will help u .

Read only

Former Member
0 Likes
1,412

Hi,

You can delete the records from the internal table which you do not require by specifying the necessary condition.

Delete itab where <condition on which record is to be deleted>.

The remaining records are the ones you want to retain.

Hope this helps.

Regards,

Himanshu

Read only

viquar_iqbal
Active Contributor
0 Likes
1,412

Hi

READ TABLE ITAB WITH KEY FIELD-NAME = W_carrid.

If option1 is selected.

Modify table Itab from wa_itab transporting w_carrid.

endif.

Thanks

Viquar Iqbal

Read only

Former Member
0 Likes
1,412

hi,

you can use read table for reading the data of an internal table one bye one.

Read table itab with key field-name = Field name.

for example.

READ TABLE it_vbrk INTO wa_vbrk WITH KEY vbeln = XYZ .

and if you want to insert data in the same table you can use. APPEND

like

Append wa_vbrk to it_vbrk.

if you want to modify some value in same table you can use modify too..

MODIFY it_vbrk FROM wa_vbrk INDEX ...

Read only

Former Member
0 Likes
1,412

hi

use this

loop at table itab1 into wa.

now check the work fields for your selection criteria.

if they match then append wa to itab2.

endloop.

here itab1 and itab2 should be of same structure.

if not then use

append wa to corrosponding fields of itab2.

please check the syntex.

Edited by: mayank jain on Apr 29, 2009 8:17 AM

Read only

RahulKeshav
Active Contributor
0 Likes
1,412

hi,

use ...

loop at itab1 into wa1 where 'ur selection criteria'.

append wa1 to itab2.

endloop.

thnx

Rohit