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 stmt

Former Member
0 Likes
531

Hi Friends,

in which scenario we will write the READ STATEMENT???

and when we write read stnt.. any preconditions we want write..like

sy-subrc ..

regards,

3 REPLIES 3
Read only

Former Member
0 Likes
511

Hi ,

Hope the below will be helpfull.

READ for Files,

Reads a file.

Syntax

READ DATASET <dsn> INTO <f> [LENGTH <len>].

Reads the contents of the file <dsn> on the application server to the variable <f>. The number of bytes transferred can be written to <len>.

READ for any Internal Table

Reads a line from any 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>.

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 index table.

Syntax

READ TABLE <itab> INDEX <idx> INTO <wa>... | ASSIGNING <FS>.

Reads the line with the index <idx>. The result is available as described above.

READ for Lists

Reads the contents of a line from a list.

Syntax

READ LINE <n> [INDEX <idx>] [OF CURRENT PAGE|OF PAGE <p>]

|CURRENT LINE

[FIELD VALUE <f1> [INTO <g1>]... <fn> [INTO <gn>]].

Reads either the line <n> on the current or specified list or page, or the last line to have been selected by the user. The addition specifies the fields that you want to read, and the target fields into which they should be placed. The entire line is always placed in the system field SY-LISEL, and the HIDE area is filled for the line.

READ for Programs

Reads ABAP programs from the program library.

Syntax

READ REPORT <prog> INTO <itab>.

Copies the lines of the program <prog> into the internal table <itab>.

Reward if usefull,

Regards,

Ramya

Message was edited by: Ramya

RAMYA RAVIKUMAR

Read only

Former Member
0 Likes
511

Hi Vijay

suppose if u have two internal tables itab1 and itab2 with a one common field

and if u want to move the data to final intetrnal table from these two tables then we use this read stmt

loop at iitab1.

read table itab2 with key vbeln = itab1-vbeln using binary seaarch

check sy-subrc value

if sy-subrc = 0.

move data

endif

endloop.

Read only

Former Member
0 Likes
511

goto

abap editor and type READ and put the cursor at the starting of read and then press F1 u will get more information on that.

if u have doubt on any of the ABAP statements do like above

<b>Reward Points If Useful</b>