2012 May 19 9:25 AM
Dear Friends,
I am downloading data from one table to excel.
for that i am using fm excel_ole_standard_dat.
I am not getting heder c olumns.
First row is dislaying empnty.. and from second row on wards data is displaying.
how do i fill FIELDNAMES field in the above fm.
i checked in that fm but there is no structure for FIELDNAMES.
i tried alot to resolve this no thread resolved my issue.
Kindly anyone help me plz.
Hii,,
Use FM GUI_DOWNLOAD
For header you first append header name to internal table and then append data to the same internal table.
Now your internal table will display like
1st row = Header name and from
2nd row data will display
Most important fields should be in Char data type.
Regards,
Ashwath.
2012 May 19 9:36 AM
2012 May 19 9:47 AM
Check the following link Seshu reddy Maramreddy Explain how to download with header(field name) using
EXCEL_OLE_STANDARD_DAT
2012 May 21 7:45 AM
Hi Anurag,
Create 2 internal tables (1 containing data and 2 containing header names).
Use FM GUI_DOWNLOAD or EXCEL_OLE_STANDARD_DAT and give the above internal table names in parameter values for header and data.
It will download the excel file with data and header names for each columns.
-Ketan.
2012 May 21 11:31 AM
Hii,,
Use FM GUI_DOWNLOAD
For header you first append header name to internal table and then append data to the same internal table.
Now your internal table will display like
1st row = Header name and from
2nd row data will display
Most important fields should be in Char data type.
Regards,
Ashwath.
2012 May 21 12:33 PM
HI,
u have add header in information in first row of internal table so that u can able to download the header data also.
2012 May 21 1:54 PM
Hi,
You can use this structure to declare the table fieldnames:
DATA:
BEGIN OF fieldnames OCCURS 50,
text (60),
tabname (10),
fieldname (10),
typ,
END OF fieldnames.
And call the function EXCEL_OLE_STANDARD_DAT.
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
...
TABLES
...
fieldnames = fieldnames
...
I think this can help you,
2012 May 21 2:24 PM
Hii Anurag,
Yes.....
you just refer the below code
Example :
types : begin of ty_final,
po type char15,
data type char10,
text type char60,
end of ty_final.
data : it_final type table of ty_final,
wa_final type ty_final.
now for excel header you just append header information.
wa_final-po = 'PO Number'.
wa-final-date = 'Date'.
wa_final-text = 'Text'.
append wa_final to it_final.
now you fill the data into internal table...
wa_final-po = 450000089.
wa_final-date = 21052012.
wa_final-text = Po number.
append wa_final to it_final.
Now your final internal table contains data
PO Number Date Text
450000089 21052012 Po number
and now use below code.
DATA: ld_filename TYPE rlgrap-filename,
ld_filename1 TYPE string,
ld_path TYPE string,
ld_fullpath TYPE string,
ld_result TYPE i,
name TYPE string.
CONCATENATE 'Text'(005) sy-uzeit sy-datum INTO name.
**POP up to save file
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
* window_title = ' '
default_extension = 'XLS'
default_file_name = name
initial_directory = 'D:\'
CHANGING
filename = ld_filename1
path = ld_path
fullpath = ld_fullpath
user_action = ld_result.
* filename = ld_fullpath.
****Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = ld_filename1
write_field_separator = '#'
* IMPORTING
* FILELENGTH =
TABLES
data_tab = it_final
* FIELDNAMES =
* 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.
Regards,
Ashwath
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |