Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to add ALV button using OO in module pool program using ALV grid

sonu_p2
Active Participant
0 Kudos
564

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos
207

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

5 REPLIES 5

Former Member
0 Kudos
207

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.

Former Member
0 Kudos
207

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.

former_member181962
Active Contributor
0 Kudos
207

Check the sample ALV program: BCALV_GRID_05

Regards,

Ravi

Former Member
0 Kudos
208

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

sonu_p2
Active Participant
0 Kudos
207

Hello Gurus!!

Can you please explain the above with simple examples.

Hoping for ur answers

Thanks,

Sachin