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: 

Button in classics ALV

Former Member
0 Kudos

Hi guys , Im listing some registers with alv but now I want to add a button to button bar for select some lines of the alv and send this lines selected after push my new button , I add

FORM cria_listagem_alv.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = pgm

it_fieldcat = fieldcat

it_sort = sortcat

i_callback_pf_status_set = 'SET_PF_STATUS'

i_callback_user_command = 'USERCOMMAND'

is_layout = layout

TABLES

t_outtab = t_zatrconsumos

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " cria_listagem_alv

&----


*& Form usercommand

&----


  • text

----


  • -->R_UCOMM text

  • -->RS_SELFIELD text

----


FORM SET_PF_STATUS USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

SET PF-STATUS 'STANDARD' EXCLUDING r_ucomm.

"SET PF-STATUS 'SAVE'.

ENDFORM. "usercommand

to add button but i got a dump of parameters missing , i think is the first step, any advice ?? ,thank you

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

you combined both. the correct coding is this..

For PF_STATUS

FORM SET_PF_STATUS USING extab type slis_t_extab.

SET PF-STATUS 'STANDARD' EXCLUDING extab.
"SET PF-STATUS 'SAVE'.

ENDFORM.

For user command

FORM USERCOMMAND using ucomm type sy-ucomm 
selfield type slis_selfield.


endform.

2 REPLIES 2

former_member188685
Active Contributor
0 Kudos

you combined both. the correct coding is this..

For PF_STATUS

FORM SET_PF_STATUS USING extab type slis_t_extab.

SET PF-STATUS 'STANDARD' EXCLUDING extab.
"SET PF-STATUS 'SAVE'.

ENDFORM.

For user command

FORM USERCOMMAND using ucomm type sy-ucomm 
selfield type slis_selfield.


endform.

former_member188685
Active Contributor
0 Kudos

For Handling of the Button which is added in the application toolbar

FORM SET_PF_STATUS USING r_extab type slis_t_extab.
SET PF-STATUS 'STANDARD' EXCLUDING r_ucomm.
"copy the status of standard program SAPLKKBL using SE41 ,
"in se41 enter the program name SAPLKKBL
"status as STANDARD
" click the copy button, give the to as your program name and ok
"now go to change mode add the button in application toolbar
"save and activate use the same status here.

ENDFORM.

FORM USERCOMMAND using ucomm type sy-ucomm 
selfield type slis_selfield.
 
case ucomm.
 
when 'BUTTONCODE'.  "<----Button code what ever you mentioned
 "do your processing here...
endcase.
 
endform.