2006 Aug 28 10:53 AM
Hi all ,
I am tryng to handle the standard function code.The error i am getting is formal parameter "parent" does not exist.However the parameter 'I_parent'has a similar name.
Can anyone resolve and make this work.Kindly help in this experts.
when '&xxl'
perform test.
data:obj1 type ref to cl_gui_alv_grid.
form test.
create object obj1
exporting
parent = control_container
node_selection_mode = cl_gui_alv_grid=>MC_FC_CALL_XXL.
endform.
2006 Aug 28 1:00 PM
Hi Satheesh,
We use the event toolbar to add the button and the event user_command to implement the new function.
so in our class we need to define two methods to handle these two events first..
u can find this out from standard program 'BCALV_GRID_05'
briefly, define 2 methods ..say
in class declaration.
METHODS:
HANDLE_TOOLBAR
FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT E_INTERACTIVE,
HANDLE_USER_COMMAND
FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
IMPORTING E_UCOMM.
now in the class implemenatation.
METHOD HANDLE_TOOLBAR.
DATA: LS_TOOLBAR TYPE STB_BUTTON.
append a separator to normal toolbar
CLEAR LS_TOOLBAR.
MOVE 3 TO LS_TOOLBAR-BUTN_TYPE.
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
append an icon to show booking table
CLEAR LS_TOOLBAR.
MOVE 'BOOKINGS' TO LS_TOOLBAR-FUNCTION.
MOVE ICON_EMPLOYEE TO LS_TOOLBAR-ICON.
MOVE 'Show Bookings'(111) TO LS_TOOLBAR-QUICKINFO.
MOVE 'Detail'(112) TO LS_TOOLBAR-TEXT.
MOVE ' ' TO LS_TOOLBAR-DISABLED.
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
ENDMETHOD.
METHOD HANDLE_USER_COMMAND.
§ 3.In event handler method for event USER_COMMAND: Query your
function codes defined in step 2 and react accordingly.
DATA: LT_ROWS TYPE LVC_T_ROW.
CASE E_UCOMM.
WHEN 'BOOKINGS'.
CALL METHOD GRID1->GET_SELECTED_ROWS
IMPORTING ET_INDEX_ROWS = LT_ROWS.
CALL METHOD CL_GUI_CFW=>FLUSH.
IF SY-SUBRC NE 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
TITEL = G_REPID
TXT2 = SY-SUBRC
TXT1 = 'Error in Flush'(500).
endif.
ENDCASE.
ENDMETHOD. "handle_user_command
after creating the grid object...
GS_LAYOUT-SEL_MODE = 'A'.
CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'
IS_LAYOUT = GS_LAYOUT
CHANGING IT_OUTTAB = GT_SFLIGHT.
CREATE OBJECT EVENT_RECEIVER.
SET HANDLER EVENT_RECEIVER->HANDLE_USER_COMMAND FOR GRID1.
SET HANDLER EVENT_RECEIVER->HANDLE_TOOLBAR FOR GRID1.
§ 4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
CALL METHOD GRID1->SET_TOOLBAR_INTERACTIVE.
SET HANDLER EVENT_RECEIVER->HANDLE_USER_COMMAND FOR GRID1.
SET HANDLER EVENT_RECEIVER->HANDLE_TOOLBAR FOR GRID1.
Regadrds,
Vidya.
Hi Satheesh,
We use the event toolbar to add the button and the event user_command to implement the new function.
so in our class we need to define two methods to handle these two events first..
u can find this out from standard program 'BCALV_GRID_05'
briefly, define 2 methods ..say
in class declaration.
METHODS:
HANDLE_TOOLBAR
FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT E_INTERACTIVE,
HANDLE_USER_COMMAND
FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
IMPORTING E_UCOMM.
now in the class implemenatation.
METHOD HANDLE_TOOLBAR.
DATA: LS_TOOLBAR TYPE STB_BUTTON.
append a separator to normal toolbar
CLEAR LS_TOOLBAR.
MOVE 3 TO LS_TOOLBAR-BUTN_TYPE.
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
append an icon to show booking table
CLEAR LS_TOOLBAR.
MOVE 'BOOKINGS' TO LS_TOOLBAR-FUNCTION.
MOVE ICON_EMPLOYEE TO LS_TOOLBAR-ICON.
MOVE 'Show Bookings'(111) TO LS_TOOLBAR-QUICKINFO.
MOVE 'Detail'(112) TO LS_TOOLBAR-TEXT.
MOVE ' ' TO LS_TOOLBAR-DISABLED.
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
ENDMETHOD.
METHOD HANDLE_USER_COMMAND.
§ 3.In event handler method for event USER_COMMAND: Query your
function codes defined in step 2 and react accordingly.
DATA: LT_ROWS TYPE LVC_T_ROW.
CASE E_UCOMM.
WHEN 'BOOKINGS'.
CALL METHOD GRID1->GET_SELECTED_ROWS
IMPORTING ET_INDEX_ROWS = LT_ROWS.
CALL METHOD CL_GUI_CFW=>FLUSH.
IF SY-SUBRC NE 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
TITEL = G_REPID
TXT2 = SY-SUBRC
TXT1 = 'Error in Flush'(500).
endif.
ENDCASE.
ENDMETHOD. "handle_user_command
after creating the grid object...
GS_LAYOUT-SEL_MODE = 'A'.
CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'
IS_LAYOUT = GS_LAYOUT
CHANGING IT_OUTTAB = GT_SFLIGHT.
CREATE OBJECT EVENT_RECEIVER.
SET HANDLER EVENT_RECEIVER->HANDLE_USER_COMMAND FOR GRID1.
SET HANDLER EVENT_RECEIVER->HANDLE_TOOLBAR FOR GRID1.
§ 4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
CALL METHOD GRID1->SET_TOOLBAR_INTERACTIVE.
SET HANDLER EVENT_RECEIVER->HANDLE_USER_COMMAND FOR GRID1.
SET HANDLER EVENT_RECEIVER->HANDLE_TOOLBAR FOR GRID1.
Regadrds,
Vidya.
2006 Aug 28 10:58 AM
Hi Satheesh,
Did you create the container ?
*--- ALV Grid instance reference
DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid .
*--- Name of the custom control added on the screen
DATA gc_custom_control_name TYPE scrfname VALUE CC_ALV .
*--- Custom container instance reference
DATA gr_ccontainer TYPE REF TO cl_gui_custom_container .
IF gr_alvgrid IS INITIAL .
*----Creating custom container instance
CREATE OBJECT gr_ccontainer
EXPORTING
container_name = gc_custom_control_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6 .
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
Now pass this while creating the grid object
*----Creating ALV Grid instance
CREATE OBJECT gr_alvgrid
EXPORTING
i_parent = gr_ccontainer
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5 .
IF sy-subrc <> 0.
*--Exception
Regards,
Vidya
2006 Aug 28 11:34 AM
Hi vidya,
you have given the very good example.Just if i wanna add the function code'&XXL' and '%PC' and to make it work,what should i do.Kindly help me with your above example.
2006 Aug 28 11:01 AM
It shud be like this
DATA TABLE_OBJ TYPE REF TO CL_GUI_ALV_GRID.
create the TABLE control
CREATE OBJECT TABLE_OBJ
EXPORTING I_PARENT = CONTAINER.
it will definately solve it ...
Reward please if helpful
Regards
Message was edited by: Tushar Mundlik
2006 Aug 28 1:00 PM
Hi Satheesh,
We use the event toolbar to add the button and the event user_command to implement the new function.
so in our class we need to define two methods to handle these two events first..
u can find this out from standard program 'BCALV_GRID_05'
briefly, define 2 methods ..say
in class declaration.
METHODS:
HANDLE_TOOLBAR
FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT E_INTERACTIVE,
HANDLE_USER_COMMAND
FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
IMPORTING E_UCOMM.
now in the class implemenatation.
METHOD HANDLE_TOOLBAR.
DATA: LS_TOOLBAR TYPE STB_BUTTON.
append a separator to normal toolbar
CLEAR LS_TOOLBAR.
MOVE 3 TO LS_TOOLBAR-BUTN_TYPE.
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
append an icon to show booking table
CLEAR LS_TOOLBAR.
MOVE 'BOOKINGS' TO LS_TOOLBAR-FUNCTION.
MOVE ICON_EMPLOYEE TO LS_TOOLBAR-ICON.
MOVE 'Show Bookings'(111) TO LS_TOOLBAR-QUICKINFO.
MOVE 'Detail'(112) TO LS_TOOLBAR-TEXT.
MOVE ' ' TO LS_TOOLBAR-DISABLED.
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
ENDMETHOD.
METHOD HANDLE_USER_COMMAND.
§ 3.In event handler method for event USER_COMMAND: Query your
function codes defined in step 2 and react accordingly.
DATA: LT_ROWS TYPE LVC_T_ROW.
CASE E_UCOMM.
WHEN 'BOOKINGS'.
CALL METHOD GRID1->GET_SELECTED_ROWS
IMPORTING ET_INDEX_ROWS = LT_ROWS.
CALL METHOD CL_GUI_CFW=>FLUSH.
IF SY-SUBRC NE 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
TITEL = G_REPID
TXT2 = SY-SUBRC
TXT1 = 'Error in Flush'(500).
endif.
ENDCASE.
ENDMETHOD. "handle_user_command
after creating the grid object...
GS_LAYOUT-SEL_MODE = 'A'.
CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'
IS_LAYOUT = GS_LAYOUT
CHANGING IT_OUTTAB = GT_SFLIGHT.
CREATE OBJECT EVENT_RECEIVER.
SET HANDLER EVENT_RECEIVER->HANDLE_USER_COMMAND FOR GRID1.
SET HANDLER EVENT_RECEIVER->HANDLE_TOOLBAR FOR GRID1.
§ 4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
CALL METHOD GRID1->SET_TOOLBAR_INTERACTIVE.
SET HANDLER EVENT_RECEIVER->HANDLE_USER_COMMAND FOR GRID1.
SET HANDLER EVENT_RECEIVER->HANDLE_TOOLBAR FOR GRID1.
Regadrds,
Vidya.
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |