‎2008 Feb 13 11:49 AM
Hi All,
We have a requirement where in we need to have a 'PUSH BUTTON' on an ALV output.If we click that ,other ALV output needs to be displayed.Please let me know the feasibility for this??And can we go back from the second output to the first one where the push button is present.
Regards
Prathima
‎2008 Feb 13 11:53 AM
ya u can do this
1) define a pf-status for ur alv in which u can copy all std alv functions and user defined button
2) on user action a specific subroutine can be called where u can write the code for displaying anothe ALV....
‎2008 Feb 13 11:54 AM
----------------------------------------------------------------------
CLASS L_CL_EVENTS DEFINITION *
----------------------------------------------------------------------
Class for inserting buttons on the toolbar *
----------------------------------------------------------------------
CLASS l_cl_events DEFINITION.
PUBLIC SECTION.
METHODS:
toolbar FOR EVENT toolbar
OF cl_gui_alv_grid
IMPORTING e_object
e_interactive,
user_command FOR EVENT user_command
OF cl_gui_alv_grid
IMPORTING e_ucomm .
ENDCLASS. " L_CL_EVENTS DEFINITION
----------------------------------------------------------------------
CLASS L_CL_EVENTS IMPLEMENTATION *
----------------------------------------------------------------------
Implementation of class L_CL_EVENTS *
----------------------------------------------------------------------
CLASS l_cl_events IMPLEMENTATION.
METHOD toolbar.
PERFORM event_toolbar USING e_object.
ENDMETHOD. " TOOLBAR
METHOD user_command.
PERFORM event_ucomm USING e_ucomm.
ENDMETHOD. " USER_COMMAND
ENDCLASS. " L_CL_EVENTS IMPLEMENTATION
DATA:
To create instance for cl_gui_custom_container
g_grid TYPE REF TO cl_gui_custom_container,
To create instance for cl_gui_alv_grid
g_alv TYPE REF TO cl_gui_alv_grid,
To create instance for l_cl_events
g_events TYPE REF TO l_cl_events,
To assign name for custom container
g_container TYPE scrfname VALUE 'CONTAINER',
To assign layout
g_fcatlayo TYPE lvc_s_layo.
----------------------------------------------------------------------
FORM EVENT_TOOLBAR *
----------------------------------------------------------------------
Setting toolbar in the alv grid *
----------------------------------------------------------------------
-->E_OBJECT TYPE REF TO CL_ALV_EVENT_TOOLBAR_SET *
----------------------------------------------------------------------
FORM event_toolbar USING e_object
TYPE REF TO cl_alv_event_toolbar_set.
Local declaration for the button.
DATA: ls_toolbar TYPE stb_button.
To add Approve button
ls_toolbar-function = c_app_rej
ls_toolbar-butn_type = c_zero.
ls_toolbar-text = text-001.
APPEND ls_toolbar TO e_object->mt_toolbar.
To add Reject button
CLEAR ls_toolbar.
ls_toolbar-function = c_fcode_rej.
ls_toolbar-butn_type = c_zero.
ls_toolbar-text = text-013.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDFORM. " EVENT_TOOLBAR
----------------------------------------------------------------------
FORM EVENT_UCOMM *
----------------------------------------------------------------------
After Input in the ALV grid,if user select record and press *
approve or reject then the record will get updated *
----------------------------------------------------------------------
--> PR_ucomm type sy-ucomm *
----------------------------------------------------------------------
FORM event_ucomm USING pr_ucomm LIKE sy-ucomm.
CASE pr_ucomm.
If e_ucomm contains 'APP' i.e.function code for Approve button
WHEN c_fcode_approve. " To approve selected record
PERFORM app_timesheet USING c_approve_status.
If e_ucomm contains 'REJ' i.e. function code for Reject
WHEN c_fcode_rej. " To reject selected record
PERFORM app_timesheet USING c_rej_status.
ENDCASE. " CASE E_UCOMM
ENDFORM. " EVENT_UCOMM<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 13, 2008 4:25 PM