10-09-2007 9:04 AM
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 ?
10-09-2007 9:16 AM
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
10-09-2007 9:10 AM
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
10-09-2007 9:12 AM
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
10-09-2007 9:13 AM
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.
10-09-2007 9:13 AM
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
10-09-2007 9:16 AM
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
10-09-2007 9:18 AM
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
10-09-2007 9:20 AM
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
10-09-2007 9:28 AM
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.