‎2006 Dec 10 6:36 PM
Hi ,
The ALV grid data is shown as below (grid1)
date plant mat.width goods
01.12.06 p1 80 100
01.12.06 p1 100 120
01.12.06 p1 70 110
if we drill down on particular row say on row one thts having (mat. width '80' ) it should display only details related to mat.width '80' at the moment it displaying all material width in the drill down ALV (grid2).
required out put for alv grid 2 (drill down report) is to show as below when user clicks on row 1.
date plant mat.width goods
01.12.06 p1 80 100
Please give some suggestions and sample code if possible to get this ..
Thxs,
Vind.
‎2006 Dec 10 6:59 PM
Here is a example of ALV interactive report.
http://www.sap-img.com/abap/an-interactive-alv-report.htm
Regards,
Ravi
note - Please mark all the helpful answers
‎2006 Dec 10 7:31 PM
Hi,
Check this example..When you click on the mat width field..It will display for its corresponding data from ITAB2.
TYPE-POOLS: slis.
DATA: BEGIN OF itab1 OCCURS 0,
mat_width type int4,
END OF itab1.
DATA: BEGIN OF itab2 OCCURS 0,
mat_width type int4,
matnr type matnr,
werks type werks_d,
END OF itab2.
DATA: t_fieldcatalog1 TYPE slis_t_fieldcat_alv.
DATA: t_fieldcatalog2 TYPE slis_t_fieldcat_alv.
DATA: v_repid TYPE syrepid.
v_repid = sy-repid.
Get the fieldcatalog1
PERFORM get_fieldcat1.
Get the fieldcatalog2
PERFORM get_fieldcat2.
Populate the data.
itab1-mat_width = 80.
append itab1.
itab1-mat_width = 10.
append itab1.
itab2-mat_width = 80.
itab2-matnr = 'adafsf'.
itab2-werks = 'ABCD'.
append itab2.
itab2-mat_width = 10.
itab2-matnr = 'bbbbbb'.
itab2-werks = 'EFGH'.
append itab2.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_callback_user_command = 'DISPLAY_DETAIL'
it_fieldcat = t_fieldcatalog1
TABLES
t_outtab = itab1.
----
FORM display_detail *
----
........ *
----
--> UCOMM *
--> SELFIELD *
----
FORM display_detail USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
DATA: itab2_temp LIKE itab2 OCCURS 0 WITH HEADER LINE.
IF ucomm = '&IC1'.
READ TABLE itab1 INDEX selfield-tabindex.
IF sy-subrc = 0.
LOOP AT itab2 WHERE mat_width = itab1-mat_width.
MOVE itab2 TO itab2_temp.
APPEND itab2_temp.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = t_fieldcatalog2
TABLES
t_outtab = itab2_temp.
ENDIF.
ENDIF.
ENDFORM.
----
FORM GET_FIELDCAT1 *
----
........ *
----
FORM get_fieldcat1.
DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
s_fieldcatalog-col_pos = '1'.
s_fieldcatalog-fieldname = 'MAT_WIDTH'.
s_fieldcatalog-tabname = 'ITAB1'.
s_fieldcatalog-seltext_l = 'Mat width'.
s_fieldcatalog-hotspot = 'X'.
s_fieldcatalog-outputlen = '6'.
APPEND s_fieldcatalog TO t_fieldcatalog1.
CLEAR s_fieldcatalog.
ENDFORM.
*
----
FORM GET_FIELDCAT2 *
----
........ *
----
FORM get_fieldcat2.
DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
s_fieldcatalog-col_pos = '1'.
s_fieldcatalog-fieldname = 'MAT_WIDTH'.
s_fieldcatalog-tabname = 'ITAB2'.
s_fieldcatalog-seltext_l = 'Mat width'.
s_fieldcatalog-hotspot = 'X'.
s_fieldcatalog-outputlen = '6'.
APPEND s_fieldcatalog TO t_fieldcatalog2.
CLEAR s_fieldcatalog.
s_fieldcatalog-col_pos = '2'.
s_fieldcatalog-fieldname = 'MATNR'.
s_fieldcatalog-tabname = 'ITAB2'.
s_fieldcatalog-rollname = 'MATNR'.
APPEND s_fieldcatalog TO t_fieldcatalog2.
CLEAR s_fieldcatalog.
s_fieldcatalog-col_pos = '3'.
s_fieldcatalog-fieldname = 'WERKS'.
s_fieldcatalog-tabname = 'ITAB2'.
s_fieldcatalog-rollname = 'WERKS_D'.
APPEND s_fieldcatalog TO t_fieldcatalog2.
CLEAR s_fieldcatalog.
ENDFORM.
Thanks,
Naren