Application Development 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: 

how to read an internal table by comparing the values of key fields

Former Member
0 Kudos

hi ,

i want to read internal table with multiple values for the key field . can anyone suggest the syntax or method for doing this,

thanks in advance.

regards,

manoj

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Read statement will read only one value at a time..

You can only compare with different values.

example :

read table it_mara into wa_mara with key matnr = '1000'

matnr = '2000'

matnr = '3000'.

if all the 3 records are found in the internal table then it will read the 1 record.

Regards

Satish Boguda

5 REPLIES 5

Former Member
0 Kudos

Hi,

Read statement will read only one value at a time..

You can only compare with different values.

example :

read table it_mara into wa_mara with key matnr = '1000'

matnr = '2000'

matnr = '3000'.

if all the 3 records are found in the internal table then it will read the 1 record.

Regards

Satish Boguda

0 Kudos

you can do it with loop statemant, just create a range for key field.

RANGES : r_pernr FOR p0001-pernr.

r_pernr-sign = 'I'.

r_pernr-option = 'EQ'.

r_pernr-low = 1000.

APPEND r_pernr.

r_pernr-low = 2000.

APPEND r_pernr.

r_pernr-low = 3000.

APPEND r_pernr.

LOOP AT gt_p WHERE pernr IN r_pernr.

ENDLOOP.

Former Member
0 Kudos

Do you want read an internal table with many field comparision for that syntax

READ TABLE itab WITH KEY BELNR = GRTAB-MBLNR BUZEI = GRTAB-ZEILE GJAHR = GRTAB-MJAHR.

Regards ,

Nagesh.

former_member536879
Active Contributor
0 Kudos

Hi,

Please see the SCN Rules Before Posting.

With Regards,

Sumodh.P

ThomasZloch
Active Contributor
0 Kudos

Basic question, please search for information before posting.

Thread locked.

Thomas