<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Export itab data into container as excel format in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/export-itab-data-into-container-as-excel-format/m-p/4638808#M1092030</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dynpro container?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please elaborate your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Lekha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Oct 2008 14:04:24 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-10-22T14:04:24Z</dc:date>
    <item>
      <title>Export itab data into container as excel format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/export-itab-data-into-container-as-excel-format/m-p/4638807#M1092029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I upload data from excel into itab,then i want to export itab data into dynpro container as excel formt.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Oct 2008 13:59:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/export-itab-data-into-container-as-excel-format/m-p/4638807#M1092029</guid>
      <dc:creator>former_member788515</dc:creator>
      <dc:date>2008-10-22T13:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Export itab data into container as excel format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/export-itab-data-into-container-as-excel-format/m-p/4638808#M1092030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dynpro container?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please elaborate your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Lekha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Oct 2008 14:04:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/export-itab-data-into-container-as-excel-format/m-p/4638808#M1092030</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-22T14:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: Export itab data into container as excel format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/export-itab-data-into-container-as-excel-format/m-p/4638809#M1092031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;

CONSTANTS:
           c_basis         TYPE char5              VALUE 'Basis',
           c_cc_excel      TYPE char10             VALUE 'W_CC_EXCEL',
           c_excel         TYPE char5              VALUE 'Excel',
           c_excel_sh      TYPE char12             VALUE 'Excel.Sheet'.


DATA:
       w_container         TYPE REF TO cl_gui_custom_container,
       w_error             TYPE REF TO i_oi_error,
       w_retcode           TYPE soi_ret_string,
       w_control           TYPE REF TO i_oi_container_control,
       w_document          TYPE REF TO i_oi_document_proxy,
       w_handle            TYPE REF TO i_oi_spreadsheet.

*"Create the instance CONTROL

  CALL METHOD c_oi_container_control_creator=&amp;gt;get_container_control
    IMPORTING
      control = w_control
      error   = w_error.

*"Create a container

  CLEAR w_container.

  CREATE OBJECT w_container
    EXPORTING
      container_name = c_cc_excel.

*"Create the object that manages the link to the OLE interface

  IF w_control IS NOT INITIAL.

    MOVE c_x TO w_inplace.

    CALL METHOD w_control-&amp;gt;init_control
      EXPORTING
        r3_application_name      = c_basis
        inplace_enabled          = w_inplace
        inplace_scroll_documents = c_x
        parent                   = w_container
        register_on_close_event  = c_x
        register_on_custom_event = c_x
        no_flush                 = c_x
      IMPORTING
        error                    = w_error.


    CALL METHOD w_control-&amp;gt;get_document_proxy
      EXPORTING
        document_type  = c_excel_sh
      IMPORTING
        document_proxy = w_document
        error          = w_error.


    IF w_document IS NOT INITIAL.

      CALL METHOD w_document-&amp;gt;create_document
        EXPORTING
          document_title = text-065
          open_inplace   = c_x.

      CALL METHOD w_document-&amp;gt;has_spreadsheet_interface
        IMPORTING
          is_available = w_available
          error        = w_error
          retcode      = w_retcode.

      CALL METHOD w_document-&amp;gt;get_spreadsheet_interface
        IMPORTING
          sheet_interface = w_handle.


*"Fill Data in Excel
        CALL METHOD w_handle-&amp;gt;insert_full
          EXPORTING
           n_vrt_keys        = 2
           n_hrz_keys        = 1
           n_att_cols        = 8
            sema              = t_sema[]
            hkey              = t_hkey[]
            vkey              = t_vkey[]
            online_text       = t_online[]
            data              = t_out
          EXCEPTIONS
            dim_mismatch_data = 1
            dim_mismatch_sema = 2
            dim_mismatch_vkey = 3
            error_in_hkey     = 4
            error_in_sema     = 5
            inv_data_range    = 6
            error_in_vkey     = 7.

        ENDIF.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Oct 2008 14:17:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/export-itab-data-into-container-as-excel-format/m-p/4638809#M1092031</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-22T14:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: Export itab data into container as excel format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/export-itab-data-into-container-as-excel-format/m-p/4638810#M1092032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check out the following sample code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES: BEGIN OF y_print.
        INCLUDE STRUCTURE gxxlt_p.
TYPES: END   OF y_print.

TYPES: BEGIN OF  y_hkey.
        INCLUDE STRUCTURE gxxlt_h.
TYPES: END   OF y_hkey .

TYPES: BEGIN OF y_vkey.
        INCLUDE STRUCTURE gxxlt_v.
TYPES: END   OF y_vkey .

TYPES: BEGIN OF y_online.
        INCLUDE STRUCTURE gxxlt_o.
TYPES: END   OF y_online.

TYPES: BEGIN OF y_sema.
        INCLUDE STRUCTURE gxxlt_s.
TYPES: END   OF y_sema.

TYPES: BEGIN OF y_out,
        vbeln TYPE vbak-vbeln,
        vkorg TYPE vbak-vkorg,
        vtweg TYPE vbak-vtweg,
        spart TYPE vbak-spart,
       END   OF y_out.

DATA:e_hkey              TYPE y_hkey,
       e_vkey              TYPE y_vkey,
       e_online            TYPE y_online,
       e_sema              TYPE y_sema.

DATA:
* Internal table for holding the horizontal key.
       t_hkey        TYPE TABLE OF y_hkey,
