Skip to Content
0
Former Member
Jan 02, 2008 at 01:58 PM

ALV download to EXCEL -- probs with SAPGUI 6.40 and EXCEL 2007

39 Views

I have a method in an ALV grid which performs a dowload to excel

Here's the method

method download_to_excel.

field-symbols:

<fs0> type standard table,

<fs1> type standard table.

assign g_outtab1->* to <fs0>.

assign g_fldcat1->* to <fs1>.

call function 'LVC_TRANSFER_TO_KKBLO'

exporting

it_fieldcat_lvc = <fs1>

  • is_layout_lvc = m_cl_variant->ms_layout

is_tech_complete = ' '

importing

es_layout_kkblo = ls_layout

et_fieldcat_kkblo = lt_fieldcat.

loop at lt_fieldcat into lt_fieldcat_wa.

clear lt_fieldcat_wa-tech_complete.

if lt_fieldcat_wa-tabname is initial.

lt_fieldcat_wa-tabname = '1'.

modify lt_fieldcat from lt_fieldcat_wa.

endif.

l_tabname = lt_fieldcat_wa-tabname.

endloop.

call function 'ALV_XXL_CALL'

exporting

i_tabname = l_tabname

is_layout = ls_layout

it_fieldcat = lt_fieldcat

i_title = sy-title

tables

it_outtab = <fs0>

exceptions

fatal_error = 1

no_display_possible = 2

others = 3.

if sy-subrc <> 0.

message id sy-msgid type 'S' number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

  • ...

endmethod.

Basically the method converts the GRID table I'm displaying into the format requred for FMOD ALV_XXL_CALL' -- the field catalog is slightly different but no big deal here.

This works fine when downloading to EXCEL 2003 but short dumps when trying to do the same thing for EXCEL 2007.

Workstation is running Windows XP / SP2 build 2600 in both cases.

Any fixes etc or should I stick with EXCEL 2003 until forced to upgrade.

Cheers

jimbo