08-09-2013 8:50 AM
Hi Experts,
How to download XSTRING data to local excel file.
This download functionality can be used in lower ECC version, which may not have webdynpro. So I should not
use CL_WDR_RUNTIME_SERVICES class. I have to download from SAPGUI. I converted my internal table to
XSTRING by formating the header & border everything. Now I would like to download the same internal table
content with the styles that I inserted via XML. Please help me.
Thanks and regards,
Venkat.
08-09-2013 9:00 AM
Hi,
I didn't understand what your Excel file have to do with xstring ? it's a picture to put in an excel file ?
regards
Fred
08-09-2013 9:05 AM
Hi,
I would like to have border, background color for headers, etc. This I have done
and I have my XML content with border styles and data. Now I would like to download this XML content to local file. After download, local file should just be the internal table content, but it should be
having color and borders.
Thanks and regards,
venkat
08-09-2013 9:45 AM
Hi Venkat,
If your final internal table has the XML Content, then you can directly download the file using the following code.
Data : FILENAME TYPE RLGRAP-FILENAME.
FILEPATH TYPE STRING.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
* DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'FILENAME'
IMPORTING
FILE_NAME = FILENAME.
IF FILENAME IS NOT INITIAL.
FILEPATH = FILENAME.
CONCATENATE FILEPATH '.XLS' INTO FILEPATH.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = FILEPATH
FILETYPE = 'ASC'
TABLES
DATA_TAB = I_XML (Internal Table having the XML data)
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,
AyyamPerumal
08-09-2013 9:53 AM
Adding to the above, you need not convert the internal table to xstring format. Instead you can download the Binary data itself directly with the above FMs.
the following link may help you creating the xml code for formatting Excel
http://msdn.microsoft.com/en-us/library/office/aa140066%28v=office.10%29.aspx#odc_xmlss_ss:cell
and this link will help you in creating multiple sheets in excel and emailing them to the recipients (Change Emailing codes with the above FMs for downloading to Excel)
Hope this might help you.
Regards,
AyyamPerumal