02-14-2006 3:37 PM
hi folks,
I am trying to download data from SAP tables on local system.
I have used GUI_DOWNLOAD -FM
the code goes like this....
data: out_file type string.
TABLES: PA0000, PA0001.
data: begin of out_tab occurs 0,
pernr LIKE p0000-pernr,
begda LIKE p0000-begda,
endda LIKE p0000-endda,
massn LIKE p0000-massn,
plans LIKE p0001-plans,
end of out_tab.
select pernr begda endda massn from pa0000 into TABLE out_tab where begda = '05/03/2000'
AND endda = '10/31/2000' AND massn = 'RV'.
if sy-subrc = 0.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = out_file
filetype = 'DAT'
APPEND = 'X'
write_field_separator = 'X'
CONFIRM_OVERWRITE = 'X'
TABLES
data_tab = OUT_TAB[]
EXCEPTIONS
file_open_error = 1
file_write_error = 2
OTHERS = 3.
else.
write: 'no output file'.
The query is not giving the results in the out_tab.
Can anyone help out here?
thanks
Vinu
02-14-2006 3:40 PM
Hi
try:
select pernr begda endda massn from pa0000 into TABLE out_tab where begda = '20000503'
AND endda = '20001031' AND massn = 'RV'.
Max
02-14-2006 3:40 PM
Hi
try:
select pernr begda endda massn from pa0000 into TABLE out_tab where begda = '20000503'
AND endda = '20001031' AND massn = 'RV'.
Max
02-14-2006 3:40 PM
Hi Vinu,
You have to give the file name to out_file field.
<b>data:out_file type string.
out_file = 'c:/file.xls'.</b>
02-14-2006 3:40 PM
Hi,
please check the begda and endda in where condition.
It should be where begda = '20000503'
AND endda = '20001031'
and not as U coded.
Also change the order of begda , endda
Regards,
GSR.
02-14-2006 3:41 PM
Hi Vinu,
The date , i think , should not be in this format
select pernr begda endda massn from pa0000 into TABLE out_tab where begda = '05/03/2000'
AND endda = '10/31/2000' AND massn = 'RV'.
try this out...
select pernr begda endda massn from pa0000 into TABLE out_tab where begda = '05.03.2000'
AND endda = '10.31.2000' AND massn = 'RV'.
i think this will work
regards
satesh
02-14-2006 3:43 PM
Hello Vinu,
If out_tab[] is initial, it means there are no entries satisfying the where condition in the SELECT statement.
If the entries exits for those conditions, then take a look at the date format you are using in the SELECT statement.
Thanks
02-14-2006 3:58 PM
02-14-2006 3:51 PM
This work for me
select pernr begda endda massn from pa0000 into TABLE out_tab where begda = '20021202'
AND endda <= '99991231' AND massn = 'RV'.
Thanks
Message was edited by: Saquib Khan
02-14-2006 3:56 PM
Hi Vinu,
Just check your select.
constants:v_begda like sy-datum value '20000503',
v_endda like sy-datum value '20001031'.
select pernr begda endda massn from pa0000 into TABLE out_tab where
begda = v_begda
AND endda = v_endda AND massn = 'RV'.
But generally ENDDA will be some thing like 99991231 as it whows the active PERNR.So use <= operation.
Message was edited by: Phani Kiran Nudurupati