Skip to Content
0
Former Member
Oct 26, 2010 at 01:42 PM

Upload pdf file from frontend to unix server

73 Views

Hi all,

I want to upload a file from frontend to unix server.

The following coding transfers the file to the unix server. But the file is corrupted.

Any ideas whats wrong?

TYPES: BEGIN OF t_data_tab,

line TYPE x LENGTH 256,

END OF t_data_tab.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL METHOD cl_gui_frontend_services=>file_open_dialog

CHANGING

file_table = lt_filetable

rc = lv_rc.

READ TABLE lt_filetable INTO p_file INDEX 1.

lv_filename = p_file.

CALL METHOD cl_gui_frontend_services=>gui_upload

EXPORTING

filename = lv_filename

filetype = 'BIN'

CHANGING

data_tab = lt_data_tab

EXCEPTIONS

OTHERS = 4.

OPEN DATASET p_unix FOR OUTPUT IN BINARY MODE.

IF sy-subrc NE 0.

EXIT.

ELSE.

LOOP AT lt_data_tab INTO ls_data_tab.

TRANSFER ls_data_tab TO p_unix.

IF sy-subrc NE 0.

CONTINUE.

ENDIF.

ENDLOOP.

CLOSE DATASET p_unix.

ENDIF.

regards