cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting Internal Table

Former Member
0 Kudos

Folks,

I am new to ABAP , T have this problem : I have sorted an Internal Table on 5 fields , Now I need to pick up the similar records on which I have done sorting while looping . How to do it , Please let me know

Manish

Accepted Solutions (1)

Accepted Solutions (1)

suresh_datti
Active Contributor
0 Kudos

You can use

READ TABLE <itab> into <WA> COMPARING f1 f2 f3 f4 f5.

If the system finds an appropriate entry, it uses the specified work area wa as the output area.

Regards,

Suresh Datti

Former Member
0 Kudos

hi Manish,

You can use the read statement

READ TABLE IT_TAB INTO X_TAB COMAPARING F1 F2 F3 F4 ...

here IT_TAB is the internal table and X_TAB is the structure in which the read statement will fill the value (if specidfied condition has some data) after reading the table.

Regards,

Richa

Answers (1)

Answers (1)

former_member181962
Active Contributor
0 Kudos

loop at itab.

if itab-field1 = lv_field1 and

itab-field2 = lv_field2.

write:/ 'similar record'.

else.

write:/ 'not similar record'.

endif.

lv_field1 = itab-field1.

lv_field2 = itab-field2.

endloop.

Regards,

Ravi