Application Development and Automation 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: 
Read only

Push button is ALV grid display.

Former Member
0 Likes
1,515

Hi all,

I am can anyone tell me hw to create pushbottun in pf-status.

Hi all,

I am can anyone tell me hw to create pushbottun in pf-status.

6 REPLIES 6
Read only

former_member404244
Active Contributor
0 Likes
925

hI,

In the application tool bar of the PF-STATUS...U can put ur text for the push button,activate it and now pass the PF-STATUS to alv_grid....

U will get the pushbutton on the application tool bar..

Regards.

Nagaraj

Read only

Former Member
0 Likes
925

Hi,

Check the link

Read only

0 Likes
925

Hi Balu ,

Set pf status 'ZEXM'. double click on the pf status . Then go to application tool bar tab . Enter the function code in the input field .Double click on the fcode. Enter the required text.

In the alv function module REUSE_ALV_GRID_DISPLAY , in this Fm in the parameter I_CALLBACK_PF_STATUS_SET give the name of the A name . The pf status should be in within form and endform. In this Form and endform , you can handle the push button .

Form pf status.

case sy-ucomm.

when 'FCODE'.

-


endcase.

endform.

Read only

Former Member
0 Likes
925

Try this sample code availble on SDN


* create a custom area on the screen 
DATA : gref_ver_toolbar      TYPE REF TO cl_gui_toolbar,
       gref_custom_container TYPE REF TO cl_gui_custom_container.
 
* initializing toolbar
* Creating toolbar container............................................
  create object gref_custom_container
  exporting
  container_name              = iv_ccarea   " control area on screen
 exceptions
   cntl_error                  = 1
   cntl_system_error           = 2
   create_error                = 3
   lifetime_error              = 4
   lifetime_dynpro_dynpro_link = 5
   others                      = 6
     .
 
* creating reference to toolbar........................................
  create object gref_ver_toolbar
  exporting
   parent         = gref_custom_container
   display_mode       = 1
 exceptions
   cntl_install_error = 1
   cntl_error         = 2
   cntb_wrong_version = 3
   others             = 4
      .
* subroutine to create buttons
* Local data............................................................
  data: lv_fcode       type ui_func,
        lv_icon        type iconname,
        lv_is_disabled type c,
        lv_quickinfo   type iconquick.
 
 
* delete node  button...................................................
  lv_fcode            = 'DELETE'.
  lv_icon             = '@11@'.
  lv_is_disabled      = space.
  lv_quickinfo        = test(001).
 
* adding button to toolbar
  call method gref_toolbar->add_button
   exporting
    fcode            = lv_fcode
    icon             = lv_icon
    is_disabled      = lv_is_disabled
    butn_type        = cntb_btype_button
    quickinfo        = lv_quickinfo
   exceptions
    cntl_error       = 1
    cntb_btype_error = 2
    cntb_error_fcode = 3
    others           = 4
            .
* registering toolbar
* Local data............................................................
  data: ls_event type cntl_simple_event,
        lt_event type cntl_simple_events.
  ls_event-eventid    = cl_gui_toolbar=>m_id_function_selected.
  ls_event-appl_event = space.
  append ls_event to lt_event.
 
* Method for Registering Events for Toolbar.............................
  call method gref_toolbar->set_registered_events
    exporting
      events                    = lt_event[]
    exceptions
      cntl_error                = 1
      cntl_system_error         = 2
      illegal_event_combination = 3
      others                    = 4.
 
 * Setting handler for the Toolbar Buttons..............................
  set handler  gref_application->handle_function_selected
          for  gref_toolbar.
 
 


just copy paste the above code in the PBO of the screen also you need to create a method handle_function_selected which will take care of the function on the button


* Method to handle button on toolbar....................................
     handle_function_selected
                    FOR EVENT function_selected
                           OF cl_gui_toolbar
                    IMPORTING fcode.
 
method handle_function_selected.
      case fcode.
 
        when 'DELETE'.
*          code...
     endcase.          
 
endmethod.

Read only

Former Member
0 Likes
924

Hi

Check this out...

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

i_callback_user_command = 'USER_COMMAND'

i_callback_pf_status_set = 'PFSTATUS'

it_fieldcat = it_fieldcat

is_layout = it_layout

  • it_event_exit = it_eventexit

  • i_screen_start_column = 10

  • i_screen_start_line = 20

  • i_screen_end_column = 70

  • i_screen_end_line = 45

  • i_grid_title = 'Call Tcode Refresh ALV'

TABLES

t_outtab = t_final.

&----


*& Form user_command

&----


  • text

----


*User actions on ALV

FORM user_command USING r_ucomm TYPE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE r_ucomm.

WHEN 'PUSHBUTTON'.

write ur logic here...

ENDCASE.

ENDFORM. "user_command

----


  • FORM PFSTATUS *

----


FORM pfstatus USING ut_extab TYPE slis_t_extab.

SET PF-STATUS 'STANDARD_FULLSCREEN1' .

ENDFORM. " PF_STATUS_SET

Double click on the 'STANDARD_FULLSCREEN1' and add ur push button.

Read only

Former Member
0 Likes
924

Using the call back status or Event for set pf status, we can do that.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

exporting

i_callback_pf_status_set = 'STATUS'

..

FORM STATUS using extab type slis_t_extab.

set pf-status 'STANDARD' excluding extab.

ENDFORM.

go to SE41, here you enter program name SAPLKKBL and status name STANDARD , now click on Copy status Button, and now a pop up appears , enter the PRogram name in to option. Now copy it, go to change mode add the button in the application tool bar, and activate that . then you go to you program and check it.

For handling the button you need to use the user_command event.

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

case ucomm.
when 'ABC'.

endcase.

ENDFORM.