Hi PF-STATUS in ALV

Hi,
How to use custom defines PF-STATUS in ALV Grid.
Please Give me suggestion this is very imprtant.

Hi,
You can create a PF status, say ZPF3 which is an exact copy of STANDARD of program SAPLSALV through transaction SE41 (Menu Painter). You can exclude certain buttons that you do not want and add more also.
To set the PF status as say ZPF3 for your ALV grid and to handle user-command, you can use the following code piece.
call function 'REUSE_ALV_GRID_DISPLAY'
   exporting
  I_INTERFACE_CHECK                = ' '
  I_BYPASSING_BUFFER               = ' '
  I_BUFFER_ACTIVE                  = ' '
   i_callback_program                = v_repid
   i_callback_pf_status_set          = 'PF_STATUS_GRID1'
   i_callback_user_command           = 'USER_COMM'
  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                     =
  I_GRID_SETTINGS                  =
   is_layout                         = s_layout
   it_fieldcat                       = t_fcat_grid1[]
  IT_EXCLUDING                     =
  IT_SPECIAL_GROUPS                =
   it_sort                           = t_sort_grid1
  IT_FILTER                        =
  IS_SEL_HIDE                      =
  I_DEFAULT                        = 'X'
  I_SAVE                           = ' '
  IS_VARIANT                       =
  it_events                         = t_events
  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                          = t_report
  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.                    " report_display
*&      Form  pf_status_grid1
      Description: Set PF_STATUS for the 1st grid
form pf_status_grid1 using rt_extab type slis_t_extab.
  set pf-status 'ZPF3'.
endform. "pf_status_grid1
*&      Form  USER_COMM
      Description: Handling click on the button 'Grand Total'
form user_comm using ucomm like sy-ucomm ls_selfield type slis_selfield.
  case ucomm.
    when '&TOT'.
      perform fieldcat_build_grid2.
      perform sort_grid2.
      perform display_grandtotal.
  endcase.
endform.                    "USER_COMM
Reward points for useful answers.

