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: 

h

Former Member
0 Kudos
188

Hi all,

How can I download the uploaded file back to any drive let say C drive. plz help

Thanks

1 ACCEPTED SOLUTION

Former Member
0 Kudos
162

Hi,

if you only want to up/down without changing the data then try this:

DATA: UP_PC TYPE STRING VALUE 'C:\TEST.TXT'.

DATA: DO_PC TYPE STRING VALUE 'C:\TEST_NEU.TXT'.

*

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_COPY

EXPORTING

SOURCE = UP_PC

DESTINATION = DO_PC

EXCEPTIONS

CNTL_ERROR = 1

ERROR_NO_GUI = 2

WRONG_PARAMETER = 3

DISK_FULL = 4

ACCESS_DENIED = 5

FILE_NOT_FOUND = 6

DESTINATION_EXISTS = 7

UNKNOWN_ERROR = 8

PATH_NOT_FOUND = 9

DISK_WRITE_PROTECT = 10

DRIVE_NOT_READY = 11

NOT_SUPPORTED_BY_GUI = 12

OTHERS = 13.

*

otherwise you have to use :

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD

make youre changes and than:

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD

Regards, Dieter

19 REPLIES 19

Former Member
0 Kudos
162

use GUI_DOWNLOAD or ws_download

specify the path and file type and store in internal table.

Former Member
0 Kudos
162

Hi

Use the fun module

GUI_DOWNLOAD

<b>Reward points for useful Answers</b>

Regards

Anji

former_member189059
Active Contributor
0 Kudos
162

Use transaction CG3Y

Former Member
0 Kudos
162

Hi,

Here is code which read the Programs & download:

Here Just pass the itab "SOURCE" into WS_DOWNLOAD.

function zuplt01f_tr.

*"----


""Local interface:

*" IMPORTING

*" REFERENCE(PROGRAM_NAME) TYPE SYREPID

*" TABLES

*" SOURCE

*"----


data: f(240) type c,

g type i,

h(72) type c,

low type i .

read report program_name into source . " state 'A'.

describe table source lines count.

endfunction.

<b>Rewards point for useful answer.</b>

former_member196280
Active Contributor
0 Kudos
162

USE GUI_DOWNLOAD and GUI_UPLOAD.

Regards,

Sairam

Former Member
0 Kudos
162

Hi,

see this code.if u select upload radio button file will be created and data in t_vbap will be written in that.if u select download radio button file contents will be read to i_vbap internal table.

TABLES : VBAP.

TABLES:SSCRFIELDS.

DATA : T_VBAP LIKE VBAP OCCURS 0 WITH HEADER LINE.

DATA : I_VBAP LIKE VBAP OCCURS 0 WITH HEADER LINE.

DATA : S_FILE TYPE STRING.

SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TIT1.

PARAMETERS : P_FILE(30) TYPE C DEFAULT 'C:\VBAP.TXT',

RB_DWLD RADIOBUTTON GROUP GR1 DEFAULT 'X',

RB_UPLD RADIOBUTTON GROUP GR1.

SELECTION-SCREEN END OF BLOCK BL1.

INITIALIZATION.

TIT1 = 'VBAP DETAILS'.

AT SELECTION-SCREEN.

S_FILE = P_FILE.

CASE SSCRFIELDS-UCOMM.

WHEN 'ONLI'.

IF RB_DWLD = 'X'.

SELECT * FROM VBAP INTO CORRESPONDING FIELDS OF TABLE T_VBAP.

T_VBAP-VBELN = 'gfhgh'.

T_VBAP-POSNR = 'GFGDFG'.

append t_vbap.

loop at t_vbap.

write:/ t_vbap-vbeln.

endloop.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = S_FILE

FILETYPE = 'ASC'

WRITE_FIELD_SEPARATOR = '*'

TABLES

DATA_TAB = T_VBAP.

else.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = S_FILE

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = i_vbap.

ENDIF.

ENDCASE.

loop at i_vbap.

write:/ i_vbap-vbeln.

endloop.

rgds,

bharat

Former Member
0 Kudos
162

Hi

Use the fun modules

GUI_DOWNLOAD or WS_DOWNLOAD

Reward points for useful Answers

with regards

suresh aluri

Former Member
0 Kudos
162

I wrote this code but it is not working..... can anyone help please

at selection-screen on value-request for pa_file.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = ''

IMPORTING

FILE_NAME = pa_file.

gv_file = pa_file.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = 'C:\test.txt'

FILETYPE = 'ASC'

TABLES

DATA_TAB = itab

0 Kudos
162

Hi Shaheen ,

If i understand correctly then you want to download the file gv_file , so please pass the file name gv_file instead of directly specifying 'C:\test.txt'

This is suggested as the data type of the file name in the function module is of type String

