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

Problem when download file

Former Member
0 Likes
885

Hi,

I have used WS_DOWNLOAD and  GUI_DOWNLOAD but when i download file i have a file with one more record:

for example : if in my internal table i have 5 records i will have a file with  6 records.

this is my code:

PARAMETERS: p_filel LIKE rlgrap-filename.

TYPES: BEGIN OF typ_stru_dchar,

          line(3000) TYPE c,

        END OF typ_stru_dchar.

TYPES: typ_tab_dchar TYPE STANDARD TABLE OF typ_stru_dchar.

DATA wa_dchar TYPE typ_stru_dchar.

DATA tb_dchar TYPE typ_tab_dchar.

wa_dchar-line = ' fist test'.

append wa_dchar to tb_dchar.

CALL FUNCTION 'WS_DOWNLOAD'

       EXPORTING

         filename                = p_filel

         filetype                = 'ASC'

       TABLES

         data_tab                = tb_dchar[]

       EXCEPTIONS

         file_open_error         = 1

         file_write_error        = 2

         invalid_filesize        = 3

         invalid_type            = 4

         no_batch                = 5

         unknown_error           = 6

         invalid_table_width     = 7

         gui_refuse_filetransfer = 8

         customer_error          = 9

         no_authority            = 10

         OTHERS                  = 11.


Why i have this problem??...i don't understand

Thanks

1 ACCEPTED SOLUTION
Read only

former_member193464
Contributor
0 Likes
827

In GUI_DOWNLOAD- set these parameters to remove that extra line....

 
        TRUNC_TRAILING_BLANKS           = 'X'

          TRUNC_TRAILING_BLANKS_EOL       = 'X'

          WRITE_LF_AFTER_LAST_LINE        = ABAP_FALSE

In GUI_DOWNLOAD- set these parameters to remove that extra line....

 
        TRUNC_TRAILING_BLANKS           = 'X'

          TRUNC_TRAILING_BLANKS_EOL       = 'X'

          WRITE_LF_AFTER_LAST_LINE        = ABAP_FALSE

6 REPLIES 6
Read only

former_member193464
Contributor
0 Likes
828

In GUI_DOWNLOAD- set these parameters to remove that extra line....

 
        TRUNC_TRAILING_BLANKS           = 'X'

          TRUNC_TRAILING_BLANKS_EOL       = 'X'

          WRITE_LF_AFTER_LAST_LINE        = ABAP_FALSE

Read only

0 Likes
827

I have the same problem.

Read only

0 Likes
827

can you paste your code for gui_download

Read only

0 Likes
827

I'm solved ...i'm wrong to set WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE but the correct value is ABAP_FALSE.

thanks

Read only

Former Member
0 Likes
827

Hi,

     Please chekc this code.

     

    

  wa_dchar-line = ' fist test'.
CONDENSE wa_dchar-line .

append wa_dchar to tb_dchar.

wa_dchar-line = ' Second test'.

CONDENSE wa_dchar-line .
append wa_dchar to tb_dchar.

Regard's

Smruti

Read only

Former Member
0 Likes
827

Check if it happens using this method:

CALL METHOD cl_gui_frontend_services=>gui_download

   EXPORTING

     filename = p_filel

     filetype = 'ASC'

   CHANGING

     data_tab = tb_dchar[]

   EXCEPTIONS

     OTHERS   = 1.