Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ABAP control - Excel spreedsheet generation

Former Member
0 Likes
514

Hi,

I am programming generation of the Excel document from ABAP. I created additional popupscreen where the Excel should be shown with the generated spreedsheet and I have following questions:

- I used the example program SAPRDEMOEXCELINTEGRATION2 as a reference for my development. I created my own class and method to generate Excel spreedsheet, I use following objects/methods like in reference program:

c_oi_container_control_creator=>get_container_control
CREATE OBJECT container
         EXPORTING container_name = 'CONTAINER'.
CALL METHOD lc_control->init_control
CALL METHOD lc_control->get_link_server
CALL METHOD link_server->start_link_server

To retrieve the document form from repository:

CALL METHOD in_bds_document->get_info
  CALL METHOD in_bds_document->get_with_url

And to generate the XLS:

CALL METHOD control->get_document_proxy
    CALL METHOD proxy->open_document
    CALL METHOD proxy->get_spreadsheet_interface

It works perfect, the Excel is shown in the popup dialog window. When the window is closed, following releasing methods are executed:

CALL METHOD proxy->is_destroyed
    CALL METHOD proxy->close_document
    CALL METHOD proxy->save_document_to_table
    CALL METHOD proxy->release_document

    CALL METHOD cl_gui_cfw=>dispatch.

    IF NOT lc_bds_instance IS INITIAL.
      FREE lc_bds_instance.
    ENDIF.

    IF NOT link_server IS INITIAL.
      CALL METHOD link_server->stop_link_server.
      FREE link_server.
    ENDIF.

    IF NOT lc_control IS INITIAL.
      CALL METHOD lc_control->destroy_control.
      FREE lc_control.
    ENDIF.

    LEAVE TO SCREEN 0.

So it looks like all the objects are released after the Excel generation. The problem is that when the user immediately run the

program again, the Excel is not shown - just an empty popup dialog screen. Anybody has any idea what is wrong?

- Second question. This method requires to have Excel installed on the presentation frontend. So it can be used in normal dialog programming, but how to generate .XLS file in BSP? The code upper can't be used because SAP GUi is not available in this schema. Is the generating .HTML file with CONTENT-TYPE: .xls the only method to generate .XLS?

Thank you!

Edited by: Wojciech Walczak ITMAXI.COM on Aug 12, 2009 11:57 AM

2 REPLIES 2
Read only

Former Member
0 Likes
446

/people/alvaro.tejadagalindo/blog/2009/02/05/excel-ole-and-abap--create-fancy-reports

https://wiki.sdn.sap.com/wiki/display/Snippets/ALV%2bGrid%2bDisplay%2bwith%2bcheckbox%2bto%2bprocess...

Read only

0 Likes
446

Sorry - I asked direct questions. I don't need your links found in SDN as I studied all of them before asking that questions.

You loose our time writing such posts!