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

read table

Former Member
0 Likes
1,190

hi,

i want to read kunnr from my internal table where name1 = 'vicky' , land1 = 'india'. I want to use the read statement.

regards,

sunny

12 REPLIES 12
Read only

Former Member
0 Likes
1,163

Hi..

Read table internal_table into wa_itab

where name = 'VICKY' and land1 = 'INDIA'.

<REMOVED BY MODERATOR>

Regards.

Edited by: Alvaro Tejada Galindo on Apr 10, 2008 6:02 PM

Read only

amit_khare
Active Contributor
0 Likes
1,163

Read itab into wa_itab with key name1 = 'vicky'

land1 = 'india'.

if sy-subrc = 0.

v_kunnar = 2a_itab-kunnr.

endif.

Regards,

Amit

Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,163

Hi,

Try this:

Read table it_kunnr into work area with key name = 'XYZ'

land1 = 'ABC'.

check sy-subrc.

<REMOVED BY MODERATOR>

Regards,

Sandeep

Edited by: Alvaro Tejada Galindo on Apr 10, 2008 6:02 PM

Read only

Former Member
0 Likes
1,163

Hi,

READ for any Internal Table

Reads a line of an internal table.

Syntax

READ TABLE <itab> FROM <wa>

|WITH TABLE KEY <k1> = <f1>... <kn> = <fn>

|WITH KEY = <f>

|WITH KEY <k1> = <f1>... <kn> = <fn>

INTO <wa> [COMPARING <f1> <f2>... |ALL FIELDS]

[TRANSPORTING <f1> <f2>... |ALL FIELDS|NO FIELDS]

|ASSIGNING <FS>

|REFERENCE INTO <dref>.

This statement reads either the line of the internal table with the same key as specified in the work area <wa>, the line with the key specified in the TABLE KEY addition, the line that corresponds fully to <f>, or the one corresponding to the freely-defined key in the KEY addition. The contents of the line are either written to the work area <wa>, or the line is assigned to the field symbol <FS>. If you assign the line to a work area, you can compare field contents and specify the fields that you want to transport.

READ for Index Tables

Reads a line of an internal table.

Syntax

READ TABLE <itab> INDEX <idx> INTO <wa>...

| ASSIGNING <FS>

| REFERENCE INTO <dref>.

The line with index 7 is read. The result is specified as with any internal table

Regards,

Priya.

Read only

Former Member
0 Likes
1,163

Hi,

u can u the stmt READ TABLE itab WITH KEY k1 = v1 ... kn = vn .

Read only

Former Member
0 Likes
1,163

hi,

you can use this codes too :

SORT ITAB BY NAME1 LAND1.

READ TABLE ITAB INTO WA_ITAB WITH KEY NAME1 = 'VICKY'

LAND1 = 'INDIA' BINARY SEARCH.

IF SY-SUBRC EQ 0.

PERFORM YOUR_STEPS.

ENDIF.

Read only

Former Member
0 Likes
1,163

Hi,

Use this:

Sort it_tab by name1 land1.

Read table it_tab into wa_tab with key name1 = 'Vicky'

land1 = 'India'

binary search.

if sy-subrc eq 0.

l_kunnr = wa_itab-kunnr.

endif.

hope it will help you.

Thanks,

Parul.

Read only

Former Member
0 Likes
1,163

Hi,

You can do as below using read statement:



sort itaby by name land1.

read table itab with key name1 = 'vicky' 
                                    land1 = 'india'.

if sy-subrc eq 0.
"Your necessary code
endif.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
1,163

Hi,

decalre an internal table and an explicit work area for that.

loop at it.

ReaD TABEL (INTERNAL TABLE NAME) INTO wa with key kunnr = 'VICKY' and land1 = 'INDIA'.

append wa.

modify itab from wa.

clear wa.

endloop.

write : wa-kunnr, wa-land1.

Read only

Former Member
0 Likes
1,163

Hi,

Read table itab with key name1 = 'vicky' and land1 = 'india'.

Thank u,

Manjula Devi.D

Read only

soumya_jose3
Active Contributor
0 Likes
1,163

Hi,

Read table itab with key name1 = 'vicky' and land1 = 'india'.

Regards,

Soumya.

Read only

Former Member
0 Likes
1,163

HI,

If your internal table has more than one Record with values:

Name = Vicky and Land = India.

Read statement will fetch the First index with above condition.

If you want to read a particular record with above combination , you should modify ur Read statement with key condition.

Else it will b OK

Thanks

Praveen