10-24-2006 12:34 AM
hi,
can someone tell me why excel download funtionality doesnt work in grid display. i tried examples like balvst0*_grid and it seems those doesnt work too.
is there any example where i can see excel download working with grid.
regards,
ravi.
10-24-2006 12:48 AM
Hi,
Check this program ALV GRID using ABAP OO..
BCALV_TEST_GRID_EDIT_01
In the output..You have a Export button..using which you can export the data to an excel..
Thanks,
Naren
10-24-2006 12:54 AM
Hi,
Also check this program for FM REUSE_ALV_GRID_DISPLAY..You can use LIST -> EXPORT -> SPREADSHEET to see the values in a excel..
TYPE-POOLS: slis.
DATA: BEGIN OF itab OCCURS 0,
vbeln TYPE vbeln,
END OF itab.
DATA: BEGIN OF itab1 OCCURS 0,
selkz TYPE char1,
vbeln TYPE vbeln,
posnr TYPE posnr,
netpr TYPE netpr,
matnr TYPE matnr,
END OF itab1.
DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.
DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
s_fieldcatalog-col_pos = '1'.
s_fieldcatalog-fieldname = 'SELKZ'.
s_fieldcatalog-tabname = 'ITAB1'.
s_fieldcatalog-checkbox = 'X'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: S_FIELDCATALOG.
s_fieldcatalog-col_pos = '2'.
s_fieldcatalog-fieldname = 'VBELN'.
s_fieldcatalog-tabname = 'ITAB1'.
s_fieldcatalog-rollname = 'VBELN'.
APPEND s_fieldcatalog TO t_fieldcatalog.
s_fieldcatalog-col_pos = '3'.
s_fieldcatalog-fieldname = 'POSNR'.
s_fieldcatalog-tabname = 'ITAB1'.
s_fieldcatalog-rollname = 'POSNR'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '4'.
s_fieldcatalog-fieldname = 'NETPR'.
s_fieldcatalog-tabname = 'ITAB1'.
s_fieldcatalog-rollname = 'NETPR'.
s_fieldcatalog-do_sum = 'X'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '5'.
s_fieldcatalog-fieldname = 'MATNR'.
s_fieldcatalog-tabname = 'ITAB1'.
s_fieldcatalog-rollname = 'MATNR'.
APPEND s_fieldcatalog TO t_fieldcatalog.
DATA: s_layout TYPE slis_layout_alv.
s_layout-subtotals_text = 'SUBTOTAL TEXT'.
SELECT vbeln UP TO 10 ROWS
FROM
vbak
INTO TABLE itab.
IF NOT itab[] IS INITIAL.
SELECT vbeln posnr
FROM vbep
INTO CORRESPONDING FIELDS OF TABLE itab1
FOR ALL ENTRIES IN itab
WHERE vbeln = itab-vbeln.
ENDIF.
DATA: v_repid TYPE syrepid.
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = t_fieldcatalog
is_layout = s_layout
TABLES
t_outtab = itab1
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks,
Naren
10-24-2006 12:55 AM
hi,
thanks for your prompt response. i have to select export option to download it however , i need to have excel icon so that when the user selects it, it should open the excel window with data in it with out any intermediate steps.
please let me know your suggestions.
regards,
ravi.