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: 

module pool

Former Member
0 Kudos

hii frnds my requirment is that in my module pool output i have to put a button so that when the user preses the button then the output will get transfer to the excel file .. so can anybody help me how to transfer the data of internal table to the excel file ...

thanking you

rohit gupta

1 ACCEPTED SOLUTION

Former Member
0 Kudos

try like this

call function 'EXCEL_OLE_STANDARD_DAT'
     exporting
          file_name                 = 'c:Total_Plant Waste.xls'
    tables
*         PIVOT_FIELD_TAB           =
         data_tab                  = t_excel1
         fieldnames                = flditab
     exceptions
          file_not_exist            = 1
          filename_expected         = 2
          communication_error       = 3
          ole_object_method_error   = 4
          ole_object_property_error = 5
          invalid_filename          = 6
          invalid_pivot_fields      = 7
          download_problem          = 8
          others                    = 9.
    clear: t_excel1,flditab.
    refresh: t_excel1,flditab.

Regards

Prabhu

4 REPLIES 4

Former Member
0 Kudos

try like this

call function 'EXCEL_OLE_STANDARD_DAT'
     exporting
          file_name                 = 'c:Total_Plant Waste.xls'
    tables
*         PIVOT_FIELD_TAB           =
         data_tab                  = t_excel1
         fieldnames                = flditab
     exceptions
          file_not_exist            = 1
          filename_expected         = 2
          communication_error       = 3
          ole_object_method_error   = 4
          ole_object_property_error = 5
          invalid_filename          = 6
          invalid_pivot_fields      = 7
          download_problem          = 8
          others                    = 9.
    clear: t_excel1,flditab.
    refresh: t_excel1,flditab.

Regards

Prabhu

Former Member
0 Kudos

Why can't you use GUI_DOWNLOAD with the file type DAT.

As its a module pool you will execute in foreground and should not have a issue with the function.

Regards

Ravi

Former Member
0 Kudos

Hi,

Use this FM

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = lv_file_name

filetype = 'DAT'

append = 'X'

write_field_separator = 'X'

codepage = '4103'

TABLES

data_tab = it_detail_report

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.

Rgds,

Prakash

Former Member
0 Kudos

Hi Rohit Gupta

Try this Code:

REPORT  ZVR_ITAB_XLS.

DATA: BEGIN OF intab occurs 0,
mandt LIKE mara-mandt,
matnr LIKE mara-matnr,
ersda LIKE mara-ersda,
ernam LIKE mara-ernam,
laeda LIKE mara-laeda,
aenam LIKE mara-aenam,
END OF intab.

start-of-selection.

select mandt matnr ersda laeda aenam from mara
into corresponding fields
of table intab up to 30 rows.

loop at intab.
write:/ intab-matnr,intab-ersda,intab-ernam,intab-laeda,intab-aenam.
clear intab.
endloop.

CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = ','
* I_LINE_HEADER =
i_filename = 'C:Documents and Settings141564My Documentstest123.xls'
tables
i_tab_sap_data = intab.

Cheers,

Vijay Raheja