2009 Feb 16 3:59 AM
Hello all
i ahve requirement like below.
In module pool i am using Table control to display data.
I want to export data from table control(module pool) to local file like in ALV list.
can any one help me
Regards
radha
Hello all
i ahve requirement like below.
In module pool i am using Table control to display data.
I want to export data from table control(module pool) to local file like in ALV list.
can any one help me
Regards
radha
2009 Feb 16 4:08 AM
Hi,
You must be displaying data into table control from an internal table.
So an alternative is to create a button in dialog programming and then in user command at sy-ucomm for that button include a code for downloading the data into excel file using FM:-
GUI_DOWNLOAD
EXCEL_OLE_STANDARD_DAT
Pass the internal table and you will get data into an excel file with all the data.
Hope this helps you.
Thanks & Regards,
Tarun
Edited by: Tarun Gambhir on Feb 16, 2009 9:38 AM
2009 Feb 16 4:23 AM
Hi Tarun,
Thanks for reply,
how to provide popup to select path and
if i want to provide popup like in ALV
how to achieve this.
regards
raadha
2009 Feb 16 9:56 AM
Hope this one helps.............
if not it1[] is initial.
it1_xls-pcode = 'Product Code'.
it1_xls-desc = 'Group Description'.
it1_xls-subfam = 'Sub_Family'.
it1_xls-codcol = 'Tint'.
it1_xls-codcoat = 'Coating'.
it1_xls-epaiscom = 'Comm. Thickness'.
it1_xls-mcode = 'Material Code'.
it1_xls-del_flag = 'Deletion_Flag'.
append it1_xls.
loop at it1.
it1_xls-pcode = it1-pcode.
it1_xls-desc = it1-desc.
it1_xls-subfam = it1-subfam.
it1_xls-codcol = it1-codcol.
it1_xls-codcoat = it1-codcoat.
it1_xls-epaiscom = it1-epaiscom.
it1_xls-mcode = it1-mcode.
it1_xls-del_flag = it1-del_flag.
append it1_xls.
endloop.
call function 'DOWNLOAD'
exporting
filename = 'C:\'
filetype = 'DAT'
mode = 'X'
tables
data_tab = it1_xls
exceptions
invalid_filesize = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
others = 7.
clear it1_xls.
refresh it1_xls.
endif.
thanks,
Rajan
2009 Feb 16 4:44 AM
Hi,
Create a sub-screen with one parameter on it which can accept a value for file path.
Refer code:-
At screen logic:-
PROCESS BEFORE OUTPUT.
MODULE status_8001.
CALL SUBSCREEN sub_area1 INCLUDING V_PROG V_DYNNR.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_8001.
MODULE INIT_SUBSCREEN.
In PAI,
MODULE INIT_SUBSCREEN.
CASE sy-ucomm.
WHEN 'DOWNLOAD' "funuction code for download buttons.
V_PROG = sy-repid.
V_DYNNR = '0800'. "sub-screen number
ENDCASE.
ENDMODULE.
Now use the parameter on this sub-screen to accept the value for file path, and then use this path to download the data into the excel file at specified path.
Hope this helps you.
Thanks & Regards,
Tarun Gambhir
2009 Feb 16 5:23 AM
Hi tarun
when i am using FM 'EXCEL_OLE_STANDARD_DAT' i am getting following dump
The current statement only supports character-type data objects.
Using this FM, we can download only character type fields.
i am getting this dump on RATE fielld
ragards
raadha
2009 Feb 16 5:55 AM
Hi
Try using:-
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:/Vendors1.xls' "pass your path
FILETYPE = 'DAT'
TABLES
DATA_TAB = ITAB "internal table
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.
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir
2009 Jun 02 6:04 AM