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

internal table won't print

Former Member
0 Likes
876

Hi. Someone please tell me why this doesn't print anything. I already checked the parameters and there is data in the table.

REPORT ZBALANCES.

TABLES: fmusfgt.

DATA: begin of itab1 occurs 0,

racct type fmusfgt-racct,

rfistl type fmusfgt-rfistl,

tsl11 type fmusfgt-tsl11,

end of itab1.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

SELECT-OPTIONS : pyear for fmusfgt-ryear default '2010',

pacct for fmusfgt-racct default '21100100'.

SELECTION-SCREEN END OF BLOCK b1.

select racct rfistl tsl11

from fmusfgt

into corresponding fields of table itab1

where racct IN pacct and

ryear = pyear and

rldnr = '95' and

rrcty = '0' and

rvers = '1' and

rbukrs = 'DLA1'.

write:'itab1:'.

loop at itab1.

write:/ itab1-racct, itab1-rfistl.

endloop.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
845

I made those two changes but I still get "select failed."

Hi. Someone please tell me why this doesn't print anything. I already checked the parameters and there is data in the table.

REPORT ZBALANCES.

TABLES: fmusfgt.

DATA: begin of itab1 occurs 0,

racct type fmusfgt-racct,

rfistl type fmusfgt-rfistl,

tsl11 type fmusfgt-tsl11,

end of itab1.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

SELECT-OPTIONS : pyear for fmusfgt-ryear default '2010',

pacct for fmusfgt-racct default '21100100'.

SELECTION-SCREEN END OF BLOCK b1.

select racct rfistl tsl11

from fmusfgt

into corresponding fields of table itab1

where racct IN pacct and

ryear = pyear and

rldnr = '95' and

rrcty = '0' and

rvers = '1' and

rbukrs = 'DLA1'.

write:'itab1:'.

loop at itab1.

write:/ itab1-racct, itab1-rfistl.

endloop.

6 REPLIES 6
Read only

former_member156446
Active Contributor
0 Likes
845

try this way:

select racct rfistl tsl11
from fmusfgt
into corresponding fields of table itab1
where racct IN pacct and
ryear = pyear and
rldnr = '95' and
rrcty = '0' and
rvers = '1' and
rbukrs = 'DLA1'.
if sy-subrc eq 0.
write:'itab1:'.
loop at itab1.
write:/ itab1-racct, itab1-rfistl.
endloop.
else.
write: 'select failed'.
endif.

Read only

former_member191735
Active Contributor
0 Likes
845

>

> Hi. Someone please tell me why this doesn't print anything. I already checked the parameters and there is data in the table.

>

> REPORT ZBALANCES.

>

> TABLES: fmusfgt.

>

> DATA: begin of itab1 occurs 0,

> racct type fmusfgt-racct,

> rfistl type fmusfgt-rfistl,

> tsl11 type fmusfgt-tsl11,

> end of itab1.

>

> SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

>

> SELECT-OPTIONS : pyear for fmusfgt-ryear default '2010',

> pacct for fmusfgt-racct default '21100100'.

>

> SELECTION-SCREEN END OF BLOCK b1.

>

> select racct rfistl tsl11

> from fmusfgt

> into corresponding fields of table itab1

> where racct IN pacct and

> ryear = pyear and

> rldnr = '95' and

> rrcty = '0' and

> rvers = '1' and

> rbukrs = 'DLA1'.

>

> write:'itab1:'.

> loop at itab1.

> write:/ itab1-racct, itab1-rfistl.

> endloop.

You may have data in database table but did you check that in your internal table.

put a break point before write statement and check your data entries or use sy-subrc after select statement to see what you get. if sy-subrc = 0 and you have data in internal table....

You have got select-options for pyear but you are using ryear = pyear. Change it to in instead of =

like this

select racct rfistl tsl11

from fmusfgt

into corresponding fields of table itab1

where racct IN pacct and

ryear in pyear and

rldnr = '95' and

rrcty = '0' and

rvers = '1' and

rbukrs = 'DLA1'.

Read only

Former Member
0 Likes
846

I made those two changes but I still get "select failed."

Read only

0 Likes
845

What are the 2 changes you made?

If you have added sy-subrc and IN instead of = ..... If you still get select failed.... there is no data in table for the data you have passing.

Edited by: Sampath Kumar on Oct 27, 2009 12:36 PM

Read only

0 Likes
845

>

> I made those two changes but I still get "select failed."

Hi Kevin

I wanted to say that there is issue with the data you are passing to the query, its the same query I copied and added a if and else statement.

check the convertion exits for the data your are passing if 1 you are pasing in tthree characters then u need to pass '001' so those are the issues you need to fix, to have ur query work..

select racct rfistl tsl11
from fmusfgt
into corresponding fields of table itab1
where racct IN pacct and
ryear = pyear and
rldnr = '95' and
rrcty = '0' and
rvers = '001' and  "<< make this change
rbukrs = 'DLA1'.
if sy-subrc eq 0.
write:'itab1:'.
loop at itab1.
write:/ itab1-racct, itab1-rfistl.
endloop.
else.
write: 'select failed'.
endif.

Edited by: J@Y on Oct 27, 2009 11:42 AM

Read only

Former Member
0 Likes
845

1. check sy-subrc

2. use "IN" instead of "="

Something is wrong with the select statement.