14.01.2020 Views

ABAP_to_the_Future

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The Basics 11.1

ld_path

ld_fullpath

TYPE string,

TYPE string.

* This is the important bit

lt_rawdata = cl_bcs_convert=>xstring_to_solix( iv_xstring = ld_xml_file ).

ld_bytecount = xstrlen( ld_xml_file ).

* From now on this is all bog standard SAP

cl_gui_frontend_services=>file_save_dialog(

EXPORTING

window_title

= 'Choose where to save file'

default_extension = 'XLSX'

CHANGING

filename

= ld_filename " File Name to Save

path = ld_path " Path to File

fullpath

= ld_fullpath " Path + File Name

EXCEPTIONS

cntl_error = 1

error_no_gui = 2

not_supported_by_gui = 3

OTHERS = 4 ).

IF sy-subrc <> 0.

RETURN.

ENDIF.

cl_gui_frontend_services=>gui_download(

EXPORTING bin_filesize = ld_bytecount

filename = ld_fullpath

filetype = 'BIN'

CHANGING data_tab = lt_rawdata ).

Listing 11.4 Downloading the Spreadsheet

In a similar manner, you can open up the spreadsheet inside SAP or email it out.

(Section 11.2.8 goes into detail about email options.) Opening the spreadsheet in

place uses standard SAP mechanisms based on standard class CL_OI_CONTAINER_

CONTROL_CREATOR, which can be seen in the ex ample programs that came with

ABAP2XLSX.

Examples

When you install ABAP2XLSX onto your system, in addition to the base classes you get

an executable program called ZABAP2XLSX_DEMO_SHOW, which is a collection of about

40 individual demonstration programs, each showing a feature of ABAP2XLSX and how

to code it. By looking at the code in these sample programs, you can quickly learn how

to make cells bold, underline cells, or perform any of the other common Excel tasks.

465

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!