Fix missing “Spreadsheet” option while right-clicking on ALV generated with REUSE_ALV_GRID_DISPLAY
Today I came across a situation where the “Spreadsheet” option was missing while right-clicking on an ALV generated using REUSE_ALV_GRID_DISPLAY.
(See below)
I went through couple of discussions on this topic but most answered the missing “Export” option in Application bar (List> Export> Spreadsheet)
Observed that in my case, I could view the “Spreadsheet” option via from Application bar.
The Internal table declaration is as below-
* TYPES—————————————————————–
types : begin of ty_output,
kbeln type kbeln,
begru type begru,
bstat type bstat,
end of ty_output.
**–Internal Table—————————————————-
Data: it_outtab type standard table of ty_output.
..
..
Logic for fetching data
..
* Display the data in grid
call function ‘REUSE_ALV_GRID_DISPLAY’
exporting
i_callback_program = sy-repid
is_layout = rec_layout
it_fieldcat = li_fldcatlog[]
i_default = ‘X’
i_save = ‘A’
is_variant = g_v_variant
tables
t_outtab = li_output.
While debugging, found that the internal table ‘li_output’ had a deep structure ‘BSTAT’.
The types declaration was updated as below-
The Internal table declaration is as below-
* TYPES—————————————————————–
types : begin of ty_output,
kbeln type kbeln,
begru type begru,
bstat type wrfbstat, “<<<<<-
end of ty_output.
**–Internal Table—————————————————-
Data: it_outtab type standard table of ty_output.
Post the code change, the ‘Spreadsheet” Option appeared.
Documentation on REUSE_ALV_GRID_DISPLAY didn’t mention about not using “Deep structures”, though.
Hope this will be helpful for others!
I believe that ALV consistency check would warn about deep structure. But it is little bit hidden:
The Consistency Check - ALV Grid Control (BC-SRV-ALV) - SAP Library
EDIT: tested it and check does not warn about deep structure (if BSTAT is not in field catalog).
I tried this solution but now working
Final table type mentioned below.
Please let me know which field to be changed
SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}
BEGIN OF gty_final,
bukrs TYPE bukrs,
belnr TYPE BELNR_D,
gjahr TYPE gjahr,
buzei TYPE buzei,
blart TYPE blart,
bldat TYPE bldat,
budat TYPE budat,
monat TYPE monat,
usnam TYPE usnam,
xblnr TYPE xblnr,
waers TYPE waers,
kursf TYPE kursf,
augdt TYPE augdt,
bschl TYPE bschl,
koart TYPE koart,
umskz TYPE umskz,
umsks TYPE umsks,
zumsk TYPE dzumsk,
shkzg TYPE shkzg,
dmbtr TYPE dmbtr,
debit TYPE wrbtr,
credit TYPE wrbtr,
pswbt TYPE pswbt,
zuonr TYPE dzuonr,
sgtxt TYPE sgtxt,
hkont TYPE hkont,
kunnr TYPE kunnr,
txt50 TYPE txt50_skat,
name1 TYPE name1,
werks TYPE werks,
fkdat TYPE fkdat,
prctr TYPE prctr,
END OF gty_final ,