Application Development 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: 

donwload data

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

try:

select pernr begda endda massn from pa0000 into TABLE out_tab where begda = '20000503'

AND endda = '20001031' AND massn = 'RV'.

Max

8 REPLIES 8

Former Member
0 Kudos

Hi

try:

select pernr begda endda massn from pa0000 into TABLE out_tab where begda = '20000503'

AND endda = '20001031' AND massn = 'RV'.

Max

Former Member
0 Kudos

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>

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

Thank you folks,

It helped to and able to make it work.

Vinu

former_member181966
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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