2007 Apr 04 1:39 PM
Hello Gurus!!!
Want some tips related how to add button using ALV Grid(OO).
I want to display the button for search, sort ....
Please suggest the step -by-step procedure for implementation of these button.
I am designing the code for transaction FB03. Header data has been displayed but want to display the line items.
Kindly suggest your answers.
Thanks,
Sachin
2007 Apr 04 2:36 PM
Hi,
I have used <b>ALV Object</b> Model for this example to display ALV standard functions,not user defined functions.
It would be pretty good to follow ALV OM.
Code sample:
report zdemo.
data: ispfli type table of spfli.
data: gr_table type ref to cl_salv_table.
data: gr_functions type ref to cl_salv_functions.
start-of-selection.
select * into table ispfli from spfli.
cl_salv_table=>factory( importing r_salv_table = gr_table changing t_table = ispfli ).
gr_functions = gr_table->get_functions( ).
gr_functions->set_all( abap_true ).
gr_table->display( ).gr_table->display( ).
Thanks
2007 Apr 04 1:54 PM
Hi,
CLASS SELSCR_APPLICATION DEFINITION DEFERRED.
CLASS SELSCR_APPLICATION DEFINITION.
PUBLIC SECTION.
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.
ENDCLASS. "SELSCR_APPLICATION DEFINITION
CLASS SELSCR_APPLICATION IMPLEMENTATION.
METHOD HANDLE_TOOLBAR.
DATA: LS_TOOLBAR TYPE STB_BUTTON.
append SAVE icon
CLEAR LS_TOOLBAR.
MOVE 'SAVE' TO LS_TOOLBAR-FUNCTION.
MOVE ICON_SYSTEM_SAVE TO LS_TOOLBAR-ICON.
MOVE 'Save' TO LS_TOOLBAR-QUICKINFO.
MOVE ' ' TO LS_TOOLBAR-DISABLED.
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
CLEAR LS_TOOLBAR.
ENDMETHOD. "handle_toolbar
METHOD HANDLE_USER_COMMAND.
CASE E_UCOMM.
WHEN 'SAVE'.
PERFORM UPDATE_FIELDS.
ENDCASE.
ENDMETHOD.
ENDCLASS. "SELSCR_APPLICATION IMPLEMENTATION
these lines should be after calling method SET_TABLE_FOR_FIRST_DISPLAY
SET HANDLER G_APPLICATION1->HANDLE_TOOLBAR FOR GRID1.
CALL METHOD grid1->set_toolbar_interactive.
rgds,
bharat.
2007 Apr 04 1:56 PM
Hi,
DATA: G_SELSCR_APPLICATION TYPE REF TO SELSCR_APPLICATION.
this also should be included after CLASS SELSCR_APPLICATION DEFINITION DEFERRED.statement in the above code.
2007 Apr 04 1:58 PM
2007 Apr 04 2:36 PM
Hi,
I have used <b>ALV Object</b> Model for this example to display ALV standard functions,not user defined functions.
It would be pretty good to follow ALV OM.
Code sample:
report zdemo.
data: ispfli type table of spfli.
data: gr_table type ref to cl_salv_table.
data: gr_functions type ref to cl_salv_functions.
start-of-selection.
select * into table ispfli from spfli.
cl_salv_table=>factory( importing r_salv_table = gr_table changing t_table = ispfli ).
gr_functions = gr_table->get_functions( ).
gr_functions->set_all( abap_true ).
gr_table->display( ).gr_table->display( ).
Thanks
2007 Apr 04 2:40 PM
Hello Gurus!!
Can you please explain the above with simple examples.
Hoping for ur answers
Thanks,
Sachin