2009 Oct 27 6:17 PM
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.
2009 Oct 27 6:34 PM
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.
2009 Oct 27 6:20 PM
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.
2009 Oct 27 6:26 PM
>
> 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'.
2009 Oct 27 6:34 PM
2009 Oct 27 6:35 PM
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
2009 Oct 27 6:39 PM
>
> 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
2009 Oct 27 6:37 PM
1. check sy-subrc
2. use "IN" instead of "="
Something is wrong with the select statement.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |