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

simple query .

Former Member
0 Likes
1,159

Hello Friends ,

I am tryin to copy a table of 12 fields with a MANDT primary key field in the table . Here is the code below . But it is not getting any data from the table to the internal table . Please advise .

REPORT Ztest.

tables: Ztab.

DATA: t_itab TYPE TABLE OF Ztab with header line.

data: lindex like sy-tabix.

start-of-selection.

SELECT * FROM Ztab

INTO corresponding fields of TABLE t_zyms .

IF NOT t_itab[] IS INITIAL.

insert Ztab FROM table t_itab.

ENDIF.

end-of-selection.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,139

Hello,

REPORT Ztest.

tables: Ztab.

DATA: t_itab TYPE TABLE OF Ztab with header line.


data: lindex like sy-tabix.

start-of-selection.

SELECT * FROM Ztab
INTO corresponding fields of TABLE  <u><b><i>t_itab</i></b></u> .


IF NOT t_itab[] IS INITIAL.

insert Ztab FROM table t_itab.

ENDIF.

Vasanth

11 REPLIES 11
Read only

amit_khare
Active Contributor
0 Likes
1,139

Check your table name ins elect query.

SELECT * FROM Ztab

INTO corresponding fields of TABLE <b>t_zyms</b> .

I think it should be t_itab.

Regards,

amit

Reward all helpful replies.

Read only

Former Member
0 Likes
1,139

start-of-selection.

SELECT * FROM Ztab

INTO corresponding fields of TABLE <b>t_itab</b> .

Read only

Former Member
0 Likes
1,140

Hello,

REPORT Ztest.

tables: Ztab.

DATA: t_itab TYPE TABLE OF Ztab with header line.


data: lindex like sy-tabix.

start-of-selection.

SELECT * FROM Ztab
INTO corresponding fields of TABLE  <u><b><i>t_itab</i></b></u> .


IF NOT t_itab[] IS INITIAL.

insert Ztab FROM table t_itab.

ENDIF.

Vasanth

Read only

Former Member
0 Likes
1,139
REPORT Ztest.
tables: Ztab.
DATA: t_itab TYPE TABLE OF Ztab with header line.

data: lindex like sy-tabix.

start-of-selection.

SELECT * FROM Ztab
INTO  corresponding fields of TABLE

<b> t_itab</b> .


IF NOT t_itab[] IS INITIAL.
insert Ztab FROM table t_itab.

ENDIF.

end-of-selection.

Hppe this solves.

Read only

Former Member
0 Likes
1,139

Table t_itab is of type Ztab and not t_zyms .

You need to change the table name in the query to t_itab .

Regards,

Saumya

Read only

0 Likes
1,139

sorry i mispelt that it is t_itab . But still not working . Please advise

Read only

0 Likes
1,139

Hi,

check the table for entries. check the code in debug mode adn try to change ur select statement to know where its goign wrong!

regards,

madhu

Read only

SantoshKallem
Active Contributor
0 Likes
1,139

try to READ the contents and then insert.

have u checked in debugging. do u geetting value to internal table.

Read only

0 Likes
1,139

I am not getting any value in the internal table. I am runnin in debug mode and there is not value in internal table after the select query is executed in the debug mode.

I tried the code with other tables which did not have MANDT field as primary key and it worked .

Please advise

Read only

0 Likes
1,139

Thank you folks i think i was using the wrong table name My bad

I will reward poiints

Read only

Former Member
0 Likes
1,139

Hi,

Can you please explain what are you trying to achieve from the below code??? you are fetching data from table Ztab and same data you are again trying to insert into Ztab.... this will definitely not happen.....

Data fetching you can do with the below code:

REPORT Ztest.

tables: Ztab.

DATA: t_itab TYPE TABLE OF Ztab with header line.

data: lindex like sy-tabix.

start-of-selection.

SELECT * FROM Ztab INTO TABLE t_itab .

IF NOT t_itab[] IS INITIAL.

insert <table> FROM table t_itab.

ENDIF.

end-of-selection.