* Internal table for holding the vertical key.
       t_vkey        TYPE TABLE OF y_vkey,
* Internal table for holding the online text....
       t_online      TYPE TABLE OF y_online,
* Internal table to hold SEMA data..............
       t_sema        TYPE TABLE OF y_sema,
       t_out         TYPE TABLE OF y_out.

CONSTANTS:c_str           TYPE char3              VALUE 'STR',
          c_dft           TYPE char3              VALUE 'DFT',
           c_x             TYPE char1              VALUE 'X'    ,
           c_basis         TYPE char5              VALUE 'Basis',
           c_cc_excel      TYPE char10             VALUE 'W_CC_EXCEL',
           c_excel         TYPE char5              VALUE 'Excel',
           c_excel_sh      TYPE char12             VALUE 'Excel.Sheet'.


DATA:  w_inplace(1)        TYPE c,
       w_available         TYPE i,
       w_container         TYPE REF TO cl_gui_custom_container,
       w_error             TYPE REF TO i_oi_error,
       w_retcode           TYPE soi_ret_string,
       w_control           TYPE REF TO i_oi_container_control,
       w_document          TYPE REF TO i_oi_document_proxy,
       w_handle            TYPE REF TO i_oi_spreadsheet.

** Fill SEMA
FREE t_sema.
CLEAR e_sema.
MOVE: 1     TO e_sema-col_no,
      c_str TO e_sema-col_typ,
      c_dft TO e_sema-col_ops.
APPEND e_sema TO t_sema.
MOVE 2 TO e_sema-col_no.
APPEND e_sema TO t_sema.
MOVE 3 TO e_sema-col_no.
APPEND e_sema TO t_sema.
MOVE 4 TO e_sema-col_no.
APPEND e_sema TO t_sema.

** Fill VKey

FREE t_vkey.
CLEAR e_vkey.
MOVE: 1             TO e_vkey-col_no,
      'Sales Order'    TO e_vkey-col_name.
APPEND e_vkey TO t_vkey.

** Fill HKEY
FREE t_hkey.
CLEAR e_hkey.
MOVE: 1            TO e_hkey-row_no,
      1            TO e_hkey-col_no,
      'Sale Org'     TO e_hkey-col_name.
APPEND e_hkey TO t_hkey.
CLEAR e_hkey.
MOVE: 1                       TO e_hkey-row_no,
      2                       TO e_hkey-col_no,
      'Distribution Channel'  TO e_hkey-col_name.
APPEND e_hkey TO t_hkey.
CLEAR e_hkey.
MOVE: 1                       TO e_hkey-row_no,
      3                       TO e_hkey-col_no,
      'Division'  TO e_hkey-col_name.
APPEND e_hkey TO t_hkey.



SELECT vbeln
       vkorg
       vtweg
       spart
  FROM vbak
  INTO TABLE t_out
  UP TO 20 ROWS.

CALL SCREEN 9001.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  M_DISPLAY_EXCEL  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE m_display_excel OUTPUT.

*"Create the instance CONTROL

  CALL METHOD c_oi_container_control_creator=&amp;gt;get_container_control
    IMPORTING
      control = w_control
      error   = w_error.

*"Create a container

  CLEAR w_container.

  CREATE OBJECT w_container
    EXPORTING
      container_name = c_cc_excel.

*"Create the object that manages the link to the OLE interface

  IF w_control IS NOT INITIAL.

    MOVE c_x TO w_inplace.

    CALL METHOD w_control-&amp;gt;init_control
      EXPORTING
        r3_application_name      = c_basis
        inplace_enabled          = w_inplace
        inplace_scroll_documents = c_x
        parent                   = w_container
        register_on_close_event  = c_x
        register_on_custom_event = c_x
        no_flush                 = c_x
      IMPORTING
        error                    = w_error.


    CALL METHOD w_control-&amp;gt;get_document_proxy
      EXPORTING
        document_type  = c_excel_sh
      IMPORTING
        document_proxy = w_document
        error          = w_error.


    IF w_document IS NOT INITIAL.

      CALL METHOD w_document-&amp;gt;create_document
        EXPORTING
          document_title = text-065
          open_inplace   = c_x.

      CALL METHOD w_document-&amp;gt;has_spreadsheet_interface
        IMPORTING
          is_available = w_available
          error        = w_error
          retcode      = w_retcode.

      CALL METHOD w_document-&amp;gt;get_spreadsheet_interface
        IMPORTING
          sheet_interface = w_handle.


*"Fill Data in Excel
      CALL METHOD w_handle-&amp;gt;insert_full
        EXPORTING
          n_vrt_keys        = 1
          n_hrz_keys        = 1
          n_att_cols        = 3
          sema              = t_sema[]
          hkey              = t_hkey[]
          vkey              = t_vkey[]
          online_text       = t_online[]
          data              = t_out
        EXCEPTIONS
          dim_mismatch_data = 1
          dim_mismatch_sema = 2
          dim_mismatch_vkey = 3
          error_in_hkey     = 4
          error_in_sema     = 5
          inv_data_range    = 6
          error_in_vkey     = 7.

    ENDIF.

  ENDIF.

ENDMODULE.                 " M_DISPLAY_EXCEL  OUTPUT

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Oct 2008 15:05:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/export-itab-data-into-container-as-excel-format/m-p/4638810#M1092032</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-22T15:05:44Z</dc:date>
    </item>
  </channel>
</rss>

