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: 

wan to add push button in the output of ALV Grid display.

Former Member
0 Kudos
1,048

Hi Friends,

I wan to add a Push button in the output of ALV GRID display with STANDARD ikons.

How to copy standard ikons of GRID output.

How to apply the copied status into my code.

Regards,

Viji

1 ACCEPTED SOLUTION

Former Member
0 Kudos
104

Hi,

You have to copy the GUI status: "STANDARD" from the func grp : SALV into your program,

Then add the buttons you want and also can remove some buttons unwanted,

Finally set the new PF status: SET PF STATUS <status> before calling theALV display

Regards

Shiva

6 REPLIES 6

Former Member
0 Kudos
105

Hi,

You have to copy the GUI status: "STANDARD" from the func grp : SALV into your program,

Then add the buttons you want and also can remove some buttons unwanted,

Finally set the new PF status: SET PF STATUS <status> before calling theALV display

Regards

Shiva

Former Member
0 Kudos
104

This message was moderated.

former_member181962
Active Contributor
0 Kudos
104

Check the sample program BCALV_GRID_05

Regards,

Ravi Kanth

Former Member
0 Kudos
104

Hi,

U copy the status from a Standrd SAP program with some other status name and call it in your program..

Eg:

copy the status from of program SAPBC_GLOBAL_SCUSTOM_CREATE status '0200_MAIN' using SE41 with name status_001.

call like below in ur program..

set pf-status 'STATUS_001'.

Hope it helps!!

Regards,

Pavan

I355602
Advisor
Advisor
0 Kudos
104

Hi,

Goto SE41, create a pf-status for your alv report program.

On the next screen, click menu EXTRAS --> click option ADJUST TEMPLATES and select radiobutton LIST VIEWER --> you will get all standard buttons of alv in the pf-status.

Delete the unwanted buttons and also you can add new buttons if reqd.

Activate pf-status --> and apply in alv program.

Now to apply this pf-status in your alv report follow code:-


  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     i_callback_program                = v_rep_id       " report id
     i_callback_pf_status_set          = 'PF'           " for PF-STATUS
     i_callback_user_command           = 'USER_COMMAND' " for User-Command
     is_layout                         = wa_layout      " for layout
     it_fieldcat                       = it_field       " field catalog
     it_sort                           = it_sort        " sort info
    TABLES
      t_outtab                          = it_final      " internal table
   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.

*&---------------------------------------------------------------------*
*&      Form  pf
*&---------------------------------------------------------------------*
*       SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
*       ON WHICH THE ALV GRID IS DISPLAYED
*----------------------------------------------------------------------*
*       -->RT_EXTAB
*----------------------------------------------------------------------*
FORM pf USING rt_extab TYPE slis_t_extab.
  SET PF-STATUS 'ZTG_STAT'. "<--pass pf-status name here
ENDFORM.                    "pf

*&---------------------------------------------------------------------*
*&      Form  USER_COMMAND
*&---------------------------------------------------------------------*
*       SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
*       AND EXECUTE THE APPROPIATE CODE
*----------------------------------------------------------------------*
*      -->LV_OKCODE   used to capture the function code
*                     of the user-defined push-buttons
*      -->L_SELFIELD   text
*----------------------------------------------------------------------*
FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.

* assign the function code to variable v_okcode
  lv_okcode = sy-ucomm.

* handle the code execution based on the function code encountered
  CASE lv_okcode.

    WHEN '<function_code>'. "<--to handle user actions

  ENDCASE.

ENDFORM.                    "USER_COMMAND

Hope this helps you.

Regards,

Tarun

Former Member
0 Kudos
104

Thanks.