‎2005 Jul 27 10:55 AM
Hi,
I need to download a file from the application server (BW - transaction CG3Y doesn't exist). Could anyone post here the <b>complete abap source</b>?
‎2005 Jul 27 11:06 AM
Hi,
Here is the code,
*&---------------------------------------------------------------------*
*& Form f1104_download_to_lofile
*&---------------------------------------------------------------------*
* Download to data from internal table to Logical File/application server
*----------------------------------------------------------------------*
FORM f1104_download_to_lofile.
* Open the file in application server
OPEN DATASET v_filepht FOR OUTPUT IN TEXT MODE.
IF sy-subrc <> 0.
MESSAGE s185 WITH v_filepht.
LEAVE LIST-PROCESSING.
ENDIF.
LOOP AT i_logfile INTO w_logfile.
TRANSFER w_logfile TO v_filepht.
CLEAR w_logfile.
ENDLOOP.
IF sy-subrc = 0.
WRITE:/ text-055, v_filepht, text-056.
ELSE.
WRITE:/ text-057, v_filepht.
ENDIF.
* Closing the file
CLOSE DATASET v_filepht.
Regs,
Venkat
‎2005 Jul 27 11:15 AM
Yes, but because I'm newbie I need something runable, not only a part.
‎2005 Jul 27 11:24 AM
Hey,
Just create a internal table, populate some dummy data and call this funtion with appropriate parameters. It's enough.
Regs,
Venkat
‎2005 Jul 27 11:57 AM
Hi,
Check this.May be this can help you.
http://sap.ittoolbox.com/code/d.asp?d=2285&a=s
Kindly reward points if it is useful.
‎2005 Jul 27 12:50 PM
How could it help? I don't want to download table content but a file that exists on AS (in sap/trans directory).
‎2005 Jul 27 1:36 PM
Hi ,
try that:
REPORT ztrans01 .
*Parameters(files)
PARAMETERS: ux_dir TYPE epsf-epsdirnam OBLIGATORY
DEFAULT '/usr/sap/trans',
filename TYPE epsf-epsfilnam OBLIGATORY DEFAULT 'test1',
pc_dir TYPE rlgrap-filename OBLIGATORY
DEFAULT 'c:tmp'.
*DATA(Strings)
DATA itab TYPE TABLE OF string.
DATA wa TYPE string.
DATA file TYPE string.
DATA size TYPE epsf-epsfilsiz.
DATA ux_file TYPE epsf-epspath.
DATA mode TYPE epsf-epstxtmod.
*start-of-selection
START-OF-SELECTION.
*1) transfer
CONCATENATE ux_dir '/' filename INTO ux_file.
OPEN DATASET ux_file FOR INPUT IN TEXT MODE.
IF sy-subrc <> 0.
MESSAGE i502(me) WITH ux_file.
ENDIF.
DO.
READ DATASET ux_file INTO wa.
IF sy-subrc <> 0. EXIT . ENDIF.
APPEND wa TO itab.
ENDDO.
CLOSE DATASET ux_file.
*2)download
CONCATENATE pc_dir '' filename INTO file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = file
TABLES
data_tab = itab.Andreas
‎2005 Jul 27 1:36 PM
I think it's more suitable to FTP the file from the server to your local machine.
Maybe you can give some more information about the goal you want to achieve?
Kind regards,
Peter
‎2005 Jul 28 9:17 AM
Yes, this is exactly what I wanted, but it doesn't seem to be working with binary files. 'IN TEXT MODE' isn't syntactically correct, I had to add 'ENCODING DEFAULT' and I tried 'IN BINARY MODE' as well. Inspite of this the size of the local file differs from that on AS. Any idea how to correct this?
‎2005 Jul 27 12:22 PM
Hi,
and what is with func-group C13Z
and fm C13Z_APPL_TO_FRONT_END ?
regards Andreas
‎2005 Jul 27 12:47 PM
This module and group doesn't exist because the system is not R/3 but BW.