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

Excel into a container

Former Member
0 Likes
1,540

Hello,

A have tested this program RSDEMO01.

I would like to do as this program, I want to load my excel file in a contenair not in external file.

Can someone help me.

thanks all.

5 REPLIES 5
Read only

MaryM
Participant
0 Likes
1,093

Hi,

you can try using interface I_OI_DOCUMENT_VIEWER.


DATA: custom_container  TYPE REF TO cl_gui_custom_container,
           document_viewer  TYPE REF TO i_oi_document_viewer.


IF custom_container3IS INITIAL.
    CREATE OBJECT custom_container3
      EXPORTING
        container_name = 'CONTAINER100'.

    CALL METHOD c_oi_container_control_creator=>get_document_viewer
      IMPORTING
        viewer = document_viewer.

    CALL METHOD document_viewer->init_viewer
      EXPORTING
        parent = custom_container.
  ENDIF.

View document using classname and classtype (they have to be defined in Business Document Service):



DATA: content    TYPE sbdst_content,
          components TYPE sbdst_components,
          wa_components LIKE LINE OF components.

  CALL METHOD cl_bds_document_set=>get_with_table
    EXPORTING
*    logical_system  =
      classname       = l_classname     "'HRFPM_EXCEL'
      classtype       = l_classtype        "'OT'
*    client          =
*    object_key      =
    CHANGING
      content         = content
*    signature       =
    components      = components
*  EXCEPTIONS
*    error_kpro      = 1
*    internal_error  = 2
*    nothing_found   = 3
*    no_content      = 4
*    parameter_error = 5
*    not_authorized  = 6
*    not_allowed     = 7
*    others          = 8
          .

  DATA: l_type(20),
        l_subtype(20),
        l_size TYPE i.

  READ TABLE components INDEX 1 INTO wa_components.
  SPLIT wa_components-mimetype AT '/' INTO l_type l_subtype.
  MOVE wa_components-comp_size TO l_size.
  BREAK-POINT.

  CALL METHOD document_viewer->view_document_from_table
    EXPORTING
      show_inplace   = 'X'
      type           = l_type
      subtype        = l_subtype
      size           = l_size
    CHANGING
      document_table = data_tab."document_table
*    EXCEPTIONS
*      dp_invalid_parameter = 1
*      dp_error_general     = 2
*      cntl_error           = 3
*      not_initalized       = 4
*      invalid_parameter    = 5.

Regards,

MayM

Read only

Former Member
0 Likes
1,093

This code can't works, and I don't undersand this lines:

DATA: content TYPE sbdst_content,

components TYPE sbdst_components,

wa_components LIKE LINE OF components.

document_table = data_tab.

classname = l_classname "'HRFPM_EXCEL'

classtype = l_classtype "'OT'

View document using classname and classtype (they have to be defined in Business Document Service)

Edited by: BOBALICE on May 18, 2009 6:17 PM

Read only

0 Likes
1,093

Hi Bob,

Have a look at the following demo program "BCALV_GRID_02".

In this Program the output will be as an ALV container.

Cheers,

KK

Read only

0 Likes
1,093

yes, I understand this program "BCALV_GRID_02" , I have a same program.

I want to add a button to this screen to display this ALVGRID in Excel FILE into another container.

thanks.

Read only

0 Likes
1,093

This is the part of code you need to add to your program.

1. create container

2. call document_viewer in container

To be able to use METHOD document_viewer->view_document_from_table, you need to have

1. data_tab (type standard table) that contains your excel file in binary.

2. Mime type and subtype for excel - to get type and subtype you can use (no obligatory though)

METHOD cl_bds_document_set=>get_with_table.