Application Development 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: 

Column Headers in multi sheet excel

Former Member
0 Kudos

Hi All,

I have problem in setting the column headers for multi sheet excel. My problem is to create multiple sheets in single work book in which every columns should have its relevant header text. I am making use of SOI interface for creating multi sheet excel, in which I have succeeded, but problem is with header text for every columns.

Please help me to solve this problem. Every help is appreciated.

Thanks in advance.

2 REPLIES 2

Former Member
0 Kudos

Hi,

You need to create separate field catalogs for every internal table that you are passing to different sheets in a single workbook. Can you please show me your code.

Danish.

Former Member
0 Kudos
************************************************************************
*                   Create document container                          *
************************************************************************
CALL METHOD c_oi_container_control_creator=>get_container_control
      IMPORTING
        control = obj_cntrl
        error   = obj_error
        retcode = gv_ret.


************************************************************************
*                   Check For Error                                    *
************************************************************************
    PERFORM check_excel_error.
*    CHECK obj_error->has_failed = 'X'.
*    CALL METHOD obj_error->raise_message( 'E' ).


************************************************************************
*                   Initialize Document Container                      *
************************************************************************
    CALL METHOD obj_cntrl->init_control
      EXPORTING
        r3_application_name = c_docu_name
        parent              = cl_gui_custom_container=>screen0
      IMPORTING
        error               = obj_error
        retcode             = gv_ret.


************************************************************************
*                   Check For Error                                    *
************************************************************************
    PERFORM check_excel_error.
*    CHECK obj_error->has_failed = 'X'.
*    CALL METHOD obj_error->raise_message( 'E' ).


************************************************************************
*                   Get Document Proxy                                 *
************************************************************************
    CALL METHOD obj_cntrl->get_document_proxy
      EXPORTING
        document_type  = soi_doctype_excel_sheet
        no_flush       = 'X'
      IMPORTING
        document_proxy = obj_prox
        error          = obj_error
        retcode        = gv_ret.


************************************************************************
*                   Check For Error                                    *
************************************************************************
    PERFORM check_excel_error.

*    CHECK obj_error->has_failed = 'X'.
*    CALL METHOD obj_error->raise_message( 'E' ).


************************************************************************
*                   Proxy Create Document                              *
************************************************************************
    CALL METHOD obj_prox->create_document
      EXPORTING
        create_view_data = ' '
        document_title   = c_docu_name
        no_flush         = ' '
        open_inplace     = ' '
        open_readonly    = ' '
        onsave_macro     = ' '
        startup_macro    = ''
      IMPORTING
        error            = obj_error
        retcode          = gv_ret.


************************************************************************
*                   Check For Error                                    *
************************************************************************
    PERFORM check_excel_error.
*    CHECK obj_error->has_failed = 'X'.
*    CALL METHOD obj_error->raise_message( 'E' ).


************************************************************************
*                   Proxy get spreadsheet interface                    *
************************************************************************
    CALL METHOD obj_prox->get_spreadsheet_interface
      EXPORTING
        no_flush        = ' '
      IMPORTING
        error           = obj_error
        retcode         = gv_ret
        sheet_interface = obj_spread.


************************************************************************
*                   Check For Error                                    *
************************************************************************
    PERFORM check_excel_error.

*    CHECK obj_error->has_failed = 'X'.
*    CALL METHOD obj_error->raise_message( 'E' ).




************************************************************************
*                   Insert Range                                       *
************************************************************************
    CALL METHOD obj_spread->insert_range
      EXPORTING
        columns  = i_cols
        rows     = i_rows
        no_flush = ' '
        name     = w_range_name
        updating = -1
      IMPORTING
        error    = obj_error
        retcode  = gv_ret.


************************************************************************
*                   Check For Error                                    *
************************************************************************
    PERFORM check_excel_error.

*    CHECK obj_error->has_failed = 'X'.
*    CALL METHOD obj_error->raise_message( 'E' ).

************************************************************************
*                   Insert Data Into Range                             *
************************************************************************
    CALL METHOD obj_spread->insert_one_table
      EXPORTING
        data_table   = i_data_tab
        rangename    = w_range_name
        fields_table = it_fields_tab
        no_flush     = ' '
        wholetable   = 'X'
        updating     = 1
      IMPORTING
        retcode      = gv_ret
        error        = obj_error.


************************************************************************
*                   Check For Error                                    *
************************************************************************
    PERFORM check_excel_error.

*    CHECK obj_error->has_failed = 'X'.
*    CALL METHOD obj_error->raise_message( 'E' ).

This is the functional module (ZHR_CREATE_EXCEL_SHEETS) code and I am calling this FM for every internal table again and again.

Edited by: Shailesh Malkar on Sep 20, 2011 7:31 AM