Hirarchy of interactive report
Hi Gurus,
Please tell me what is the meaning of "Hirarchy of an interactive report"?
HI
refer this code.
*& Include Z_TABLE_DISPLAY
VERSION 2
Code from François Henrotte (EPONA Solutions)
http://www.eponasolutions.com
Belgium
Please keep reference !
HOW TO
Display an ALV grid :
CALL METHOD lcl_table_display=>display_grid( 'tabname' ).
Display a hierarchical list with header and detail :
CALL METHOD lcl_table_display=>display_hier( in_header = 'table1'
in_detail = 'table2' ).
Display a block list with two tables :
CALL METHOD lcl_table_display=>set_block_mode( 'X' ).
CALL METHOD lcl_table_display=>display_grid( 'table1' ).
CALL METHOD lcl_table_display=>display_grid( 'table2' ).
CALL METHOD lcl_table_display=>end_block_list( ).
You never have to deal with field catalog of tables !!
What if field catalog has to be changed anyway ?
ob_table = lcl_table_display=>create_table( 'tabname' ).
CALL METHOD ob_table->set_alv_fieldtext( in_field = field
in_ftext = 'text' ).
CALL METHOD lcl_table_display=>display_grid( 'tabname' ).
type-pools: abap, slis.
LCL_TABLE_DISPLAY DEFINITION
class lcl_table_display definition.
public section.
class-methods: display_list importing in_tabname type any,
display_grid importing in_tabname type any,
display_hier importing in_header type any
in_detail type any
in_level type i optional,
set_block_mode importing in_mode type c,
set_block_text importing in_text type any,
end_block_list importing in_print
type slis_print_alv optional
exceptions display_error,
create_table
importing
in_tabname type tabname
returning
value(out_table) type ref to lcl_table_display
exceptions
create_error,
get_existing_table
importing
in_tabname type any optional
in_repid type any optional
in_struc type any optional
returning
value(out_table) type ref to lcl_table_display
exceptions
no_parameter
not_found,
refresh_objects.
methods: constructor importing in_data type standard table
exceptions casting_error
empty_fieldcat.
methods: get_alv_fieldcat returning value(out_fieldcat)
type slis_t_fieldcat_alv.
methods: set_table_name importing in_tabname type any,
set_alv_title importing in_title type any,
set_alv_fieldcat importing in_fieldcat
type slis_t_fieldcat_alv,
set_alv_fieldnoout importing in_field type any
in_noout type c optional
in_tech type c optional,
set_alv_fieldedit importing in_field type any
in_edit type c optional,
set_alv_fieldtext importing in_field type any
in_ftext type any,
set_alv_fieldsum importing in_field type any
in_dosum type c optional,
set_alv_linebreak importing in_field type any,
set_alv_settings importing in_settings type any,
set_alv_layout importing in_layout type any,
set_alv_print importing in_print type any,
set_alv_sorting importing in_field type any
in_desc type c optional
in_group type any optional
in_subtot type c optional,
set_alv_keys importing in_level type i
in_key type c optional,
set_alv_event importing in_name type any
in_form type any,
set_all_events.
protected section.
data: g_table_type type slis_list_type.
data: g_title type lvc_title,
gt_fcat type slis_t_fieldcat_alv,
gs_sett type lvc_s_glay,
gs_layo type slis_layout_alv,
gt_sort type slis_t_sortinfo_alv,
gt_evnt type slis_t_event,
gs_prin type slis_print_alv.
class-methods: output_hierarchy exceptions display_error.
methods: output_table importing mode type c
exceptions display_error,
output_list,
output_grid.
private section.
class-data: gt_table_obj type table of ref to lcl_table_display,
g_header_table type ref to lcl_table_display,
g_detail_table type ref to lcl_table_display.
class-data: g_variant_level type i.
class-data: g_block_mode type c,
g_block_text type slis_text40.
types: begin of ty_defin,
fieldname type fieldname,
ref_tabname type tabname,
ref_fieldname type fieldname,
end of ty_defin.
data: g_repid type repid,
g_struc type tabname,
g_table type tabname.
data: gt_data type ref to data.
data: gt_defin type table of ty_defin,
g_level type tabname.
methods: init_block_list,
fill_fieldcat importing repid type repid
struc type tabname
changing fcat type slis_t_fieldcat_alv
exceptions no_definition,
get_definition importing repid type repid
struc type tabname
changing abap type rsfb_source,
recursive_definition importing repid type repid
changing abap type rsfb_source,
map_structure importing source type any
changing destin type any,
get_default_variant changing out_variant type disvariant.
endclass. "lcl_table_display DEFINITION
LCL_TABLE_DISPLAY IMPLEMENTATION
class lcl_table_display implementation.
Display table in ALV list
method display_list.
data: l_object type ref to lcl_table_display,
l_tabname type tabname,
l_found type c.
l_tabname = in_tabname.
loop at gt_table_obj into l_object.
if l_object->g_table = l_tabname.
l_found = 'X'.
exit.
endif.
endloop.
if l_found is initial.
l_object = lcl_table_display=>create_table( l_tabname ).
if g_block_mode is initial.
l_object->g_table_type = 4.
else.
l_object->g_table_type = 2.
endif.
call method l_object->set_all_events.
endif.
call method l_object->output_list.
endmethod. "display_list
Display table in ALV grid
method display_grid.
data: l_object type ref to lcl_table_display,
l_tabname type tabname,
l_found type c.
l_tabname = in_tabname.
loop at gt_table_obj into l_object.
if l_object->g_table = l_tabname.
l_found = 'X'.
exit.
endif.
endloop.
if l_found is initial.
l_object = lcl_table_display=>create_table( l_tabname ).
if g_block_mode is initial.
l_object->g_table_type = 4.
else.
l_object->g_table_type = 2.
endif.
call method l_object->set_all_events.
endif.
if g_block_mode is initial.
call method l_object->output_grid.
else.
call method l_object->output_list.
endif.
endmethod. "display_grid
Display tables in ALV hierarchy
method display_hier.
data: l_tabnam1 type tabname,
l_tabnam2 type tabname,
lt_fcat1 type slis_t_fieldcat_alv,
lt_fcat2 type slis_t_fieldcat_alv,
ls_fcat1 type slis_fieldcat_alv,
ls_fcat2 type slis_fieldcat_alv.
l_tabnam1 = in_header.
l_tabnam2 = in_detail.
call method lcl_table_display=>get_existing_table
exporting
in_tabname = l_tabnam1
receiving
out_table = g_header_table
exceptions
not_found = 1.
if sy-subrc ne 0.
g_header_table = lcl_table_display=>create_table( l_tabnam1 ).
if g_block_mode is initial.
g_header_table->g_table_type = 1.
else.
g_header_table->g_table_type = 3.
endif.
call method g_header_table->set_all_events.
endif.
call method lcl_table_display=>get_existing_table
exporting
in_tabname = l_tabnam2
receiving
out_table = g_detail_table
exceptions
not_found = 1.
if sy-subrc ne 0.
g_detail_table = lcl_table_display=>create_table( l_tabnam2 ).
endif.
Set key fields
if in_level is initial.
lt_fcat1 = g_header_table->get_alv_fieldcat( ).
lt_fcat2 = g_detail_table->get_alv_fieldcat( ).
loop at lt_fcat1 into ls_fcat1.
ls_fcat1-key = space.
loop at lt_fcat2 into ls_fcat2
where fieldname = ls_fcat1-fieldname.
ls_fcat2-key = space.
ls_fcat2-key_sel = 'X'.
ls_fcat2-tech = 'X'.
modify lt_fcat2 from ls_fcat2 transporting key.
endloop.
if sy-subrc = 0.
ls_fcat1-key = 'X'.
endif.
modify lt_fcat1 from ls_fcat1 transporting key.
endloop.
call method g_header_table->set_alv_fieldcat
exporting
in_fieldcat = lt_fcat1.
call method g_detail_table->set_alv_fieldcat
exporting
in_fieldcat = lt_fcat2.
else.
call method g_header_table->set_alv_keys
exporting
in_level = in_level.
call method g_detail_table->set_alv_keys
exporting
in_level = in_level
in_key = space.
endif.
call method output_hierarchy.
endmethod. "display_hier
Set block mode
method set_block_mode.
g_block_mode = in_mode.
endmethod. "set_block_mode
Set block text
method set_block_text.
g_block_text = in_text.
endmethod. "set_block_text
Create new table
method create_table.
data: l_object type ref to lcl_table_display.
field-symbols: set_table_name
exporting
in_tabname = in_tabname.
Default print options
l_object->gs_prin-no_print_selinfos = 'X'.
l_object->gs_prin-no_coverpage = 'X'.
l_object->gs_prin-no_print_listinfos = 'X'.
out_table = l_object.
endmethod. "create_table
Get existing table
method get_existing_table.
data: l_object type ref to lcl_table_display,
l_tabname type tabname,
l_repid type repid,
l_struc type tabname,
l_found type c.
l_tabname = in_tabname.
l_repid = in_repid.
l_struc = in_struc.
if l_tabname is initial.
if l_repid is initial and
l_struc is initial.
raise no_parameter.
else.
Get last existing table with same definition
loop at gt_table_obj into l_object.
if l_object->g_repid = l_repid and
l_object->g_struc = l_struc.
l_found = 'X'.
exit.
endif.
endloop.
endif.
else.
Get last existing table with same name
loop at gt_table_obj into l_object.
if l_object->g_table = l_tabname.
l_found = 'X'.
exit.
endif.
endloop.
endif.
if l_found is initial.
raise not_found.
else.
out_table = l_object.
endif.
endmethod. "get_existing_table
Create table display
method constructor.
data: l_object type ref to lcl_table_display.
data: ls_data type ref to data.
data: ob_desc type ref to cl_abap_structdescr.
data: l_found type c,
l_absol type char200,
l_repid type repid,
l_struc type tabname.
field-symbols: type any.
Get data and store it into attribute
create data me->gt_data like in_data.
assign me->gt_data->* to .
= in_data.
Get global data definition
create data ls_data like line of ).
endcatch.
if sy-subrc = 1.
raise casting_error.
endif.
Get program name and main type used to define table
l_absol = ob_desc->absolute_name.
split l_absol at 'TYPE=' into l_repid l_struc.
shift l_repid up to '='.
shift l_repid.
check l_struc np '%_*'.
Set attributes
me->g_repid = l_repid.
me->g_struc = l_struc.
me->g_table = l_struc.
replace 'TY' with 'WT' into me->g_table.
Field catalog
call method lcl_table_display=>get_existing_table
exporting
in_repid = l_repid
in_struc = l_struc
receiving
out_table = l_object
exceptions
not_found = 1.
if sy-subrc = 0.
me->gt_fcat = l_object->get_alv_fieldcat( ).
call method set_table_name
exporting
in_tabname = me->g_table.
else.
call method fill_fieldcat
exporting
repid = l_repid
struc = l_struc
changing
fcat = me->gt_fcat.
if me->gt_fcat is initial.
raise empty_fieldcat.
endif.
endif.
Keep list of tables
append me to gt_table_obj.
endmethod. "constructor
Output list
method output_list.
call method output_table
exporting
mode = 'L'.
endmethod. "output_list
Output grid
method output_grid.
call method output_table
exporting
mode = 'G'.
endmethod. "output_grid
Output table
method output_table.
data: l_object type ref to lcl_table_display.
data: ls_vari type disvariant.
field-symbols: type standard table.
assign me->gt_data->* to .
if not g_block_mode is initial.
read table gt_table_obj into l_object index 1.
if sy-subrc = 0.
if l_object->g_table = me->
g_table.
call method init_block_list.
endif.
endif.
endif.
Get default user variant
call method get_default_variant
changing
out_variant = ls_vari.
Display table contents
if mode = 'G'.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = me->g_repid
i_grid_title = me->g_title
i_grid_settings = me->gs_sett
is_layout = me->gs_layo
it_fieldcat = me->gt_fcat
it_sort = me->gt_sort
i_save = 'U'
is_variant = ls_vari
it_events = me->gt_evnt
is_print = me->gs_prin
tables
t_outtab =
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
raise display_error.
endif.
call method refresh_objects.
else.
if g_block_mode is initial.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = me->g_repid
is_layout = me->gs_layo
it_fieldcat = me->gt_fcat
it_sort = me->gt_sort
i_save = 'U'
is_variant = ls_vari
it_events = me->gt_evnt
is_print = me->gs_prin
tables
t_outtab =
exceptions
others = 0.
if sy-subrc <> 0.
raise display_error.
endif.
call method refresh_objects.
else.
call function 'REUSE_ALV_BLOCK_LIST_APPEND'
exporting
is_layout = me->gs_layo
it_fieldcat = me->gt_fcat
i_tabname = me->g_table
it_events = me->gt_evnt
it_sort = me->gt_sort
i_text = g_block_text
tables
t_outtab =
exceptions
program_error = 1
maximum_of_appends_reached = 2
others = 3.
if sy-subrc <>
0.
raise display_error.
endif.
endif.
endif.
endmethod. "output_table
Output hierarchy
method output_hierarchy.
data: l_object type ref to lcl_table_display.
data: lt_fcat type slis_t_fieldcat_alv,
lt_sort type slis_t_sortinfo_alv,
ls_fcat type slis_fieldcat_alv,
ls_vari type disvariant,
ls_keyi type slis_keyinfo_alv.
data: l_index type numc2,
l_field type fieldname.
field-symbols: .
Set key fields as common fields between header and detail
loop at g_header_table->gt_fcat into ls_fcat
where key = 'X'.
l_index = l_index + 1.
Create link
concatenate 'HEADER' l_index into l_field.
assign component l_field of structure ls_keyi to init_block_list.
endif.
endif.
endif.
Get default user variant
call method g_header_table->get_default_variant
changing
out_variant = ls_vari.
if g_block_mode is initial.
call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
exporting
i_callback_program = g_header_table->g_repid
is_layout = g_header_table->gs_layo
it_fieldcat = lt_fcat
it_sort = lt_sort
i_save = 'U'
is_variant = ls_vari
it_events = g_header_table->gt_evnt
i_tabname_header = g_header_table->g_table
i_tabname_item = g_detail_table->g_table
is_keyinfo = ls_keyi
is_print = g_header_table->gs_prin
tables
t_outtab_header = 0.
raise display_error.
endif.
endif.
endmethod. "output_hierarchy
Init block list
method init_block_list.
data: ls_evnt1 type slis_alv_event,
ls_evnt2 type slis_alv_event.
Events for whole list display
concatenate 'F_' slis_ev_pf_status_set '_BLOCK'
into ls_evnt1-form.
concatenate 'F_' slis_ev_user_command '_BLOCK'
into ls_evnt2-form.
Initialization of block list
call function 'REUSE_ALV_BLOCK_LIST_INIT'
exporting
i_callback_program = me->g_repid
i_callback_pf_status_set = ls_evnt1-form
i_callback_user_command = ls_evnt2-form.
endmethod. "init_block_list
End of block list
method end_block_list.
data: l_object type ref to lcl_table_display,
ls_print type slis_print_alv.
check not g_block_mode is initial.
if in_print is supplied.
ls_print = in_print.
else.
read table gt_table_obj into l_object index 1.
ls_print = l_object->gs_prin.
endif.
call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'
exporting
is_print = ls_print
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
raise display_error.
endif.
call method refresh_objects.
endmethod. "end_block_list
Refresh table of objects
method refresh_objects.
free: gt_table_obj.
endmethod.
Fill field catalog
method fill_fieldcat.
data: lt_abap type rsfb_source.
data: ls_defin type ty_defin.
data: lt_dfies type table of dfies,
ls_dfies type dfies,
ls_dd04v type dd04v,
ls_dd01v type dd01v,
l_flong type dfies-lfieldname,
l_dname type dfies-domname.
data: ls_fcat type slis_fieldcat_alv,
ls_fcat2 type slis_fieldcat_alv.
data: l_index type i,
l_nbfld type i.
free: me->gt_defin.
Process data definition
call method get_definition
exporting
repid = repid
struc = struc
changing
abap = lt_abap.
Process sub levels if required
call method recursive_definition
exporting
repid = repid
changing
abap = lt_abap.
if me->gt_defin is initial.
raise no_definition.
endif.
loop at me->gt_defin into ls_defin.
clear: ls_fcat.
move-corresponding ls_defin to ls_fcat.
Retrieve info about this field
free: ls_dfies, ls_dd04v, ls_dd01v, l_dname.
l_flong = ls_fcat-ref_fieldname.
set locale language 'E'.
translate: ls_fcat-ref_tabname to upper case,
ls_fcat-ref_fieldname to upper case,
l_flong to upper case.
if not ls_fcat-ref_tabname is initial.
Try to get info about field in table
call function 'DDIF_FIELDINFO_GET'
exporting
tabname = ls_fcat-ref_tabname
fieldname = ls_fcat-ref_fieldname
lfieldname = l_flong
importing
dfies_wa = ls_dfies
exceptions
not_found = 1
internal_error = 2
others = 3.
if sy-subrc = 0.
move-corresponding ls_dfies to ls_fcat.
ls_fcat-fieldname = ls_defin-fieldname.
move: ls_dfies-keyflag to ls_fcat-key,
ls_dfies-scrtext_m to ls_fcat-seltext_l,
ls_dfies-domname to l_dname.
endif.
else.
Try to get info about structure
ls_defin-ref_tabname = ls_defin-ref_fieldname.
call function 'DDIF_FIELDINFO_GET'
exporting
tabname = ls_defin-ref_tabname
tables
dfies_tab = lt_dfies
exceptions
others = 0.
if not lt_dfies is initial.
Process fields of this structure
loop at lt_dfies into ls_dfies.
clear: ls_fcat.
move-corresponding ls_dfies to ls_fcat.
if ls_defin-fieldname ne 'INCLUDE'.
concatenate ls_defin-fieldname ls_fcat-fieldname
into ls_fcat-fieldname
separated by '-'.
endif.
move ls_dfies-keyflag to ls_fcat-key.
move ls_dfies-scrtext_m to ls_fcat-seltext_l.
ls_fcat-tabname = me->g_table.
clear: ls_fcat-col_pos,
ls_fcat-offset.
if ls_fcat-ref_tabname is initial.
ls_fcat-ddictxt = 'L'.
endif.
Display Yes/No fields as checkboxes
if ls_dfies-domname = 'XFELD'.
ls_fcat-checkbox = 'X'.
endif.
Add field to field catalog
append ls_fcat to fcat.
endloop.
continue.
else.
Try to get info about data element
call function 'DDIF_DTEL_GET'
exporting
name = ls_fcat-ref_fieldname
langu = sy-langu
importing
dd04v_wa = ls_dd04v
exceptions
illegal_input = 1
others = 2.
if sy-subrc = 0.
move-corresponding ls_dd04v to ls_fcat.
move: ls_dd04v-scrtext_m to ls_fcat-seltext_l,
ls_dd04v-domname to l_dname.
else.
Finally try to get info about domain
call function 'DDIF_DOMA_GET'
exporting
name = ls_fcat-ref_fieldname
langu = sy-langu
importing
dd01v_wa = ls_dd01v
exceptions
illegal_input = 1
others = 2.
if sy-subrc = 0.
move-corresponding ls_dd01v to ls_fcat.
move: ls_dd01v-ddtext to ls_fcat-seltext_l,
ls_dd01v-domname to l_dname.
endif.
endif.
endif.
endif.
Table name must be internal table containing data
ls_fcat-tabname = g_table.
No offset
clear: ls_fcat-offset.
Default text is stored in long text
if ls_fcat-ref_tabname is initial.
ls_fcat-ddictxt = 'L'.
endif.
Display Yes/No fields as checkboxes
if l_dname = 'XFELD'.
ls_fcat-checkbox = 'X'.
endif.
Add field to field catalog
append ls_fcat to fcat.
endloop.
Positions
loop at fcat into ls_fcat.
ls_fcat-row_pos = 1.
ls_fcat-col_pos = sy-tabix.
modify fcat from ls_fcat transporting row_pos col_pos.
endloop.
Link between fields
describe table fcat lines l_nbfld.
loop at fcat into ls_fcat.
if sy-tabix ne l_nbfld.
l_index = sy-tabix + 1.
read table fcat into ls_fcat2 index l_index.
if sy-subrc = 0.
if ls_fcat-datatype = 'CURR'.
Currency unit
if ls_fcat2-datatype = 'CUKY'.
ls_fcat-cfieldname = ls_fcat2-fieldname.
ls_fcat-ctabname = ls_fcat2-tabname.
modify fcat from ls_fcat.
else.
loop at fcat into ls_fcat2
from l_index
where datatype = 'CUKY'.
First currency unit after field
ls_fcat-cfieldname = ls_fcat2-fieldname.
ls_fcat-ctabname = ls_fcat2-tabname.
modify fcat from ls_fcat.
exit.
endloop.
if sy-subrc ne 0.
No currency unit after field, try before
read table fcat into ls_fcat2
with key datatype = 'CUKY'.
if sy-subrc = 0.
ls_fcat-cfieldname = ls_fcat2-fieldname.
ls_fcat-ctabname = ls_fcat2-tabname.
modify fcat from ls_fcat.
else.
Default is EURO
ls_fcat-currency = 'EUR'.
endif.
endif.
endif.
endif.
if ls_fcat-datatype = 'QUAN'.
Quantity unit
if ls_fcat2-datatype = 'UNIT'.
ls_fcat-cfieldname = ls_fcat2-fieldname.
ls_fcat-ctabname = ls_fcat2-tabname.
modify fcat from ls_fcat.
endif.
endif.
endif.
endif.
endloop.
endmethod. "fill_fieldcat
Get definition of type from code source
method get_definition.
data: l_strng type rssource,
ls_abap type rssource,
l_fdpos type i,
l_first type i,
l_lastr type i.
data: lt_incl type table of repid,
ls_incl type repid.
Get program code
read report repid into abap.
check sy-subrc eq 0.
Get first line of definition
concatenate 'BEGIN OF' struc into l_strng
separated by space.
loop at abap into ls_abap.
if ls_abap cs l_strng.
l_fdpos = strlen( l_strng ) + sy-fdpos.
if ls_abap(1) = '*' or ls_abap(sy-fdpos) cs '"'.
continue.
endif.
if ls_abap+l_fdpos(1) ca ',. "'.
l_first = sy-tabix.
exit.
endif.
endif.
endloop.
if l_first is initial.
Table is defined in an include
call function 'RS_GET_ALL_INCLUDES'
exporting
program = repid
tables
includetab = lt_incl
exceptions
others = 1.
if sy-subrc = 0.
loop at lt_incl into ls_incl.
Try to find definition in this include
read report ls_incl into abap.
loop at abap into ls_abap.
if ls_abap cs l_strng.
l_fdpos = strlen( l_strng ) + sy-fdpos.
if ls_abap(1) = '*' or ls_abap(sy-fdpos) cs '"'.
continue.
endif.
if ls_abap+l_fdpos(1) ca ',. "'.
l_first = sy-tabix.
exit.
endif.
endif.
endloop.
if not l_first is initial.
exit.
endif.
endloop.
endif.
endif.
Get last line of definition
concatenate 'END OF' struc into l_strng
separated by space.
loop at abap into ls_abap.
if ls_abap cs l_strng.
l_fdpos = strlen( l_strng ) + sy-fdpos.
if ls_abap(1) = '*' or ls_abap(sy-fdpos) cs '"'.
continue.
endif.
if ls_abap+l_fdpos(1) ca ',. "'.
l_lastr = sy-tabix - l_first.
exit.
endif.
endif.
endloop.
Keep only relevant code lines
if l_first le 0
or l_lastr le 0.
refresh abap.
else.
delete abap to l_first.
delete abap from l_lastr.
endif.
endmethod. "get_definition
Get definition of type recursively
method recursive_definition.
data: lt_token type table of stokex,
ls_token type stokex,
lt_state type table of sstmnt,
ls_state type sstmnt.
data: ls_defin type ty_defin,
l_reffld type fieldname.
data: lt_recu type rsfb_source.
Retrieve tokens
scan abap-source abap
tokens into lt_token
statements into lt_state.
loop at lt_state into ls_state.
clear: ls_defin.
Field name
read table lt_token into ls_token
index ls_state-from.
ls_defin-fieldname = ls_token-str.
Reference type
read table lt_token into ls_token
index ls_state-to.
l_reffld = ls_token-str.
Check if this type is defined in program
free: lt_recu.
call method get_definition
exporting
repid = repid
struc = l_reffld
changing
abap = lt_recu.
if lt_recu is initial.
if not g_level is initial.
concatenate g_level ls_defin-fieldname
into ls_defin-fieldname separated by '-'.
condense ls_defin-fieldname.
endif.
if l_reffld cs '-'.
split l_reffld at '-'
into ls_defin-ref_tabname
ls_defin-ref_fieldname.
if ls_defin-ref_tabname = 'SY'.
ls_defin-ref_tabname = 'SYST'.
endif.
else.
ls_defin-ref_fieldname = ls_token-str.
endif.
append ls_defin to me->gt_defin.
else.
Process sub levels
if me->g_level is initial.
me->g_level = ls_defin-fieldname.
else.
concatenate me->g_level ls_defin-fieldname into me->g_level
separated by '-'.
endif.
call method recursive_definition
exporting
repid = repid
changing
abap = lt_recu.
if me->g_level cs '-'.
shift me->g_level right up to '-'.
shift me->g_level right.
shift me->g_level left deleting leading space.
else.
clear: me->g_level.
endif.
endif.
endloop.
endmethod. "recursive_definition
Get fieldcat
method get_alv_fieldcat.
out_fieldcat = me->gt_fcat.
endmethod. "get_alv_fieldcat
Set table name
method set_table_name.
data: l_fcat type slis_fieldcat_alv.
loop at me->gt_fcat into l_fcat.
l_fcat-tabname = in_tabname.
modify me->gt_fcat from l_fcat.
endloop.
me->g_table = in_tabname.
endmethod. "set_table_name
Set title
method set_alv_title.
me->g_title = in_title.
endmethod. "set_alv_title
Set fieldcat
method set_alv_fieldcat.
me->gt_fcat = in_fieldcat.
endmethod. "set_alv_fieldcat
Set field invisible
method set_alv_fieldnoout.
data: l_field type fieldname,
l_noout type c,
l_tech type c,
ls_fcat type slis_fieldcat_alv.
l_field = in_field.
if in_noout is supplied.
l_noout = in_noout.
else.
l_noout = 'X'.
endif.
if in_tech is supplied.
l_tech = in_tech.
endif.
loop at me->gt_fcat into ls_fcat
where fieldname = l_field.
ls_fcat-no_out = l_noout.
ls_fcat-tech = l_tech.
modify gt_fcat from ls_fcat transporting no_out tech.
endloop.
endmethod. "set_alv_fieldnoout
Set field editable
method set_alv_fieldedit.
data: l_field type fieldname,
l_edit type c,
ls_fcat type slis_fieldcat_alv.
l_field = in_field.
if in_edit is supplied.
l_edit = in_edit.
else.
l_edit = 'X'.
endif.
loop at me->gt_fcat into ls_fcat
where fieldname = l_field.
ls_fcat-edit = l_edit.
modify gt_fcat from ls_fcat transporting edit.
endloop.
endmethod. "set_alv_fieldedit
Set field text
method set_alv_fieldtext.
data: l_field type fieldname,
ls_fcat type slis_fieldcat_alv.
l_field = in_field.
loop at me->gt_fcat into ls_fcat
where fieldname = l_field.
ls_fcat-seltext_m = in_ftext.
ls_fcat-ddictxt = 'M'.
modify gt_fcat from ls_fcat transporting seltext_m ddictxt.
endloop.
endmethod. "set_alv_fieldtext
Set field sum
method set_alv_fieldsum.
data: l_field type fieldname,
l_dosum type c,
ls_fcat type slis_fieldcat_alv.
l_field = in_field.
if in_dosum is supplied.
l_dosum = in_dosum.
else.
l_dosum = 'X'.
endif.
loop at me->gt_fcat into ls_fcat
where fieldname = l_field.
ls_fcat-do_sum = l_dosum.
modify gt_fcat from ls_fcat transporting do_sum.
endloop.
endmethod. "set_alv_fieldsum
Set line break in field catalog
method set_alv_linebreak.
data: l_field type fieldname,
ls_fcat type slis_fieldcat_alv,
l_tabix type i.
l_field = in_field.
read table me->gt_fcat into ls_fcat
with key fieldname = l_field.
if sy-subrc = 0.
l_tabix = sy-tabix.
else.
exit.
endif.
loop at me->gt_fcat into ls_fcat
from l_tabix.
ls_fcat-row_pos = ls_fcat-row_pos + 1.
modify gt_fcat from ls_fcat transporting row_pos.
endloop.
endmethod. "set_alv_linebreak
Set settings
method set_alv_settings.
call method map_structure
exporting
source = in_settings
changing
destin = me->gs_sett.
endmethod. "set_alv_settings
Set layout
method set_alv_layout.
call method map_structure
exporting
source = in_layout
changing
destin = me->gs_layo.
endmethod. "set_alv_layout
Set printing options
method set_alv_print.
call method map_structure
exporting
source = in_print
changing
destin = me->gs_prin.
endmethod. "set_alv_print
Set sortings
method set_alv_sorting.
data: l_desc type alvdynp-sortdown,
l_group type alvdynp-grouplevel,
l_subtot type alvdynp-subtotals.
data: ls_sort type slis_sortinfo_alv,
l_index type i.
if in_desc is supplied.
l_desc = in_desc.
endif.
if in_group is supplied.
l_group = in_group.
else.
l_group = '*'.
endif.
if in_subtot is supplied.
l_subtot = in_subtot.
else.
l_subtot = 'X'.
endif.
describe table me->gt_sort lines l_index.
l_index = l_index + 1.
ls_sort-spos = l_index.
ls_sort-fieldname = in_field.
ls_sort-tabname = me->g_table.
if l_desc is initial.
ls_sort-up = 'X'.
else.
ls_sort-down = 'X'.
endif.
ls_sort-group = l_group.
ls_sort-subtot = l_subtot.
append ls_sort to me->gt_sort.
endmethod. "set_alv_sorting
Set key fields
method set_alv_keys.
data: l_key type c,
ls_fcat type slis_fieldcat_alv.
if in_key is supplied.
l_key = in_key.
else.
l_key = 'X'.
endif.
loop at me->gt_fcat into ls_fcat from 1 to in_level.
ls_fcat-key = l_key.
modify gt_fcat from ls_fcat transporting key.
endloop.
endmethod. "set_alv_keys
Add event
method set_alv_event.
data: ls_evnt type slis_alv_event.
loop at gt_evnt into ls_evnt
where name = in_name.
ls_evnt-form = in_form.
modify gt_evnt from ls_evnt transporting fo
Similar Messages
-
Open document from interactive report
Application Express version 4.0.2.00.07.
In apex I am trying to accomplish the following:
1. create a link to a pdf or Word document stored on local network using the file browse button.
2. store the link to that file in my table but not store the actual document in the oracle table.
3. open the document from link in interactive report.
My dba does not want to store anymore documents into oracle because of performance issues we are experiencing with current applications that do this. Does anyone know the where to find sample code that will accomplish this task or will load the linked document into the oracle table but delete the document from the blob when the document is closed.You're probably looking to use the BFILE functionality - a pointer to a LOB on the filesystem.
Try looking at some of the following sources for guidance
http://docs.oracle.com/cd/B10501_01/appdev.920/a96591/adl12bfl.htm
APEX BFILE
http://monkeyonoracle.blogspot.com.au/2009/10/storing-images-outside-oracle-xe-with.html
Scott -
Questions on Interactive Report Icons
When I created an Interactive Report, rectangular icons have been automatically created on the left side of the report on every line.
When clicked one of the icons, it displays the details of the line in vertical order.
Here are my questions:
1. When I've hidden some columns in the interactive report and clicked the icon, it does not display hidden column details. But I want to hide those columns only in the report but displays all details when the icon is clicked. How can I do this?
2. How can I hide the icons?
3. How can I use the icons not to display line details but to direct to an editable page to edit the same details?
Thanks,
GuyHello
1. When I've hidden some columns in the interactive report and clicked the icon, it does not display hidden column details. But I want to hide those columns only in the report but displays all details when the icon is clicked. How can I do this?You can create another region, or page that will show your row description by identifier or rowid. You can do this by changing Link Column type to "Link to Custom Target"
2. How can I hide the icons?Go to Interactive Report -> Link Column -> Link Column change to (Exclude Link Column)
3. How can I use the icons not to display line details but to direct to an editable page to edit the same details?The same as answer 1.
Best Regards, Kostya Proskudin! -
Interactive Report view is empty
Hi,
I'm on CRM 7.0 EHP3. I'm encountering empty report criteria and display when open the Campaign effectiveness and all other interactive report page. Please see the screen shot below. There is no error message on the screen, as well as ST22.
I've configured the interactive report and ran the configuration wizard /CRMBW/CONFIG_WIZARD successfully and no error found.
Also the roles SAP_CRM_OR_ADMIN, SAP_CRM_OR_CONFIG and SAP_CRM_OR_USER and SAP_ALL are given to the user in both clients.
Please let me know what could be the causes.
Thanks in advance.
cheers,
juliusOkay, problem seems solved. I don't know if it is a bug or a feature... (: Anyway, this view selects data from threads that had been created from a portal application. And if you create threads from WC_Collaboration server admin console, there's no data will be selected with FORUMCRAWLER_VW view. Sorry, have no time to check SQL query for those DB view, may be this behaviour is reasonable.
Edited by: Insomnium on 17.01.2013 2:33 -
Interactive report column filters to display differently than column values
Greetings...
We use images a lot in our interactive reports to provide a visual representation to a status, or something locked for update, or what-have-you. By default, when a user clicks the column heading of a column which contains images, the drop-down list that shows up displays the actual images, which is nice for the user to identify exactly which thing they want to filter on. The problem is when the user selects on of the options in the filtering drop-down, the resulting condition that is displayed under the interactive report search bar is the HTML code of the image. I'd like something else to display there because showing the user the HTML code is atrocious.
I didn't think what I want is possible, but then I came across the Page Locks page within ApEx (page 4000:291 in ApEx 4.0.1) which displays a list of all the pages of an application and whether they are locked or not. It also allows you to bulk lock or bulk unlock a bunch of pages. That page uses an interactive report with a column called "Status" which contains images that represent whether the page is locked or not. When you click the "Status" column heading to filter, instead of seeing the images of an open and closed lock, you see the words "Page Locked" and "Page Unlocked." And even better... when you select on of them, the condition that is displayed to the user is very user-friendly.
Can someone tell me how this is done so I can replicate it in my own apps?
Shane.Why not create the IR using the text you require e.g. 'Lock', 'Unlock' and then use JQuery to replace the text in the report with the image you want. All the filters should then show the plain text and the report will display the image. e.g.
http://apex.oracle.com/pls/apex/f?p=46801:1
Here's what I did:
Firstly make sure the IR has a region template.
Then create a Dynamic Action with the following attributes:
1. Advanced
2. Event: After Refresh
3. Selection Type: Region
4. Region: [select the IR Region]
5. Action: Execute JS Code
6. Fire on page load: [checked]
7. Code:
$('td [headers="TEST"]').each(function(index) {
if ($(this).text() == 'Lock') {
$(this).empty().html('<img src="/i/htmldb/icons/locked_small.gif" alt="Lock" />');
else {
$(this).empty().html('<img src="/i/htmldb/icons/unlocked_small.gif" alt="Unlock" />');
});Where TEST is the column name.
That's it, this may also be of interest:
http://simonhunt.blogspot.com/2011/10/adjusting-interactive-report-column.html
I hope it helps
Shunt -
Error while scheduling a Hyperion Interactive Report
Hi,
I'm trying to run a scheduled Hyperion Interactive Report (version 9.3.1). The report is scheduled to run for 1st of every month. After the report is scheduled. When a user tries to run the report on demand.
The error log states as follows:
$ view server_messages_IRJobService.log
"server_messages_IRJobService.log" [Read only] 38 lines, 2688 characters
<event logger="com.brio.one.services.bqservice.SERVICE" method="ThrID(7) Logger(ZDbgPrint)" timestamp="1247269603142" level="ERROR" thread="[ORB=_it_orb_id_1,Pool=1]::id-6" sequence_no="74">^M
<time>10 Jul 2009 16:46:43,142</time>^M
<context subject="TIPAdmin" session_id="zRMz99t6-00000122670ef701-0000-8197-0a3f0708" originator_type="IRJobService" originator_name="InteractiveReportingService" host="tsbrit02">^M
<info type="RESOURCE">IBQServiceImpl::runJob Job Identifier: TIPPFSMRPT Service Name: JF1_tsbrit02 Cycle Name: Cycle_0</info>^M
<info type="RESOURCE_ID">000001225ef102a5-0000-8197-0a3f0708</info>^M
</context>^M
<message><![CDATA[TCApp::ExecuteJavaScript failed: ]]></message>^M
</event>^M
^M
But when the report is uploaded and when the user tries running it. It runs without any problem.
The report has 3 filters(drop downs) on runtime.
Could anyone please help me in this regard.
Regards,
Sadiqcheck your discoverer user role using:
select granted_role from dba_role_privs where grantee=upper('<username>');
from your database. the database to which the desktop is connecting.
check for connect, resouce, multiorg roles. -
APEX 4.0: error while opening a XLS file downloaded from interactive report
Hi,
I'm getting below error while opening a XLS file downloaded from an interactive report (APEX 4.0).
"The file you trying to open, 'customer_2.xls', is in a different format than specified by the file extension.
Verify that the is not corrupted and is from a trusted source before opening file. Do you want to open file."
Yes No Help
May be this one Apex 4.0 issue.
please help me.
Thanks
MukeshHi,
is the next part of the code correct.
What i mean is packing of the attachment, finding out the size of pdf file and doc type as PDF.
You can also try below link..
Link: [http://wiki.sdn.sap.com/wiki/display/Snippets/SENDALVGRIDASPDFATTACHMENTTOSAPINBOXUSINGCLASSES]
Hope this helps.
Regards,
-Sandeep -
Interactive reports in abap objects
Hi,
plz send me the code of interactive report using ABAP Objects .
Thanks,
T.Sreekanth.Hi,
It will be similar to what you do in normal report.
Here you may create an object instance and then call some method on the object.
AT LINE-SELECTION.
create object obj.
CALL METHOD obj->method1
IMPORTING
text = im_text.
write: im_text.
Regards,
Sesh -
Can we merge data from multiple sources in Hyperion Interactive Reporting ?
Hi Experts,
Can we merge data from multiple sources in Hyperion Interactive Reporting ?Example can we have a report based on DB2
Oracle,
Informix and Multidiemnsional Databases like DB2,MSOLAP,ESSBASE?
Thanks,
VYes, Each have their own Query and have some common dimension for the Results Sections to be joined together in a final query.
look in help for Creating Local Joins -
CRM Interactive reports not loading any data on WEB UI
CRM BI client is setup properly by following CRM IR config guide C41.
/CRMBW/CONFIG_WIZARD doesn't show any major errors. I am able to create
the custom interactive reports but when these reports are executed no
data shows up in the report.For example ,we are building interactive
reports under opportunities area for a user, who has opportunities in
the system.
Our CRM Sytem is on CRM7.0 EHP1 SPS3.
Thanks
ThirumalaHi Thirumala,
if still relevant (sorry for the late reply): check if the user is assigned to a business partner (employee), which is assignet to a correct position in the CRM Org model, and that this business partner is the employee responsible of the sales documents you want him to see in the reports.
Alternatively, the user's business partner can be a manager of such an employee.
Best regards -
Unique id in interactive report
Hello
how can I add unique id to interactive report? This id has to remain unchanged if I move application to other workspace. I know there is interactive_report_id, but I am not sure if it stays unchanged when I will move application to other workspace.In the region definition.
Attributes - Static ID:
Enter value to identify this region. You can reference this value using the substitution string #REGION_STATIC_ID#. Referencing this value can be useful when developing custom JavaScript.http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/ui.htm#BABBEJJD -
What is difference between interactive list and interactive reports?
what is difference between interactive list and interactive reports?
hi check this..
interactive report/list means any input(double click or single click or user command ) on the screen will results a new screen with the corresponding fields....this is upto 20 levels only check this..
report .
start-of-selection.
write:/ 'this is the source list'.
at line-selection .
if sy-lsind = 1 .
write:/ ' this is the 1st list'.
elseif.
if sy-lsind = 2 .
write:/ ' this is the 2 list'.
if sy-lsind = 3 .
write:/ ' this is the 3 list'.
if sy-lsind = 4 .
write:/ ' this is the 4 list'.
if sy-lsind = 5 .
write:/ ' this is the 5 list'.
if sy-lsind = 6 .
write:/ ' this is the 6 list'.
if sy-lsind = 7 .
write:/ ' this is the 7 list'.
if sy-lsind = 8.
write:/ ' this is the 8 list'.
if sy-lsind = 9 .
write:/ ' this is the 9 list'.
if sy-lsind = 10 .
write:/ ' this is the 10 list'.
endif.
regards,
venkat -
Is there a way to do a "OR" with filters of an Interactive Report?
Hi,
I've noticed for a long time now that when you apply filters on an Interactive Report, they are applied on top of each other. But there is no way to apply them in an 'OR' fashion it seems. Unless I am mistaken.
Now I know that you could apply a Row filter and do something like B = 'Something' OR B = 'Something Else', but the that isn't user friendly enough for my clients.
ThanksYou can, it's just not easy.
Under Actions, select Filter. Change from a column filter (the default) to a row filter. This lets you put in pretty much anything you want for your filter, including things like "A=3 or A=5". This is one area where knowing SQL can be beneficial for users of APEX.
Ignore that; I hadn't read your message closely enough before posting.
-David
Edited by: David Gale on Dec 20, 2010 11:34 AM -
Dynamic action with interactive report region refresh
Hi!
I'm using APEX 4.02
I've got a page with 2 regions.
Region1 is a (input) form
Region2 is an interactive report on the same table as region 1
When entering values on the form I'm trying to dynmically lookup similar records in the table with the interactive report.
I've made a dynamic action on the change of the form fields which should refresh the interactive report region. I can see this one fires if I add a alert to debug if it fires.
The dynamic report is based on a query with bind variables pointing to the form fields, for example
where
field1 = :P2_FIELD1
This works great on the page load, so no dynamic action is fired but I can see the rows in the report region are the ones I am looking for.
But the refresh of the report region is not working, it is never refreshing and/or showing the correct data after a change of the form fields, so it looks like the dynamic action "refresh region" is not working on the interactive report.
Any ideas why this can go wrong ?
I would like to solve this using standard dynamic actions and preferrably not via PL/SQL or JS, shoudl be possible if I should believe the documentation... ;)
Cheers
Bas
Edited by: bklerk on 26-apr-2011 3:07Hi,
When you change value to item, I assume you do not set value to session state.
Use interactive report advanced attributes "Page Items to Submit" , set items session state before report is refreshed.
http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/app_comp.htm#sthref1235
Similar post/issue here
Hide and show region - hides on refresh
Regards,
Jari -
Problems with Page Break in an Interactive Reporting report
Hello everybody,
Platform: Hyperion System 9.3.1.
I have serious problems in managing the 'page break' in an Interactive Reporting report.
The report shows sales data by store, with article and colour details and it is organized like this:
group 1: geographic area
group 2: country
group 3: city
group 4: store
columns: article, colour
facts: quantity, price, value
My client's request is to perform a page break at the store group level, meaning that apart from the first store occurance, any change in the store value shoul start a new page.
The requested result is like this:
page1: geographic area1
country1
city1
store1
data store1...
page 2: store2
data store2...
page3: store3
data store3...
I tried several combinations of using Break After and Break Before on the store group, with Keep Next / Keep Together and it was impossible to obtain the desired result.
If I use Break Before the result is as follows:
page 1: geographic area1
country1
city1
page 2: store1
data store1...
page 3: store2
data store2...
If I use Break After the result is as follows:
page 1: geographic area1
country1
city1
store 1
page 2: data store1...
store 2
page 3: data store2...
even if I specify 'Keep with next' or 'Keep together' for store group and the store data table.
Any help will be very very appreciated because I've been trying for weeks to figure out this issue.
DanielaFirst start without using any of the Keep with Next and Keep together.
Second. try putting the Page Break in the Group Footer. You do not need to keep it visible
Then you may want to repeat headers on Store in case the Store's Detail rolls onto next page
Hope this helps
Wayne
Maybe you are looking for
-
Blank space at bottom of page in FF
I was sent some code to put a CMS system behind. But on testing the content on the div elements I have found I have blank space on the bottom of the page. I know this is caused by position:relative; but I thought using this was the correct way to dis
-
Authorisations etc.....
Got my first Mac in 2003/4 an iBook G4. Put all my music on an external drive. 2 years later went to boot and nothing!.... Apple store said the motherboard was screwed and it was going to cost like 75% of the cost of a new iBook to replace. I got a 1
-
How to capture warranty information in CRM
Dear all, How can we enter product warranty information in CRM system. We don't have equipment master data in ECC. we need to enter warranty information in CRM and we need to link it with the relevant Product in the ECC system. we want system to show
-
IPhoto keeps reading "uploading 25 photos" on Photo Stream
When I go into iCloud or My Photo Stream on iPhoto (on my PowerBook), it continually reads "Uploading 25 photos" in the upper right hand corner. This is true after restarting several times. It looks like all the pertinent photos are there, what are
-
Cant change a icon..
hello, I wanted to change the adobe suit's icons. I had no problem changing all but Indesign's icon does not change. It seems like its locked. I have never experinced this before. Anything I can do about it ? Thanking in advance. Gokce