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: 

Printing contents of a table.

Former Member
0 Kudos

Hello All,

I am trying to see contents of a table. I am trying to randomly pick a row and try to see if my select statement works (by putting key field values and printing some other field value). I tried se16, but its asking some values before i can execute. Is there any other way to see all the contents of a table.

Regards.

Srinivas

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello Srinivas,

U can select all the data from the table into a itab like this.


data: itab like mara occurs 0 with header line.

select * from mara up to 100 rows into table itab.
loop at itab.
write: itab-matnr, itab-mtart " All the fields u want to see.
endloop.

Regards,

vasanth

12 REPLIES 12

former_member194669
Active Contributor
0 Kudos

SE16 mandatory values before execute?

Which table are try to view?

aRs

Former Member
0 Kudos

Hi,

You can use SE16..Give the table name..

To display all the contents..

Increase the "Maximum number of hits"

Thanks,

Naren

Former Member
0 Kudos

Hello Srinivas,

U can select all the data from the table into a itab like this.


data: itab like mara occurs 0 with header line.

select * from mara up to 100 rows into table itab.
loop at itab.
write: itab-matnr, itab-mtart " All the fields u want to see.
endloop.

Regards,

vasanth

0 Kudos

Hi Vasanth,

Can you tell me how to test a class. Where can I see the output of the select statement.

Regards.

Srinivas

0 Kudos

create a test report, tcode SE38... and iwrite that code and execute to check output of select statement...

0 Kudos

Would you be more specific. How to create a test report. How to write that code and what should I execute (did you mean the tcode/class).

Thanks and Regards.

srinivas

0 Kudos

I am getting an error when i activate the method:

The table is there, but its giving this error.

Class ZPOSITION_INFORMATION,Method EXTRACT_DATA

Field "HRP9007" is unknown. It is neither in one of the specified

tables nor defined by a "DATA" statement. "DATA" statement.

Can anybody see whats wrong here.

Thanks

Srinivas

0 Kudos

hey u just want to check output of select statement of following code rite?


data: itab like mara occurs 0 with header line.
 
select * from mara up to 100 rows into table itab.
loop at itab.
write: itab-matnr, itab-mtart " All the fields u want to see.
endloop.

if that is the case then goto Transaction SE38 and create test report , copy this code and execute(F8)....

0 Kudos

Hello Srinivas,

I think field HRP9007 is not available in the table where u trying to select iut.

Check zthis.

Regards,

Vasanth

0 Kudos

I am still getting an error (bear with me)

Class ZPOSITION_INFORMATION,Method EXTRACT_DATA

Tables with headers are no longer supported in the OO context.

Here is the code:

method EXTRACT_DATA .

DATA: start_date type sy-datum,

end_date type sy-datum,

position(8) type n.

data : begin of i_table occurs 0.

include structure hrp9007. " << your table

data : end of i_table.

select * from hrp9007 into table i_table

where plvar eq '01'

and istat eq '1'

and begda le sy-datum

and endda ge sy-datum

and status eq '99'. " << write here your where condition

loop at i_table.

write 😕 i_table.

endloop.

endmethod.

0 Kudos

Hello,

The problem is here:


data : begin of i_table occurs 0.
include structure hrp9007. " << your table
data : end of i_table.

Make the change:

data: i_table type table of hrp9007.  " make this change..

Better reward the points and close this thread.

Start a new thread with the new queries

Regards,

Vasanth

former_member194669
Active Contributor
0 Kudos

data : begin of i_table occurs 0.
   include structure ztable.   " << your table 
data : end of i_table.

select * from ztable into table i_table 
   where  '_____________'.  " << write here your where condition

loop at i_table.
   write 😕 i_table.
endloop.

aRs