‎2009 Dec 23 6:48 AM
Dear All,
i have a problem with create interactive ALV report, i want to display 2 different ALV in same report, my requirement is i have a 2 internal table, and 1st ITAB i shown in a output data, once i click into a docno of the alv output then display 2nd ITAB data in a sub screen on ALV grid in the same program because of i calculate some amount in 2nd ITAB.
please help me how to do it.
Regards,
Abhilash
‎2009 Dec 23 7:04 AM
Refer to below pseudo code
FORM z_display_grid_alv .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'Z_USER_COMMAND'
i_callback_top_of_page = 'Z_TOP_OF_PAGE'
it_fieldcat = t_fieldcat
TABLES
t_outtab = t_outtab
EXCEPTIONS
program_error = 1
OTHERS = 2
.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " Z_DISPLAY_ALV
*&---------------------------------------------------------------------*
*& Form Z_USER_COMMAND
*&---------------------------------------------------------------------*
* User command ALV GRID
*----------------------------------------------------------------------*
* -->R_UCOMM text
* -->RS_SELFIELD text
*----------------------------------------------------------------------*
FORM z_user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
READ TABLE t_outtab INTO wa_outtab INDEX rs_selfield-tabindex.
IF sy-subrc = 0.
PERFORM z_prepare_list_field_catalog. " Field catalog for drill down.
PERFORM z_populate_details_value. " Populating data in table to display.
PERFORM z_event_call. " Event for list display
PERFORM z_populate_event. " Populating envent table
PERFORM z_display_list_alv. " Display details of line selected
ENDIF.
ENDCASE.
ENDFORM. "Z_USER_COMMAND
‎2009 Dec 23 6:54 AM
once u click on the docnum in 1st alv, u need to write to display second alv in the USER COMMAND
*User actions on ALV
FORM user_command USING r_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'. " ON DOUBLE CLICK
HERE u select ur data accoring to the docnum slected and store it in a second internal table
and display it.
END CASE.
U have lot of posts in SCN. please chk it.
‎2009 Dec 23 7:02 AM
hi Kalyan,
Thanks for u r reply,
i have done this work, but how to display it, i am getting following error in display 2nd alv.
"The current application triggered a termination with a short dump"
how to display it.
abhilash
‎2009 Dec 23 7:04 AM
HI,
debud your program. Try to get the point which is raising this error.
‎2009 Dec 23 7:04 AM
‎2009 Dec 23 6:55 AM
‎2009 Dec 23 7:06 AM
‎2009 Dec 23 7:01 AM
Hi,
Use the following code for your requirement.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'PFSTATUS'
it_fieldcat = it_fieldcat
is_layout = it_layout
it_event_exit = it_eventexit
i_screen_start_column = 10
i_screen_start_line = 20
i_screen_end_column = 70
i_screen_end_line = 45
TABLES
t_outtab = itab.
FORM user_command USING r_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
READ TABLE itab INDEX rs_selfield-tabindex INTO wa.
(logic for second internal table)
ENDCASE.
ENDFORM.
More detailed information you can get from internet search.
Hope it will solve your problem.
‎2009 Dec 23 7:04 AM
Refer to below pseudo code
FORM z_display_grid_alv .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'Z_USER_COMMAND'
i_callback_top_of_page = 'Z_TOP_OF_PAGE'
it_fieldcat = t_fieldcat
TABLES
t_outtab = t_outtab
EXCEPTIONS
program_error = 1
OTHERS = 2
.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " Z_DISPLAY_ALV
*&---------------------------------------------------------------------*
*& Form Z_USER_COMMAND
*&---------------------------------------------------------------------*
* User command ALV GRID
*----------------------------------------------------------------------*
* -->R_UCOMM text
* -->RS_SELFIELD text
*----------------------------------------------------------------------*
FORM z_user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
READ TABLE t_outtab INTO wa_outtab INDEX rs_selfield-tabindex.
IF sy-subrc = 0.
PERFORM z_prepare_list_field_catalog. " Field catalog for drill down.
PERFORM z_populate_details_value. " Populating data in table to display.
PERFORM z_event_call. " Event for list display
PERFORM z_populate_event. " Populating envent table
PERFORM z_display_list_alv. " Display details of line selected
ENDIF.
ENDCASE.
ENDFORM. "Z_USER_COMMAND
‎2009 Dec 23 7:21 AM