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

how to create file manually..?

Former Member
0 Likes
751

Hi All,

Is there any function module to create the file?

My requirement is to upload the data into the file running u2018GUI_DOWNLOADu2019 function module, but that file should not be created manually, it should automatically create through the program, any help plsu2026?

Puppy

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
714

Hi Puppy,

GUI_DOWNLOAD itself takes care of cratiing file Automatically on Local drive.

For Example in below code file will be created with name l_file1 with contents of table t_tab.


  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
*   BIN_FILESIZE                    =
      filename                        = l_file1
      filetype                        = 'TXT'
*   APPEND                          = ' '
      write_field_separator           = 'X'
    TABLES
      data_tab                        = t_tab
      fieldnames                      = t_headers.

Regards

Shital

5 REPLIES 5
Read only

Former Member
0 Likes
715

Hi Puppy,

GUI_DOWNLOAD itself takes care of cratiing file Automatically on Local drive.

For Example in below code file will be created with name l_file1 with contents of table t_tab.


  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
*   BIN_FILESIZE                    =
      filename                        = l_file1
      filetype                        = 'TXT'
*   APPEND                          = ' '
      write_field_separator           = 'X'
    TABLES
      data_tab                        = t_tab
      fieldnames                      = t_headers.

Regards

Shital

Read only

0 Likes
714

Hi shital,

in file name place i think we have to mention the file path.

Puppy.

Read only

0 Likes
714

It might be Fully Qualified Windows path Like C:\Folder\Filename.txt.

Read only

0 Likes
714

Hi,

Use this.

v_file = 'C:\Documents and Settings\test\Desktop\file.txt'

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = v_file

filetype = 'ASC'

TABLES

data_tab = it_final

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7

separator_not_allowed = 8

filesize_not_allowed = 9

header_too_long = 10

dp_error_create = 11

dp_error_send = 12

dp_error_write = 13

unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full = 17

dp_timeout = 18

file_not_found = 19

dataprovider_exception = 20

control_flush_error = 21

OTHERS = 22.

IF sy-subrc <> 0.

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

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

ENDIF.

Read only

Former Member
0 Likes
714

Hi,

Use FM:- TMP_GUI_CREATE_DIRECTORY