Application Development and Automation 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 only

Cannot fetch data from Select Query

Former Member
0 Likes
1,150

Hi,

I am developing a simple BSP application in which I am using a simple select query like:

DATA: gt_zemp TYPE TABLE OF zemp_detail.
FREE: gt_zemp[].
SELECT * FROM zemp_detail INTO TABLE gt_zemp.

The table ZEMP_DETAIL has 3 entries but I am still getting SY-SUBRC = 4 and the GT_ZEMP is not getting filled. But when I am executing the same query in a demo report GT_ZEMP is getting filled.

The table ZEMP_DETAIL has TMG and and there is no restriction on this table.

Can anyone please help me where I am doing wrong?

4 REPLIES 4
Read only

Ankit_Maskara
Product and Topic Expert
Product and Topic Expert
0 Likes
996

What purpose does free statement serve ? Its not needed just after declaration.

Read only

Former Member
0 Likes
996

Hi Subhajit,

DATA: gt_zemp TYPETABLEOF zemp_detail.

FREE: gt_zemp[].

SELECT*FROM zemp_detail INTOTABLE gt_zemp.

instead of Free write refresh.

i.e REFRESH : gt_zemp[].

Regards,

Bhagaban.P

Read only

Sandra_Rossi
Active Contributor
0 Likes
996

and also useless right before SELECT ... INTO TABLE ...

Read only

Sandra_Rossi
Active Contributor
0 Likes
996

Maybe you have run the program from the wrong client (mandant)?