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

Downloading file from application server in Binary mode

Former Member
0 Likes
3,132

Hi,

I am trying to read an application server file using open dataset in Binary Mode..

While downloading using gui_download method the file is getting truncated because of its size.

My questions are,

How to increase the size of the internal table dynamically. Already tried using STRING type but it is not accepting.

If I use the CHAR type with maximum length 65535 and if the length of the file is less than that then in the remaining spaces box like symbols are printed .

How can I achieve it.

Thanks & Regards,

NJ

Hi,

I am trying to read an application server file using open dataset in Binary Mode..

While downloading using gui_download method the file is getting truncated because of its size.

My questions are,

How to increase the size of the internal table dynamically. Already tried using STRING type but it is not accepting.

If I use the CHAR type with maximum length 65535 and if the length of the file is less than that then in the remaining spaces box like symbols are printed .

How can I achieve it.

Thanks & Regards,

NJ

1 REPLY 1
Read only

Former Member
0 Likes
1,366

TYPES: BEGIN OF type_download,

data1 TYPE zchar20000,

data2 TYPE zchar20000,

data3 TYPE char3000,

data4 TYPE char2000,

END OF type_download.

DATA: lt_download TYPE STANDARD TABLE OF type_download,

lx_download TYPE string,

lv_filename TYPE string.

  • Read data from application server to internal table

OPEN DATASET p_p_ftappl FOR INPUT IN BINARY MODE.

IF sy-subrc = 0.

  • Read file

DO.

CLEAR lx_download.

READ DATASET p_p_ftappl INTO lx_download.

IF sy-subrc <> 0.

EXIT.

ENDIF.

APPEND lx_download TO lt_download.

ENDDO.

  • Download data to presentation server from internal table

lv_filename = p_p_ftfron.

  • Download data from application server to PC

CALL METHOD cl_gui_frontend_services=>gui_download

EXPORTING

  • bin_filesize =

filename = lv_filename

filetype = c_bin

  • append = space

  • write_field_separator = space

  • header = '00'

  • trunc_trailing_blanks = 'X' "space "commented

  • trunc_trailing_blanks_eol = 'X' "added

  • IMPORTING

  • filelength =

CHANGING

data_tab = lt_download.

*Exceptions deleted .

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

  • Close file

CLOSE DATASET p_p_ftappl.

Edited by: NewJoinee123 on Mar 25, 2010 8:45 AM