Regards

Arun

0 Kudos
162

hi,

y r u not passing gv_file to the parameter Filename in GUI_DOWNLOAD??

0 Kudos
162

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_pfname.

PERFORM get_file_from_present_server .

FORM get_file_from_present_server.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

EXPORTING

program_name = sy-repid

dynpro_number = sy-dynnr

CHANGING

file_name = p_pfname

EXCEPTIONS

mask_too_long = 1

OTHERS = 2.

and store this filename in a string variable

Data t type string.

t = p_pfname.

then use GUI_Download.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = 'C:\test.txt'

FILETYPE = '<b>DAT</b>'

TABLES

DATA_TAB = itab

************

USE GUI_UPLOAD

not gui_download.

Message was edited by:

Sumi Vasu

0 Kudos
162

Can i the code please

0 Kudos
162

For test just write this in START-OF-SELECTION event.

Make sure itab is filled before this function call.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = 'C:\test.txt'

FILETYPE = 'ASC'

TABLES

DATA_TAB = itab.

Reward if useful

0 Kudos
162

Still not working

0 Kudos
162

GIUI_UPLOAD

data l_file type string.

l_file = P_FILE.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = L_FILE

filetype = 'ASC'

  • HAS_FIELD_SEPARATOR = ','

TABLES

data_tab = t_text

EXCEPTIONS

file_open_error = 1

file_read_error = 2

header_too_long = 11

disk_full = 15

dp_timeout = 16

OTHERS = 17.

IF sy-subrc <> 0.

WRITE: / text-006, l_file , sy-subrc.

ENDIF.

0 Kudos
162

Thanks but I wanted the code for downloading a file into the c drive.

0 Kudos
162

hi,

at selection-screen on value-request for pa_file.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = ''

IMPORTING

FILE_NAME = pa_file.

gv_file = pa_file.

start-of-selection.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = GV_FILE

FILETYPE = 'ASC'

TABLES

DATA_TAB = itab.

rgds,

priya

0 Kudos
162

hI,

SEE THIS CODE.

TABLES : VBAP.

TABLES:SSCRFIELDS.

DATA : T_VBAP LIKE VBAP OCCURS 0 WITH HEADER LINE.

DATA : I_VBAP LIKE VBAP OCCURS 0 WITH HEADER LINE.

<b>DATA : S_FILE TYPE STRING.</b>

<b>DATA:PA_FILE TYPE IBIPPARMS-PATH.</b>

DATA:ITAB TYPE MARA OCCURS 0 WITH HEADER LINE.

SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TIT1.

PARAMETERS:RB_DWLD RADIOBUTTON GROUP GR1 DEFAULT 'X',

RB_UPLD RADIOBUTTON GROUP GR1.

SELECTION-SCREEN END OF BLOCK BL1.

INITIALIZATION.

TIT1 = 'VBAP DETAILS'.

AT SELECTION-SCREEN.

<b>CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

*FIELD_NAME = ''

IMPORTING

FILE_NAME = pa_file.

S_FILE = pa_file.</b>

CASE SSCRFIELDS-UCOMM.

WHEN 'ONLI'.

IF RB_DWLD = 'X'.

SELECT * FROM VBAP INTO CORRESPONDING FIELDS OF TABLE T_VBAP.

T_VBAP-VBELN = 'gfhgh'.

T_VBAP-POSNR = 'GFGDFG'.

append t_vbap.

loop at t_vbap.

write:/ t_vbap-vbeln.

endloop.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = S_FILE

FILETYPE = 'ASC'

WRITE_FIELD_SEPARATOR = '*'

TABLES

DATA_TAB = T_VBAP.

else.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = S_FILE

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = i_vbap.

ENDIF.

ENDCASE.

RGDS,

BHARAT.

Former Member
0 Kudos
163

Hi,

if you only want to up/down without changing the data then try this:

DATA: UP_PC TYPE STRING VALUE 'C:\TEST.TXT'.

DATA: DO_PC TYPE STRING VALUE 'C:\TEST_NEU.TXT'.

*

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_COPY

EXPORTING

SOURCE = UP_PC

DESTINATION = DO_PC

EXCEPTIONS

CNTL_ERROR = 1

ERROR_NO_GUI = 2

WRONG_PARAMETER = 3

DISK_FULL = 4

ACCESS_DENIED = 5

FILE_NOT_FOUND = 6

DESTINATION_EXISTS = 7

UNKNOWN_ERROR = 8

PATH_NOT_FOUND = 9

DISK_WRITE_PROTECT = 10

DRIVE_NOT_READY = 11

NOT_SUPPORTED_BY_GUI = 12

OTHERS = 13.

*

otherwise you have to use :

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD

make youre changes and than:

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD

Regards, Dieter