08-01-2008 1:40 AM
Hi,
currently my report is getting display using FM:REUSE_ALV_HIERSEQ_LIST_DISPLAY.
now i want to extend functionality that when user click on any line-item into output it will take to the secondary list with all more details of selected line-item.
i am trying to with USER_COMMAND but it is not working.
plz send me wth example so i can do it tht way.
Thaks
08-04-2008 9:01 PM
Hi
Try this sample code:
REPORT z_demo_jg.
type-pools: slis.
types:
begin of x_mara,
matnr type matnr,
ersda type ersda,
ernam type ernam,
laeda type laeda,
aenam type aenam,
vpsta type vpsta,
pstat type pstat_d,
lvorm type lvoma,
check type char1,
end of x_mara,
begin of x_marc,
matnr type matnr,
werks type werks_d,
end of x_marc.
data: i_mara type standard table of x_mara initial size 0,
i_marc type standard table of x_marc initial size 0,
wa_alv_keyinfo type slis_keyinfo_alv,
i_fieldcat type slis_t_fieldcat_alv,
wa_layout type slis_layout_alv.
start-of-selection.
select matnr
werks
from marc
into table i_marc
up to 100 rows.
if sy-subrc = 0.
select
matnr
ersda
ernam
laeda
aenam
vpsta
pstat
lvorm
from mara into table i_mara
for all entries in i_marc
where matnr = i_marc-matnr.
if sy-subrc = 0.
endif.
endif.
end-of-selection.
data:
i_callback_program type syrepid value sy-repid.
perform sub_populate_fcat.
wa_alv_keyinfo-header01 = 'MATNR'.
wa_alv_keyinfo-item01 = 'MATNR'.
wa_alv_keyinfo-item02 = 'WERKS'.
wa_layout-f2code = 'ABCD'.
call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
exporting
I_INTERFACE_CHECK = 'X'
i_callback_program = i_callback_program
i_callback_user_command = 'SUB_USER_COMMAND'
is_layout = wa_layout
it_fieldcat = i_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
i_tabname_header = 'I_MARA'
i_tabname_item = 'I_MARC'
I_STRUCTURE_NAME_HEADER =
I_STRUCTURE_NAME_ITEM =
is_keyinfo = wa_alv_keyinfo
IS_PRINT =
IS_REPREP_ID =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
IR_SALV_HIERSEQ_ADAPTER =
IT_EXCEPT_QINFO =
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab_header = i_mara
t_outtab_item = i_marc
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.
&----
*& Form sub_populate_fcat
&----
text
----
form sub_populate_fcat.
data: l_wa_fieldcat type slis_fieldcat_alv.
l_wa_fieldcat-ref_tabname = 'MARA'.
l_wa_fieldcat-tabname = 'I_MARA'.
l_wa_fieldcat-fieldname = 'MATNR'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat-fieldname.
l_wa_fieldcat-fieldname = 'ERSDA'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat-fieldname.
l_wa_fieldcat-fieldname = 'ERNAM'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat-fieldname.
l_wa_fieldcat-fieldname = 'LAEDA'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat-fieldname.
l_wa_fieldcat-fieldname = 'AENAM'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat-fieldname.
l_wa_fieldcat-fieldname = 'VPSTA'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat-fieldname.
l_wa_fieldcat-fieldname = 'PSTAT'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat-fieldname.
l_wa_fieldcat-fieldname = 'LVORM'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat.
l_wa_fieldcat-fieldname = 'MATNR'.
l_wa_fieldcat-ref_tabname = 'MARC'.
l_wa_fieldcat-tabname = 'I_MARC'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat.
l_wa_fieldcat-fieldname = 'WERKS'.
l_wa_fieldcat-ref_tabname = 'MARC'.
l_wa_fieldcat-tabname = 'I_MARC'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat.
endform. "sub_populate_fcat'
&----
*& Form SUB_USER_COMMAND
&----
text
----
form sub_user_command using rf_ucomm type syucomm
rs type slis_selfield.
data: l_i_mara type standard table of x_mara initial size 0,
l_lines type i,
l_wa_mara type x_mara.
case rf_ucomm.
when 'ABCD'.
message i001(00) with 'Write ur logic here'.
* WHEN .
* WHEN OTHERS.
endcase.
endform. "sub_user_command
08-01-2008 4:21 AM
I am sure it is possible. Just show we will figure out the issue..
did similar sort of report.
08-01-2008 4:33 AM
Hi,
Check the Below program in SE38
BCALV_TEST_HIERSEQ_LIST Program BCALV_TEST_HIERSEQ_LIST
BCALV_TEST_HIERSEQ_LIST_EVENTS Program BCALV_TEST_HIERSEQ_LIST_EVENTS
Regards,
Boobalan S
08-01-2008 6:11 AM
08-04-2008 8:23 PM
08-04-2008 9:01 PM
Hi
Try this sample code:
REPORT z_demo_jg.
type-pools: slis.
types:
begin of x_mara,
matnr type matnr,
ersda type ersda,
ernam type ernam,
laeda type laeda,
aenam type aenam,
vpsta type vpsta,
pstat type pstat_d,
lvorm type lvoma,
check type char1,
end of x_mara,
begin of x_marc,
matnr type matnr,
werks type werks_d,
end of x_marc.
data: i_mara type standard table of x_mara initial size 0,
i_marc type standard table of x_marc initial size 0,
wa_alv_keyinfo type slis_keyinfo_alv,
i_fieldcat type slis_t_fieldcat_alv,
wa_layout type slis_layout_alv.
start-of-selection.
select matnr
werks
from marc
into table i_marc
up to 100 rows.
if sy-subrc = 0.
select
matnr
ersda
ernam
laeda
aenam
vpsta
pstat
lvorm
from mara into table i_mara
for all entries in i_marc
where matnr = i_marc-matnr.
if sy-subrc = 0.
endif.
endif.
end-of-selection.
data:
i_callback_program type syrepid value sy-repid.
perform sub_populate_fcat.
wa_alv_keyinfo-header01 = 'MATNR'.
wa_alv_keyinfo-item01 = 'MATNR'.
wa_alv_keyinfo-item02 = 'WERKS'.
wa_layout-f2code = 'ABCD'.
call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
exporting
I_INTERFACE_CHECK = 'X'
i_callback_program = i_callback_program
i_callback_user_command = 'SUB_USER_COMMAND'
is_layout = wa_layout
it_fieldcat = i_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
i_tabname_header = 'I_MARA'
i_tabname_item = 'I_MARC'
I_STRUCTURE_NAME_HEADER =
I_STRUCTURE_NAME_ITEM =
is_keyinfo = wa_alv_keyinfo
IS_PRINT =
IS_REPREP_ID =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
IR_SALV_HIERSEQ_ADAPTER =
IT_EXCEPT_QINFO =
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab_header = i_mara
t_outtab_item = i_marc
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.
&----
*& Form sub_populate_fcat
&----
text
----
form sub_populate_fcat.
data: l_wa_fieldcat type slis_fieldcat_alv.
l_wa_fieldcat-ref_tabname = 'MARA'.
l_wa_fieldcat-tabname = 'I_MARA'.
l_wa_fieldcat-fieldname = 'MATNR'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat-fieldname.
l_wa_fieldcat-fieldname = 'ERSDA'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat-fieldname.
l_wa_fieldcat-fieldname = 'ERNAM'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat-fieldname.
l_wa_fieldcat-fieldname = 'LAEDA'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat-fieldname.
l_wa_fieldcat-fieldname = 'AENAM'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat-fieldname.
l_wa_fieldcat-fieldname = 'VPSTA'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat-fieldname.
l_wa_fieldcat-fieldname = 'PSTAT'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat-fieldname.
l_wa_fieldcat-fieldname = 'LVORM'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat.
l_wa_fieldcat-fieldname = 'MATNR'.
l_wa_fieldcat-ref_tabname = 'MARC'.
l_wa_fieldcat-tabname = 'I_MARC'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat.
l_wa_fieldcat-fieldname = 'WERKS'.
l_wa_fieldcat-ref_tabname = 'MARC'.
l_wa_fieldcat-tabname = 'I_MARC'.
append l_wa_fieldcat to i_fieldcat.
clear l_wa_fieldcat.
endform. "sub_populate_fcat'
&----
*& Form SUB_USER_COMMAND
&----
text
----
form sub_user_command using rf_ucomm type syucomm
rs type slis_selfield.
data: l_i_mara type standard table of x_mara initial size 0,
l_lines type i,
l_wa_mara type x_mara.
case rf_ucomm.
when 'ABCD'.
message i001(00) with 'Write ur logic here'.
* WHEN .
* WHEN OTHERS.
endcase.
endform. "sub_user_command