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

saving downloaded data to client's desktop

Former Member
0 Likes
889

Hi Experts,

Gotta a problem in saving downloaded file. The file is too big that i cannot execute it normally but execute it in background. I need to save the data in client's pc but the data saves at the server.

Pls help... the code is below

data: ld_output(10000),
      wa_fkimg(15),
      wa_unipr(15),
      wa_netwr(15),
      wa_unico(15),
      wa_wavwr(15),
      wa_kurrf(15),
      wa_kwmeng(15).

field-symbols: <wa> type t_download.

open dataset 'c:\sap2notes.txt' for output in text mode
             encoding default.


loop at it_download assigning <wa>.
    move: <wa>-fkimg to wa_fkimg,
          <wa>-unipr to wa_unipr,
          <wa>-netwr to wa_netwr,
          <wa>-unico to wa_unico,
          <wa>-wavwr to wa_wavwr,
          <wa>-kurrf to wa_kurrf,
          <wa>-kwmeng to wa_kwmeng.
    concatenate  <wa>-ename
                 <wa>-fkdat
                 <wa>-aubel
                 <wa>-name1
                 <wa>-name2
                 <wa>-werks
                 <wa>-vtweg
                 wa_fkimg
                 <wa>-matnr
                 <wa>-arktx
                 wa_unipr
                 wa_netwr
                 wa_unico
                 wa_wavwr
                 <wa>-mvgr1
                 <wa>-mvgr2
                 <wa>-mvgr3
                 <wa>-auart
                 <wa>-kvgr1
                 <wa>-kvgr2
                 <wa>-pernr
                 <wa>-kunag
                 <wa>-audat
                 <wa>-waerk
                 <wa>-vbeln
                 wa_kurrf
                 <wa>-vrkme
                 <wa>-mvgr1t
                 <wa>-mvgr2t
                 <wa>-mvgr3t
                 <wa>-kvgr1t
                 <wa>-kvgr2t
                 <wa>-auartt
                 <wa>-werkst
                 <wa>-vtwegt
                 <wa>-bktxt
                 <wa>-bstnk
                 <wa>-spart
                 <wa>-fkart
                 wa_kwmeng
                 <wa>-bzirk_auft
                 <wa>-spartt
                 <wa>-fkartt
                 <wa>-bzirk_auftt
                 <wa>-ltext
                 <wa>-refdoc
            into ld_output separated by '|'.
            transfer ld_output to 'c:\sap2notes.txt'.
endloop.

close dataset 'c:\sap2notes.txt'.

-


Thanks and best regards,

aashta

Hi Experts,

Gotta a problem in saving downloaded file. The file is too big that i cannot execute it normally but execute it in background. I need to save the data in client's pc but the data saves at the server.

Pls help... the code is below

data: ld_output(10000),
      wa_fkimg(15),
      wa_unipr(15),
      wa_netwr(15),
      wa_unico(15),
      wa_wavwr(15),
      wa_kurrf(15),
      wa_kwmeng(15).

field-symbols: <wa> type t_download.

open dataset 'c:\sap2notes.txt' for output in text mode
             encoding default.


loop at it_download assigning <wa>.
    move: <wa>-fkimg to wa_fkimg,
          <wa>-unipr to wa_unipr,
          <wa>-netwr to wa_netwr,
          <wa>-unico to wa_unico,
          <wa>-wavwr to wa_wavwr,
          <wa>-kurrf to wa_kurrf,
          <wa>-kwmeng to wa_kwmeng.
    concatenate  <wa>-ename
                 <wa>-fkdat
                 <wa>-aubel
                 <wa>-name1
                 <wa>-name2
                 <wa>-werks
                 <wa>-vtweg
                 wa_fkimg
                 <wa>-matnr
                 <wa>-arktx
                 wa_unipr
                 wa_netwr
                 wa_unico
                 wa_wavwr
                 <wa>-mvgr1
                 <wa>-mvgr2
                 <wa>-mvgr3
                 <wa>-auart
                 <wa>-kvgr1
                 <wa>-kvgr2
                 <wa>-pernr
                 <wa>-kunag
                 <wa>-audat
                 <wa>-waerk
                 <wa>-vbeln
                 wa_kurrf
                 <wa>-vrkme
                 <wa>-mvgr1t
                 <wa>-mvgr2t
                 <wa>-mvgr3t
                 <wa>-kvgr1t
                 <wa>-kvgr2t
                 <wa>-auartt
                 <wa>-werkst
                 <wa>-vtwegt
                 <wa>-bktxt
                 <wa>-bstnk
                 <wa>-spart
                 <wa>-fkart
                 wa_kwmeng
                 <wa>-bzirk_auft
                 <wa>-spartt
                 <wa>-fkartt
                 <wa>-bzirk_auftt
                 <wa>-ltext
                 <wa>-refdoc
            into ld_output separated by '|'.
            transfer ld_output to 'c:\sap2notes.txt'.
endloop.

close dataset 'c:\sap2notes.txt'.

-


Thanks and best regards,

aashta

5 REPLIES 5
Read only

Former Member
0 Likes
846

IN addition with that Experts,

i tried to use the function below but there seems to be an error, the file is no where to be found.

call function 'GUI_DOWNLOAD'
  exporting
    filename              = 'C:test.txt'
    write_field_separator = 'X'
  tables
    data_tab              = it_download.

thanks...

Read only

0 Likes
846

You cannot use 'GUI_DOWNLOAD' Fm for background process,

so once you got your file uploaded to applicaton server then use that

function module to download the same to presentation server.

Read only

0 Likes
846

Hi,

GUI_* and WS_* function modules do not work in background

When scheduling a job in the background the appropriate statement to read in your file is OPEN DATASET, and the file must be on the file system that the SAP server can see.

At anytime, a user can switch of the Personal Computers even though the job is still running in the background. Therefore GUI_* and WS_* function modules are not designed to work in that way, as they need to access your personal computer file.

To choose the correct download method to used, you can check the value of SY-BATCH in your code,

if it is 'X' use OPEN DATASET and if it is ' ' use WS_UPLOAD.

*-- Open dataset for reading

DATA:

dsn(20) VALUE '/usr/test.dat',

rec(80).

OPEN DATASET dsn FOR INPUT IN TEXT MODE.

IF sy-subrc = 0.

DO.

READ DATASET dsn INTO rec.

IF sy-subrc <> 0.

EXIT.

ELSE.

WRITE / rec.

ENDIF.

ENDDO.

ENDIF.

CLOSE DATASET dsn.

*-- Open dataset for writing

DATA rec(80).

OPEN DATASET dsn FOR OUTPUT IN TEXT MODE.

TRANSFER rec TO '/usr/test.dat'.

CLOSE DATASET dsn.

Thanks,

Archana

Read only

vinod_vemuru2
Active Contributor
0 Likes
846

Hi,

Looks like a duplicate thread!!!

Thanks,

Vinod.

Read only

0 Likes
846

Solve. Many thanks