‎2008 Aug 20 10:21 AM
Hi,
Iam working on ALV interactive Report which has 3 levels of reporting. First level will be displaying plant data. In second level Storage location data is displayed and third level material data is displayed. The problem is coming when iam trying to display third level data. Based on the level it will be calling different subroutines.
Is there any field which gives in which level we are?. I tried sy-lsind but the value is always zero.
Best Regards
Suresh
‎2008 Aug 20 1:30 PM
Hi,
Thanks for the response. The data displayed at all 3 levels is different and Iam using 3 different internal tables to hold the data at each level as the data types are different for the 3 levels.
At present Iam using USER_COMMAND but this is not working.
eg., the first level displays plant data and based on plant data second level is displayed. Second level is storage location data and based on this data 3rd level is displayed. Iam using three different internal tables to hold data at each level. Even I use the Read command in USER_COMMAND , as the internal tables are different at different levels Iam having problem in identifying what the previous data was.
FORM USER_COMMAND TABLES p_nodes STRUCTURE seucomm USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
READ TABLE t_output INTO WA_OUTPUT INDEX RS_SELFIELD-TABINDEX.
Perform fill_column_headers.
Perform bld_ls_fieldcat.
Perform bld_layout.
PERFORM event_call.
PERFORM populate_event.
Perform display_alv_report_sloc.
ENDCASE.
ENDFORM. "user_command
In above code t_output is used to hold 1st level data and the internal tables are different for other levels.
If any one has examples of ALV repoting which displays more than 3 levels please send the code. Thanks.
Best Regards
Suresh
Edited by: mariosuresh on Aug 20, 2008 2:30 PM
‎2008 Aug 20 10:24 AM
Hi Suresh
http://saptechnical.com/Tutorials/ALV/ALVTreeDemo/interactive.htm Check the program in the link for your reference.
Regards,
Syf
‎2008 Aug 20 10:24 AM
> when iam trying to display third level data. Based on the >level it will be calling different subroutines.
If you are trying to display different ALV report, then Don't use any Common USER_COMMAND routines with different names, use separate Routines, may be you are using same name for all the cases.
‎2008 Aug 20 1:30 PM
Hi,
Thanks for the response. The data displayed at all 3 levels is different and Iam using 3 different internal tables to hold the data at each level as the data types are different for the 3 levels.
At present Iam using USER_COMMAND but this is not working.
eg., the first level displays plant data and based on plant data second level is displayed. Second level is storage location data and based on this data 3rd level is displayed. Iam using three different internal tables to hold data at each level. Even I use the Read command in USER_COMMAND , as the internal tables are different at different levels Iam having problem in identifying what the previous data was.
FORM USER_COMMAND TABLES p_nodes STRUCTURE seucomm USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
READ TABLE t_output INTO WA_OUTPUT INDEX RS_SELFIELD-TABINDEX.
Perform fill_column_headers.
Perform bld_ls_fieldcat.
Perform bld_layout.
PERFORM event_call.
PERFORM populate_event.
Perform display_alv_report_sloc.
ENDCASE.
ENDFORM. "user_command
In above code t_output is used to hold 1st level data and the internal tables are different for other levels.
If any one has examples of ALV repoting which displays more than 3 levels please send the code. Thanks.
Best Regards
Suresh
Edited by: mariosuresh on Aug 20, 2008 2:30 PM
‎2008 Aug 20 1:56 PM
See this example with more than 3 levels.
REPORT ztest_alv_interactive.
TYPE-POOLS: slis.
DATA: it_flight TYPE sflight_tab1,
it_spfli TYPE TABLE OF spfli,
it_book TYPE STANDARD TABLE OF sbook,
it_scarr TYPE STANDARD TABLE OF scarr.
DATA: form_name TYPE slis_formname,
struc TYPE dd02l-tabname,
title TYPE lvc_title .
SELECT * FROM scarr
INTO TABLE it_scarr
UP TO 10 ROWS.
form_name = 'USER_COMMAND1'.
struc = 'SCARR'.
title = 'First List'.
PERFORM list_display USING form_name
struc
title
it_scarr.
*&---------------------------------------------------------------------*
*& Form list_display
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_FORM_NAME text
* -->P_IT_FLIGHT text
*----------------------------------------------------------------------*
FORM list_display USING p_form_name
struc
title
it_data TYPE STANDARD TABLE.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = form_name
i_structure_name = struc
i_grid_title = 'Flight'
TABLES
t_outtab = it_data
EXCEPTIONS
program_error = 1.
ENDFORM. " list_display
*&---------------------------------------------------------------------*
*& Form user_command1
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->UCOMM text
* -->SELFIELD text
*----------------------------------------------------------------------*
FORM user_command1 USING ucomm TYPE sy-ucomm
selfield TYPE slis_selfield.
DATA: wa_scarr TYPE scarr.
CASE ucomm.
WHEN '&IC1'.
READ TABLE it_scarr INTO wa_scarr INDEX selfield-tabindex.
CLEAR it_spfli.
SELECT * FROM spfli
INTO TABLE it_spfli
WHERE carrid = wa_scarr-carrid.
form_name = 'USER_COMMAND2'.
struc = 'SPFLI'.
title = 'Second List'.
PERFORM list_display USING form_name
struc
title
it_spfli.
ENDCASE.
ENDFORM. "user_command1
*&---------------------------------------------------------------------*
*& Form user_command2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->UCOMM text
* -->SELFIELD text
*----------------------------------------------------------------------*
FORM user_command2 USING ucomm TYPE sy-ucomm
selfield TYPE slis_selfield.
DATA: wa_spfli TYPE spfli.
CASE ucomm.
WHEN '&IC1'.
READ TABLE it_spfli INTO wa_spfli INDEX selfield-tabindex.
CLEAR it_flight.
SELECT * FROM sflight
INTO TABLE it_flight
WHERE carrid = wa_spfli-carrid AND
connid = wa_spfli-connid.
form_name = 'USER_COMMAND3'.
struc = 'SFLIGHT'.
title = 'Third List'.
PERFORM list_display USING form_name
struc
title
it_flight.
ENDCASE.
ENDFORM. "user_command1
*&---------------------------------------------------------------------*
*& Form user_command2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->UCOMM text
* -->SELFIELD text
*----------------------------------------------------------------------*
FORM user_command3 USING ucomm TYPE sy-ucomm
selfield TYPE slis_selfield.
DATA: wa_flight TYPE sflight.
CASE ucomm.
WHEN '&IC1'.
READ TABLE it_flight INTO wa_flight INDEX selfield-tabindex.
CLEAR it_scarr.
SELECT * FROM sbook
INTO TABLE it_book
WHERE carrid = wa_flight-carrid AND
connid = wa_flight-connid AND
fldate = wa_flight-fldate.
struc = 'SBOOK'.
title = 'Fourth List'.
PERFORM list_display USING form_name
struc
title
it_book.
ENDCASE.
ENDFORM. "user_command1