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: 

file creation

Former Member
0 Kudos

hi everybody,

how to create output file based on internal table and local variables and the contents of that file should be printed on printer and saves on logical file path by giveng selection parameters

plz guide me how to do this

regards,

sree

5 REPLIES 5

Former Member
0 Kudos

Hi,

Check the following link, this will give step by step way to create the file,

http://www.sapdevelopment.co.uk/file/file_updown.htm

Rgds,

Former Member
0 Kudos

Hi Divya,

The output file can be created from the internal table in different formats and it can store to the specified path.

Ex: Try these function modules...

1. WS_EXCEL for saving content as the excel file.

2. WS_DOWNLOAD, DOWNLOAD etc.,

try and get back...

Former Member
0 Kudos

Hi,

For Logical Files use tcode FILE to view all Logical directories use tcode AL11.

Regards:-

Santosh

Former Member
0 Kudos

Hi,

For,

<b>saves on logical file path by giving selection parameters</b>


REPORT ztest_2.
 
 
          DATA : it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE,
                 ftemp TYPE string.
 
          PARAMETERS : p_file TYPE rlgrap-filename DEFAULT 'C:LSMWdata'.
 
          START-OF-SELECTION.
 
            CONCATENATE p_file '.xls' INTO p_file.
 
            ftemp = p_file.
            CONDENSE ftemp NO-GAPS.
 
            SELECT * FROM mara INTO TABLE it_mara UP TO 200 ROWS.
 
            CALL FUNCTION 'GUI_DOWNLOAD'
              EXPORTING
                filename                = ftemp
                filetype                = 'ASC'
              TABLES
                data_tab                = it_mara[]
              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.
 


Regards,

AS

athavanraja
Active Contributor
0 Kudos

to save the file

use FM FILE_GET_NAME to convert the logical file physical file name.

then

local pc - use gui_download

application server - user open dataset .. statement (search the forum for code sample)

for also printing it.

you need to call function GET_PRINT_PARAMETERS with parameters immediately = 'X' and no_dialog= 'X' .(apart from other parameters)

Regards

Raja