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: 

Regarding header line in internal table

Former Member
0 Kudos

Hi Experts,

I wrote the following code to test the value of header line.

TABLES: sflight.

DATA: itab LIKE STANDARD TABLE OF sflight WITH HEADER LINE.

SELECT * FROM sflight UP TO 10 ROWS.

APPEND sflight to itab.

ENDSELECT.

WRITE:/ itab-carrid, itab-connid, itab-price

1. o/p i got was the initial default values.

My question is that->

will this display the last record appended to the itab or not???

Could anyone please clear my doubt ??

Regards

Sudhansu

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi

if you want the last record in header line use this :

TABLES: sflight.

DATA: itab LIKE STANDARD TABLE OF sflight WITH HEADER LINE.

SELECT * FROM sflight into itab UP TO 10 ROWS.

APPEND itab.

ENDSELECT.

WRITE:/ itab-carrid, itab-connid, itab-price.

rgds

Deepak

8 REPLIES 8

Former Member
0 Kudos

Hi,

Fill the Internal table first, and if you want to print the last record of the internal table follow this one ..

<b>DESCRIBE TABLE ITAB LINES LIN .</b>

<b>Read table ITAB index LIN.</b>

then the Header will contain the last record of the internal table

Regards

Sudheer

Former Member
0 Kudos

hi sudhansu

it will not display the last record appened. because you you are using the workarea

sflight seprately (you are not using header line).

rgds

Deepak.

Former Member
0 Kudos

do this way..

Make use of describe statement ..


describe table itab lines v_lines.

read table itab index  v_lines.

Regards,

santosh

Former Member
0 Kudos

Hi

Loop at your itab and inside there write the code

TABLES: sflight.

DATA: itab LIKE STANDARD TABLE OF sflight WITH HEADER LINE.

SELECT * FROM sflight UP TO 10 ROWS.

APPEND sflight to itab.

ENDSELECT.

<b>loop at itab.

WRITE:/ itab-carrid, itab-connid, itab-price

endloop.</b>

regards

Shiva

Former Member
0 Kudos
It will display the first 10 rows

report ychatest.

tables: sflight.
data: itab like standard table of sflight with header line.
select * from sflight up to 10 rows.
  append sflight to itab.
endselect.

loop at itab.
  write : / itab-carrid.
endloop.



OUTPUT

AA
AA
AA
AA
AA
AA
AA
AA
AA
AA

Former Member
0 Kudos

Hi,

The query would not display the last appended record .It will display only the values in the Header of the internal table which are the initial values.

Regards,

Sowmya.

Former Member
0 Kudos

hi

if you want the last record in header line use this :

TABLES: sflight.

DATA: itab LIKE STANDARD TABLE OF sflight WITH HEADER LINE.

SELECT * FROM sflight into itab UP TO 10 ROWS.

APPEND itab.

ENDSELECT.

WRITE:/ itab-carrid, itab-connid, itab-price.

rgds

Deepak

0 Kudos

thanks deepak, ur suggestion solved my problem.