2012 Dec 10 5:55 PM
hi friend,
when i try to see thee table in excel nothing happend. &vexcel command.
The report show a table input as parameter. t001 is the table used for testing.
thanks in advance.
Miguel Angel Orihuela.
*
*
REPORT zruhr_testing_grid_vexcel .
TYPE-POOLS:
slis.
CONSTANTS:
gc_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
DATA:
gt_tab TYPE REF TO data.
PARAMETERS:
p_table TYPE dd02l-tabname.
DATA:
_save TYPE c,
_variant LIKE disvariant,
_repid LIKE sy-repid,
gt_events TYPE slis_t_event,
gt_fieldcat TYPE slis_t_fieldcat_alv,
gs_layout TYPE slis_layout_alv.
FIELD-SYMBOLS:
<gt_tab> TYPE STANDARD TABLE.
CREATE DATA gt_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN gt_tab->* TO <gt_tab>.
SELECT * FROM (p_table) INTO TABLE <gt_tab>.
END-OF-SELECTION.
PERFORM fieldcatalog USING p_table
CHANGING gt_fieldcat[].
PERFORM eventtab_build USING gt_events[].
PERFORM layout_build USING gs_layout.
_repid = sy-repid.
_save = 'A'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = _repid
i_callback_pf_status_set = 'ALV_PF_STATUS'
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
i_save = _save
is_variant = _variant
it_events = gt_events[]
TABLES
t_outtab = <gt_tab>
EXCEPTIONS
program_error = 1
OTHERS = 2.
*&---------------------------------------------------------------------*
*& Form fieldcatalog
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->_FIELDCAT text
*----------------------------------------------------------------------*
FORM fieldcatalog USING pi_table TYPE dd02l-tabname
CHANGING li_alv_cat TYPE slis_t_fieldcat_alv.
DATA: t_fieldcat TYPE lvc_t_fcat,
w_fieldcat TYPE lvc_s_fcat,
ls_fieldcat TYPE slis_fieldcat_alv.
REFRESH:
li_alv_cat,
t_fieldcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = pi_table
CHANGING
ct_fieldcat = t_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
LOOP AT t_fieldcat INTO w_fieldcat.
MOVE-CORRESPONDING w_fieldcat TO ls_fieldcat.
ls_fieldcat-seltext_l = sy-tabix.
ls_fieldcat-seltext_m = sy-tabix.
ls_fieldcat-seltext_s = sy-tabix.
APPEND ls_fieldcat TO li_alv_cat.
ENDLOOP.
ENDFORM. " SETUP-FIELDCATALOG
*&---------------------------------------------------------------------*
*& Form alv_pf_status
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->L_ALV_EXCL text
*----------------------------------------------------------------------*
FORM alv_pf_status USING l_alv_excl TYPE STANDARD TABLE.
SET PF-STATUS 'GRID_FULLSCREEN'
OF PROGRAM 'SAPLBSPL'.
* SET PF-STATUS 'STANDARD_FULLSCREEN' "excluding lt_extab
* OF PROGRAM 'SAPLSETB'.
ENDFORM. "alv_pf_status
*&---------------------------------------------------------------------*
*& Form eventtab_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->_EVENTS text
*----------------------------------------------------------------------*
FORM eventtab_build USING _events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = _events.
READ TABLE _events
WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE gc_top_of_page TO ls_event-form.
APPEND ls_event TO _events.
ENDIF.
ENDFORM. " eventtab_buil
*&---------------------------------------------------------------------*
*& Form layout_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->_LAYOUT text
*----------------------------------------------------------------------*
FORM layout_build USING _layout TYPE slis_layout_alv.
_layout-no_input = 'X'.
_layout-zebra = 'X'.
ENDFORM. " layout_build
*&---------------------------------------------------------------------*
*& Form top_of_page
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM top_of_page.
"#EC CALLED
DATA: ls_header TYPE slis_listheader.
DATA: lt_header TYPE slis_t_listheader.
* typ(1) type c, " H = Header, S = Selection, A = Action
CLEAR: ls_header.
ls_header-typ = 'H'.
ls_header-info = text-002.
APPEND ls_header TO lt_header.
CLEAR: ls_header.
ls_header-typ = 'S'.
ls_header-key = text-003.
ls_header-info = 'ZRUHR_TESTING_GRID_VEXCEL' .
APPEND ls_header TO lt_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = lt_header[].
ENDFORM. " top_general
2012 Dec 11 5:58 PM
Hello, did you check the security configuration in Excel? In Excel, under menu Tools -> Macro -> Security -> Trusted editors, mark flag 'Trust in access to Visual Basic projects'.
(In spanish language, it will be the menu Herramientas -> Macro -> Seguridad -> Editores de confianza -> Confiar en el acceso a proyectos de Visual Basic)
Check also that the security level is not set to 'High'.
I think it is answered in topic http://scn.sap.com/thread/80927
2012 Dec 11 5:58 PM
Hello, did you check the security configuration in Excel? In Excel, under menu Tools -> Macro -> Security -> Trusted editors, mark flag 'Trust in access to Visual Basic projects'.
(In spanish language, it will be the menu Herramientas -> Macro -> Seguridad -> Editores de confianza -> Confiar en el acceso a proyectos de Visual Basic)
Check also that the security level is not set to 'High'.
I think it is answered in topic http://scn.sap.com/thread/80927
2014 Jul 08 5:51 AM