07-23-2008 9:05 AM
Dear friends,
In report i have a check box for excel download,
If the user selectes download into excel file option than I need to download
the particular report variables and internal tables details like invoice header and line item details in a particular row and column of the excel file.
Additionally If we can able to download already available excel template is more
helpful for me.
If anyone knows , please provide me the details.
Thaaks for advance reply.
Thanks and Regards
V.Raja sekaran
07-23-2008 9:11 AM
Hi
There are several ways to download the data into excel files, probably the easy way is to use fm GUI_DOWNLOAD, anyway u can see the XXL program demo like XXLSTEST in order to use the fm XXL_SIMPLE_API.
Max
07-23-2008 9:16 AM
Hi,
Refer This:
https://forums.sdn.sap.com/click.jspa?searchID=14388042&messageID=1444639
Regards,
Shiva Kumar
07-23-2008 9:26 AM
Hi,
Use FM GUI_DOWNLOAD for this.
END-OF-SELECTION.
IF download EQ 'X'. " Ur selection screen check box is selected.
Call above FM.
ENDIF.
I hope u have all the data in one internal table.
Check below simple sample code.
TYPES:BEGIN OF t_tab,
empno(10) TYPE c,
END OF t_tab.
DATA: i_tab TYPE TABLE OF t_tab,
wa_tab TYPE t_tab.
CLEAR wa_tab.
wa_tab-empno = '0075694'.
APPEND wa_tab TO i_tab.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = 'D:/test.xls'
* FILETYPE = 'ASC'
* APPEND = ' '
WRITE_FIELD_SEPARATOR = '#'
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
tables
data_tab = i_tab
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.
If u want to append the data to existing file then pass parameter APPEND = 'X'. It will append the content.
Thanks,
Vinod.