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: 

Read first row of the internal table

Former Member

Dear All,

Please let me know how to read the first row of the internal table?

I used following read statement but it is not working

READ TABLE t_cdhdr INDEX 1.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

statement is correct

1. put condition if itab is not initial.

read condition

endif.

2. or check your sy-subrc after read.

5 REPLIES 5

Former Member
0 Kudos

Hi,

The statement that you have used appears correct .

Regards

Shruthi R

Former Member
0 Kudos

Hi,

i think you are not reading an internal table

according to your code i think you are reading a type

which may be declared as types...

types are declared just for reference

eg

types: begin of t_cdhdr .

include strucuture cdhdr .

types: end of t_cdhdr .

types: t_it_cdhdr type standard table of t_cdhdr.

data: git_t_cdhdr type t_it_cdhdr.

data: gwa_t_cdhdr type t_cdhdr.

now have to fill the iternal table

and

read table git_t_cdhdr into gwa_t_cdhdr index 1.

reward points if helpful

thanks & regards,

venkatesh

Former Member
0 Kudos

statement is correct

1. put condition if itab is not initial.

read condition

endif.

2. or check your sy-subrc after read.

Former Member

hi,

That READ statement is correct.I think ur reading an internal table without header

i.e ur referring to an type.

Please check if it is a table with out header line then declare workarea and use that workarea while reading the table.

READ table itab into wa INDEX 1.

Don't forget the REWARD (If it helps)

rgds

harris

Former Member
0 Kudos

You might be reading internal table w/o header line.. so u have to specify work area too..

data: wa_cdhdr like line of t_cdhdr.

READ TABLE t_cdhdr into wa_cdhdr INDEX 1.

Regards

Prax