Break-point in ALV-GRID OO if standard-button &PRINT_BACK is pressed.

Hi,
is it possible to set a break-point in Button '&PRINT_BACK'?
I will use it to test if i can use:
    CALL METHOD I_ALV_GRID->GET_FRONTEND_PRINT
      IMPORTING
        ES_PRINT = GS_PRNT.
and
    CALL METHOD I_ALV_GRID->SET_FRONTEND_PRINT
      EXPORTING
        IS_PRINT = GS_PRNT.
Regards, Dieter

Hi,
Please check links,
ALV Grid Control - Dropwdown / Checkbox
Question about triggering event for ALV dropdown
Regards,
Hema.
Reward points if it is useful.

Similar Messages

  • How can I call functionality of ALV Grid by event of button outside grid?

    Hello,
    How can I call functionality of ALV Grid by event of button located outside ALV Grid? For example how to fire printing of this ALV Grid by button click elsewhere on the screen (not in toolbar of ALV Grid).
    Best regards,
    Josef Motl

    hi Motl,
    these are steps to create a button in ALV and trigger an event from it..
    1.Use the parameter i_callback_pf_status_set in the function module REUSE_ALV_GRID_DISPLAY
    i_callback_program = gd_repid
    i_callback_pf_status_set = 'SET_PF_STATUS'
    form set_pf_status using rt_extab type slis_t_extab.
    set pf-status 'NEWALVSTATUS'.
    endform.
    You have to copy the standard ALV pf stauts to 'NEWALVSTATUS' and add your button.
    2.You have to do the following to process the new button click.
    i_callback_user_command = 'USER_COMMAND'
    form user_command using i_ucomm like sy-ucomm
    is_selfield type slis_selfield.
    case i_ucomm.
    3. to copy the standard pf status to a new one.go to the ALV screen and take the menu System -> Status.  Then look for the standard pf status. Copy this to Z range and then add your new button.
    reward points if helpful
    regards
    satesh

  • Downloading format breaking line in ALV Grid display

    Dear All,
    When i am downloading data from from table or using spool request, why after few line item many data comes into one cell.
    I have selected ALV Grid display and taking output in *.xls format.
    Please find the attached screen shot for your reference
    Regards
    Sanjeet Kumar

    Hi,
    Check these links for more details -
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    ashish

  • ALV GRID Export to Excel button Missing

    HI All,
    I am facing some problem with ALV GRID. When excuting the report with my user id I am able to see the 'Export to Local file' button in the ALV GRID where as if i am excuting with another user id which is having less authorisations than the button is greyed out.  I checked by giving all authorisation than we are able to see the button.
    Could anyone please tell me which authorisation object we have to assign to see the buttons.
    Thanks & Regards,
    Murali.

    Hi,
    Before clicking on the Export to Excel button, start the debugging session by placing the command /H in the command prompt.
    Now, put the break point at statement AUTHORITY-CHECK. Now it will trigger all the authorization objects relevant to this.
    check the sy-subrc value gets failed.
    Regards,
    Santhosh.

  • Problem with ALV Grid Display screen Back Button

    Dear Friends ,
    I have an ALV Grid Display,Here am facing a problem for my 'Back' button,i haven't defined any PF Status and is using the standard one.But after the Display when i press Back Button a blank Screen is appearing n then again i have to press back button to go to my Selection Screen.
    Please Suggest if i have to take care of something else.
    I want my Selection Screen when i press Back on my Display Screen.
    DATA:  IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
            EXPORTING
             I_BYPASSING_BUFFER          =
             I_BUFFER_ACTIVE             =
             I_INTERFACE_CHECK           = ' '
                 I_CALLBACK_PROGRAM          = 'ZRMMPD01A'
             I_CALLBACK_PF_STATUS_SET    = ' '
             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                     =  I_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_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
        IMPORTING
             E_EXIT_CAUSED_BY_CALLER     =
             ES_EXIT_CAUSED_BY_USER      =
             TABLES
                  T_OUTTAB                    = IT_FINAL
            EXCEPTIONS
                 PROGRAM_ERROR               = 1
                 OTHERS                      = 2
    Thanks and Regards,
    Ashwini

    Hi Vijay ,
    No i dont have any write statement in my proggram.
    Here it is
    REPORT ZRMMPD01A  NO STANDARD PAGE HEADING.
    TABLES : EQUI,SER03,MKPF,OBJK.
    TYPE-POOLS : SLIS.
    DATA  IT_EQUI LIKE EQUI OCCURS 0 WITH HEADER LINE.
    DATA  IT_OBJK LIKE OBJK OCCURS 0 WITH HEADER LINE..
    DATA  IT_SER03 LIKE SER03 OCCURS 0 WITH HEADER LINE.
    DATA  IT_MKPF LIKE MKPF OCCURS 0 WITH HEADER LINE .
    DATA : BEGIN OF IT_DISPLAY OCCURS 0,
                MATNR LIKE EQUI-MATNR,
                SERNR LIKE EQUI-SERNR,
                BWART LIKE SER03-BWART,
                WERK LIKE SER03-WERK,
                CHARGE LIKE SER03-CHARGE,
                LAGERORT LIKE SER03-LAGERORT,
                MBLNR LIKE SER03-MBLNR,
                MJAHR LIKE SER03-MJAHR,
                ZEILE LIKE SER03-ZEILE,
                BUDAT LIKE MKPF-BUDAT,
                BKTXT LIKE MKPF-BKTXT,
                USNAM LIKE MKPF-USNAM,
                XBLNR LIKE MKPF-XBLNR,
            END OF IT_DISPLAY.
    DATA : WA_DISPLAY LIKE IT_DISPLAY.
    DATA  IT_FINAL LIKE IT_DISPLAY OCCURS 0 WITH HEADER LINE.
    DATA  IT_TEMP LIKE IT_DISPLAY OCCURS 0 WITH HEADER LINE.
    DATA:  IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA :I_LAYOUT TYPE SLIS_LAYOUT_ALV,
          I_EVENTS TYPE SLIS_T_EVENT.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS : S_MATNR FOR EQUI-MATNR MATCHCODE OBJECT MCD,"OBLIGATORY
                    S_SERNR FOR EQUI-SERNR, "MATCHCODE OBJECT MCD OBLIGATORY
                    S_MBLNR FOR SER03-MBLNR MATCHCODE OBJECT MCD,
                    S_BWART FOR SER03-BWART MATCHCODE OBJECT MCD,
                    S_WERK FOR SER03-WERK MATCHCODE OBJECT MCD,
                    S_LAGET FOR SER03-LAGERORT MATCHCODE OBJECT MCD,
                    S_BUDAT FOR MKPF-BUDAT MATCHCODE OBJECT MCD,
                    S_XBLNR FOR MKPF-XBLNR MATCHCODE OBJECT MCD.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
    PARAMETERS : R1 RADIOBUTTON GROUP G1 DEFAULT 'X',
                 R2 RADIOBUTTON GROUP G1.
    SELECTION-SCREEN END OF BLOCK B2.
    START-OF-SELECTION.
    *Fetch Data.
      PERFORM GET_DATA.
    *Fill Display Fields.
      PERFORM FILL_TABLE.
    *Segregate data according to radio button selection.
      PERFORM SELECT_CONDITION.
    *Fill The Feild catalog.
      PERFORM FIELD_CATALOG.
    *Display Output.
      PERFORM OUTPUT_DISPLAY..
    *&      Form  GET_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DATA.
      SELECT * FROM EQUI INTO TABLE IT_EQUI
        WHERE MATNR IN S_MATNR
        AND SERNR IN S_SERNR.
      SELECT * FROM OBJK INTO TABLE IT_OBJK
      FOR ALL ENTRIES IN IT_EQUI
      WHERE EQUNR = IT_EQUI-EQUNR.
      SELECT * FROM SER03 INTO TABLE IT_SER03
      FOR ALL ENTRIES IN IT_OBJK
      WHERE OBKNR = IT_OBJK-OBKNR
      AND MBLNR IN S_MBLNR
      AND BWART IN S_BWART
      AND WERK IN S_WERK
      AND LAGERORT IN S_LAGET.
      SELECT * FROM MKPF INTO TABLE IT_MKPF
      FOR ALL ENTRIES IN IT_SER03
      WHERE MBLNR = IT_SER03-MBLNR
      AND BUDAT IN S_BUDAT
      AND XBLNR IN S_XBLNR.
    ENDFORM.                    " GET_DATA
    *&      Form  FILL_TABLE
          text
    -->  p1        text
    <--  p2        text
    FORM FILL_TABLE.
      LOOP AT IT_EQUI.
        LOOP AT IT_OBJK.
          IF IT_OBJK-EQUNR <> IT_EQUI-EQUNR.
            SKIP.
          ELSE.
            READ TABLE IT_SER03 WITH KEY OBKNR = IT_OBJK-OBKNR.
            IF SY-SUBRC = 0.
              WA_DISPLAY-MATNR = IT_EQUI-MATNR.
              WA_DISPLAY-SERNR = IT_EQUI-SERNR.
              WA_DISPLAY-BWART = IT_SER03-BWART.
              WA_DISPLAY-WERK = IT_SER03-WERK.
              WA_DISPLAY-CHARGE = IT_SER03-CHARGE.
              WA_DISPLAY-LAGERORT = IT_SER03-LAGERORT.
              WA_DISPLAY-MBLNR = IT_SER03-MBLNR.
              WA_DISPLAY-MJAHR = IT_SER03-MJAHR.
              WA_DISPLAY-ZEILE = IT_SER03-ZEILE.
             READ TABLE IT_MKPF WITH KEY MBLNR = IT_SER03-MBLNR.
              IF SY-SUBRC = 0.
                WA_DISPLAY-BUDAT = IT_MKPF-BUDAT.
                WA_DISPLAY-BKTXT = IT_MKPF-BKTXT.
                WA_DISPLAY-USNAM = IT_MKPF-USNAM.
                WA_DISPLAY-XBLNR = IT_MKPF-XBLNR.
              ENDIF.
            ENDIF.
          ENDIF.
          IF NOT WA_DISPLAY IS INITIAL.
            APPEND WA_DISPLAY TO IT_DISPLAY.
            CLEAR WA_DISPLAY.
          ENDIF.
        ENDLOOP.
      ENDLOOP.
    ENDFORM.                    " FILL_TABLE
    *&      Form  FIELD_CATALOG
          text
    -->  p1        text
    <--  p2        text
    FORM FIELD_CATALOG.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'MATNR'.
      FIELDCAT-SELTEXT_M = 'Material Number'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'SERNR'.
      FIELDCAT-SELTEXT_M = 'Serial number'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'MBLNR'.
      FIELDCAT-SELTEXT_L = 'Number of material document'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'BWART'.
      FIELDCAT-SELTEXT_M = 'Movement type'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'WERK'.
      FIELDCAT-SELTEXT_M = 'Plant'.
      FIELDCAT-OUTPUTLEN =  5.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'CHARGE'.
      FIELDCAT-SELTEXT_M = 'Batch number'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'LAGERORT'.
      FIELDCAT-SELTEXT_M = 'Storage Location'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'MJAHR'.
      FIELDCAT-SELTEXT_M = 'Material doc. year'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'ZEILE'.
      FIELDCAT-SELTEXT_L = 'Item in material document'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'BUDAT'.
      FIELDCAT-SELTEXT_L = 'Posting date in the document'.
      FIELDCAT-OUTPUTLEN =  10.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'BKTXT'.
      FIELDCAT-SELTEXT_L = 'Document header text'.
      FIELDCAT-OUTPUTLEN =  25.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'USNAM'.
      FIELDCAT-SELTEXT_M = 'User name'.
      FIELDCAT-OUTPUTLEN =  15.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'XBLNR'.
      FIELDCAT-SELTEXT_L = 'Reference document number'.
      FIELDCAT-OUTPUTLEN =  25.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
    ENDFORM.                    " FIELD_CATALOG
    *&      Form  DISPLAY_OUTPUT
          text
    -->  p1        text
    <--  p2        text
    FORM OUTPUT_DISPLAY.
      IF R1 = 'X'.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
              I_CALLBACK_PROGRAM          = 'ZRMMPD01A'
              IS_LAYOUT                   =  I_LAYOUT
              IT_FIELDCAT                 = IT_FIELDCAT
          TABLES
              T_OUTTAB                    = IT_DISPLAY
            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.
        REFRESH IT_DISPLAY.
        CLEAR IT_DISPLAY.
      ELSEIF R2 = 'X'.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
            EXPORTING
                 I_CALLBACK_PROGRAM          = 'ZRMMPD01A'
                 IS_LAYOUT                     =  I_LAYOUT
                 IT_FIELDCAT                 =  IT_FIELDCAT
             TABLES
                  T_OUTTAB                    = IT_FINAL
            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.
        REFRESH IT_DISPLAY.
        CLEAR IT_DISPLAY.
      ENDIF.
    ENDFORM.                    " DISPLAY_OUTPUT
    *&      Form  SELECT_CONDITION
          text
    -->  p1        text
    <--  p2        text
    FORM SELECT_CONDITION.
      IF R2 = 'X'.
        CLEAR WA_DISPLAY.
        SORT IT_DISPLAY BY MATNR SERNR MBLNR ZEILE.
        DELETE ADJACENT DUPLICATES FROM IT_DISPLAY.
        LOOP AT IT_DISPLAY WHERE ZEILE = '0002'.
          READ TABLE IT_DISPLAY WITH KEY MATNR = IT_DISPLAY-MATNR
          SERNR = IT_DISPLAY-SERNR ZEILE = '0001'.
          IF SY-SUBRC = 0.
            DELETE IT_DISPLAY.
          ENDIF.
        ENDLOOP.
        SORT IT_DISPLAY BY MATNR SERNR BWART MBLNR.
        DELETE ADJACENT DUPLICATES FROM IT_DISPLAY.
        LOOP AT IT_DISPLAY.
          IF WA_DISPLAY IS INITIAL.
            WA_DISPLAY =  IT_DISPLAY.
          ENDIF.
          LOOP AT IT_DISPLAY WHERE MATNR = WA_DISPLAY-MATNR
          AND SERNR = WA_DISPLAY-SERNR.
            IF IT_DISPLAY-BUDAT > WA_DISPLAY-BUDAT.
              WA_DISPLAY = IT_DISPLAY.
            ELSE.
              DELETE IT_DISPLAY.
            ENDIF.
          ENDLOOP.
          APPEND WA_DISPLAY TO IT_TEMP.
          CLEAR WA_DISPLAY.
        ENDLOOP.
        DELETE ADJACENT DUPLICATES FROM IT_TEMP.
        IF NOT IT_TEMP[] IS INITIAL.
          IT_FINAL[] = IT_TEMP[].
        ENDIF.
      ENDIF.
    ENDFORM.                    " SELECT_CONDITION
    Regards,
    Ashwini

  • ALV Grid: exclude a menu button

    Hello,
    I have a strange problem here:
    I'm excluding several buttons and menu buttons from the default alv grid toolbar. But one the the menu buttons doesn't behave like the others.
    cl_gui_alv_grid=>mc_fc_views
    and
    cl_gui_alv_grid=>mc_mb_view
    both remove the menu entries but not the button itself !
    Other menu buttons like
    cl_gui_alv_grid=>mc_mb_subtot
    are removed properly.
    Any ideas on this one ?
    Best regards,
    Patrick Baer

    The suggestion i am going to give you is not a nice one, but would work.
    i had one alv where i had removed all the standard buttons. and the following is the contents  of the exclusion table.
    place all of them into the exclusion table and remove one by one from the exclusion table to check out.
    append cl_gui_alv_grid=>mc_fc_auf                   to exl_tab.
      append cl_gui_alv_grid=>mc_fc_average               to exl_tab.
      append cl_gui_alv_grid=>mc_fc_back_classic          to exl_tab.
      append cl_gui_alv_grid=>mc_fc_call_abc              to exl_tab.
      append cl_gui_alv_grid=>mc_fc_call_chain            to exl_tab.
      append cl_gui_alv_grid=>mc_fc_call_crbatch          to exl_tab.
      append cl_gui_alv_grid=>mc_fc_call_crweb            to exl_tab.
      append cl_gui_alv_grid=>mc_fc_call_lineitems        to exl_tab.
      append cl_gui_alv_grid=>mc_fc_call_master_data      to exl_tab.
      append cl_gui_alv_grid=>mc_fc_call_more             to exl_tab.
      append cl_gui_alv_grid=>mc_fc_call_report           to exl_tab.
      append cl_gui_alv_grid=>mc_fc_call_xint             to exl_tab.
      append cl_gui_alv_grid=>mc_fc_call_xxl              to exl_tab.
      append cl_gui_alv_grid=>mc_fc_check to exl_tab.
      append cl_gui_alv_grid=>mc_fc_col_invisible to exl_tab.
      append cl_gui_alv_grid=>mc_fc_col_optimize to exl_tab.
      append cl_gui_alv_grid=>mc_fc_current_variant to exl_tab.
      append cl_gui_alv_grid=>mc_fc_data_save to exl_tab.
      append cl_gui_alv_grid=>mc_fc_delete_filter to exl_tab.
      append cl_gui_alv_grid=>mc_fc_deselect_all to exl_tab.
      append cl_gui_alv_grid=>mc_fc_detail to exl_tab.
      append cl_gui_alv_grid=>mc_fc_excl_all to exl_tab.
      append cl_gui_alv_grid=>mc_fc_expcrdata to exl_tab.
      append cl_gui_alv_grid=>mc_fc_expcrdesig to exl_tab.
      append cl_gui_alv_grid=>mc_fc_expcrtempl to exl_tab.
      append cl_gui_alv_grid=>mc_fc_expmdb to exl_tab.
      append cl_gui_alv_grid=>mc_fc_extend to exl_tab.
      append cl_gui_alv_grid=>mc_fc_f4 to exl_tab.
      append cl_gui_alv_grid=>mc_fc_filter to exl_tab.
      append cl_gui_alv_grid=>mc_fc_find to exl_tab.
      append cl_gui_alv_grid=>mc_fc_fix_columns to exl_tab.
      append cl_gui_alv_grid=>mc_fc_graph to exl_tab.
      append cl_gui_alv_grid=>mc_fc_help to exl_tab.
      append cl_gui_alv_grid=>mc_fc_html to exl_tab.
      append cl_gui_alv_grid=>mc_fc_info to exl_tab.
      append cl_gui_alv_grid=>mc_fc_load_variant to exl_tab.
      append cl_gui_alv_grid=>mc_fc_loc_append_row to exl_tab.
      append cl_gui_alv_grid=>mc_fc_loc_copy to exl_tab.
      append cl_gui_alv_grid=>mc_fc_loc_copy_row to exl_tab.
      append cl_gui_alv_grid=>mc_fc_loc_cut to exl_tab.
      append cl_gui_alv_grid=>mc_fc_loc_delete_row to exl_tab.
      append cl_gui_alv_grid=>mc_fc_loc_insert_row to exl_tab.
      append cl_gui_alv_grid=>mc_fc_loc_move_row to exl_tab.
      append cl_gui_alv_grid=>mc_fc_loc_paste to exl_tab.
      append cl_gui_alv_grid=>mc_fc_loc_paste_new_row to exl_tab.
      append cl_gui_alv_grid=>mc_fc_loc_undo to exl_tab.
      append cl_gui_alv_grid=>mc_fc_maintain_variant to exl_tab.
      append cl_gui_alv_grid=>mc_fc_maximum to exl_tab.
      append cl_gui_alv_grid=>mc_fc_minimum to exl_tab.
      append cl_gui_alv_grid=>mc_fc_pc_file      to exl_tab.
      append cl_gui_alv_grid=>mc_fc_print        to exl_tab.
      append cl_gui_alv_grid=>mc_fc_print_back   to exl_tab.
      append cl_gui_alv_grid=>mc_fc_print_prev   to exl_tab.
      append cl_gui_alv_grid=>mc_fc_refresh      to exl_tab.
      append cl_gui_alv_grid=>mc_fc_reprep       to exl_tab.
      append cl_gui_alv_grid=>mc_fc_save_variant to exl_tab.
      append cl_gui_alv_grid=>mc_fc_select_all   to exl_tab.
      append cl_gui_alv_grid=>mc_fc_send         to exl_tab.
      append cl_gui_alv_grid=>mc_fc_separator    to exl_tab.
      append cl_gui_alv_grid=>mc_fc_sort         to exl_tab.
      append cl_gui_alv_grid=>mc_fc_sort_asc     to exl_tab.
      append cl_gui_alv_grid=>mc_fc_sort_dsc to exl_tab.
      append cl_gui_alv_grid=>mc_fc_subtot        to exl_tab.
      append cl_gui_alv_grid=>mc_fc_sum           to exl_tab.
      append cl_gui_alv_grid=>mc_fc_to_office     to exl_tab.
      append cl_gui_alv_grid=>mc_fc_to_rep_tree   to exl_tab.
      append cl_gui_alv_grid=>mc_fc_unfix_columns to exl_tab.
      append cl_gui_alv_grid=>mc_fc_views         to exl_tab.
      append cl_gui_alv_grid=>mc_fc_view_crystal  to exl_tab.
      append cl_gui_alv_grid=>mc_fc_view_excel    to exl_tab.
      append cl_gui_alv_grid=>mc_fc_view_grid     to exl_tab.
      append cl_gui_alv_grid=>mc_fc_word_processor to exl_tab.
      append cl_gui_alv_grid=>mc_lystyle_drag_drop_rows to exl_tab.
      append cl_gui_alv_grid=>mc_lystyle_no_delete_rows to exl_tab.
      append cl_gui_alv_grid=>mc_lystyle_no_insert_rows to exl_tab.
      append cl_gui_alv_grid=>mc_lystyle_no_insert_rows to exl_tab.
      append cl_gui_alv_grid=>mc_ly_drag_drop_rows to exl_tab.
      append cl_gui_alv_grid=>mc_ly_no_delete_rows to exl_tab.
      append cl_gui_alv_grid=>mc_ly_no_insert_rows to exl_tab.
      append cl_gui_alv_grid=>mc_mb_export         to exl_tab.
      append cl_gui_alv_grid=>mc_mb_view           to exl_tab.
      append cl_gui_alv_grid=>mc_mb_sum            to exl_tab.
      append cl_gui_alv_grid=>mc_mb_subtot         to exl_tab.
      append cl_gui_alv_grid=>mc_mb_filter         to exl_tab.
      append cl_gui_alv_grid=>mc_mb_variant        to exl_tab.
      append cl_gui_alv_grid=>mc_mb_paste          to exl_tab.
      append cl_gui_alv_grid=>mc_style4_link       to exl_tab.
      append cl_gui_alv_grid=>mc_style4_link_no to exl_tab.
      append cl_gui_alv_grid=>mc_style_button            to exl_tab.
      append cl_gui_alv_grid=>mc_style_disabled          to exl_tab.
      append cl_gui_alv_grid=>mc_style_enabled           to exl_tab.
      append cl_gui_alv_grid=>mc_style_f4                to exl_tab.
      append cl_gui_alv_grid=>mc_style_f4_no             to exl_tab.
      append cl_gui_alv_grid=>mc_style_no_delete_row     to exl_tab.
    Regards
    Raja

  • ALV grid display enable save button

    Hi gurus all,
    I want to make save button in alv display turns onn, cause now it's gray and i cannot click on it. and i'm using function reuse_alv_grid_display.
    i'm included half of my code,
      DATA: li_events  TYPE slis_t_event,
            lwa_events LIKE LINE OF li_events.
      REFRESH li_events.
      CLEAR lwa_events.
    Get event
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 4
        IMPORTING
          et_events   = li_events.
    Set event END_OF_LIST
      READ TABLE li_events WITH KEY name = 'END_OF_LIST'
      INTO lwa_events.
      IF sy-subrc = 0.
        lwa_events-form = 'END_OF_LIST'.
        MODIFY li_events FROM lwa_events TRANSPORTING form
        WHERE name = 'END_OF_LIST'.
      ENDIF.
      data : ls_variant like disvariant,
             gs_layout  type slis_layout_alv.
      ls_variant-report = sy-repid.
    Display ALV
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program     = sy-repid
          i_callback_top_of_page = 'TOP_OF_PAGE'
          it_fieldcat            = i_fieldcat
          is_layout              = gs_layout
          it_sort                = i_sortcat
          it_events              = li_events
          i_save                 = c_x
          is_variant             = ls_variant
        TABLES
          t_outtab               = i_final
        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.

    Hi memeo,
    1. Simple
    2.<b>  i_save                  = 'A'</b>
    3. While calling the fm
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    make sure u pass the parameter also. (with value 'A')
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          <b>      i_save                  = 'A'</b>
    regards,
    amit m.

  • To get own Filed Desc. like ALV Grid while exporting to ALV using standard

    Hi all,
    How to get the custom field heading when we export to XLS using the standard Functionality/button available in ALV grid to  export to spread sheet.
    I mean is there anything in ALV field catalog /something by which we can have our custom heading , the way we do in ALV grid output using the button available to do export .
    Note: I am not talking about any FM , its the standrad button available in ALV grid by which we can do export to spread sheet , currently its taking the small text of the data element  field level.
    Regards

    Hi,
    Modify your fieldcatelog before calling the grid display FM. Remove data element reference (ref_fieldname) and change ddictxt, seltext_s, seltext_m and seltext_l fields to the text you want.
    Dataelement texts can be found in table DD04T.
    Thanks,
    Vinod.

  • Regard check box concept in alv grid display

    HI Friends,
            i am displaying the sales order details with check box. so my first field is checkbox. When user click on check box then he press the details icon.
            my question i need a logic for calling the tcode based on the vbeln when it is cheked.
            thanks in advance.
    Regards,
    Purna.

    hi,
    go through this program
    program bcalv_edit_05.
    Purpose:
    ~~~~~~~~
    This example shows how to use checkboxes within an ALV Grid Control.
    You learn:
    o how to define a column for editable checkboxes for an attribute
       of your list (see also remark below)
    o how to evaluate the checked checkboxes
    o how to switch between editable and non-editable checkboxes
    Important Remark
    ~~~~~~~~~~~~~~~~
    The checkbox functionality has been replaced by selection buttons
    in front of each row (field SEL_MODE of the layout structure
    set to 'A' or 'D'; when using the editable ALV Grid Control,
    these selection buttons are always visible).
    Class methods like GET_SELECTED_ROWS work only for this new
    functionality and not for checkboxes.
    Thus checkboxes should not be used for line selection but for
    a column as an additional or for an already existing attribute
    (like field SMOKER in SBOOK).
    To check program behavior
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    Try out the functions displayed in the application toolbar:
    o The first sets all checked lines to initial values.
      (see form reset_selected_entries)
    o The seconds marks all checkboxes that are input enabled
    o The third unmarks all checkboxes that are input enabled
    o To try the forth, you have to select a line first using
      the selection buttons on the left.
      The function deactivates/activates a checkbox.
    Checkboxes may be locked/unlocked using a double click on the
    checkbox cell.
    Essential steps (search for '§')
    ~~~~~~~~~~~~~~~
    This example focusses on two aspects of checkboxes in an
    editable ALV Grid Control:
    A How to integrate, set, reset and evaluate checkboxes
    B What you must do to lock particular checkboxes against input
    A) Integrate, set, reset and evaluate checkboxes
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    A1.Extend your output table by a checkbox field.
    A2.Add an entry for the checkbox in the fieldcatalog
    A3.Optionally, check checkboxes initially after selecting data.
    A4.Before you (a)set, (b)reset, (c)(de)activate or
       (d)evaluate checkboxes, you must check the input cells.
    B) Lock particular checkboxes against input
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    B1.Extend your output table by a field to dis- or enable
        cells for input.
    B2.After selecting data,
        assign a style for each row of your checkbox column.
    B3.Use the layout structure to aquaint additional field to ALV.
    B4.Switch the style to dis- or enable a cell for input
    class lcl_event_receiver definition deferred.  "for event handling
    data: ok_code like sy-ucomm,
          save_ok like sy-ucomm,
          g_container type scrfname value 'BCALV_GRID_DEMO_0100_CONT1',
          g_grid  type ref to cl_gui_alv_grid,
          g_custom_container type ref to cl_gui_custom_container,
          g_event_receiver type ref to lcl_event_receiver,
          gt_fieldcat type lvc_t_fcat,
          gs_layout type lvc_s_layo,
          g_max type i value 100.
    *§A1.Extend your output table by a checkbox field.
        If you do not want to lock sole checkboxes against input
        you do not need field 'celltab'.
    types: begin of gs_outtab.
    types: checkbox type c.                "field for checkbox
    §B1.Extend your output table by a field to dis- or enable
        cells for input.
    types: celltab type lvc_t_styl.        "field to switch editability
            include structure sflight.
    types: end of gs_outtab.
    data: gt_outtab type gs_outtab occurs 0 with header line.
    LOCAL CLASSES
    This local class only handles event DOUBLE_CLICK.
    Wenn the user double clicks on a checkbox cell the status of
    this cell is switched from editable to not editable and vice versa.
    class lcl_event_receiver definition.
    public section.
    methods: catch_doubleclick
             for event double_click of cl_gui_alv_grid
             importing
                e_column
                es_row_no
                sender.
    endclass.
    class lcl_event_receiver implementation.
    method catch_doubleclick.
      data: ls_outtab type gs_outtab,
            ls_celltab type lvc_s_styl.
    Function:
    Switch between 'editable' and 'not editable' checkbox.
    If the user clicked on another column there is
    nothing to do.
      if e_column-fieldname ne 'CHECKBOX'.
        exit.
      endif.
      read table gt_outtab into ls_outtab index es_row_no-row_id.
    The loop is only needed if there are other columns that
    use checkboxes. At this point the loop could be
    replaced by a READ of the first line of CELLTAB.
          loop at ls_outtab-celltab into ls_celltab.
            if ls_celltab-fieldname eq 'CHECKBOX'.
    §B4.Switch the style to dis- or enable a cell for input
             if ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
              ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
             else.
              ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
             endif.
             modify ls_outtab-celltab from ls_celltab.
            endif.
          endloop.
          modify gt_outtab from ls_outtab index es_row_no-row_id.
        call method sender->refresh_table_display.
    endmethod.
    endclass.
          MAIN                                                          *
    end-of-selection.
      call screen 100.
          MODULE PBO OUTPUT                                             *
    module pbo output.
      set pf-status 'MAIN100'.
      set titlebar 'MAIN100'.
      if g_custom_container is initial.
        perform create_and_init_alv.
      endif.
    endmodule.
          MODULE PAI INPUT                                              *
    module pai input.
      save_ok = ok_code.
      clear ok_code.
      case save_ok.
        when 'EXIT'.
          perform exit_program.
        when 'SELECT'.
          perform select_all_entries changing gt_outtab[].
        when 'DESELECT'.
          perform deselect_all_entries changing gt_outtab[].
        when 'RESET'.
          perform reset_selected_entries changing gt_outtab[].
        when 'SWITCH'.
          perform switch_activation changing gt_outtab[].
      endcase.
    endmodule.
          FORM EXIT_PROGRAM                                             *
    form exit_program.
      leave program.
    endform.
    *&      Form  BUILD_FIELDCAT
          text
         <--P_GT_FIELDCAT  text
    form build_fieldcat changing pt_fieldcat type lvc_t_fcat.
      data ls_fcat type lvc_s_fcat.
      call function 'LVC_FIELDCATALOG_MERGE'
           exporting
                i_structure_name = 'SFLIGHT'
           changing
                ct_fieldcat      = pt_fieldcat.
    *§A2.Add an entry for the checkbox in the fieldcatalog
      clear ls_fcat.
      ls_fcat-fieldname = 'CHECKBOX'.
    Essential: declare field as checkbox and
               mark it as editable field:
      ls_fcat-checkbox = 'X'.
      ls_fcat-edit = 'X'.
    do not forget to provide texts for this extra field
      ls_fcat-coltext = text-f01.
      ls_fcat-tooltip = text-f02.
      ls_fcat-seltext = text-f03.
    optional: set column width
      ls_fcat-outputlen = 10.
      append ls_fcat to pt_fieldcat.
    endform.
    *&      Form  CREATE_AND_INIT_ALV
          text
         <--P_GT_OUTTAB  text
         <--P_GT_FIELDCAT  text
         <--P_GS_LAYOUT  text
    form create_and_init_alv.
      data: lt_exclude type ui_functions.
      create object g_custom_container
             exporting container_name = g_container.
      create object g_grid
             exporting i_parent = g_custom_container.
      perform build_fieldcat changing gt_fieldcat.
    Exclude all edit functions in this example since we do not need them:
      perform exclude_tb_functions changing lt_exclude.
      perform build_data.
    *§ B3.Use the layout structure to aquaint additional field to ALV.
      gs_layout-stylefname = 'CELLTAB'.
      call method g_grid->set_table_for_first_display
           exporting is_layout             = gs_layout
                     it_toolbar_excluding  = lt_exclude
           changing  it_fieldcatalog       = gt_fieldcat
                     it_outtab             = gt_outtab[].
      create object g_event_receiver.
      set handler g_event_receiver->catch_doubleclick for g_grid.
    Set editable cells to ready for input initially
      call method g_grid->set_ready_for_input
       exporting
        i_ready_for_input = 1.
    endform.                               "CREATE_AND_INIT_ALV
    *&      Form  EXCLUDE_TB_FUNCTIONS
          text
         <--P_LT_EXCLUDE  text
    form exclude_tb_functions changing pt_exclude type ui_functions.
      data ls_exclude type ui_func.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
      append ls_exclude to pt_exclude.
    endform.                               " EXCLUDE_TB_FUNCTIONS
    *&      Form  build_data
          text
    -->  p1        text
    <--  p2        text
    form build_data.
      data: lt_sflight type table of sflight,
            ls_sflight type sflight,
            ls_celltab type lvc_s_styl,
            lt_celltab type lvc_t_styl,
            l_index type i.
      select * from sflight into table lt_sflight up to g_max rows.
      if sy-subrc ne 0.
    generate own entries if db-table is empty so that this example
    still works
        perform generate_entries changing lt_sflight.
      endif.
    *§A3.Optionally, check checkboxes initially after selecting data.
    (Omitted in this example)
      loop at lt_sflight into ls_sflight.
        move-corresponding ls_sflight to gt_outtab.
      if gt_outtab-connid eq '400'.
        gt_outtab-checkbox = 'X'.
      endif.
        append gt_outtab.
      endloop.
    §B2.After selecting data,
       assign a style for each row of your checkbox column.
    Initially, set all checkbox cells editable.
      ls_celltab-fieldname = 'CHECKBOX'.
      ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
      loop at gt_outtab.
        l_index = sy-tabix.
        refresh lt_celltab.
        ls_celltab-fieldname = 'CHECKBOX'.
        ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
        insert ls_celltab into table lt_celltab.
        insert lines of lt_celltab into table gt_outtab-celltab.
        modify gt_outtab index l_index.
      endloop.
    endform.                               " build_data
    *&      Form  generate_entries
          text
         <--P_LT_SLFIGHT  text
    form generate_entries changing pt_slfight type standard table.
    This form is only needed for the case that there is no
    data in database table SFLIGHT.
      data: ls_sflight type sflight,
            l_month(2) type c,
            l_day(2) type c,
            l_date(8) type c.
      ls_sflight-carrid = 'LH'.
      ls_sflight-connid = '0400'.
      ls_sflight-currency = 'DEM'.
      ls_sflight-planetype = '747-400'.
      ls_sflight-seatsmax = 660.
      do 110 times.
        ls_sflight-price = sy-index * 100.
        ls_sflight-seatsocc = 660 - sy-index * 6.
        ls_sflight-paymentsum = ls_sflight-seatsocc * ls_sflight-price.
        l_month = sy-index / 10 + 1.
        do 2 times.
          l_day = l_month + sy-index * 2.
          l_date+0(4) = '2000'.
          l_date4(2) = l_month0(2).
          l_date6(2) = l_day0(2).
          ls_sflight-fldate = l_date.
          append ls_sflight to pt_slfight.
        enddo.
      enddo.
    endform.                               " generate_entries
    *&      Form  select_all_entries
          text
         <--P_GT_OUTTAB  text
    form select_all_entries changing pt_outtab type standard table.
      data: ls_outtab type gs_outtab.
      data: l_valid type c,
            l_locked type c.
    *§A4ad. Before you (a)set, reset or (d)evaluate checkboxes,
          you must check the input cells.
    If all entries are ok, ALV transferes new values to the output
    table which you then can modify.
      call method g_grid->check_changed_data
                  importing
                     e_valid = l_valid.
      if l_valid eq 'X'.
        loop at pt_outtab into ls_outtab.
          perform check_lock using    ls_outtab
                             changing l_locked.
          if l_locked is initial
             and not ls_outtab-checkbox eq '-'.
            ls_outtab-checkbox = 'X'.
          endif.
          modify pt_outtab from ls_outtab.
        endloop.
        call method g_grid->refresh_table_display.
      endif.
    endform.                               " select_all_entries
    *&      Form  deselect_all_entries
          text
         <--P_GT_OUTTAB[]  text
    form deselect_all_entries changing pt_outtab type standard table.
      data: ls_outtab type gs_outtab.
      data: l_valid type c,
            l_locked type c.
    *§A4ad. Before you (a)set, reset or (d)evaluate checkboxes,
          you must check the input cells.
    If all entries are ok, ALV transferes new values to the output
    table which you then can modify.
      call method g_grid->check_changed_data
                  importing
                     e_valid = l_valid.
      if l_valid eq 'X'.
        loop at pt_outtab into ls_outtab.
          perform check_lock using    ls_outtab
                           changing l_locked.
          if l_locked is initial
             and not ls_outtab-checkbox eq '-'.
            ls_outtab-checkbox = ' '.
          endif.
          modify pt_outtab from ls_outtab.
        endloop.
        call method g_grid->refresh_table_display.
      endif.
    endform.                               " deselect_all_entries
    *&      Form  reset_selected_entries
          text
         <--P_GT_OUTTAB[]  text
    form reset_selected_entries changing pt_outtab type standard table.
      data: ls_outtab type gs_outtab.
      data: l_valid type c.
    *§A4b. Before you set, (b)reset or evaluate checkboxes,
         you must check the input cells.
    If all entries are ok, ALV transferes new values to the output
    table which you then can modify.
      call method g_grid->check_changed_data
                  importing
                     e_valid = l_valid.
      if l_valid eq 'X'.
        loop at pt_outtab into ls_outtab.
          if     not ls_outtab-checkbox is initial
             and not ls_outtab-checkbox eq '-'.
            clear ls_outtab.
            modify pt_outtab from ls_outtab.
          endif.
        endloop.
        call method g_grid->refresh_table_display.
      endif.
    endform.                               " reset_selected_entries
    form switch_activation changing pt_outtab type standard table.
      data: ls_outtab type gs_outtab.
      data: l_valid type c,
            lt_row_no type lvc_t_roid with header line.
    *§A4c. Before you set, reset, (c)(de)activate
         or evaluate checkboxes, you must check the input cells.
    If all entries are ok, ALV transferes new values to the output
    table which you then can modify.
      call method g_grid->check_changed_data
                  importing
                     e_valid = l_valid.
      if l_valid eq 'X'.
        call method g_grid->get_selected_rows
          importing
             et_row_no     = lt_row_no[].
        loop at lt_row_no.
           read table pt_outtab into ls_outtab index lt_row_no-row_id.
           if ls_outtab-checkbox ne '-'.
             ls_outtab-checkbox = '-'.
           else.
             ls_outtab-checkbox = ' '.
           endif.
           modify pt_outtab from ls_outtab index lt_row_no-row_id.
        endloop.
        call method g_grid->refresh_table_display.
      endif.
    endform.                               " switch_activation
    *&      Form  check_lock
          text
         -->P_LS_OUTTAB  text
         <--P_L_LOCKED  text
    form check_lock using    ps_outtab type gs_outtab
                    changing p_locked.
      data ls_celltab type lvc_s_styl.
      loop at ps_outtab-celltab into ls_celltab.
        if ls_celltab-fieldname = 'CHECKBOX'.
          if ls_celltab-style eq cl_gui_alv_grid=>mc_style_disabled.
            p_locked = 'X'.
          else.
            p_locked = space.
          endif.
        endif.
      endloop.
    endform.                               " check_lock
    Regards,
    Sindhu

  • ALV grid with editable fields

    Dear Colleagues,
    I develop an ALV grid with OO standard methods. Before the first display of the table I define the editable fields. It works fine.
    I have a problem : if the table is empty and I press the standard icons "Append a line" or "Insert a line", the new line don't have the defined editable characteristics.for fields. Is there a standard method which I have forgotten ?
    Thanks a lot and kind regards
    Peter

    vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_delete_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_append_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_insert_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_cut.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_undo.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
    * Displaying the output in ALV Grid
        vs_layout_grid-no_rowmark = 'X'.
        vs_layout_grid-zebra      = 'X'.
        vs_layout_grid-cwidth_opt = 'X'.
        vs_layout_grid-edit       = 'X'.
        vs_layout_grid-ctab_fname = 'CT'.
        vs_layout_grid-stylefname = 'CELLTAB'.
        CALL METHOD v_grid->set_table_for_first_display
          EXPORTING
            i_save                        = 'X'
            is_layout                     = vs_layout_grid
            it_toolbar_excluding          = i_toolbar_excluding[]
          CHANGING
            it_outtab                     = itab[]
            it_fieldcatalog               = it_fieldcat[]
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
        IF sy-subrc NE 0.
          MESSAGE 'ALV Grid display unsuccessful' TYPE 'I'.
          STOP.
        ENDIF.                             " IF sy-subrc NE 0
      ELSE.                                " IF w_custom_container...
    * Refresh the container if it already exists
        CALL METHOD v_grid->refresh_table_display
          EXCEPTIONS
            finished = 1
            OTHERS   = 2.
        IF sy-subrc NE 0.
          MESSAGE 'Refreshing the container is not successful' TYPE 'I'.
          STOP.
        ENDIF.                            

  • TO enable the menu button in ALV Grid Display

    Hi Mates,
    I have a peculiar problem while doing ALV Grid display for screens.
    In the main Screen i have Three coloumns.The 1st coloum will interacted
    next screen 101 and 2nd coloum will interacted to screen 102.
    Now the problem is in the menu of ALV Grid display,the Total button was enabled for screen
    101 and same button is disabled in screen 102.
    But the code semms to be fine .
    Below i have pasted the code and please have a look and help to come out of this cris.
    My Code  :
    FORM CREATE_ALV_GRID USING R_SCREEN.
      DATA: LS_LAYOUT TYPE LVC_S_LAYO,
      ITAB_FUNCTIONS     TYPE UI_FUNCTIONS.   "MHTK903257(+)(add)
      CASE R_SCREEN.
    *--> SCREEN 9000
        WHEN C_SCREEN_9000.
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_OVERVIEW' 'WADAT'     'Due date'(004)  'X' 'D' ' ' ' ' ' ' 'C100',
    *'ITAB_OVERVIEW' 'HU_UNLOAD' 'Unloaded HU'(005) 'X' 'I' '15' ' ' ' ' 'C500',  "MHTK903257(-)
    'ITAB_OVERVIEW' 'TOT_TO'    'Total TO'(006)   'X' 'I' ' '  ' ' ' ' 'C30',
    GMTK901103: REMOVE HOTSPOT ON ESTIMATED TO:
    'ITAB_OVERVIEW' 'EST_TO'    'Estim TO'(030)    ' ' 'I' ' '  ' ' ' ' 'C500'.
          LOOP AT ITAB_INB_LOC WHERE OUTPUT = 'X'.
                PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
                                        USING:
       ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
            'ITAB_OVERVIEW' ITAB_INB_LOC-FIELDNAME
            ITAB_INB_LOC-Z_INBND_LOC 'X' '' ' ' ' ' 'R' 'C500'.  "MHTK903418
            ENDLOOP.
          LOOP AT ITAB_STORAGE_TYPE WHERE OUTPUT = 'X'.
            PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
                                        USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_OVERVIEW' ITAB_STORAGE_TYPE-FIELDNAME
      ITAB_STORAGE_TYPE-LGTYP 'X' 'I' ' ' ' ' 'R' 'C500'.
          ENDLOOP.
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1000
            EXPORTING
              I_PARENT  = PT_DOCK_1000.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS   "MHTK903257(+)(add)
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1000
                                     CHANGING LS_LAYOUT-GRID_TITLE.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1000->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_OVERVIEW
              IT_FIELDCATALOG = ITAB_FIELDCAT_9000.
    *--> SCREEN 9100
        WHEN C_SCREEN_1100.
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_DETIAL' 'WAUHR'     'Due time'(007)  ' ' 'T' ' ' 'X' ' ' 'C100',
    'ITAB_DETAIL' 'TOT_TO'    'Total TO'(006)   'X' 'I' ' '  ' ' ' ' 'C30',
    'ITAB_DETAIL' 'EST_TO'    'Estim TO'(030)   ' ' 'I' ' '  ' ' ' ' 'C500'.
       CLEAR ITAB_INB_LOC.
        LOOP AT ITAB_INB_LOC WHERE SELECTED = 'X'.
             CHECK SY-SUBRC EQ 0.
                PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
                                        USING:
       ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
            'ITAB_DETAIL' ITAB_INB_LOC-FIELDNAME
            ITAB_INB_LOC-Z_INBND_LOC '' '' ' ' ' ' 'R' 'C500'.
         ENDLOOP.
         CLEAR: ITAB_STORAGE_TYPE.
          LOOP AT ITAB_STORAGE_TYPE WHERE SELECTED = 'X'.
            CHECK SY-SUBRC EQ 0.
            PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
                                        USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_DETAIL' ITAB_STORAGE_TYPE-FIELDNAME
      ITAB_STORAGE_TYPE-LGTYP 'X' 'I' ' ' ' ' 'R' 'C500'.
          ENDLOOP.
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1100
            EXPORTING
              I_PARENT  = PT_DOCK_1100.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS   "MHTK903257(+)(add)
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1100
                                     CHANGING LS_LAYOUT-GRID_TITLE.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1100->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_DETAIL
              IT_FIELDCATALOG = ITAB_FIELDCAT_1100.
    screen 1300 TO detail.
    *--> SCREEN 9300
        WHEN C_SCREEN_1300.
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1300
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_TO2' 'TANUM' 'TO'(020)  ' '   'C' ' ' ' ' ' ' 'C100',
    'ITAB_TO2' 'NLPLA' 'Location'(021) ' '   'C' ' '  ' ' ' ' 'C500',
    'ITAB_TO2' 'LETY1' 'SUT'(013)  ' ' 'C'  ' ' ' ' ' ' 'C500',
    'ITAB_TO2' 'MATNR' 'Material'(016) ' '  'C' ' '  ' ' ' ' 'C500',
    'ITAB_TO2' 'NSOLM' 'Quantity'(017) ' ' 'I' ' '  ' ' ' ' 'C500',
    'ITAB_TO2' 'NLTYP' 'Storage type'(014) ' ' '' ' '  ' ' ' ' 'C500'.  "MHTK903257(-)
    *'ITAB_TO2' 'POSNR' 'Line'(015) ' ' 'C' ' ' ' ' ' ' 'C500'.       "MHTK903257(-)
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1300
            EXPORTING
              I_PARENT  = PT_DOCK_1300.
    *-- Exclude the non-applicable functions from the ALV grid.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1300
                                     CHANGING LS_LAYOUT-GRID_TITLE.
          SORT ITAB_TO2 BY TANUM VBELN POSNR.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1300->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_TO2
              IT_FIELDCATALOG = ITAB_FIELDCAT_1300.
    screen 9400 Pre Processing detail.
    *--> SCREEN 9400
        WHEN C_SCREEN_9400.          "MHTK903418(BEgin Of change)
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1400
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_PRE_PROC2' 'Z_PRE_PROC' 'Pre Processing Number'(030)  ' '   'C' ' ' ' ' ' ' 'C100',
    'ITAB_PRE_PROC2' 'Z_PRE_PROC_LN' 'Pre Processing Number'(035) ' '   'C' ' '  ' ' ' ' 'C100',
    'ITAB_PRE_PROC2' 'MATNR' 'Material'(035) ' '   'C' ' '  ' ' ' ' 'C500',
    'ITAB_PRE_PROC2' 'Z_PSH_QTY' 'Quantity'(035) ' '   'C' ' '  ' ' ' ' 'C500'.
    *'ITAB_TO2' 'MATNR' 'Material'(016) ' '  'C' ' '  ' ' ' ' 'C500',
    *'ITAB_TO2' 'NSOLM' 'Quantity'(017) ' ' 'I' ' '  ' ' ' ' 'C500',
    *'ITAB_TO2' 'NLTYP' 'Storage type'(014) ' ' '' ' '  ' ' ' ' 'C500'.  "MHTK903257(-)
    **'ITAB_TO2' 'POSNR' 'Line'(015) ' ' 'C' ' ' ' ' ' ' 'C500'.       "MHTK903257(-)
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1400
            EXPORTING
              I_PARENT  = PT_DOCK_1400.
    *-- Exclude the non-applicable functions from the ALV grid.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1400
                                     CHANGING LS_LAYOUT-GRID_TITLE.
          SORT ITAB_PRE_PROC2 BY Z_PRE_PROC.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1400->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_PRE_PROC2
              IT_FIELDCATALOG = ITAB_FIELDCAT_1400.  "MHTK903418(End of change)
      ENDCASE.

    Hi
    U copy from standard program and paste ur report ...It will work..'
    Regards:
    Prabu

  • REFRESH FUNCTIONALITy in ALV GRID

    Hi Experts,
    I have added two custom buttons (CO40 and REFRESH) in ALV GRID .
    WHEN CO40 button is clicked it will go the CO40 transaction.
    here the problem is when clicking the REFRESH , the REFRESH fuctionality is not working.
    (here i went to CO40 transaction by clicking CO40 button and deleted one planned order and come back and clicked REFRESH button but the planned order still showing in the output but the planned oreder is deleted in the table ) please help me rgarding this
    pls see my code and pls send me the code with modifications
    Thanks
    Nagendra
    REPORT  zpp_plannedorder_conv LINE-SIZE 200.
    TYPE-POOLS: slis.
    TABLES: plaf, vbak.
    PLANNED ORDER TABLE
    CONSTANTS: c_e TYPE c LENGTH 01 VALUE 'E'.
    TYPES: BEGIN OF ty_plaf,
           kdauf     TYPE kdauf,
           kdpos     TYPE kdpos,
           plnum TYPE plnum,     
           dispo TYPE dispo,
           matnr     TYPE matnr,
           maktx     TYPE maktx,
           pwwrk     TYPE pwwrk,
           paart     TYPE paart,
           beskz     TYPE beskz,
           gsmng     TYPE gsmng,
           END OF ty_plaf.
    SALES FIELDS
    TYPES: BEGIN OF ty_vbak,
           vbeln TYPE vbeln,
           posnr TYPE posnr,
           kunnr     TYPE kunnr,
           grkor     TYPE grkor,
           autlf     TYPE autlf,
           mvgr2     TYPE mvgr2,
           fixmg     TYPE  fixmg,
           bstdk     TYPE bstdk,
           edatu     TYPE edatu,
           posex  TYPE posex,
           END OF ty_vbak.
    output table.
    TYPES: BEGIN OF ty_out,
           plnum TYPE plnum,     
           dispo TYPE dispo,
           matnr     TYPE matnr,
           maktx     TYPE maktx,
           pwwrk     TYPE pwwrk,
           paart     TYPE paart,
           beskz     TYPE beskz,
           gsmng     TYPE gsmng,
           kdauf     TYPE kdauf,
           kdpos     TYPE kdpos,
           kunnr     TYPE kunnr,
           grkor     TYPE grkor,
           autlf     TYPE autlf,
           mvgr2     TYPE mvgr2,
           fixmg     TYPE  fixmg,
           bstdk     TYPE bstdk,
           edatu     TYPE edatu,
           posex  TYPE posex,
           END OF ty_out.
    DATA: tb_plaf TYPE STANDARD TABLE OF ty_plaf,
          tb_vbak TYPE STANDARD TABLE OF ty_vbak,
          tb_out  TYPE STANDARD TABLE OF ty_out.
    DATA: lv_plaf TYPE ty_plaf,
          lv_vbak TYPE ty_vbak,
          lv_out  TYPE ty_out.
    TYPES: BEGIN OF ty_vbep,
        vbeln TYPE vbeln,
        posnr TYPE posnr,
        etenr TYPE etenr,
        edatu TYPE edatu,
       END OF ty_vbep.
    DATA: tb_vbep TYPE STANDARD TABLE OF ty_vbep.
    DATA: lv_flag(1) TYPE c.
    **Start changes RFS: SANN - 0856
    DATA:  w_repid            TYPE sy-repid.
    DATA:  it_fieldcat        TYPE slis_t_fieldcat_alv, "field catalog table
           gs_layout          TYPE slis_layout_alv, "struct data type
           it_sort            TYPE slis_t_sortinfo_alv,
           it_events          TYPE slis_t_event,
           gt_event_exit          TYPE slis_t_event_exit.
    **End changes RFS: SANN - 0856
    SELECT OPTIONS.
    SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-t01.
    SELECT-OPTIONS: sel_pln FOR plaf-plnum,
                    sel_pww FOR plaf-pwwrk OBLIGATORY,
                    sel_dis FOR plaf-dispo,
                    sel_kun FOR vbak-kunnr,
                    sel_paa FOR plaf-paart,
                    sel_kda FOR plaf-kdauf.
    SELECTION-SCREEN END OF BLOCK a1.
    START-OF-SELECTION.
      REFRESH: tb_plaf ,tb_vbak.
      SELECT pkdauf pkdpos pplnum pdispo pmatnr mmaktx
              ppwwrk ppaart pbeskz pgsmng INTO TABLE tb_plaf
              FROM plaf AS p JOIN makt AS m
                ON pmatnr EQ mmatnr
                WHERE p~plnum IN sel_pln
                  AND p~pwwrk IN sel_pww
                  AND p~dispo IN sel_dis
                  AND p~paart IN sel_paa
                  AND p~kdauf IN sel_kda
                  AND m~spras EQ c_e.
      IF NOT  tb_plaf[] IS INITIAL.
        SORT tb_plaf BY kdauf DESCENDING.
        SELECT  kvbeln pposnr kkunnr pgrkor kautlf pmvgr2 p~fixmg     
                kbstdk vedatu p~posex INTO TABLE tb_vbak
                 FROM vbak AS k JOIN vbap AS p
                   ON kvbeln EQ pvbeln
                      INNER JOIN vbep AS v
                         ON pvbeln EQ vvbeln
                        AND pposnr EQ vposnr
        FOR ALL ENTRIES IN tb_plaf
            WHERE k~vbeln EQ tb_plaf-kdauf
              AND p~posnr EQ tb_plaf-kdpos
              AND k~kunnr IN sel_kun
              AND v~etenr EQ '0001'.
        IF NOT  tb_vbak[] IS INITIAL.
          LOOP AT tb_plaf INTO lv_plaf.
            CLEAR lv_out.
            MOVE-CORRESPONDING lv_plaf TO lv_out.
            IF NOT lv_plaf-kdauf IS INITIAL.
              READ TABLE tb_vbak INTO lv_vbak WITH KEY vbeln = lv_plaf-kdauf
                                                       posnr = lv_plaf-kdpos.
              MOVE-CORRESPONDING lv_vbak TO lv_out.
            ENDIF.
            APPEND lv_out TO tb_out.
          ENDLOOP.
        ENDIF.
      ENDIF.
    END-OF-SELECTION.
      PERFORM f_build_fcat.
      PERFORM f_get_display.
    *&      Form  F_BUILD_FCAT
    FORM f_build_fcat .
      CLEAR: w_repid.
      PERFORM fill_fieldcat " TABLES it_fieldcat
            USING:
                   text-f01 'TB_OUT'  text-k01  text-k01 '10' ,
                   text-f02 'TB_OUT'  text-k02  text-k02 '10' ,
                   text-f03 'TB_OUT'  text-k03  text-k03 '06' ,
                   text-f04 'TB_OUT'  text-k04  text-k04 '18' ,
                   text-f05 'TB_OUT'  text-k05  text-k05 '06' ,
                   text-f06 'TB_OUT'  text-k06  text-k06 '08' ,
                   text-f07 'TB_OUT'  text-k07  text-k07 '05' ,
                   text-f08 'TB_OUT'  text-k08  text-k08 '05' ,
                   text-f09 'TB_OUT'  text-k09  text-k09 '15' ,
                   text-f10 'TB_OUT'  text-k10  text-k10 '05' ,
                   text-f11 'TB_OUT'  text-k11  text-k11 '05' ,
                   text-f12 'TB_OUT'  text-k12  text-k12 '10' ,
                   text-f13 'TB_OUT'  text-k13  text-k13 '10' ,
                   text-f14 'TB_OUT'  text-k14  text-k14 '10' ,
                   text-f15 'TB_OUT'  text-t15  text-k15 '10' ,
                   text-f16 'TB_OUT'  text-k16  text-k16 '10' ,
                   text-f17 'TB_OUT'  text-k17  text-k17 '10' .
    ENDFORM.                    " F_BUILD_FCAT
    *&      Form  fill_fieldcat
    FORM  fill_fieldcat  " TABLES  l_catalog TYPE slis_t_fieldcat_alv       "#EC *
                       USING    p_field                         "#EC *
                                p_table                         "#EC *
                                p_desc                          "#EC *
                                p_desc_l                        "#EC *
                                p_len.                          "#EC *
      DATA: ls_fieldcat   TYPE slis_fieldcat_alv.
      ls_fieldcat-fieldname       = p_field.
      ls_fieldcat-tabname         = p_table.
      ls_fieldcat-seltext_l       = p_desc_l.
      ls_fieldcat-reptext_ddic    = p_desc.
      ls_fieldcat-outputlen       = p_len.
      APPEND ls_fieldcat TO it_fieldcat.
      CLEAR ls_fieldcat.
    ENDFORM.                    " fill_fieldcat
    *&     FORM F_GET_DISPLAY
          text
    FORM f_get_display .
      CLEAR w_repid.
      MOVE sy-repid TO w_repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = w_repid
          i_callback_pf_status_set = 'PF_STATUS'
          i_callback_user_command  = 'USER_COMMAND'
          is_layout                = gs_layout
          it_fieldcat              = it_fieldcat
          it_sort                  = it_sort
          i_save                   = 'X'
        TABLES
          t_outtab                 = tb_out
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc EQ 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " F_GET_DISPLAY
    *&      Form  PF_STATUS
          text
    FORM pf_status USING rt_extab TYPE slis_t_extab.
      DATA: wa_extab LIKE LINE OF rt_extab.
      REFRESH: rt_extab.
      wa_extab-fcode = '&REFRESH'.
      APPEND wa_extab TO rt_extab.
      SET PF-STATUS '0001' EXCLUDING rt_extab.
    ENDFORM.                    "PF_STATUS
         -->COMMAND    text
         -->SELFIELD   text
    FORM user_command USING command LIKE sy-ucomm selfield TYPE slis_selfield."#EC CALLED
      CLEAR : lv_out-plnum,lv_out-kdauf,lv_out-paart,lv_out-kdauf.
      CASE command.
        WHEN '&IC1'.                       "doubleclick
          CASE selfield-fieldname.
            WHEN 'PLNUM'.
              READ TABLE tb_out INTO lv_out INDEX selfield-tabindex.
              IF sy-subrc EQ 0.
                SET PARAMETER ID 'PAF'  FIELD lv_out-plnum.
                CALL TRANSACTION 'MD12' AND SKIP FIRST SCREEN.
              ENDIF.
            WHEN 'KDAUF'.
              READ TABLE tb_out INTO lv_out INDEX selfield-tabindex.
              IF sy-subrc EQ 0.
                SET PARAMETER ID 'AUN'  FIELD lv_out-kdauf.
                CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
              ENDIF.
          ENDCASE.
        WHEN 'CO40'.
          READ TABLE tb_out INTO lv_out INDEX selfield-tabindex.
          IF sy-subrc EQ 0.
            SET PARAMETER ID 'PAF'  FIELD lv_out-plnum.
            CALL TRANSACTION 'CO40' AND SKIP FIRST SCREEN.
          ENDIF.
        WHEN 'REFRESH'.
          PERFORM select_data.
      ENDCASE.
    ENDFORM.                    "user_command
    *End changes RFS: SANN - 0856
    *&      Form  SELECT_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM select_data .
      commit work and wait.
      REFRESH:tb_plaf[],tb_vbak[],tb_out[].
      SELECT pkdauf pkdpos pplnum pdispo pmatnr mmaktx
              ppwwrk ppaart pbeskz pgsmng INTO TABLE tb_plaf
              FROM plaf AS p JOIN makt AS m
                ON pmatnr EQ mmatnr
                WHERE p~plnum IN sel_pln
                  AND p~pwwrk IN sel_pww
                  AND p~dispo IN sel_dis
                  AND p~paart IN sel_paa
                  AND p~kdauf IN sel_kda
                  AND m~spras EQ c_e.
      IF NOT  tb_plaf[] IS INITIAL.
        SORT tb_plaf BY kdauf DESCENDING.
        SELECT  kvbeln pposnr kkunnr pgrkor kautlf pmvgr2 p~fixmg     
                kbstdk vedatu p~posex INTO TABLE tb_vbak
                 FROM vbak AS k JOIN vbap AS p
                   ON kvbeln EQ pvbeln
                      INNER JOIN vbep AS v
                         ON pvbeln EQ vvbeln
                        AND pposnr EQ vposnr
        FOR ALL ENTRIES IN tb_plaf
            WHERE k~vbeln EQ tb_plaf-kdauf
              AND p~posnr EQ tb_plaf-kdpos
              AND k~kunnr IN sel_kun
              AND v~etenr EQ '0001'.
        IF NOT  tb_vbak[] IS INITIAL.
          LOOP AT tb_plaf INTO lv_plaf.
            CLEAR lv_out.
            MOVE-CORRESPONDING lv_plaf TO lv_out.
            IF NOT lv_plaf-kdauf IS INITIAL.
              READ TABLE tb_vbak INTO lv_vbak WITH KEY vbeln = lv_plaf-kdauf
                                                       posnr = lv_plaf-kdpos.
              MOVE-CORRESPONDING lv_vbak TO lv_out.
            ENDIF.
            APPEND lv_out TO tb_out.
          ENDLOOP.
        ENDIF.
      ENDIF.
    ENDFORM.                    " SELECT_DATA

    Hi,
    Gothrough the following link,
    Handle Refresh button on ALV
    Regards,
    Harish

  • Change Layout in Selection Screen for OO ALV-Grid

    Hello everyone,
    I got a problem regarding layouts for objectoriented ALV Grid. I want to make it possible that user can take the layout for ALV he wants to on the selection screen. So far thats no problem and it works. But there are some little problems which I do not know how to fix them. But first the facts:
    (1) I got my parameter for layout
    PARAMETER: p_vari  TYPE disvariant-variant.
    (2) I fill my global layout structure in initialization
    INITIALIZATION.
    * Variante vorbelegen
       gs_variant-username = sy-uname.
       gs_variant-report   = sy-repid.
    * Layout holen
       CALL FUNCTION 'LVC_VARIANT_DEFAULT_GET'
         EXPORTING
           i_save        = 'A'
         CHANGING
           cs_variant    = gs_variant
         EXCEPTIONS
           wrong_input   = 1
           not_found     = 2
           program_error = 3
           OTHERS        = 4.
       IF sy-subrc = 0.
         p_vari = gs_variant-variant.
       ENDIF.
    (3) I got my handling for F4-value help on variant parameter
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
       CALL FUNCTION 'LVC_VARIANT_F4'
         EXPORTING
           is_variant    = gs_variant
           i_save        = 'A'
         IMPORTING
           es_variant    = gs_variant
         EXCEPTIONS
           not_found     = 1
           program_error = 2
           OTHERS        = 3.
       IF sy-subrc <> 0.
         MESSAGE text-m01 TYPE 'S'.
       ELSE.
         p_vari = gs_variant-variant.
       ENDIF.
    (4) I give back my parameters content into the variant structure at start of selection
    START-OF-SELECTION.
       gs_variant-username = sy-uname.
       gs_variant-report   = sy-repid.
       gs_variant-variant  = p_vari.
    This works all fine but I got some problems when using default variants/layouts. For example I got a default variant only for me. When starting the selection screen it works fine that the default layout was written. It is displayed automatically in the variant parameter. But I want that if i I empty the content (blank it out) from my variant parameter, that report should start with "normal" layout how it was written in the report and NOT with default layout.
    When I clear the gs_variant it works like I want it, but then the alv layout button looks like (without functions for layout), because I do not have the reference to my report.
    So what to do? :-)
    Regards
    Michael

    Wow that was fast, works great, thanks :-)
    I did not use this parameter in set table method but now I fill it dynamically.
    Ok next problem, one step harder ;-)
    Now I have one selection screen for one ALV-Grid, but four radio buttons which control with which data the ALV gets filled (four different fieldcats, data tables and so on). Each Grid got an own HANDLE so that the layouts can be separated in four categories.
    Now I want that by changing the radio button the individual standard layout for the chosen alv grid is getting filled.
    This works fine when using it in selection screen output.
    AT SELECTION-SCREEN OUTPUT.
       CLEAR gs_variant.
    * Layout-Handles individuell für Klausel-Radiobuttons setzen
       IF     p_py IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLPY'.
       ELSEIF p_rh IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLRH'.
       ELSEIF p_aj IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLAJ'.
       ELSEIF p_sr IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLSR'.
       ENDIF.
    * Layout holen
       CALL FUNCTION 'LVC_VARIANT_DEFAULT_GET'
         EXPORTING
           i_save        = 'A'
         CHANGING
           cs_variant    = gs_variant
         EXCEPTIONS
           wrong_input   = 1
           not_found     = 2
           program_error = 3
           OTHERS        = 4.
       IF sy-subrc = 0.
         p_vari = gs_variant-variant.
       ELSE.
         CLEAR p_vari.
       ENDIF.
    But unfortunately selection screen output is getting passed by EACH changing in the selection screen. This means when I try to clear the default layout in my parameter field, it gets refilled automatically with default layout. If I do a condition around the filling (only if not initial) the default value filling does not work fine in every case, e.g. when clearing the parameters field and then change the radiobutton -> then it does not get filled automatically.

  • ALV grid - Disabling options

    Hi,
    I have a question on the ALV grid.
    In the ALV grid, there is the button - EXPORT under which the following options are available:-
    - Spreadsheet
    - Word Processing
    - Local File
    - Send...
    I just want to whether it is possible to remove the 'Send' option from the list, all other options should be available ?
    Regards,
    Ajit G

    Hi,
    For this kind of a requirement where you want the standard ALV
    pf-status to get modified, you have to exclude the required Send Option
    functionality from it. You can do like:
    DATA: itab_exclude TYPE slis_t_extab,
          wa_exclude TYPE slis_extab.
    *& *MAINTAINIG INTERNAL TABLE FOR EXCLUDING COMPONENTS FROM THE ALV STANDARD TOOLBAR
    * For excluding the components from the standard toolbar we have to comment the
    *  i_callback_pf_status_set          = 'PF_STATUS' in the grid display function module
      wa_exclude-fcode = '&LFO'.
      APPEND wa_exclude TO itab_exclude.
      CLEAR wa_exclude.
      wa_exclude-fcode = '&NFO'.
      APPEND wa_exclude TO itab_exclude.  "You can like this exclude the function code of send Option functionality here
    Then you can pass it in the Reuse Function Module,
      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_STATUS'
          i_callback_user_command           = 'COMM'
          i_callback_top_of_page            = 'TOP'
    *    I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *    I_CALLBACK_HTML_END_OF_LIST       = ' '
    *    I_STRUCTURE_NAME                  =
    *    I_BACKGROUND_ID                   = ' '
          i_grid_title                      = it_grid_title
    *    I_GRID_SETTINGS                   =
          is_layout                         = it_layout
          it_fieldcat                       = it_field
    *    it_excluding                      = itab_exclude      " function codes appended in this internal table will get deleted in o/p
    Hope it helps,
    Regards
    Mansi

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

    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

    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

Maybe you are looking for

  • UnAuthorised error while checking Resource History of provisioned account

    Hi Experts, I have provisioned an ACF2 account in OIM 11gR2, I wanted to check the resource history of the provisioned account. When i clicked on the resource history button,, i get error page saying: Just for information, i tired doing the same from

  • Using Javascript in a report region

    I have a text box that I need to populate with an amount for billing. There is also a field that shows the amount due. If the amount due is equal to the amount being paid, I want my user to click on the amount due, and it automatically populates the

  • Accounting document through MR21

    Dear Experts, My user just performed price changed through MR21. My question is, why no Accounting document created after executed. There was only 'price change document appears after checked through CKMPCD. Please advice. Thank you in advance.

  • Problems with Use Cases for Process Integration

    Hi there, I'm reading the "Simple Use Cases for Process Integration" (http://service.sap.com/xi -> Media Library -> Documentation) and try to setup the variants 1 up to 4. As per description I created the Technical and Business Systems in the SLD. Ev

  • Adobe Reader and Flash not installing

    As soon as the install starts I get the following messages Error for Adobe Flash An Error has occured in the script on this page Line: 1 Char  14760 Error:  Object expected Code: URL: http://127..1.4453/ap/_ia/adobe.js Error for Adobe Reader An Error