11 Replies Latest reply: Feb 9, 2009 5:15 PM by Tarun Gambhir RSS

Button in ALV toolbar with REUSE_ALV_GRID_DISPLAY

Krishan Kumar Birmiwala
Currently Being Moderated

Hello friends,

 

I am Displaying ALV using REUSE_ALV_GRID_IDSPLAY. i need to add a button in grid toolbar.

i am doing it by adding a new ZSTATUS in  SET PF_STATUS. but the problem is that it is removing the standard buttons.

 

i want to add button without removing the standard butttons.

Please help.

 

thanx in advance.

 

Krishan Kumar

  • Re: Button in ALV toolbar with REUSE_ALV_GRID_DISPLAY
    Upender Macharla
    Currently Being Moderated

    BY adding a new ZSTATUS in SET PF_STATUS.it wil removing the standard ALV buttons.

     

    U  want to add button without removing the standard butttons.

     

    u hav to include all buttons in ur SET PF_STATUS

     

    See any standard ALV program find SET PF_STATUS of that program,

    find the all buttons and functon codes..

     

    add that in ur SET PF_STATUS

  • Re: Button in ALV toolbar with REUSE_ALV_GRID_DISPLAY
    pratyush verma
    Currently Being Moderated

    You have to add all the buttons thats the only solution i know

     

    Edited by: pratyush v on Feb 5, 2009 10:20 AM

  • Re: Button in ALV toolbar with REUSE_ALV_GRID_DISPLAY
    kalyan balabhadrapatruni
    Currently Being Moderated

    Hi,

     

    Please check the code Below,

     

    you should copy the 'STANDARD' GUI status from program SAPLKKBL using transaction SE90 >Programming SubObjects> Gui Status.

     

    Execute this transaction to get to next screen. select status using checkbox. click on GUI Status --> Copy.

     

    Enter your Z program name and the name you what for this status - you can keep it as 'STANDARD' to be simple.

     

    Then you can edit the new status to add or delete buttons. This will also bring in the standard SAP ALV functionality such as sorting/subtotaling etc...

     

    When you call 'REUSE_ALV_GRID_DISPLAY' make sure you pass it the new status name.

     

    Thanks

    Kalyan B.

  • Re: Button in ALV toolbar with REUSE_ALV_GRID_DISPLAY
    Nithya Murugesan
    Currently Being Moderated

    Hi

     

    If U set ur own PF-STATUS the standard buttons will not be added.

     

    At The same time u cannot change the functionalities of the standard button also.

     

    if u want, u can add them by giving the function codes to that. For Example

     

    In Function Keys tab,

     

    Give BACK, EXIT,CANCEL ETC..,

     

     

    Thanks,

    Nithya.

  • Re: Button in ALV toolbar with REUSE_ALV_GRID_DISPLAY
    Avinash Kodarapu
    Currently Being Moderated

    Hi,

     

    Refer this demo program BCALV_GRID_07...how to add the button in the Application toolbar keeping the standard buttons active.

  • Re: Button in ALV toolbar with REUSE_ALV_GRID_DISPLAY
    Benu Mariantony
    Currently Being Moderated

    Hey Buddy,

     

    You should not create your own GUI status. Copy the ALV GRID's GUI Status (STANDARD_FULLSCREEN) and add the button on it.

     

    Go to SE80 and open the program SLVC_FULLSCREEN here you will find the GUI Status node. drill the node and rightclick -> copy the GUI Status STANDARD_FULLSCREEN. give the target program name (your alv grid program) and zguistatus name.

     

    Add the button in the Zguistatus. thats it.

     

    For handling the butten event the code snippet is below,

     

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

       I_CALLBACK_PROGRAM             = sy-repid

       I_CALLBACK_PF_STATUS_SET       = 'SET_PF_STATUS'

       I_CALLBACK_USER_COMMAND        = 'USER_COMMAND'

       IT_FIELDCAT                    = d_fieldcat

       I_GRID_TITLE                   = 'Communications Infotype'

       IT_EVENTS                      = it_event

      TABLES

        t_outtab                       = it_tab.

     

    FORM user_command USING r_ucomm TYPE syucomm

    rs_selfield TYPE slis_selfield.

     

    CASE r_ucomm.

    WHEN '&DELETE'.

    ENDCASE.

     

    ENDFORM.

     

    FORM set_pf_status USING rt_extab TYPE slis_t_extab .       "#EC NEEDED

      SET PF-STATUS 'ZSTANDARD_FULLSCREEN'.

    ENDFORM.

    • Re: Button in ALV toolbar with REUSE_ALV_GRID_DISPLAY
      Currently Being Moderated

      hai friends.......

                         i had tried to add custom button to the reuse_alv_grid_display.please send  the coding...

       

       

      REPORT  ZHAJI_SAMPLE.

       

      tables:lfa1.

      TYPE-POOLS : slis.

      SELECT-OPTIONS: lifnr FOR lfa1-lifnr.

      types:begin of fs,

            flag type c,

            lifnr type lfa1-lifnr,

            land1 type lfa1-land1,

            name1 type lfa1-name1,

       

            end of fs.

       

      data: itab type table of fs,

            wa type fs.

       

      data: fcat type slis_t_fieldcat_alv,

            fcat1 type slis_fieldcat_alv.

       

           

       

      data: rt_extab type slis_t_extab.

       

       

      *CONSTANTS : c_check(1) VALUE 'X'.

       

       

       

       

       

      select lifnr land1 name1 from lfa1 into corresponding FIELDS OF table

      itab where lifnr IN

      lifnr.

       

       

      perform sub.

       

       

      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

      EXPORTING

      •   I_INTERFACE_CHECK                 = ' '

      •   I_BYPASSING_BUFFER                = ' '

      •   I_BUFFER_ACTIVE                   = ' '

         I_CALLBACK_PROGRAM                = 'sy-repid'

         I_CALLBACK_PF_STATUS_SET           = 'PF'

      •   I_CALLBACK_USER_COMMAND           = ' '

      •   I_CALLBACK_TOP_OF_PAGE            = ' '

      •   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '

      •   I_CALLBACK_HTML_END_OF_LIST       = ' '

      •   I_STRUCTURE_NAME                  =

      •   I_BACKGROUND_ID                   = ' '

      • I_GRID_TITLE                      = 'vendor details'

      •   I_GRID_SETTINGS                   =

      • IS_LAYOUT                         = LAYOUT

         IT_FIELDCAT                       = fcat

      •   IT_EXCLUDING                      =

      •   IT_SPECIAL_GROUPS                 =

      •   IT_SORT                           =

      •   IT_FILTER                         =

      •   IS_SEL_HIDE                       =

      •   I_DEFAULT                         = 'X'

      •   I_SAVE                            = ' '

      •   IS_VARIANT                        =

      • IT_EVENTS                         = I_EVENT

      •   IT_EVENT_EXIT                     =

      •   IS_PRINT                          =

      •   IS_REPREP_ID                      =

      •   I_SCREEN_START_COLUMN             = 0

      •   I_SCREEN_START_LINE               = 0

      •   I_SCREEN_END_COLUMN               = 0

      •   I_SCREEN_END_LINE                 = 0

      •   IT_ALV_GRAPHICS                   =

      •   IT_HYPERLINK                      =

      •   IT_ADD_FIELDCAT                   =

      •   IT_EXCEPT_QINFO                   =

      •   I_HTML_HEIGHT_TOP                 =

      •   I_HTML_HEIGHT_END                 =

      • IMPORTING

      •   E_EXIT_CAUSED_BY_CALLER           =

      •   ES_EXIT_CAUSED_BY_USER            =

        TABLES

          T_OUTTAB                          = itab

      • 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 sub.

      fcat1-fieldname = 'FLAG'.

      fcat1-tabname = 'TAB'.

      *fcat1-COL_POS = 1.

      fcat1-checkbox = 'X'.

      fcat1-edit         = 'X'.

      append fcat1 to fcat.

      CLEAR FCAT1.

       

       

       

      fcat1-fieldname = 'LIFNR'.

      fcat1-ref_tabname = 'LFA1'.

      fcat1-ref_fieldname = 'LIFNR'.

      • FCAT1-outputlen = 10.

       

      append fcat1 to fcat.

      CLEAR FCAT1.

       

      fcat1-fieldname = 'NAME1'.

      fcat1-ref_tabname = 'LFA1'.

      fcat1-ref_fieldname = 'NAME1'.

       

      append fcat1 to fcat.

      CLEAR FCAT1.

       

       

      fcat1-fieldname = 'LAND1'.

      fcat1-ref_tabname = 'LFA1'.

      fcat1-ref_fieldname = 'LAND1'.

       

      append fcat1 to fcat.

      CLEAR FCAT1.

      endform.

      form PF USING rt_extab TYPE slis_t_extab.

       

      SET PF-STATUS 'ZHAJI_P1' .

       

      ENDFORM.

       

       

       

      just give the fine coding

  • Re: Button in ALV toolbar with REUSE_ALV_GRID_DISPLAY
    soumya chakraborty
    Currently Being Moderated

    Hi,

     

    Go to SE80 and give the function group SALV.

    In GUIstatus copy the STANDARD GUIstatus (right click on STANDARD , clic on Copy)

    to ur 'Z' status(ZSTANDARD).Then add ur required status.

     

    Regards.

  • Re: Button in ALV toolbar with REUSE_ALV_GRID_DISPLAY
    farha farqual
    Currently Being Moderated

    Hi,

     

     

    copy the standard  pfstatus  STANDARD  from program name  SAPLSALV   and add your own buttons to your pf status

  • Re: Button in ALV toolbar with REUSE_ALV_GRID_DISPLAY
    Tarun Gambhir
    Currently Being Moderated

    Hi,

     

    Goto SE41, give the program name and create a new pf-status for your alv program.

    Now in menu goto --> extras -- > click adjust template --> select list viewer --> and click done.

     

    This will create a standard alv toolbar pf-status.

     

    Now you can delete the standard buttons that you dnt want and also can add new buttons to be used as per your requirement.

     

    Now you can use this pf-status in your alv grid and can handle the execution in user command.

     

    Hope this solves your problem.

     

    Thanks & Regards,

    Tarun Gambhir

Actions