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: 

Internal table

Former Member
0 Kudos

Hi

I gt a student table. I want to create a internal table for this student table. Next i want to perform a loop on the internal table and use a write statement to display the record. How can i do ?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi.

tables : <student table name>

data : it_st like table of <student table name> with header line.

select * from <student table name> into table of it_st.

loop at it_st.

write /: it_st-<fied name 1> ( eg name),

it_st-<field name 2>

endloop.

regards

baskaran

8 REPLIES 8

Former Member
0 Kudos

hi.

use this code.

data : begin of itab occurs 0.

include structures mara.

data : end of itab.

select * from mara into itab.

loop at itab.

write 😕 .......

endloop.

Regards

prajwal.k

Message was edited by:

prajwal k

Message was edited by:

prajwal k

Former Member
0 Kudos

hI

CREAT A INTERNAL TABLE OF TYPE THAT STUDENT TABLE

AFTER THAT WRITE A SELCT QUERY TO STORE DATA INTO THAT INTERNAL TABLE

SELECT * FROM STUDENT TABLE INTO INTERNAL TABLE

NEXT LOOP AT THAT INTERNAL TABLE AND IN THAT LOOP WRITE THE WRITE STATEMENT

ENDLOOP.

REWARD IF USEFULL

Former Member
0 Kudos

hi

first u enter the data into your z or y stud table.

for example of internal table.

DATA: BEGIN OF itab OCCURS 0,

matnr LIKE mara-matnr,

maktx LIKE makt-maktx,

END OF itab.

as per above example u can declare your table fields.LIKE here u can give your table name.

THanks.

Prashant.

Former Member
0 Kudos

hi,

U have a student table right, suppose the name of the table is <b>SNAME</b> then,

Declare internal table for this table like below:

<b>data: itab type standard table of SNAME with header line.

loop at itab.

write:/ itab-fname1,itab-fname2...

endloop.</b>

thanks.

Dharmishta

Former Member
0 Kudos

hi.

tables : <student table name>

data : it_st like table of <student table name> with header line.

select * from <student table name> into table of it_st.

loop at it_st.

write /: it_st-<fied name 1> ( eg name),

it_st-<field name 2>

endloop.

regards

baskaran

Former Member
0 Kudos

Hi,

suppose the student table is - stud

so

****data Decleration**

data : begin of t_stud occours 0,

field1 like stud-field1,

field2 like stud-field2,

end of t_stud.

***internal table***

data : i_stud type standard table of t_stud with header data.

**selection-screen*

select-options: s_id like stud_id.

**selection - screen validation****

***start-of-selection**

select * from stud

into i_stud

where id in s_id.

***write statement**

loop at i_stud.

write: field1 , field2.

endloop.

***top - of-page***

-


-


*****do rewards if usefull

vijay

former_member200338
Active Contributor
0 Kudos

Hi,

try this.

suppose it_student_table is your internal table.

1) Creating an another internal table is as follows.

Data: it_new_student like it_student_table.

2) creating a work area for the above table

Data ls_new_student like line of it_student_table.

<<populate the internal table.>>

loop at it_new_student into ls_new_student.

write:/ ls_new_student-value.

endloop.

Regards,

Niyaz

Former Member
0 Kudos

data : begin of itab_student occurs 0,

stud_id like zstudent-stud_id,

stud_name like zstudent-stud_name,

stud_address like zstudent-stud_address,

end of itab_student.

selection-screen : begin of block blk1 with frame title text-001.

select-options : s_stid for zstudent-stud_id.

selection-screen : end of block blk1.

select stud_id stud_name stud_address from zstudent

into corresponding fields of table itab_student

where stud_id in s_stid.

if sy-subrc = 0.

loop at itab_student.

write 😕 itab_student.

endloop.

Reward with points if helpful.