Similar Messages

  • PF STATUS IN ALV REPORT

    hi,
    How to use PF STATUS IN ALV REPORT?

    HI,
    see this code.
    TABLES:MARA.
    SELECT-OPTIONS: MATNR FOR MARA-MATNR.
    DATA:BEGIN OF ITAB OCCURS 0,
         MATNR LIKE MARA-MATNR,
         ERSDA LIKE MARA-ERSDA,
         MTART LIKE MARA-MTART,
         MBRSH LIKE MARA-MBRSH,
    END OF ITAB.
    SELECT * FROM MARA INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE MATNR
    IN MATNR.
    TYPE-POOLS SLIS.
    DATA:FCAT TYPE slis_t_fieldcat_alv.
    DATA:LAYOUT TYPE slis_layout_alv.
    DATA:EVE TYPE slis_t_event WITH HEADER LINE.
    DATA:HEAD TYPE slis_t_listheader WITH HEADER LINE.
    DATA:SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    SORT-UP = 'X'.
    SORT-SPOS = 1.
    SORT-FIELDNAME = 'ERSDA'.
    SORT-tabname = 'MARA'.
    APPEND SORT.
    SORT-SPOS = 2.
    SORT-FIELDNAME = 'MTART'.
    SORT-tabname = 'MARA'.
    APPEND SORT.
    EVE-NAME = 'TOP_OF_PAGE'.
    EVE-FORM = 'TOPOFPAGE'.
    APPEND EVE.
    EVE-NAME = 'TOP_OF_LIST'.
    EVE-FORM = 'TOPOFLIST'.
    APPEND EVE.
    EVE-NAME = 'END_OF_LIST'.
    EVE-FORM = 'ENDOFLIST'.
    APPEND EVE.
    LAYOUT-ZEBRA = 'X'.
    LAYOUT-no_hline = 'X'.
    LAYOUT-NO_VLINE = 'X'.
    LAYOUT-window_titlebar = 'MATERIAL DETAILS'.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = SY-REPID
       I_INTERNAL_TABNAME           = 'ITAB'
      I_STRUCTURE_NAME             =
      I_CLIENT_NEVER_DISPLAY       = 'X'
       I_INCLNAME                   = SY-REPID
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
      CHANGING
        CT_FIELDCAT                  = FCAT
    EXCEPTIONS
      INCONSISTENT_INTERFACE       = 1
      PROGRAM_ERROR                = 2
      OTHERS                       = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
       I_CALLBACK_PROGRAM             = SY-REPID
    <b>   I_CALLBACK_PF_STATUS_SET       = 'STATUS'
       I_CALLBACK_USER_COMMAND        = 'UCOMM'</b>
      I_STRUCTURE_NAME               =
       IS_LAYOUT                      = LAYOUT
       IT_FIELDCAT                    = FCAT
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
       IT_SORT                        = SORT[]
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
       IT_EVENTS                      = EVE[]
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 5
      I_SCREEN_START_LINE            = 5
      I_SCREEN_END_COLUMN            = 120
      I_SCREEN_END_LINE              = 25
    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 TOPOFPAGE.
    REFRESH HEAD.
        HEAD-TYP = 'H'.
        HEAD-INFO = 'MATERIALS'.
        APPEND HEAD.
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
            IT_LIST_COMMENTARY       = HEAD[]
          I_LOGO                   =
          I_END_OF_LIST_GRID       =
    ENDFORM.
    FORM TOPOFLIST.
    REFRESH HEAD.
        HEAD-TYP = 'H'.
        HEAD-INFO = 'MATERIALS-LISTTOP'.
        APPEND HEAD.
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
            IT_LIST_COMMENTARY       = HEAD[]
          I_LOGO                   =
          I_END_OF_LIST_GRID       =
    ENDFORM.
    FORM ENDOFLIST.
    REFRESH HEAD.
        HEAD-TYP = 'H'.
        HEAD-INFO = 'MATERIALS-LISTEND'.
        APPEND HEAD.
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
            IT_LIST_COMMENTARY       = HEAD[]
          I_LOGO                   =
          I_END_OF_LIST_GRID       =
    ENDFORM.
    <b>FORM STATUS USING MYMENU.
        SET PF-STATUS 'MENU' excluding MYMENU.
    ENDFORM.
    FORM UCOMM USING CODE STEXT.
        CASE CODE.
            WHEN 'ABC'.
            WRITE:/ 'YOU HAVE CLICKED ON ABC'.
            WHEN 'XYZ'.
            WRITE:/ 'YOU HAVE CLICKED ON XYZ'.
        ENDCASE.
    ENDFORM.</b>
    rgds,
    bharat.

  • Problem in pf status in alv grid

    Hi ,
    In alv grid in fm reuse_alv_grid_display under parameter   I_CALLBACK_PF_STATUS_SET   = STATUS
    FORM STATUS_SET USING LS_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'XYZ' EXCLUDING EXTAB.
    ENDFORM.
    Now i have to set back & exit button in my std toolbar.
    I double clicked on XYZ & then control moves to menu painter & i defined all above mentioned button in application toolbar.
    I activated but the mentioned buttons are not displaying in output.
    Anybody will suggest me what i have to do in this case??

    hi
    good
    go through this links
    http://sap.ittoolbox.com/code/archives.asp?i=10&d=3603&a=s
    http://sap.ittoolbox.com/code/archives.asp?i=10&d=1917&a=s
    this ll give you complete idea about the pf status in alv.
    thanks
    mrutyun^

  • User defined PF-STATUS in ALV

    Hi all,
          I am doing an ALV through an user defined pf-status.But when I am using this pf-status I am unable to find the standard application tool bar and remaining also.I have seen some threads regarding this. These threads are giving me the suggestions to copy the standard pf status of ALV into user defined pf status. How to copy this standard pf status to my program.
    Sathish Reddy.

    First of all you must copy STANDART status from any ALV example in SLIS Development Class into your report.
    You can change this status Properties. (Functions, Buttons)
    And you must add this form to Active Your Status in ALV.
    *&      Form  set_pf_status
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form set_pf_status using rt_extab type slis_t_extab.
      set pf-status 'STANDARD' excluding rt_extab.
    endform.
    and you must add specified line in your callf of ALV Function.
      call function 'REUSE_ALV_LIST_DISPLAY'
           exporting
                i_callback_program = g_repid
                it_fieldcat        = gt_fieldcat[]
                it_events          = t_events[]
                i_callback_user_command = 'USER_COMMAND'
                i_callback_pf_status_set = 'SET_PF_STATUS'  <<<<<< ADD THIS
           tables
                t_outtab           = mglistoutput.
    ibrahim

  • Regarding PF Status In ALV Grid Dispaly

    Hi..
    Can you please tell me how to set PF status in ALV Grid Display.
    Regards
    Sandeep.

    hi,
    if u use REUSE_ALV_LIST_DISPLAY copy the standard GUI-Status named STANDARD from function group SALV in your program
    if u use REUSE_ALV_GRID_DISPLAY_LVC or REUSE_ALV_GRID_DISPLAY copy the standard GUI-Status named STANDARD_FULLSCREEN from function group SLVC_FULLSCREEN in your program
    after  that you cas set the pf-status in this way:
    >CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'                   
    > EXPORTING                                               
    >    i_callback_program                = sy-cprog         
    >    i_callback_pf_status_set          = 'STATUS'
    >    i_callback_user_command           = 'USERCOMMAND'    
    >   is_layout                           = st_layout         
    >   it_fieldcat                          = st_fieldcat      
    >  TABLES                                      
    >    t_outtab                          = outtab 
    or
    >CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'              
    > EXPORTING                                              
    >    i_callback_program                = sy-cprog         
    >    i_callback_pf_status_set          = 'STATUS'  
    >    i_callback_user_command           = 'USERCOMMAND'   
    >    is_layout_lvc                     = wa_slis_layout  
    >    it_fieldcat_lvc                   = tb_slis_fieldcat
    >  TABLES                                                
    >    t_outtab                          = tb_app          
    where USERCOMMAND and STATUS are 2 forms in your program.
    >FORM status USING pfstat TYPE slis_t_extab.
    > SET PF-STATUS 'STANDARD' EXCLUDING pfstat.
    >ENDFORM.
    >
    > ...
    >
    >FORM usercommand USING okcode LIKE sy-ucomm
    >                       wa_selfield TYPE slis_selfield.
    >  CASE okcode.
    >      .... 
    >  ENDCASE
    >ENDFORM.
    Bye.
    Marco

  • PF-STATUS IN ALV Reports

    Hi
    i want to use SET PF-STATUS in ALV Grid display
    this is my code,can u tl me wts the wrong and any modification is needed.
    TYPE-POOLS: SLIS.
    TYPES: BEGIN OF I_MARA,
           MATNR LIKE MARA-MATNR,
           MTART LIKE MARA-MTART,
           MEINS LIKE MARA-MEINS,
           GROES LIKE MARA-GROES,
           VOLUM LIKE MARA-VOLUM,
           END OF I_MARA.
    DATA: IT_MARA TYPE STANDARD TABLE OF I_MARA INITIAL SIZE 0.
    DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
          REPID TYPE SY-REPID,
          GD_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA: I_TITLE_MARA TYPE LVC_TITLE VALUE 'GRID DISPLAY'.
    START-OF-SELECTION.
    PERFORM DATA_RETRIEVAL.
    PERFORM BLD_FLDCAT.
    PERFORM BLD_LAYOUT.
    PERFORM DISPLAY_ALV_REPORT.
    FORM BLD_FLDCAT.
    FLDCAT-FIELDNAME = 'MATNR'.
    FLDCAT-SELTEXT_M = 'MATERIAL NUMBER'.
    FLDCAT-COL_POS = 0.
    FLDCAT-KEY = 'X'.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    FLDCAT-FIELDNAME = 'MTART'.
    FLDCAT-SELTEXT_M = 'MATERIAL TYPE'.
    FLDCAT-COL_POS = 1.
    FLDCAT-KEY = 'X'.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    FLDCAT-FIELDNAME = 'MEINS'.
    FLDCAT-SELTEXT_M = 'UNIT OF MEASURE'.
    FLDCAT-COL_POS = 2.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    FLDCAT-FIELDNAME = 'GROES'.
    FLDCAT-SELTEXT_M = 'SIZE'.
    FLDCAT-COL_POS = 3.
    FLDCAT-KEY = 'X'.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    FLDCAT-FIELDNAME = 'VOLUM'.
    FLDCAT-SELTEXT_M = 'VOLUME'.
    FLDCAT-COL_POS = 4.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    ENDFORM.
    FORM BLD_LAYOUT.
    GD_LAYOUT-NO_INPUT = 'X'.
    GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    GD_LAYOUT-ZEBRA = 'X'.
    GD_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'.
    ENDFORM.
    FORM DISPLAY_ALV_REPORT.
    REPID = SY-REPID.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = REPID
       I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'
      I_CALLBACK_USER_COMMAND           = ' '
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      = I_TITLE_MARA
      I_GRID_SETTINGS                   =
       IS_LAYOUT                         = GD_LAYOUT
       IT_FIELDCAT                       = FLDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
       I_SAVE                            = 'X'
      IS_VARIANT                        =
      IT_EVENTS                         =
      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
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          = IT_MARA
    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.
    FORM DATA_RETRIEVAL.
    SELECT MATNR MTART MEINS GROES VOLUM
    INTO TABLE IT_MARA FROM MARA
    UP TO 40 ROWS.
    ENDFORM.
    FORM TOP_OF_PAGE.
    DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
          WA_HEADER TYPE SLIS_LISTHEADER.
    WA_HEADER-TYP = 'H'.
    WA_HEADER-INFO = 'THIS IS MY FIRST ALV'.
    APPEND WA_HEADER TO T_HEADER.
    WA_HEADER-TYP = 'S'.
    WA_HEADER-INFO = 'THIS IS SECOND'.
    APPEND WA_HEADER TO T_HEADER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = T_HEADER
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.
    FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
    SET PF-STATUS 'ZSTAT'.
    ENDFORM.
    when i double click on ZSTAT ,it shows the prg is currently edit by (user-name).
    thanks in advance.

    1.   
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
        I_CALLBACK_PROGRAM                = W_REPID
       <b> I_CALLBACK_PF_STATUS_SET          = 'PF_STATUS'
        I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'</b>
    2.
    FORM <b>PF_STATUS</b> using RT_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STANDARD1' EXCLUDING RT_EXTAB.
    ENDFORM.                    "PF_STATUS
    3.
    FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM
                            P_SELFLD TYPE SLIS_SELFIELD.
      DATA : L_REP_MODE.                "report mode
      CASE P_UCOMM.
      ENDCASE.
    ENDFORM.

  • PF Status in ALV list.

    Hi,
    please tell me how to create PF status in ALV. I know how to create PF status but not sure in ALV. can some one give simple report with code please. ex: spfli table. I want to use
    'REUSE_ALV_LIST_DISPLAY' instead of grid.
    Please help.
    Thanks in advance.

    Hi,
       First you need to assign one form name(like STATUS) to the one of the parameters (I_CALLBACK_PF_STATUS_SET) of the function module. After calling the FM, you can call the new form with the above said name(STATUS). In between the form and endform you can use the statement SET PF-STATUS.
    Check the below code....
    *& Report  ZZZ_TEST_500
    REPORT  zzz_test_500.
    TABLES:vbak.
    TYPE-POOLS:slis.
    TYPES:BEGIN OF ty_vbak,
           vbeln LIKE vbak-vbeln,
           auart LIKE vbak-auart,
           kunnr LIKE vbak-kunnr,
           vkorg LIKE vbak-vkorg,
           vtweg LIKE vbak-vtweg,
           spart LIKE vbak-spart,
          END OF ty_vbak,
          BEGIN OF ty_vbap,
           posnr LIKE vbap-posnr,
           matnr LIKE vbap-matnr,
           werks LIKE vbap-werks,
           lgort LIKE vbap-lgort,
           ntgew LIKE vbap-ntgew,
          END OF ty_vbap.
    DATA:i_vbak TYPE STANDARD TABLE OF ty_vbak,
         i_vbap TYPE STANDARD TABLE OF ty_vbap,
         w_vbak TYPE ty_vbak,
         w_vbap TYPE ty_vbap.
    SELECT-OPTIONS:s_vbeln FOR vbak-vbeln.
    PARAMETERS:p_var LIKE disvariant-variant.
    *Declarations for ALV
    DATA:i_fieldcat TYPE slis_t_fieldcat_alv,
         w_fieldcat LIKE LINE OF i_fieldcat,
         w_layout   TYPE slis_layout_alv,
         disvar     TYPE disvariant,
         invariant  TYPE disvariant,
         i_event    TYPE slis_t_event,
         w_event    TYPE slis_alv_event,
         i_header   TYPE slis_t_listheader,
         w_header   TYPE slis_listheader.
    CONSTANTS:status TYPE slis_formname VALUE 'PF_STATUS'.
    AT SELECTION-SCREEN ON s_vbeln.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var.
      invariant-report = sy-repid.
      CALL FUNCTION 'LVC_VARIANT_F4'
        EXPORTING
          is_variant                = invariant
      IT_DEFAULT_FIELDCAT       =
      I_SAVE                    = ' '
       IMPORTING
        e_exit                    =
         es_variant                = disvar
       EXCEPTIONS
         not_found                 = 1
         program_error             = 2
         OTHERS                    = 3
      IF sy-subrc = 0.
        p_var = disvar-variant.
      ENDIF.
    START-OF-SELECTION.
      PERFORM read_data.
      PERFORM build_fieldcat.
      PERFORM prepare_events.
      PERFORM display_output.
    *&      Form  read_data
          text
    FORM read_data .
      SELECT vbeln
             auart
             kunnr
             vkorg
             vtweg
             spart FROM vbak
                   INTO TABLE i_vbak
                   WHERE vbeln IN s_vbeln.
      IF sy-subrc = 0.
      ENDIF.
    ENDFORM.                    " read_data
    *&      Form  build_fieldcat
          text
    FORM build_fieldcat .
      w_fieldcat-col_pos = 1.
      w_fieldcat-fieldname = 'VBELN'.
      w_fieldcat-tabname = 'I_VBAK'.
      w_fieldcat-seltext_l = 'Sales Document #'.
      APPEND w_fieldcat TO i_fieldcat.
      CLEAR w_fieldcat.
      w_fieldcat-col_pos = 2.
      w_fieldcat-fieldname = 'AUART'.
      w_fieldcat-tabname = 'I_VBAK'.
      w_fieldcat-seltext_l = 'Order Type'.
      APPEND w_fieldcat TO i_fieldcat.
      CLEAR w_fieldcat.
      w_fieldcat-col_pos = 3.
      w_fieldcat-fieldname = 'KUNNR'.
      w_fieldcat-tabname = 'I_VBAK'.
      w_fieldcat-seltext_l = 'Customer #'.
      APPEND w_fieldcat TO i_fieldcat.
      CLEAR w_fieldcat.
      w_fieldcat-col_pos = 4.
      w_fieldcat-fieldname = 'VKORG'.
      w_fieldcat-tabname = 'I_VBAK'.
      w_fieldcat-seltext_l = 'Sales Org'.
      APPEND w_fieldcat TO i_fieldcat.
      CLEAR w_fieldcat.
      w_fieldcat-col_pos = 5.
      w_fieldcat-fieldname = 'VTWEG'.
      w_fieldcat-tabname = 'I_VBAK'.
      w_fieldcat-seltext_l = 'Distribution Channel'.
      APPEND w_fieldcat TO i_fieldcat.
      CLEAR w_fieldcat.
      w_fieldcat-col_pos = 6.
      w_fieldcat-fieldname = 'SPART'.
      w_fieldcat-tabname = 'I_VBAK'.
      w_fieldcat-seltext_l = 'Division'.
      APPEND w_fieldcat TO i_fieldcat.
      CLEAR w_fieldcat.
    ENDFORM.                    " build_fieldcat
    *&      Form  display_output
          text
    FORM display_output .
      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          = status
      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                      =
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
         it_fieldcat                       = i_fieldcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
        is_variant                        = disvar
        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
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
        TABLES
          t_outtab                          = i_vbak
    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.                    " display_output
    *&      Form  STATUS
          text
    FORM pf_status USING extab TYPE slis_t_extab.
      SET PF-STATUS 'TEST1'.
    ENDFORM.                    "STATUS
    *&      Form  PREPARE_EVENTS
          text
    FORM prepare_events .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 0
        IMPORTING
          et_events       = i_event
        EXCEPTIONS
          list_type_wrong = 1
          OTHERS          = 2.
      IF sy-subrc = 0.
      READ TABLE i_event INTO w_event WITH KEY name = slis_ev_pf_status_set.
        w_event-form = 'SET_PF_STATUS'.
        MODIFY i_event FROM w_event INDEX sy-tabix.
       READ TABLE i_event INTO w_event WITH KEY name = slis_ev_user_command.
        w_event-form = 'USER_COMMAND'.
        MODIFY i_event FROM w_event INDEX sy-tabix.
        READ TABLE i_event INTO w_event WITH KEY name = slis_ev_top_of_page.
        w_event-form = 'TOP_OF_PAGE'.
        MODIFY i_event FROM w_event INDEX sy-tabix.
      ENDIF.
    ENDFORM.                    " PREPARE_EVENTS
    *&      Form  SET_PF_STATUS
          text
    FORM set_pf_status USING extab TYPE slis_t_extab.
      SET PF-STATUS 'TEST_NEW'.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  USER_COMMAND
          text
    FORM user_command USING rs_ucomm LIKE sy-ucomm
                            rs_selfield TYPE slis_selfield.
      CASE rs_ucomm.
        WHEN 'VBAP'.
          PERFORM display_vbap_data USING rs_selfield.
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    *&      Form  DISPLAY_VBAP_DATA
          text
    FORM display_vbap_data USING rs_selfield TYPE slis_selfield.
      SET PARAMETER ID 'AUN' FIELD rs_selfield-value.
      CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    ENDFORM.                    " DISPLAY_VBAP_DATA
    *&      Form  TOP_OF_PAGE
          text
    FORM top_of_page.
      w_header-typ = 'H'.
      w_header-info = sy-repid.
      APPEND w_header TO i_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary       = i_header
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.                    " TOP_OF_PAGE
    Rgds,
    Bujji

  • PFS status in ALV report.

    Hi,
    How can we set PFS status in ALV report.Please tell the procedure.
    Thanks in advance.

    HI,
    see this code.
    TABLES:MARA.
    SELECT-OPTIONS: MATNR FOR MARA-MATNR.
    DATA:BEGIN OF ITAB OCCURS 0,
    MATNR LIKE MARA-MATNR,
    ERSDA LIKE MARA-ERSDA,
    MTART LIKE MARA-MTART,
    MBRSH LIKE MARA-MBRSH,
    END OF ITAB.
    SELECT * FROM MARA INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE MATNR
    IN MATNR.
    TYPE-POOLS SLIS.
    DATA:FCAT TYPE slis_t_fieldcat_alv.
    DATA:LAYOUT TYPE slis_layout_alv.
    DATA:EVE TYPE slis_t_event WITH HEADER LINE.
    DATA:HEAD TYPE slis_t_listheader WITH HEADER LINE.
    DATA:SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    SORT-UP = 'X'.
    SORT-SPOS = 1.
    SORT-FIELDNAME = 'ERSDA'.
    SORT-tabname = 'MARA'.
    APPEND SORT.
    SORT-SPOS = 2.
    SORT-FIELDNAME = 'MTART'.
    SORT-tabname = 'MARA'.
    APPEND SORT.
    EVE-NAME = 'TOP_OF_PAGE'.
    EVE-FORM = 'TOPOFPAGE'.
    APPEND EVE.
    EVE-NAME = 'TOP_OF_LIST'.
    EVE-FORM = 'TOPOFLIST'.
    APPEND EVE.
    EVE-NAME = 'END_OF_LIST'.
    EVE-FORM = 'ENDOFLIST'.
    APPEND EVE.
    LAYOUT-ZEBRA = 'X'.
    LAYOUT-no_hline = 'X'.
    LAYOUT-NO_VLINE = 'X'.
    LAYOUT-window_titlebar = 'MATERIAL DETAILS'.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = SY-REPID
    I_INTERNAL_TABNAME = 'ITAB'
    I_STRUCTURE_NAME =
    I_CLIENT_NEVER_DISPLAY = 'X'
    I_INCLNAME = SY-REPID
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE =
    CHANGING
    CT_FIELDCAT = FCAT
    EXCEPTIONS
    INCONSISTENT_INTERFACE = 1
    PROGRAM_ERROR = 2
    OTHERS = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = SY-REPID
    <b>I_CALLBACK_PF_STATUS_SET = 'STATUS'
    I_CALLBACK_USER_COMMAND = 'UCOMM'</b>
    I_STRUCTURE_NAME =
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FCAT
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT = SORT[]
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
    IT_EVENTS = EVE[]
    IT_EVENT_EXIT =
    IS_PRINT =
    IS_REPREP_ID =
    I_SCREEN_START_COLUMN = 5
    I_SCREEN_START_LINE = 5
    I_SCREEN_END_COLUMN = 120
    I_SCREEN_END_LINE = 25
    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 TOPOFPAGE.
    REFRESH HEAD.
    HEAD-TYP = 'H'.
    HEAD-INFO = 'MATERIALS'.
    APPEND HEAD.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = HEAD[]
    I_LOGO =
    I_END_OF_LIST_GRID =
    ENDFORM.
    FORM TOPOFLIST.
    REFRESH HEAD.
    HEAD-TYP = 'H'.
    HEAD-INFO = 'MATERIALS-LISTTOP'.
    APPEND HEAD.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = HEAD[]
    I_LOGO =
    I_END_OF_LIST_GRID =
    ENDFORM.
    FORM ENDOFLIST.
    REFRESH HEAD.
    HEAD-TYP = 'H'.
    HEAD-INFO = 'MATERIALS-LISTEND'.
    APPEND HEAD.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = HEAD[]
    I_LOGO =
    I_END_OF_LIST_GRID =
    ENDFORM.
    <b>FORM STATUS USING MYMENU.
    SET PF-STATUS 'MENU' excluding MYMENU.
    ENDFORM.
    FORM UCOMM USING CODE STEXT.
    CASE CODE.
    WHEN 'ABC'.
    WRITE:/ 'YOU HAVE CLICKED ON ABC'.
    WHEN 'XYZ'.
    WRITE:/ 'YOU HAVE CLICKED ON XYZ'.
    ENDCASE.
    ENDFORM.</b>
    rgds,
    bharat.

  • Can anyone tell me how to use GUI status in ALV report.

    Can anyone tell me how to use GUI status in ALV report. I want to use  buttons in ALV report.

    Juheb,
    see the link
    http://help.sap.com/saphelp_nw2004s/helpdata/en/5e/88d440e14f8431e10000000a1550b0/frameset.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
    Adding a button on the ALV grid using OOPs
    check these sites.
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/webDynproABAP-ALVControllingStandard+Buttons&
    chk this.
    alv-pfstatus:
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_pfstatus.htm
    then how to capture that button click.
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_ucomm.htm
    REPORT ZTESTALV.
    TYPE-POOLS: SLIS.
    *- Fieldcatalog
    DATA: IT_FIELDCAT  TYPE LVC_T_FCAT,
          IT_FIELDCAT1  TYPE SLIS_T_FIELDCAT_ALV..
    *- For Events
    DATA:IT_EVENTS TYPE SLIS_T_EVENT.
    DATA:  X_FIELDCAT  TYPE LVC_S_FCAT,
            X_FIELDCAT1  TYPE SLIS_FIELDCAT_ALV.
    DATA:X_LAYOUT TYPE LVC_S_LAYO.
    "{ FOR DISABLE
    DATA: LS_EDIT TYPE LVC_S_STYL,
          LT_EDIT TYPE LVC_T_STYL.
    "} FOR DISABLE
    DATA: BEGIN OF IT_VBAP OCCURS 0,
          VBELN LIKE VBAP-VBELN,
          POSNR LIKE VBAP-POSNR,
          HANDLE_STYLE TYPE LVC_T_STYL, "FOR DISABLE
       <b>   BUTTON(10),</b>
         END OF IT_VBAP.
    DATA: LS_OUTTAB LIKE LINE OF IT_VBAP.
    SELECT VBELN
           POSNR
           UP TO 10 ROWS
          INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
          FROM VBAP.
    DATA:L_POS TYPE I VALUE 1.
    CLEAR: L_POS.
    L_POS = L_POS + 1.
    <b>X_FIELDCAT-SELTEXT = 'Button'.
    x_fieldcat-fieldname = 'BUTTON'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-OUTPUTLEN = '10'.
    X_FIELDCAT-style = X_FIELDCAT-style bit-xor
                      cl_gui_alv_grid=>MC_STYLE_BUTTON bit-xor
                      cl_gui_alv_grid=>MC_STYLE_ENABLEd.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.</b>
    L_POS = L_POS + 1.
    X_FIELDCAT-SELTEXT = 'VBELN'.
    X_FIELDCAT-FIELDNAME = 'VBELN'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-EDIT = 'X'.
    X_FIELDCAT-OUTPUTLEN = '10'.
    x_fieldcat-ref_field = 'VBELN'.
    x_fieldcat-ref_table = 'VBAK'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    X_FIELDCAT-SELTEXT = 'POSNR'.
    X_FIELDCAT-FIELDNAME = 'POSNR'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-EDIT = 'X'.
    X_FIELDCAT-OUTPUTLEN = '5'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    "{FOR DISABLE HERE 6ROW IS DISABLED
    SY-TABIX = 6.
    LS_EDIT-FIELDNAME = 'VBELN'.
    LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
    LS_EDIT-STYLE2 = SPACE.
    LS_EDIT-STYLE3 = SPACE.
    LS_EDIT-STYLE4 = SPACE.
    LS_EDIT-MAXLEN = 10.
    INSERT LS_EDIT INTO TABLE LT_EDIT.
    *LS_EDIT-FIELDNAME = 'POSNR'.
    *LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
    *LS_EDIT-STYLE2 = SPACE.
    *LS_EDIT-STYLE3 = SPACE.
    *LS_EDIT-STYLE4 = SPACE.
    *LS_EDIT-MAXLEN = 6.
    *INSERT LS_EDIT INTO TABLE LT_EDIT.
    INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
    MODIFY IT_VBAP INDEX SY-TABIX FROM LS_OUTTAB  TRANSPORTING
                                      HANDLE_STYLE .
    X_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
    "} UP TO HERE
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
      EXPORTING
        I_CALLBACK_PROGRAM = SY-REPID
        IS_LAYOUT_LVC      = X_LAYOUT
        IT_FIELDCAT_LVC    = IT_FIELDCAT
      TABLES
        T_OUTTAB           = IT_VBAP[]
      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.
    Don't forget to reward if useful....

  • Setting the PF Status for ALV

    Hi all,
    How it would be possible to create a PF Status for ALV display. I want to add one button my ALV report.
    Thanks.
    Harshad.

    Hi ,
    You can create PF-status using the Statement :   set pf-status 'STATUS_NAME'  in a FORM as shown below:
    form frm_status using rt_extab type slis_t_extab.
      set pf-status 'STANDARD'.
    endform.
    Double click on the STATUS_NAME and it Navigates to the Screen Painter. There you can specify the Menu , Buttons as required.
    Instead of cretaing a new status you can also copy the existing Standard status as told above and use the required buttons / menu items.
    Now to handle the operations of these buttons :Include in a form as below
    form frm_usercommand using r_ucomm like sy-ucomm
                      rs_selfield type slis_selfield.
      case r_ucomm.
        when 'SUB'.
          <opertion as required>
        when 'SUB1'.
           <opertion as required>
      endcase.
    Endform.
    Pass these two form names to the FM REUSE_ALV_GRID_DISPLAY ( Parameters of FM : i_callback_pf_status_set   &  i_callback_user_command  ) and the result will be dispalyed with the new Status to the parameters  .
    call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
        I_INTERFACE_CHECK                 = ' '
        I_BYPASSING_BUFFER                = ' '
        I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = v_repid
         i_callback_pf_status_set          = 'FRM_STATUS'
         i_callback_user_command           = 'FRM_USERCOMMAND'
        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                      =
        I_GRID_SETTINGS                   =
        IS_LAYOUT                         =
         it_fieldcat                       = it_fieldcat
        IT_EXCLUDING                      =
        IT_SPECIAL_GROUPS                 =
        IT_SORT                           =
        IT_FILTER                         =
        IS_SEL_HIDE                       =
        I_DEFAULT                         = 'X'
        I_SAVE                            = ' '
        IS_VARIANT                        =
          it_events                         = it_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
        I_HTML_HEIGHT_TOP                 = 0
        I_HTML_HEIGHT_END                 = 0
        IT_ALV_GRAPHICS                   =
        IT_HYPERLINK                      =
        IT_ADD_FIELDCAT                   =
        IT_EXCEPT_QINFO                   =
        IR_SALV_FULLSCREEN_ADAPTER        =
      IMPORTING
        E_EXIT_CAUSED_BY_CALLER           =
        ES_EXIT_CAUSED_BY_USER            =
        tables
          t_outtab                          = it_vbak
       exceptions
         program_error                     = 1
         others                            = 2
    Regards,
    Radhika.

  • How to create Status in ALV reports?

    Hi experts,
                     I need to create a status in a alv report. but i am not getting how to create it. i have declared a variable type slis_formname. and appended the events with it. now how to create the status in form.answers will be rewarded.
    Thanks in advance,
    Ramana

    Hello Venkat,
    Copy the standard pf status of the ALV in SE41 and do the following.
      DATA: IT_EVENTS TYPE SLIS_T_EVENT,
            WA_EVENTS LIKE LINE OF IT_EVENTS.
      REFRESH: IT_EVENTS.
      CLEAR: WA_EVENTS,IT_EVENTS.
      WA_EVENTS-NAME = 'PF_STATUS_SET'.
      WA_EVENTS-FORM = 'STATUS'.
      APPEND WA_EVENTS TO IT_EVENTS .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM      = IT_VARIANT-REPORT
                I_CALLBACK_TOP_OF_PAGE  = 'TOP_OF_PAGE'
                I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
                IT_FIELDCAT             = IT_FIELDCAT
                I_SAVE                  = 'A'
                IS_VARIANT              = IT_VARIANT
                IT_SORT                 = IT_SORT
                IT_EVENTS               = IT_EVENTS
           TABLES
                T_OUTTAB                = G_T_OUTTAB
           EXCEPTIONS
                PROGRAM_ERROR           = 1
                OTHERS                  = 2.
          FORM status                                                   *
    FORM STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STANDARD' EXCLUDING RT_EXTAB.
    ENDFORM.
    If useful reward.
    Vasanth

  • How to get custom PF status in ALV using cl_salv_table (Using  a container)

    I created a screen and inside that a container.I tried for an ALV display using CL_SALV_TABLE in the cvontainer. It's working. when I opted for default PF status.It's working. But when I tried for custom PF status using SET_SCREEN_STATUS method, it's throwing some exception. But it's working if I don't use a container .
    In both the cases I copied PF status into my program from some standard program.Then added some functionality.

    I f you are using Screen and container use CLass:
    CL_GUI_ALV_CONTAINER
    CL_GUI_ALV_GRID
    METHOD-->SET_TABLE_FOR_FIRST_DISPLAY    " to display Alv.
    Create PF-STATUS in PBO of screen.
    [Change standard PF|https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/change%252balv%252bstandard%252btoolbar%252band%252brespond%252bit]
    EXCLUDE Certain buttons on standard toolbar:
    DATA: lt_exclude TYPE ui_functions,
          ls_exclude TYPE ui_func.
      ls_exclude = cl_gui_alv_grid=>mc_fc_sum.
      APPEND ls_exclude TO lt_exclude.
      CLEAR ls_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_mb_filter.
      APPEND ls_exclude TO lt_exclude.
      CLEAR ls_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_mb_sum.
      APPEND ls_exclude TO lt_exclude.
    pass lt_exclude to METHOD-->SET_TABLE_FOR_FIRST_DISPLAY
    Regards,
    Gurpreet

  • "Excluding" not working with PF status In ALV tool bar

    Hi all,
    I have 5 buttond in ALV tool bar out of which for every distinct logic only two buttons should be actually visible on toolbar.For this am using-
    SET PF-STATUS 'ZQACCAL'  EXCLUDING '&QE17''&QA13''&QE19' IMMEDIATELY.
    Problem is am still viewing excluded buttons (ie '&QE17''&QA13''&QE19' )also.
    Please tell me the solution for the same.
    Thank you.

    Hi,
    Use:-
    *FOR EXCLUDING STANDARD BUTTON FROM ALV TOOLBAR
    DATA : it_exclude TYPE slis_t_extab,
           wa_exclude TYPE slis_extab.
    *          FOR EXCLUDING STANDARD BUTTONS FROM ALV TOOLBAR
      wa_exclude-fcode = '&OUP'.
      APPEND wa_exclude TO it_exclude.
      CLEAR wa_exclude.
      wa_exclude-fcode = '&ODN'.
      APPEND wa_exclude TO it_exclude.
      CLEAR wa_exclude.
      wa_exclude-fcode = '&OAD'.
      APPEND wa_exclude TO it_exclude.
      CLEAR wa_exclude.
      wa_exclude-fcode = '&INFO'.
      APPEND wa_exclude TO it_exclude.
      CLEAR wa_exclude.
    "similarly append more function codes for standard buttons that needs to be excluded
    "you can get to know the func code for the button by enabling debugging at run time
    "and check valus for sy-ucomm and append it to it_exclude
    *          DISPLAY RECORDS IN ALV GRID
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       i_callback_program                = sy-repid
       it_fieldcat                       = it_field
       it_excluding                      = it_exclude
    TABLES
       t_outtab                          = it_final
    EXCEPTIONS
       program_error                     = 1
       OTHERS                            = 2.
      IF sy-subrc <> 0.
      ENDIF.
    Hope this helps you.
    Regards,
    Tarun
    Edited by: Tarun Gambhir on Mar 6, 2009 5:06 PM

  • Problem with a pf-status in alv?

    Hi guys,
    I am displaying a alv grid report(not using OO).I added my own button 'download' in the tool bar.I used my own status.when the user clicks this button,the report is downloaded into a excel file.he will make some changes in the excel file and save it.
    In the same program and in the selection screen,the user will import the excel which he saved before and exectues he will get a second alv report.for this i m calling alv_display again with the standard status.But i need a new button 'upload' in the second alv report.this button when clicked will call  some transaction.Can i  create a second status or i can add the upload button to my status which i created already and the hide the previous button when displaying the 2nd alv report.
    Any suggestions will be helpful and rewarded.
    Thank you.

    Hello DP,
    U can use the same PF Status. In the PBO , use the code belwo to hide the btns'.
    CASE process_mode.
        WHEN tpmco_char_1 OR tpmco_char_2.
          APPEND 'EXCEL' TO tcode.
        WHEN tpmco_char_3.
          APPEND 'TEST' TO tcode.
          APPEND 'ENTER' TO tcode.
      ENDCASE.
      SET PF-STATUS 'STATUS_PROCESS' EXCLUDING tcode.

  • Set pf status in alv oops concept

    Hi all,
    can any one pls tell me  by using which method or class  i can set the
    pf status......?  
    regards
    cnu

    Fast and Easy way
    As you are using OO ALV, remove any function not needed from the ALV via parameter IT_TOOLBAR_EXCLUDING of method set_table_for_first_display and put your own function in the menu of your dynpro PBO via SET PF-STATUS.
    Nethertheless you can use a more complew way using :
    <b>Changing Standard Functions</b>
    Purpose
    The standard functions are not designed for specific applications. As a result, special knowledge of the data displayed cannot be considered. In individual cases, you may design a standard function - such as sorting by a specific column - more effectively in a specific application.
    Process Flow
    1. Define an event handler method for event before_user_command [Page 108]. This event is triggered after the user has selected a function. This means that the ALV Grid Control passes control to the application before the function is executed. Using event parameter I_UCOMM you can restrict the function code to the function you want to modify.
    2. Implement your own algorithm for the function within the event handler method. In this context, you can call methods of the ALV Grid Control.
    3. Reset the function code to ensure that the standard function is no longer executed:
    CALL METHOD <Instance of the ALV Ccntrol>->set_user_command exporting I_UCOMM = SPACE.
    If you never need specific functions of the tool bar, you can hide them for the entire life-cycle of the control. To do this, you use parameter IT_TOOLBAR_EXCLUDING of method set_table_for_first_display  to pass a table that contains the function codes to be hidden.
    <b>Defining GUI Elements in the Toolbar</b>
    Process Flow
    1. Define an event handler method for event TOOLBAR.
    2. Declare a structure for defining a toolbar element:
    data: ls_toolbar TYPE stb_button.
    3. For a pushbutton, for example, you would fill the following fields:
    CLEAR ls_toolbar. MOVE 0 TO ls_toolbar-butn_type.
    MOVE 'BOOKINGS' TO ls_toolbar-function.
    MOVE icon_employee TO ls_toolbar-icon.
    MOVE 'Show Bookings'(111) TO ls_toolbar-quickinfo. MOVE SPACE TO ls_toolbar-disabled.
    In the butn_type field, you specify the type of the GUI element for the ALV Grid Control. For possible values, see the value range of domain TB_BTYPE.
    4. Use event parameter E_OBJECT to append the new definition to table mt_toolbar:
    APPEND ls_toolbar TO e_object->mt_toolbar.
    5. If you want to define additional elements, go back to step 3.
    6. Call method set_toolbar_interactive, if you want to rebuild the toolbar.
    Result
    In the event handler method of event USER_COMMAND, you can query the function code you specified in field function to implement the associated function.
    See also report BCALV_GRID_05 in development class SLIS.
    Look at this documentation too : <a href="http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf">ALV Gird Control (BC-SRV-ALV)</a>
    Regards

Maybe you are looking for

  • Elements 8 when in file location view the thumbnail is not the right photo

    When I click on a file folder location the thumbnail that opens in not the right photos for that file folder.  I have run catalog repair and optomized the catalog.  I don't know much about the database but think it must be messedup.  I need to move m

  • SSO and MST

    I am running a 6509 (IOS ver s3223-ipbasek9-mz.122-18.SXF3)with dual sup32's in SSO redundancy mode. I am also running Multiple Spanning-tree (MST). During testing I have found that when a switchover of the active supervisor occurs (due to physical r

  • My problem can't use safari on my iPad

    the ferts time I buy this iPad from apple distributor,far away 200 miles my home town.until know.I can't use or or anything about "safari"shame whit my iMac . I buy 3 apple produksi .iMac.snw leopard/Mac pro/ iPad.just iPad can't use that safari.if a

  • Airport Express & USB connection

    Am very new to all of this so hope somebody can help ! Have just got broadband today which connects to my iBook via USB cable - I tried plugging it into my Airport Express USB port and it won't work and says I need to use the ethernet port Is there a

  • How can I choose the path where I want my workers be compiled into ?

    Hi, I didn't found where to set that, it seems FB follows the package structure to create sub directories inside workerswfs, I want to be able to choose where the compiled worker will stand. Can someone help on it ? -Fred