REUSE_ALV_GRID_DISPLAY

Hi,
I am using the REUSE_ALV_GRID_DISPLAY to display my list. I want to save the data from the displayed list in an excel file. My question is I don't see any icon saying 'spreadsheet' in the toolbar. Where as if we use REUSE_ALV_LIST_DISPLAY function, we can see the 'spreadsheet' icon in toolbar.
I want to know how we can add an icon for 'spreadsheet' when we use REUSE_ALV_GRID_DISPLAY.
NOTE: 1. Though we can download the data by going to List->Export->Spreadsheet, I want to see an icon for spreadsheet in REUSE_ALV_GRID_DISPLAY case.
2. There is already an icon 'EXCEL' in toolbar, but its not working. I want a seperate icon for spreadsheet in toolbar.
Please help me in solving this problem. Thanks

<i>2. There is already an icon 'EXCEL' in toolbar, but its not working. I want a seperate icon for spreadsheet in toolbar.</i>
First, I would try getting that button to work.  Not sure why it is not.  Make sure that your SAPgui has the lastest patch and check OSS notes.  Also make sure that excel exists on the local machine.
This functionality is provided by te "Excel" button, it should be working, there is not need to write special code to add a button to the toolbar and handle it yourself.  Fix the problem, don't reinvent the wheel.
REgards,
Rich Heilman

Similar Messages

  • How to color a specific cell in ALV (not REUSE_ALV_GRID_DISPLAY)

    Hi
    I want to change color font or background to a specify position in ALV grid
    It is possible but by creating ALV container (not FM for example REUSE_ALV_GRID_DISPLAY)?

    Hi,
    REPORT ZALV_LIST1.
    TABLES:
    SPFLI.
    TYPE-POOLS:
    SLIS.
    PARAMETERS:
    P_COL TYPE I ,
    P_ROW TYPE I,
    P_COLOR(4) TYPE C .
    DATA:
    T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    FS_FIELDCAT LIKE LINE OF T_FIELDCAT,
    FS_LAYOUT TYPE SLIS_LAYOUT_ALV ,
    W_COLOR(4) ,
    W_ROW TYPE I,
    W_FIELDNAME(20),
    W_PROG TYPE SY-REPID.
    DATA:
    BEGIN OF T_SPFLI OCCURS 0,
    COLOR(4),
    CHECKBOX ,
    CELL TYPE SLIS_T_SPECIALCOL_ALV,
    CARRID TYPE SPFLI-CARRID,
    CONNID TYPE SPFLI-CONNID,
    CITYFROM TYPE SPFLI-CITYFROM,
    CITYTO TYPE SPFLI-CITYTO,
    DISTANCE TYPE SPFLI-DISTANCE,
    END OF T_SPFLI.
    DATA:
    FS_CELL LIKE LINE OF T_SPFLI-CELL.
    SELECT *
    FROM SPFLI
    INTO CORRESPONDING FIELDS OF TABLE T_SPFLI.
    W_COLOR = P_COLOR.
    T_SPFLI-COLOR = P_COLOR.
    IF P_COL IS INITIAL AND P_ROW GT 0.
    MODIFY T_SPFLI INDEX P_ROW TRANSPORTING COLOR.
    ENDIF.
    FS_FIELDCAT-FIELDNAME = 'CARRID'.
    FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
    FS_FIELDCAT-COL_POS = 1.
    FS_FIELDCAT-KEY = 'X'.
    FS_FIELDCAT-HOTSPOT = 'X'.
    APPEND FS_FIELDCAT TO T_FIELDCAT.
    CLEAR FS_FIELDCAT .
    FS_FIELDCAT-FIELDNAME = 'CONNID'.
    FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
    FS_FIELDCAT-COL_POS = 2.
    FS_FIELDCAT-KEY = 'X'.
    FS_FIELDCAT-HOTSPOT = 'X'.
    APPEND FS_FIELDCAT TO T_FIELDCAT.
    CLEAR FS_FIELDCAT .
    FS_FIELDCAT-FIELDNAME = 'DISTANCE'.
    FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
    FS_FIELDCAT-COL_POS = 3.
    FS_FIELDCAT-KEY = ' '.
    FS_FIELDCAT-EDIT = 'X'.
    APPEND FS_FIELDCAT TO T_FIELDCAT.
    CLEAR FS_FIELDCAT.
    FS_FIELDCAT-FIELDNAME = 'CITYFROM'.
    FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
    FS_FIELDCAT-COL_POS = 4.
    FS_FIELDCAT-KEY = ' '.
    APPEND FS_FIELDCAT TO T_FIELDCAT.
    LOOP AT T_FIELDCAT INTO FS_FIELDCAT.
    IF FS_FIELDCAT-COL_POS EQ P_COL.
    FS_FIELDCAT-EMPHASIZE = P_COLOR.
    W_FIELDNAME = FS_FIELDCAT-FIELDNAME.
    IF P_ROW IS INITIAL AND P_COL GT 0.
    MODIFY T_FIELDCAT FROM FS_FIELDCAT TRANSPORTING EMPHASIZE.
    ENDIF.
    ENDIF.
    ENDLOOP.
    FS_CELL-FIELDNAME = W_FIELDNAME .
    FS_CELL-COLOR-COL = 6.
    FS_CELL-NOKEYCOL = 'X'.
    APPEND FS_CELL TO T_SPFLI-CELL.
    IF P_ROW IS NOT INITIAL AND P_COL IS NOT INITIAL.
    MODIFY T_SPFLI INDEX P_ROW TRANSPORTING CELL.
    ENDIF.
    FS_LAYOUT-INFO_FIELDNAME = 'COLOR'.
    FS_LAYOUT-BOX_FIELDNAME = 'CHECKBOX'.
    FS_LAYOUT-COLTAB_FIELDNAME = 'CELL'.
    FS_LAYOUT-F2CODE = '&ETA'.
    W_PROG = SY-REPID.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = W_PROG
    IS_LAYOUT = FS_LAYOUT
    IT_FIELDCAT = T_FIELDCAT
    TABLES
    T_OUTTAB = T_SPFLI
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2

  • What is diff b/w reuse_alv_grid_display and reuse_alv_grid_display_lvc

    Hi everbody,
    what is diff b/w reuse_alv_grid_display and reuse_alv_grid_display_lvc.
    can u give a dteils on it .
    Regards,
    Priya

    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV? http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV? http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV? http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Check this for basic concepts of OOPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
    Tabstrip
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20for%20tab%20strip%20in%20alv.pdf
    Editable ALV
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc
    Tree
    http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm
    General Tutorial for OOPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
    http://www.sapdevelopment.co.uk/reporting/alvhome.htm
    http://www.sap-img.com/abap/what-is-alv-programming.htm
    http://www.sap-img.com/abap-function.htm
    http://www.geocities.com/mpioud/Abap_programs.html
    http://www.sapdevelopment.co.uk/reporting/alv/alvtree%5Calvtree_basic.htm
    http://esnips.com/doc/ad20dca9-6182-4903-8d8f-96a66dc8590c/ALV.pdf
    http://www.sap-img.com/abap-function.htm

  • ** Filtering is not working correctly in ALV (REUSE_ALV_GRID_DISPLAY)

    Hi Friends,
    We have one Z report that output is displayed in ALV. We are using the standard FM 'REUSE_ALV_GRID_DISPLAY. 
    We have requirement to remove leading zeros for the field like Material Number (MATNR), Equipment Number (EQUNR) etc. We did the changes by applying the field catalog properties as below.
    lw_fieldcat-lzero = space.
    lw_fieldcat-no_zero = 'X'.
    After this, the MATNR and EQUNR is displayed correctly in the ALV. (Leading zeros are suppressed). But, when we do filter for these fields, in the filter window it displays all the values with leading zeros.
    1. We don't understand why it is showing in the Filter widow with all leading zeros. All it shows all the records instead of unique items.
    Later on, we removed the above fieldcat coding. Then, we have called the CONVERSION_EXIT routines (in the domain) for the fields to remove leading zeros.
    Now, the MATNR and EQUNR is displayed correctly (without leading zeros) in ALV. When we do filter, it is also doing filtering correctly. But, when we do filter which have EQUNR having long values (after zero suppression), it is not working correctly. i.e no items are displayed in the ALV.
    Not only for this items. If we filter character columns which have long text, it is not filtering correctly.
    2. It is not able to understand why the filtering is not working for long items. But in the standard report, the filtering is working correctly.
    We are using SAP ECC 6.0.
    Friends, can you clarify the about doubts. It is surprising for me.
    Kind regards,
    Jegathees P.
    Our customer is asked to remove the leading zeros for the numeric field

    Hi Clemens Li
    I agreed on your point. When we define the Internal table the type for element EQUNR & QUMNR , we are referring the SAP data element for EQUNR, QMNUM field.
    Our doubt is even though we refer the standard data element, in the ALV display, it shows with leading zeros and also it creates problems in the filtering and in the filter window all values instead of unique nos.
    Hi Abhii
    I have given below the fieldcat coding.
    Friends, can you kindly clarify the above said problems. Since we use SAP ECC 6.0 any notes or patches apply is required. ( this is the basic functionality in ALV, that is my doubt).
        wls_fieldcat-col_pos   = wpv_pos.
        wls_fieldcat-fieldname = wpv_champ.
        wls_fieldcat-tabname   = wlc_tabname.
      wls_fieldcat-seltext_s = wls_fieldcat-seltext_m
        wls_fieldcat-seltext_l = wpv_libelle.
        wls_fieldcat-ddictxt   = 'L'.
        wls_fieldcat-no_out    = wv_no_out.
        APPEND wls_fieldcat TO gt_fieldcat.
    Kind regards,
    Jegathees P.

  • ALV Grid Excel in Place using REUSE_ALV_GRID_DISPLAY

    I have a ALV grid displayed in a report and i have a bunch of layouts created by various users and the layouts works fine when selected. But when I use 'Excel'  (excel-in-place) button to export the grid into an excel sheet, the order of the columns are all jumbled up and not in sync with the ALV grid layout on the screen. However, when I use export to local file>excel option, the order of columns are in sync with the layout. Can any one explain why this is happening and how I can fix it ? Is there any OSS note or something that I need to apply ?
    PS : I am using REUSE_ALV_GRID_DISPLAY to display the report and I am building the fieldcatalog manually
    Eg :
    CLEAR r_fieldcatalog.
      MOVE 'TB_OUTPUT'  TO r_fieldcatalog-tabname.
      MOVE 'BUKRS'      TO r_fieldcatalog-fieldname.
      MOVE 'VBAK'       TO r_fieldcatalog-ref_tabname.
      MOVE 'BUKRS_VF'   TO r_fieldcatalog-ref_fieldname.
      MOVE text-f01     TO r_fieldcatalog-seltext_s.
      MOVE text-f01     TO r_fieldcatalog-seltext_m.
      MOVE text-f01     TO r_fieldcatalog-seltext_l.
      add '1' to lv_col_pos .
      move lv_col_pos to r_fieldcatalog-col_pos .
      APPEND r_fieldcatalog TO tc_fieldcatalog.
      CLEAR r_fieldcatalog.
      MOVE 'TB_OUTPUT'  TO r_fieldcatalog-tabname.
      MOVE 'VKORG'      TO r_fieldcatalog-fieldname.
      MOVE 'VBAK'       TO r_fieldcatalog-ref_tabname.
      MOVE 'VKORG'      TO r_fieldcatalog-ref_fieldname.
      MOVE text-f02     TO r_fieldcatalog-seltext_s.
      MOVE text-f02     TO r_fieldcatalog-seltext_m.
      MOVE text-f02     TO r_fieldcatalog-seltext_l.
      add '1' to lv_col_pos .
      move lv_col_pos to r_fieldcatalog-col_pos .
      APPEND r_fieldcatalog     TO tc_fieldcatalog.
    Thanks in advance,
    Shareen

      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_pf_status_set = 'ALV_PF_STATUS'
          i_callback_program       = sy-repid
          is_layout                = gs_layout
          it_fieldcat              = gt_fieldcat[]
          i_default                = ' '
          i_save                   = g_save
        TABLES
          t_outtab                 = it_tab
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
    and beneath this just put a form.as its shown.
    FORM alv_pf_status USING l_alv_excl TYPE STANDARD TABLE.
      SET PF-STATUS 'STANDARD_FULLSCREEN' "excluding lt_extab
                    OF PROGRAM 'SAPLSETB'.
    ENDFORM.                    "alv_pf_status

  • Total in REUSE_ALV_GRID_DISPLAY

    Hi,
    If we CHECK total option in REUSE_ALV_GRID_DISPLAY we get a total of numeric value with yellow color at the bottom.
    Requirement:
    Let say I have 3 line item records in the display, with 20 fields and one amount field. So I get the total of the amount field. Apart from that I want the Total number of LINE ITEMS to get displayed on that line. Is that possible . How?
    Thanks in Advance.

    Just call Reuse_alv_list_display instead of gris. Rest of functionality is same.
    *& Report  ZDEMO_ALVGRID                                               *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic requirement for this demo is to display a number of       *
    *& fields from the EKKO table.                                         *
    REPORT  zdemo_alvgrid                 .
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    * There are a number of ways to create a fieldcat.
    * For the purpose of this example i will build the fieldcatalog manualy
    * by populating the internal table fields individually and then
    * appending the rows. This method can be the most time consuming but can
    * also allow you  more control of the final product.
    * Beware though, you need to ensure that all fields required are
    * populated. When using some of functionality available via ALV, such as
    * total. You may need to provide more information than if you were
    * simply displaying the result
    *               I.e. Field type may be required in-order for
    *                    the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    *  fieldcatalog-do_sum      = 'X'.
    *  fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15. 
      fieldcatalog-do_sum      = 'X'        "Display column total
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    *  gd_layout-totals_only        = 'X'.
    *  gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
    *                                         "click(press f2)
    *  gd_layout-zebra             = 'X'.
    *  gd_layout-group_change_edit = 'X'.
    *  gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
    *            i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
    *            i_callback_user_command = 'USER_COMMAND'
    *            i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
    *            it_special_groups       = gd_tabgroup
    *            IT_EVENTS                = GT_XEVENTS
                i_save                  = 'X'
    *            is_variant              = z_template
           tables
                t_outtab                = it_ekko
           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_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into table it_ekko.
    endform.                    " DATA_RETRIEVAL

  • Checkbox field in ALV for REUSE_ALV_GRID_DISPLAY

    how to handle Checkbox field in ALV for REUSE_ALV_GRID_DISPLAY????
    For example Alv has displayed 400 entries if user checks 4 entries and wants to donwload only those 4 entries from ALV using Copy to local file option then how should it be done. please provide some help...

    REPORT  YHRMR_LTC_TAXABLE NO STANDARD PAGE HEADING LINE-SIZE 120.
    TYPE-POOLS: SLIS.
    Start of Data Declaration                                            *
    DATA: G_PLVAR               TYPE PLVAR.
    DATA: P_MONTH               TYPE TFMATAGE.
    DATA: TOTAL_NO              TYPE I.
    DATA: TOTAL_NO_SUM          TYPE I.
    DATA: COUNT_15              TYPE I.
    DATA: COUNT_15_SUM          TYPE I.
    DATA: COUNT_LTC             TYPE I.
    DATA: COUNT_LTC_SUM         TYPE I.
    DATA: COUNT_ERROR_IT15      TYPE I.
    DATA: COUNT_ERROR_IT15_SUM  TYPE I.
    DATA: COUNT_ERROR_LTC       TYPE I.
    DATA: COUNT_ERROR_LTC_SUM   TYPE I.
    DATA: COUNT_ENTRY_IT15      TYPE I.
    DATA: COUNT_ENTRY_IT15_SUM  TYPE I.
    --LOCAL TABLE TYPE--
    DATA: T_DATA_LTC     LIKE YHRMT_LTC OCCURS 0 WITH HEADER LINE.
    DATA: T_DATA_LTC_NEW LIKE YHRMT_LTC OCCURS 0 WITH HEADER LINE.
    DATA: T_PA0015 LIKE PA0015 OCCURS 0 WITH HEADER LINE.
    DATA: T_P0015 LIKE PA0015 OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF T_FINAL OCCURS 0,
          CHECK_BOX(1),
          MANDT        TYPE MANDT,
          PERNR        TYPE PERSNO,
          ABKRS        TYPE ABKRS,
          PERSK        TYPE PERSK,
          WAGETYPE     TYPE LGART,
          LTCSTART     TYPE YAJAHR,
          LTCEND       TYPE YYAJAHR,
          FLAG         TYPE YCHAR1,
          SEQNR        TYPE SEQNR,
          LEVSTART     TYPE URBEG,
          LEVEND       TYPE BDATU_052R,
          PAYDATE      TYPE YBEGDA,
          AMOUNTPAY    TYPE AMUNT,
          TAXYR        TYPE PHK_TAXYR,
          DOCUNO       TYPE YCHAR20,
          DOCUDATE     TYPE YENDDA,
          VOUCHNO      TYPE YCHAR20,
          APDATE       TYPE BPS_APPDA,
          CANCEL_MOD   TYPE YCANCELMOD,
          LTC_IND      TYPE ATZH1,
          APPL_TAG     TYPE YAPPTAG,
          CANCEL_DATE  TYPE AEDTM,
          CANCEL_USER  TYPE AENAM,
          LASTCHANGE   TYPE AEDTM,
          USERNAME     TYPE AENAM,
          END OF T_FINAL.
    DATA: BEGIN OF T_PA0001 OCCURS 0,
          PERNR LIKE PA0001-PERNR,
          ABKRS LIKE PA0001-ABKRS,
          END OF T_PA0001.
    --Message Part Declaration--
    DATA: BEGIN OF T_SUCCESS OCCURS 0,
          PERNR       TYPE PERSNO,
          MESSAGE(50) TYPE C,
          END OF T_SUCCESS.
    DATA: BEGIN OF T_ERROR OCCURS 0,
          PERNR       TYPE PERSNO,
          MESSAGE(50)  TYPE C,
          END OF T_ERROR.
    --TABLE TYPE OF SLIS TYPE-GROUP--
    DATA: G_FLD TYPE SLIS_T_FIELDCAT_ALV,
          G_EV TYPE SLIS_T_EVENT,
          G_SORT TYPE SLIS_T_SORTINFO_ALV,
          G_LST TYPE SLIS_T_LISTHEADER.
    DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
          GD_TAB_GROUP TYPE SLIS_T_SP_GROUP_ALV,
          GD_LAYOUT    TYPE SLIS_LAYOUT_ALV,
          I_EVENTS TYPE SLIS_T_EVENT,
          GD_REPID     LIKE SY-REPID.
    --STRUCTURE TYPE OF SLIS TYPE-GROUP--
    DATA: L_EV TYPE SLIS_ALV_EVENT.
    CONSTANTS : C_PF TYPE SLIS_FORMNAME VALUE 'PF_STATUS_SET',
                C_UCOM TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
    *---- Start Change by Bibek/Shankar Dated : 12-03-2008 via cmr no : J/08/03/062/1.
    DATA: L_ENDDATE   LIKE SY-DATUM.
    *---- End   Change by Bibek/Shankar Dated : 12-03-2008 via cmr no : J/08/03/062/1.
    End of Data Declaration                                              *
    Start of Selection screen Parameters                                 *
    SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-002.
    *START CHANGE BY SHAYARI ON 18.02.2008, CMR No.:- J/08/02/323
    PARAMETERS:P_ABKRS LIKE PA0001-ABKRS OBLIGATORY.
    *END CHANGE BY SHAYARI ON 18.02.2008,  CMR No.:- J/08/02/323
    *START CHANGE BY BIBEk Dt : 06.03.2008, CMR No.:- J/08/03/062/1
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 1.
    SELECTION-SCREEN COMMENT 1(78) TEXT-006 FOR FIELD P_LES.
    PARAMETER P_LES RADIOBUTTON GROUP RB1.
    SELECTION-SCREEN END OF LINE.
    *END CHANGE BY BIBEk Dt : 06.03.2008, CMR No.:- J/08/03/062/1
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 1.
    SELECTION-SCREEN COMMENT 1(78) TEXT-003 FOR FIELD P_ONE.
    PARAMETER P_ONE RADIOBUTTON GROUP RB1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 1.
    SELECTION-SCREEN COMMENT 1(78) TEXT-004 FOR FIELD P_TWO.
    PARAMETER P_TWO  RADIOBUTTON GROUP RB1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 1.
    SELECTION-SCREEN COMMENT 1(78) TEXT-005 FOR FIELD P_MORE.
    PARAMETER P_MORE RADIOBUTTON GROUP RB1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK A.
    End of Selection screen Parameters                                   *
    *Get Plan Version
    CALL FUNCTION 'RH_GET_PLVAR'
      IMPORTING
        PLVAR = G_PLVAR.
    PERFORM CLEAR.
    CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
      EXPORTING
        IV_DATE                   = SY-DATUM
    IMPORTING
      EV_MONTH_BEGIN_DATE       =
        EV_MONTH_END_DATE         = L_ENDDATE.
    SELECT *
      FROM YHRMT_LTC
      INTO TABLE T_DATA_LTC
    WHERE FLAG   = '1'
       AND WAGETYPE = '1640'
       AND LEVEND LE L_ENDDATE
       AND PAYDATE GE '20080101'.
    If SY-SUBRC <> 0.
    MESSAGE I398(00) with 'No Records to display '.
    ENDIF.
    DELETE T_DATA_LTC WHERE LEVEND = '00000000'.
    *START CHANGE BY BIBEk Dt : 06.03.2008, CMR No.:- J/08/03/062/1
    *For Less Than One Month from Leave End Date
    IF P_LES = 'X'.
      LOOP AT T_DATA_LTC.
        CLEAR P_MONTH.
        CALL FUNCTION 'HR_AUPBS_MONTH_DAY'
          EXPORTING
            BEG_DA   = T_DATA_LTC-LEVEND
            END_DA   = SY-DATUM
          IMPORTING
            NO_MONTH = P_MONTH.
        IF P_MONTH LT '1'.
          T_FINAL-MANDT       =  T_DATA_LTC-MANDT.
          T_FINAL-PERNR       =  T_DATA_LTC-PERSONNELNO.
          T_FINAL-PERSK       =  T_DATA_LTC-PERSK.
          T_FINAL-WAGETYPE    =  T_DATA_LTC-WAGETYPE.
          T_FINAL-LTCSTART    =  T_DATA_LTC-LTCSTART.
          T_FINAL-LTCEND      =  T_DATA_LTC-LTCEND.
          T_FINAL-FLAG        =  T_DATA_LTC-FLAG.
          T_FINAL-SEQNR       =  T_DATA_LTC-SEQNR.
          T_FINAL-LEVSTART    =  T_DATA_LTC-LEVSTART.
          T_FINAL-LEVEND      =  T_DATA_LTC-LEVEND.
          T_FINAL-PAYDATE     =  T_DATA_LTC-PAYDATE.
          T_FINAL-AMOUNTPAY   =  T_DATA_LTC-AMOUNTPAY.
          T_FINAL-TAXYR       =  T_DATA_LTC-TAXYR.
          T_FINAL-DOCUNO      =  T_DATA_LTC-DOCUNO.
          T_FINAL-DOCUDATE    =  T_DATA_LTC-DOCUDATE.
          T_FINAL-VOUCHNO     =  T_DATA_LTC-VOUCHNO.
          T_FINAL-APDATE      =  T_DATA_LTC-APDATE.
          T_FINAL-CANCEL_MOD  =  T_DATA_LTC-CANCEL_MOD.
          T_FINAL-LTC_IND     =  T_DATA_LTC-LTC_IND.
          T_FINAL-APPL_TAG    =  T_DATA_LTC-APPL_TAG.
          T_FINAL-CANCEL_DATE =  T_DATA_LTC-CANCEL_DATE.
          T_FINAL-CANCEL_USER =  T_DATA_LTC-CANCEL_USER.
          T_FINAL-LASTCHANGE  =  T_DATA_LTC-LASTCHANGE.
          T_FINAL-USERNAME    =  T_DATA_LTC-USERNAME.
          APPEND T_FINAL.
          CLEAR  T_FINAL.
        ENDIF.
      ENDLOOP.
    *For One Month from Leave End Date
    ELSEIF P_ONE = 'X'.
      LOOP AT T_DATA_LTC.
        CLEAR P_MONTH.
        CALL FUNCTION 'HR_AUPBS_MONTH_DAY'
          EXPORTING
            BEG_DA   = T_DATA_LTC-LEVEND
            END_DA   = SY-DATUM
          IMPORTING
            NO_MONTH = P_MONTH.
        IF P_MONTH EQ '1' AND P_MONTH LT '2'.
          T_FINAL-MANDT       =  T_DATA_LTC-MANDT.
          T_FINAL-PERNR       =  T_DATA_LTC-PERSONNELNO.
          T_FINAL-PERSK       =  T_DATA_LTC-PERSK.
          T_FINAL-WAGETYPE    =  T_DATA_LTC-WAGETYPE.
          T_FINAL-LTCSTART    =  T_DATA_LTC-LTCSTART.
          T_FINAL-LTCEND      =  T_DATA_LTC-LTCEND.
          T_FINAL-FLAG        =  T_DATA_LTC-FLAG.
          T_FINAL-SEQNR       =  T_DATA_LTC-SEQNR.
          T_FINAL-LEVSTART    =  T_DATA_LTC-LEVSTART.
          T_FINAL-LEVEND      =  T_DATA_LTC-LEVEND.
          T_FINAL-PAYDATE     =  T_DATA_LTC-PAYDATE.
          T_FINAL-AMOUNTPAY   =  T_DATA_LTC-AMOUNTPAY.
          T_FINAL-TAXYR       =  T_DATA_LTC-TAXYR.
          T_FINAL-DOCUNO      =  T_DATA_LTC-DOCUNO.
          T_FINAL-DOCUDATE    =  T_DATA_LTC-DOCUDATE.
          T_FINAL-VOUCHNO     =  T_DATA_LTC-VOUCHNO.
          T_FINAL-APDATE      =  T_DATA_LTC-APDATE.
          T_FINAL-CANCEL_MOD  =  T_DATA_LTC-CANCEL_MOD.
          T_FINAL-LTC_IND     =  T_DATA_LTC-LTC_IND.
          T_FINAL-APPL_TAG    =  T_DATA_LTC-APPL_TAG.
          T_FINAL-CANCEL_DATE =  T_DATA_LTC-CANCEL_DATE.
          T_FINAL-CANCEL_USER =  T_DATA_LTC-CANCEL_USER.
          T_FINAL-LASTCHANGE  =  T_DATA_LTC-LASTCHANGE.
          T_FINAL-USERNAME    =  T_DATA_LTC-USERNAME.
          APPEND T_FINAL.
          CLEAR  T_FINAL.
        ENDIF.
      ENDLOOP.
    *For Two Month from Leave End Date
    ELSEIF P_TWO = 'X'.
      LOOP AT T_DATA_LTC.
        CLEAR P_MONTH.
        CALL FUNCTION 'HR_AUPBS_MONTH_DAY'
          EXPORTING
            BEG_DA   = T_DATA_LTC-LEVEND
            END_DA   = SY-DATUM
          IMPORTING
            NO_MONTH = P_MONTH.
        IF P_MONTH EQ '2' AND P_MONTH LT '3'.
          T_FINAL-MANDT       =  T_DATA_LTC-MANDT.
          T_FINAL-PERNR       =  T_DATA_LTC-PERSONNELNO.
          T_FINAL-PERSK       =  T_DATA_LTC-PERSK.
          T_FINAL-WAGETYPE    =  T_DATA_LTC-WAGETYPE.
          T_FINAL-LTCSTART    =  T_DATA_LTC-LTCSTART.
          T_FINAL-LTCEND      =  T_DATA_LTC-LTCEND.
          T_FINAL-FLAG        =  T_DATA_LTC-FLAG.
          T_FINAL-SEQNR       =  T_DATA_LTC-SEQNR.
          T_FINAL-LEVSTART    =  T_DATA_LTC-LEVSTART.
          T_FINAL-LEVEND      =  T_DATA_LTC-LEVEND.
          T_FINAL-PAYDATE     =  T_DATA_LTC-PAYDATE.
          T_FINAL-AMOUNTPAY   =  T_DATA_LTC-AMOUNTPAY.
          T_FINAL-TAXYR       =  T_DATA_LTC-TAXYR.
          T_FINAL-DOCUNO      =  T_DATA_LTC-DOCUNO.
          T_FINAL-DOCUDATE    =  T_DATA_LTC-DOCUDATE.
          T_FINAL-VOUCHNO     =  T_DATA_LTC-VOUCHNO.
          T_FINAL-APDATE      =  T_DATA_LTC-APDATE.
          T_FINAL-CANCEL_MOD  =  T_DATA_LTC-CANCEL_MOD.
          T_FINAL-LTC_IND     =  T_DATA_LTC-LTC_IND.
          T_FINAL-APPL_TAG    =  T_DATA_LTC-APPL_TAG.
          T_FINAL-CANCEL_DATE =  T_DATA_LTC-CANCEL_DATE.
          T_FINAL-CANCEL_USER =  T_DATA_LTC-CANCEL_USER.
          T_FINAL-LASTCHANGE  =  T_DATA_LTC-LASTCHANGE.
          T_FINAL-USERNAME    =  T_DATA_LTC-USERNAME.
          APPEND T_FINAL.
          CLEAR  T_FINAL.
        ENDIF.
      ENDLOOP.
    *For More than Two Month from Leave End Date
    ELSEIF P_MORE = 'X'.
      LOOP AT T_DATA_LTC.
        CLEAR P_MONTH.
        CALL FUNCTION 'HR_AUPBS_MONTH_DAY'
          EXPORTING
            BEG_DA   = T_DATA_LTC-LEVEND
            END_DA   = SY-DATUM
          IMPORTING
            NO_MONTH = P_MONTH.
        IF P_MONTH GT '2' .
          T_FINAL-MANDT       =  T_DATA_LTC-MANDT.
          T_FINAL-PERNR       =  T_DATA_LTC-PERSONNELNO.
          T_FINAL-PERSK       =  T_DATA_LTC-PERSK.
          T_FINAL-WAGETYPE    =  T_DATA_LTC-WAGETYPE.
          T_FINAL-LTCSTART    =  T_DATA_LTC-LTCSTART.
          T_FINAL-LTCEND      =  T_DATA_LTC-LTCEND.
          T_FINAL-FLAG        =  T_DATA_LTC-FLAG.
          T_FINAL-SEQNR       =  T_DATA_LTC-SEQNR.
          T_FINAL-LEVSTART    =  T_DATA_LTC-LEVSTART.
          T_FINAL-LEVEND      =  T_DATA_LTC-LEVEND.
          T_FINAL-PAYDATE     =  T_DATA_LTC-PAYDATE.
          T_FINAL-AMOUNTPAY   =  T_DATA_LTC-AMOUNTPAY.
          T_FINAL-TAXYR       =  T_DATA_LTC-TAXYR.
          T_FINAL-DOCUNO      =  T_DATA_LTC-DOCUNO.
          T_FINAL-DOCUDATE    =  T_DATA_LTC-DOCUDATE.
          T_FINAL-VOUCHNO     =  T_DATA_LTC-VOUCHNO.
          T_FINAL-APDATE      =  T_DATA_LTC-APDATE.
          T_FINAL-CANCEL_MOD  =  T_DATA_LTC-CANCEL_MOD.
          T_FINAL-LTC_IND     =  T_DATA_LTC-LTC_IND.
          T_FINAL-APPL_TAG    =  T_DATA_LTC-APPL_TAG.
          T_FINAL-CANCEL_DATE =  T_DATA_LTC-CANCEL_DATE.
          T_FINAL-CANCEL_USER =  T_DATA_LTC-CANCEL_USER.
          T_FINAL-LASTCHANGE  =  T_DATA_LTC-LASTCHANGE.
          T_FINAL-USERNAME    =  T_DATA_LTC-USERNAME.
          APPEND T_FINAL.
          CLEAR  T_FINAL.
        ENDIF.
      ENDLOOP.
    ENDIF.
    ****Payroll Area Put
    SELECT PERNR ABKRS FROM PA0001
    INTO CORRESPONDING FIELDS OF TABLE T_PA0001
    FOR ALL ENTRIES IN T_FINAL
    WHERE PERNR = T_FINAL-PERNR
    AND ABKRS = P_ABKRS
    AND BEGDA LE SY-DATUM
    AND ENDDA GE SY-DATUM.
    LOOP AT T_FINAL.
      READ TABLE T_PA0001 WITH KEY PERNR = T_FINAL-PERNR.
      IF SY-SUBRC = 0.
        T_FINAL-ABKRS = T_PA0001-ABKRS.
        MODIFY T_FINAL.
        CLEAR  T_FINAL.
      ENDIF.
    ENDLOOP.
    CLEAR T_FINAL.
    DELETE T_FINAL WHERE ABKRS = ''.
    *Output Form ALV List
    PERFORM ALV.
    *&      Form  ALV
    FORM ALV .
      PERFORM BUILD_FIELDCATALOG.
      PERFORM BUILD_EVENT.
      PERFORM DISPLAY_DATA.
    ENDFORM.                    " ALV
    *&      Form  BUILD_FIELDCATALOG
    FORM BUILD_FIELDCATALOG .
      FIELDCATALOG-TABNAME     = 'T_FINAL'.
      FIELDCATALOG-FIELDNAME   = 'PERNR'.
      FIELDCATALOG-SELTEXT_M   = 'Personnel number'.
      FIELDCATALOG-COL_POS     = 1.
      FIELDCATALOG-OUTPUTLEN   = 17.
      APPEND FIELDCATALOG TO FIELDCATALOG.
      CLEAR  FIELDCATALOG.
      FIELDCATALOG-TABNAME     = 'T_FINAL'.
      FIELDCATALOG-FIELDNAME   = 'ABKRS'.
      FIELDCATALOG-SELTEXT_M   = 'Payroll Area'.
      FIELDCATALOG-COL_POS     = 2.
      FIELDCATALOG-OUTPUTLEN   = 17.
      APPEND FIELDCATALOG TO FIELDCATALOG.
      CLEAR  FIELDCATALOG.
      FIELDCATALOG-TABNAME     = 'T_FINAL'.
      FIELDCATALOG-FIELDNAME   = 'LTCSTART'.
      FIELDCATALOG-SELTEXT_M   = 'LTC Start year'.
      FIELDCATALOG-COL_POS     = 3.
      FIELDCATALOG-OUTPUTLEN   = 15.
      APPEND FIELDCATALOG TO FIELDCATALOG.
      CLEAR  FIELDCATALOG.
      FIELDCATALOG-TABNAME     = 'T_FINAL'.
      FIELDCATALOG-FIELDNAME   = 'LTCEND'.
      FIELDCATALOG-SELTEXT_M   = 'LTC End year'.
      FIELDCATALOG-COL_POS     = 4.
      FIELDCATALOG-OUTPUTLEN   = 15.
      APPEND FIELDCATALOG TO FIELDCATALOG.
      CLEAR  FIELDCATALOG.
      FIELDCATALOG-TABNAME     = 'T_FINAL'.
      FIELDCATALOG-FIELDNAME   = 'LEVSTART'.
      FIELDCATALOG-SELTEXT_M   = 'Start of leave'.
      FIELDCATALOG-COL_POS     = 5.
      FIELDCATALOG-OUTPUTLEN   = 15.
      APPEND FIELDCATALOG TO FIELDCATALOG.
      CLEAR  FIELDCATALOG.
      FIELDCATALOG-TABNAME     = 'T_FINAL'.
      FIELDCATALOG-FIELDNAME   = 'LEVEND'.
      FIELDCATALOG-SELTEXT_M   = 'End of leave'.
      FIELDCATALOG-COL_POS     = 6.
      FIELDCATALOG-OUTPUTLEN   = 15.
      APPEND FIELDCATALOG TO FIELDCATALOG.
      CLEAR  FIELDCATALOG.
      FIELDCATALOG-TABNAME     = 'T_FINAL'.
      FIELDCATALOG-FIELDNAME   = 'AMOUNTPAY'.
      FIELDCATALOG-SELTEXT_M   = 'Amount'.
      FIELDCATALOG-DO_SUM      = 'X'.
      FIELDCATALOG-COL_POS     = 7.
      FIELDCATALOG-OUTPUTLEN   = 13.
      APPEND FIELDCATALOG TO FIELDCATALOG.
      CLEAR  FIELDCATALOG.
      FIELDCATALOG-TABNAME     = 'T_FINAL'.
      FIELDCATALOG-FIELDNAME   = 'PAYDATE'.
      FIELDCATALOG-SELTEXT_M   = 'Payment Date'.
      FIELDCATALOG-COL_POS     = 8.
      FIELDCATALOG-OUTPUTLEN   = 15.
      APPEND FIELDCATALOG TO FIELDCATALOG.
      CLEAR  FIELDCATALOG.
      FIELDCATALOG-TABNAME     = 'T_FINAL'.
      FIELDCATALOG-FIELDNAME   = 'APPL_TAG'.
      FIELDCATALOG-SELTEXT_M   = 'Application Tag '.
      FIELDCATALOG-COL_POS     = 9.
      FIELDCATALOG-OUTPUTLEN   = 15.
      APPEND FIELDCATALOG TO FIELDCATALOG.
      CLEAR  FIELDCATALOG.
    *Check Box Field Add
      CLEAR GD_LAYOUT.
      GD_LAYOUT-BOX_FIELDNAME = 'CHECK_BOX'.
      GD_LAYOUT-BOX_TABNAME = 'T_FINAL'.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_EVENT
    FORM BUILD_EVENT .
    *Event Handler
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE     = 0
        IMPORTING
          ET_EVENTS       = G_EV
        EXCEPTIONS
          LIST_TYPE_WRONG = 1
          OTHERS          = 2.
      IF SY-SUBRC <> 0.
      ELSE.
        READ TABLE G_EV INTO L_EV WITH KEY NAME = SLIS_EV_PF_STATUS_SET.
        IF SY-SUBRC = 0.
          MOVE C_PF TO L_EV-FORM.
          MODIFY G_EV FROM L_EV INDEX SY-TABIX TRANSPORTING FORM.
        ENDIF.
        READ TABLE G_EV INTO L_EV WITH KEY NAME = SLIS_EV_USER_COMMAND.
        IF SY-SUBRC = 0.
          MOVE C_UCOM TO L_EV-FORM.
          MODIFY G_EV FROM L_EV INDEX SY-TABIX TRANSPORTING FORM.
        ENDIF.
      ENDIF.
    ENDFORM.                    " BUILD_EVENT
    *&      Form  DISPLAY_DATA
    FORM DISPLAY_DATA .
      GD_REPID = SY-REPID.
      CLEAR I_EVENTS. REFRESH I_EVENTS.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = GD_REPID
          I_CALLBACK_PF_STATUS_SET = C_PF
          I_CALLBACK_USER_COMMAND  = C_UCOM
          IS_LAYOUT                = GD_LAYOUT
          IT_FIELDCAT              = FIELDCATALOG[]
          IT_EVENTS                = G_EV
        TABLES
          T_OUTTAB                 = T_FINAL.
    ENDFORM.                    " DISPLAY_DATA
          FORM PF_STATUS_SET                                            *
    FORM PF_STATUS_SET USING RX_TAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'LTC'.
    ENDFORM.                    "PF_STATUS_SET
          FORM USER_COMMAND                                             *
    FORM USER_COMMAND USING R_UCOM LIKE SY-UCOMM
                            RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOM.
        WHEN 'POST'.
          PERFORM POST_IT15_LTC_TABLE.
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    *&      Form  POST_IT15_LTC_TABLE
    FORM POST_IT15_LTC_TABLE .
    ENDFORM.                    " POST_IT15_LTC_TABLE
    *&      Form  clear
    FORM CLEAR .
      CLEAR   T_DATA_LTC.
      REFRESH T_DATA_LTC.
      CLEAR   T_DATA_LTC_NEW.
      REFRESH T_DATA_LTC_NEW.
      CLEAR   T_FINAL.
      REFRESH T_FINAL.
      CLEAR   T_PA0015.
      REFRESH T_PA0015.
      CLEAR   T_SUCCESS.
      REFRESH T_SUCCESS.
      CLEAR   T_ERROR.
      REFRESH T_ERROR.
      CLEAR G_PLVAR.
      CLEAR P_MONTH.
      CLEAR COUNT_15.
      CLEAR COUNT_15_SUM.
      CLEAR COUNT_LTC.
      CLEAR COUNT_LTC_SUM.
      CLEAR TOTAL_NO.
      CLEAR TOTAL_NO_SUM.
      CLEAR COUNT_ERROR_IT15.
      CLEAR COUNT_ERROR_IT15_SUM.
      CLEAR COUNT_ERROR_LTC.
      CLEAR COUNT_ERROR_LTC_SUM.
      CLEAR COUNT_ENTRY_IT15.
      CLEAR COUNT_ENTRY_IT15_SUM.
    ENDFORM.                    " clear

  • F4 help in ALV report output  (FM REUSE_ALV_GRID_DISPLAY)

    Hello,
    I have developed ALV report using the FM REUSE_ALV_GRID_DISPLAY.
    My requirement is to have a customized search help on the output of ALV on one field.
    I tried to find it on SDN but all the methods are using OO ALV.
    How we can attaché customized search help in ALV developed using the FM REUSE_ALV_GRID_DISPLAY.
    Kindly Help
    Regards
    Sachin

    Hii..
    If you use OO then it is very easy to create a F4 help on the ALV..
    try this sample code
    <removed by moderator>
    Hope this will help u..
    Regards,
    Jhings
    Moderator message: please post only relevant code parts, your post must be less than 5000 characters to preserve formatting.
    Edited by: Thomas Zloch on Mar 28, 2011 12:51 PM

  • Button in ALV toolbar with REUSE_ALV_GRID_DISPLAY

    Hello friends,
    I am Displaying ALV using REUSE_ALV_GRID_IDSPLAY. i need to add a button in grid toolbar.
    i am doing it by adding a new ZSTATUS in  SET PF_STATUS. but the problem is that it is removing the standard buttons.
    i want to add button without removing the standard butttons.
    Please help.
    thanx in advance.
    Krishan Kumar

    hai friends.......
                       i had tried to add custom button to the reuse_alv_grid_display.please send  the coding...
    REPORT  ZHAJI_SAMPLE.
    tables:lfa1.
    TYPE-POOLS : slis.
    SELECT-OPTIONS: lifnr FOR lfa1-lifnr.
    types:begin of fs,
          flag type c,
          lifnr type lfa1-lifnr,
          land1 type lfa1-land1,
          name1 type lfa1-name1,
          end of fs.
    data: itab type table of fs,
          wa type fs.
    data: fcat type slis_t_fieldcat_alv,
          fcat1 type slis_fieldcat_alv.
    data: rt_extab type slis_t_extab.
    *CONSTANTS : c_check(1) VALUE 'X'.
    select lifnr land1 name1 from lfa1 into corresponding FIELDS OF table
    itab where lifnr IN
    lifnr.
    perform sub.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = 'sy-repid'
       I_CALLBACK_PF_STATUS_SET           = 'PF'
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
    I_GRID_TITLE                      = 'vendor details'
      I_GRID_SETTINGS                   =
    IS_LAYOUT                         = LAYOUT
       IT_FIELDCAT                       = fcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
    IT_EVENTS                         = I_EVENT
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          = itab
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    form sub.
    fcat1-fieldname = 'FLAG'.
    fcat1-tabname = 'TAB'.
    *fcat1-COL_POS = 1.
    fcat1-checkbox = 'X'.
    fcat1-edit         = 'X'.
    append fcat1 to fcat.
    CLEAR FCAT1.
    fcat1-fieldname = 'LIFNR'.
    fcat1-ref_tabname = 'LFA1'.
    fcat1-ref_fieldname = 'LIFNR'.
    FCAT1-outputlen = 10.
    append fcat1 to fcat.
    CLEAR FCAT1.
    fcat1-fieldname = 'NAME1'.
    fcat1-ref_tabname = 'LFA1'.
    fcat1-ref_fieldname = 'NAME1'.
    append fcat1 to fcat.
    CLEAR FCAT1.
    fcat1-fieldname = 'LAND1'.
    fcat1-ref_tabname = 'LFA1'.
    fcat1-ref_fieldname = 'LAND1'.
    append fcat1 to fcat.
    CLEAR FCAT1.
    endform.
    form PF USING rt_extab TYPE slis_t_extab.
    SET PF-STATUS 'ZHAJI_P1' .
    ENDFORM.
    just give the fine coding

  • Button in alv grid cell using REUSE_ALV_GRID_DISPLAY

    Hi all,
      I want to make the contents of 2 columns of my alv grid as push button with values as text on it. I am not using classes or methods but alv grid fm. On clicking the button one dialog box has to pop up which gives edit option for the values in that coloumn, my question is how to introduce button in alv grid cell? if i can use t_fieldcatalog-icon, then please give me the complete steps for that.
    Thanks.

    this may helps u
    u need to copy stadard screen elemetn to MARATAB1(at PF -STATUS)
    You should copy the 'STANDARD' GUI status from program <b>SAPLSLVC_FULLSCREEN</b>
    type this one in SE41 program name is:<b>SAPLSLVC_FULLSCREEN</b>
    status : <b>STANDARD_FULLSCREEN</b>
    and copy it ...
             Type-pool
    type-pools slis.
             Tables
    tables: mara,sscrfields.
           Selection screen
    select-options: s_matnr for mara-matnr.
    PARAMETERS: p_email TYPE somlreci1-receiver.
    TYPES: BEGIN OF t_charmara,
      matnr(18)  TYPE c,                   " Material Number
      ernam(12)  TYPE c,                   " Person Credited
      aenam(12)  TYPE c,                   " Person Changed Object
      pstat(15)  TYPE c,                   " Maintenance Status
    END OF t_charmara.
             Data Declarations
    data: rt_extab    type slis_t_extab,   " Table of inactive function
                                           codes
          wa_charmara TYPE t_charmara,     " work area of mara Table
          fs_fieldcat type slis_t_fieldcat_alv,
                                           " Field catalog with field
                                           descriptions
          t_fieldcat  like line of fs_fieldcat,
                                           " Table of Field catalog
          r_ucomm     like sy-ucomm,       " User Command
          rs_selfield TYPE slis_selfield.  " cursor position ALV
    data: filedlayout   type slis_layout_alv,
          heading       type slis_t_listheader with header line,
          t_event       type slis_t_event.
    data: fs_event      like line of t_event.
    data: fs_sort type slis_sortinfo_alv,
           t_sort type slis_t_sortinfo_alv.
    data: w_char(200) type c,
          w_matnr     type mara-matnr.
    fs_sort-fieldname = 'MATNR'.
    fs_sort-up        = 'X'.
    fs_sort-group     = '*'.
    append fs_sort to t_sort.
    clear fS_sort.
    DATA:   t_packing_list  LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            t_contents      LIKE solisti1   OCCURS 0 WITH HEADER LINE,
            t_receivers     LIKE somlreci1  OCCURS 0 WITH HEADER LINE,
            t_attachment    LIKE solisti1   OCCURS 0 WITH HEADER LINE,
            t_object_header LIKE solisti1   OCCURS 0 WITH HEADER LINE,
            w_cnt           TYPE i,
            w_sent_all(1)   TYPE c,
            w_doc_data      LIKE sodocchgi1,
            gd_error        TYPE sy-subrc,
            gd_reciever     TYPE sy-subrc.
             Internal Tables
    data: begin of it_mara occurs 0,
            matnr like mara-matnr,         " Material Number
            ernam like mara-ernam,         " Person Credited
            aenam like mara-aenam,         " Person Changed Object
            pstat like mara-pstat,         " Maintenance Status
          end of it_mara.
    DATA:   it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    *at selection-screen on field event
    AT SELECTION-SCREEN on s_matnr.
    PERFORM f0100_VALIDATE_MATERIAL_NUMBER.
    start-of-selection.
    retrive Data from the data base table Mara
    perform retrive_data_from_mara.
    end-of-selection.
    *Field catalog with field descriptions
    perform fieldcat.
    *perform top_of_page.
    PERFORM EVENT_LIST.
    *ALV Grid Display
    perform alv_display.
    Creating one Push button ENTER
    perform maratab1 USING    RT_EXTAB.
    *&      Form  f0100_VALIDATE_MATERIAL_NUMBER
          text
    There are no interface parameters to be passed to this subroutine
    FORM F0100_VALIDATE_MATERIAL_NUMBER .
    select matnr                          " Material Number
       from mara
      up to 1 rows
       into mara-matnr
      where matnr in s_matnr.
      endselect.
    IF sy-subrc NE 0.
          clear sscrfields-ucomm.
          MESSAGE e000 WITH 'Enter valid Material number'(003).
        ENDIF.                             " IF sy-subrc NE 0
    ENDFORM.                               " f0100_VALIDATE_MATERIAL_NUMBER
    *&      Form  retrive_data_from_mara
          text
    *There are no interface parameters to be passed to this subroutine
    FORM retrive_data_from_mara .
    select   matnr                         " Material Number
             ernam                         " Person Credited
             aenam                         " Person Changed Object
             pstat                         " Maintenance Status
        from mara
        into table It_mara
       where matnr in s_matnr.
    IF sy-subrc NE 0.
          MESSAGE i001 WITH 'Records are not found'.
          exit.
          stop.
        ENDIF.                             " IF sy-subrc NE 0
    ENDFORM.                               " retrive_data_from_mara
    *&      Form  fieldcat
          text
    *There are no interface parameters to be passed to this subroutine
    FORM fieldcat .
    *field catalog for MATNR
      t_FIELDCAT-REF_TABNAME = 'MARA'.
      t_fieldcat-fieldname   = 'MATNR'.
      t_fieldcat-col_pos     = 1.
      append t_fieldcat to fs_fieldcat.
      clear t_fieldcat.
    *field catalog for ERNAM
      t_FIELDCAT-REF_TABNAME = 'MARA'.
      t_fieldcat-fieldname   = 'ERNAM'.
      t_fieldcat-col_pos     = 2.
      append t_fieldcat to fs_fieldcat.
      clear t_fieldcat.
    *field catalog for AENAM
      t_FIELDCAT-REF_TABNAME = 'MARA'.
      t_fieldcat-fieldname   = 'AENAM'.
      t_fieldcat-col_pos     = 3.
      append t_fieldcat to fs_fieldcat.
      clear t_fieldcat.
    *field catalog for PSTAT
      t_FIELDCAT-REF_TABNAME = 'MARA'.
      t_fieldcat-fieldname   = 'PSTAT'.
      t_fieldcat-col_pos     = 4.
      append t_fieldcat to fs_fieldcat.
      clear t_fieldcat.
    ENDFORM.                               " fieldcat
    *&      Form  EVENT_LIST
          text
    *There are no interface parameters to be passed to this subroutine
    FORM EVENT_LIST .
      fs_event-name ='TOP_OF_PAGE'.
      fs_event-form = 'TOP_PAGE'.
      append fs_event TO t_EVENT.
      CLEAR FS_EVENT.
      fs_event-name ='END_OF_PAGE'.
      fs_event-form = 'END_PAGE'.
      append fs_event TO t_EVENT.
      CLEAR FS_EVENT.
      fs_event-name ='END_OF_LIST'.
      fs_event-form = 'LIST_END'.
      append fs_event TO t_EVENT.
      CLEAR FS_EVENT.
    ENDFORM.                               " EVENT_LIST
    *&      Form  alv_display
          text
    *There are no interface parameters to be passed to this subroutine
    FORM alv_display .
    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       = 'MARATAB1'
       I_CALLBACK_USER_COMMAND        = 'USER_COMMAND'
      I_STRUCTURE_NAME               =
      IS_LAYOUT                      =
       IT_FIELDCAT                    = FS_FIELDCAT
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
       IT_SORT                        = T_SORT
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
       IT_EVENTS                      = T_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
      IR_SALV_LIST_ADAPTER           =
      IT_EXCEPT_QINFO                =
      I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    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.                               " alv_display
    form TOP_PAGE.
      data:tbl_listheader type slis_t_listheader,
            wa_listheader type slis_listheader .
       wa_listheader-typ = 'S'.
       wa_listheader-info = 'Created by : Vijay Pawar'.
       append wa_listheader to tbl_listheader.
       wa_listheader-typ = 'S'.
       concatenate ' Date ' sy-datum into
                  wa_listheader-info separated by space.
        append wa_listheader to tbl_listheader.
       wa_listheader-typ = 'S'.
       concatenate ' From ' s_matnr-low '  To  ' s_matnr-high into
                           wa_listheader-info separated by space.
       append wa_listheader to tbl_listheader.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = tbl_listheader
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    endform.                               " form TOP_PAGE.
    form END_PAGE.
      STATICS W_PAGE TYPE I .
      data:tbl_listheader type slis_t_listheader,
            wa_listheader type slis_listheader .
      wa_listheader-typ   = 'S'.
      wa_listheader-info  = W_PAGE.
      append wa_listheader to tbl_listheader.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = tbl_listheader
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    add 1 to w_page.
    endform.                               " form END_PAGE.
    form list_end.
      data:tbl_listheader type slis_t_listheader,
      wa_listheader type slis_listheader .
      wa_listheader-typ = 'S'.
      wa_listheader-info = '......................................Last Page'
      append wa_listheader to tbl_listheader.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = tbl_listheader
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    endform.                               " form list_end.
    *&      Form  maratab1
          text
         -->P_RT_EXTAB  text
    FORM maratab1  USING    P_RT_EXTAB.
      SET PF-STATUS 'MARATAB1' EXCLUDING rt_extab.
    ENDFORM.                               " maratab1
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                         rs_selfield TYPE slis_selfield.
    case r_ucomm.
       when 'ENTER'.
       perform bulid_xls_data_table.
       PERFORM send_file_as_email_attachment
                                      tables it_message
                                             it_attach
                                       using p_email "'[email protected]'
                                    'Example .xls documnet attachment'
                                             'XLS'
                                             'filename'
                                    changing gd_error
                                             gd_reciever.
        perform populate_email_message_body.
        PERFORM initiate_mail_execute_program.
      endcase.                             " case r_ucomm.
    endform.                               " FORM user_command
    perform populate_email_message_body.
    PERFORM initiate_mail_execute_program.
         CALL FUNCTION 'RH_START_EXCEL_WITH_DATA'
    EXPORTING
       DATA_FILENAME             = 'MARA.XLS'
       DATA_PATH_FLAG            = 'W'
      DATA_ENVIRONMENT          =
       DATA_TABLE                = ITAB[]
      MACRO_FILENAME            =
      MACRO_PATH_FLAG           = 'E'
      MACRO_ENVIRONMENT         =
       WAIT                      = 'X'
      DELETE_FILE               = 'X'
    EXCEPTIONS
       NO_BATCH                  = 1
       EXCEL_NOT_INSTALLED       = 2
       INTERNAL_ERROR            = 3
       CANCELLED                 = 4
       DOWNLOAD_ERROR            = 5
       NO_AUTHORITY              = 6
       FILE_NOT_DELETED          = 7
       OTHERS                    = 8
       IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       ENDIF.
       leave to list-processing.
    endcase.
    *&      Form  bulid_xls_data_table
          text
    *There are no interface parameters to be passed to this subroutine
    FORM bulid_xls_data_table .
    CONSTANTS: con_cret TYPE x VALUE '0D',  "OK for non Unicode
                con_tab TYPE x VALUE '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    constants:
        con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
        con_cret type c value cl_abap_char_utilities=>CR_LF.
      CONCATENATE 'matnr' 'ernam' 'aenam' 'pstat'
             INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
      LOOP AT It_mara INTO wa_charmara.
        CONCATENATE wa_charmara-matnr wa_charmara-ernam
                    wa_charmara-aenam wa_charmara-pstat
               INTO it_attach SEPARATED BY con_tab.
        CONCATENATE con_cret it_attach  INTO it_attach.
        APPEND  it_attach.
      ENDLOOP.                             " LOOP AT it_mara INTO...
    ENDFORM.                               " bulid_xls_data_table
    *&      Form  send_file_as_email_attachment
       Send email
         -->P_IT_MESSAGE  text
         -->P_IT_ATTACH  text
         -->P_P_EMAIL  text
         -->P_0387   text
         -->P_0388   text
         -->P_0389   text
         -->P_0390   text
         -->P_0391   text
         -->P_0392   text
         <--P_GD_ERROR  text
         <--P_GD_RECIEVER  text
    FORM send_file_as_email_attachment tables pit_message
                                              pit_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error               TYPE sy-subrc,
            ld_reciever            TYPE sy-subrc,
            ld_mtitle              LIKE sodocchgi1-obj_descr,
            ld_email               LIKE  somlreci1-receiver,
            ld_format              TYPE  so_obj_tp ,
            ld_attdescription      TYPE  so_obj_nam ,
            ld_attfilename         TYPE  so_obj_des ,
            ld_sender_address      LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver            LIKE  sy-subrc.
      ld_email               = p_email.
      ld_mtitle              = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = pit_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin  = space.
      t_packing_list-head_start  = 1.
      t_packing_list-head_num    = 0.
      t_packing_list-body_start  = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type    = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver   = ld_email.
      t_receivers-rec_type   = 'U'.
      t_receivers-com_type   = 'INT'.
      t_receivers-notif_del  = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.                               " send_file_as_email_attachment
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    FORM initiate_mail_execute_program.
      WAIT UP TO 2 SECONDS.
      SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
    ENDFORM.                               " INITIATE_MAIL_EXECUTE_PROGRAM
    *&      Form  POPULATE_EMAIL_MESSAGE_BODY
           Populate message body text
    form populate_email_message_body.
      REFRESH it_message.
      it_message = 'Please find attached a list test mara records'.
      APPEND it_message.
    endform.                               "form populate_email_message_bod
    rewards if it helps u

  • Set pf_status in REUSE_ALV_GRID_DISPLAY

    Hi All,
    I am using the 'i_callback_pf_status_set' from the FUNCTION 'REUSE_ALV_GRID_DISPLAY' and I see the output but the pf_status is not working. I donot see the buttin I created not even basic BACK and SAvE are working. When I activate the program I am getting the warning like '
    when you pass SY-REPID DIRECTLY, "I_CALLBACK_PROGRAM" is set to the name ot the function group "REUSE_ALV_GRID_DISPLAY"'.
    Please help me how to set the pf_status in the ALV.
    Thanks,
    Neelu.
    REPORT zppprice1 .
    TABLES: zppprice, kna1.
    * ALV Type-Pools                                                       *
    TYPE-POOLS:  slis.                                "Global types
    * ALV Structures                                                       *
    * ALV layout catalog
    DATA: s_alv_layout_cat          TYPE slis_layout_alv.
    * ALV Tables                                                           *
    * ALV field catalog
    DATA: it_alv_field_cat TYPE slis_t_fieldcat_alv,
    *occurs 0 with header line,
          i_fieldcat TYPE slis_fieldcat_alv OCCURS 0 WITH HEADER LINE,
          w_fieldcat LIKE LINE OF i_fieldcat.        "ALV FieldCat WorkArea
    * ALV sort catalog
    DATA: it_alv_sort_cat TYPE slis_sortinfo_alv OCCURS 0 WITH HEADER LINE.
    * ALV event catalog
    *data: it_alv_event_cat type slis_alv_event occurs 0 with header line.
    DATA: it_alv_event_cat TYPE slis_t_event,
          ls_alv_event TYPE slis_alv_event.
    DATA: t_list_top_of_page TYPE slis_t_listheader.
    TYPES: BEGIN OF slis_layout_alv.
    INCLUDE TYPE slis_layout_main.
    INCLUDE TYPE slis_layout_alv_spec.
    TYPES: END OF slis_layout_alv.
    DATA: gt_zprice TYPE TABLE OF zprice_struct,
          gs_zprice TYPE zprice_struct.
    DATA: chbox(1) TYPE c VALUE ' '.
    *SET PF-STATUS 'LIST'.
    *NEW-PAGE LINE-SIZE 158.
    SELECT kunnr matnr crdate efdate sprice
            eprice eohqty aohqty crmemo
            FROM zppprice
            INTO TABLE gt_zprice.
    PERFORM field_catalog.
    * Populate the layout catalog for alv
    PERFORM alv_layout.
    * Populate the event catalog for alv
    PERFORM alv_events.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       i_callback_program                = sy-repid
       i_callback_pf_status_set          = 'PF_STATUS'
       i_callback_user_command           = 'HANDLE_USER_COMMAND'
       is_layout                         = s_alv_layout_cat
       it_fieldcat                       = it_alv_field_cat
       i_default                         = 'X'
       i_save                            = 'A'
       it_events                         = it_alv_event_cat
      TABLES
        t_outtab                          = gt_zprice
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
    FORM field_catalog.
      DATA: ls_fieldcat TYPE slis_fieldcat_alv.
      ls_fieldcat-fieldname = 'CHBOX'.
      ls_fieldcat-checkbox = 'X'.
      ls_fieldcat-input = 'X'.
      ls_fieldcat-edit = 'X'.
      ls_fieldcat-seltext_s = 'BOX'.
      ls_fieldcat-seltext_l = 'BOX'.
      APPEND ls_fieldcat TO it_alv_field_cat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'KUNNR'.
      ls_fieldcat-seltext_s = 'Customer'.
      ls_fieldcat-seltext_l = 'Customer'.
    APPEND ls_fieldcat TO it_alv_field_cat.
    CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'MATNR'.
      ls_fieldcat-seltext_s = 'Material'.
      ls_fieldcat-seltext_l = 'Material'.
      APPEND ls_fieldcat TO it_alv_field_cat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'CRDATE'.
      ls_fieldcat-seltext_s = 'Creation date'.
      ls_fieldcat-seltext_l = 'Creation date'.
      APPEND ls_fieldcat TO it_alv_field_cat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'EFDATE'.
      ls_fieldcat-seltext_s = 'Effective date'.
      ls_fieldcat-seltext_l = 'Effective date'.
      APPEND ls_fieldcat TO it_alv_field_cat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'SPRICE'.
      ls_fieldcat-seltext_s = 'Old Price'.
      ls_fieldcat-seltext_l = 'Old Price'.
      APPEND ls_fieldcat TO it_alv_field_cat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'EPRICE'.
      ls_fieldcat-seltext_s = 'New Price'.
      ls_fieldcat-seltext_l = 'New Price'.
      APPEND ls_fieldcat TO it_alv_field_cat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'EOHQTY'.
      ls_fieldcat-seltext_s = 'Est. Qty'.
      ls_fieldcat-seltext_l = 'Est. Qty'.
      APPEND ls_fieldcat TO it_alv_field_cat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'AOHQTY'.
      ls_fieldcat-seltext_s = 'Act. Qty'.
      ls_fieldcat-seltext_l = 'Act. Qty'.
      APPEND ls_fieldcat TO it_alv_field_cat.
      CLEAR ls_fieldcat.
    ENDFORM.                    " field_catalog
    *&      Form  alv_layout
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM alv_layout.
    * Enable striped output display if user wants
      s_alv_layout_cat-zebra                = 'X'.
    * Optimize column width if user wants
      s_alv_layout_cat-colwidth_optimize    = 'X'.
      s_alv_layout_cat-box_fieldname        = space.
      s_alv_layout_cat-no_input             = 'X'.
    ENDFORM.                    " alv_layout
    *       FORM SET_PFSTATUS                                             *
    *  -->  EXTAB                                                         *
    FORM pf_status USING extab TYPE slis_t_extab.
      SET PF-STATUS 'LIST'.
    ENDFORM.
    *       FORM HANDLE_USER_COMMAND                                      *
    *  -->  I_UCOM                                                        *
    *  -->  IS_SELFIELD                                                   *
    FORM handle_user_command USING i_ucom TYPE sy-ucomm
                             is_selfield TYPE slis_selfield.
      CASE i_ucom.
        WHEN 'CMEMO'.
          LOOP AT  gt_zprice INTO gs_zprice WHERE chbox = 'X'.
          ENDLOOP.
      ENDCASE.
    ENDFORM.
    *&      Form  alv_events
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM alv_events.
    * Declare event catalog for page headers
      REFRESH: it_alv_event_cat.
      CLEAR ls_alv_event.
      ls_alv_event-name = 'PF_STATUS_SET'.
      ls_alv_event-form = 'PF_STATUS'.
      APPEND ls_alv_event TO it_alv_event_cat.
    * Declare event catalog for report footers
      CLEAR ls_alv_event.
      ls_alv_event-name = 'USER_COMMAND'.
      ls_alv_event-form = 'HANDLE_USER_COMMAND'.
      APPEND ls_alv_event TO it_alv_event_cat.
    ENDFORM.                    " alv_events

    Yes, do not pass SY-REPID directly, first move to a variable.
    data: repid type sy-repid.
    repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       i_callback_program                = repid
       i_callback_pf_status_set          = 'PF_STATUS'
       i_callback_user_command           = 'HANDLE_USER_COMMAND'
       is_layout                         = s_alv_layout_cat
       it_fieldcat                       = it_alv_field_cat
       i_default                         = 'X'
       i_save                            = 'A'
       it_events                         = it_alv_event_cat
      TABLES
        t_outtab                          = gt_zprice
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
    Regards,
    Rich Heilman

  • Filter is not working in ALV GRID output using FM 'REUSE_ALV_GRID_DISPLAY'

    Hello Experts,
    I have searched SCN before posting this thread.
    In my report output (by using 'REUSE_ALV_GRID_DISPLAY'), i am trying to filter values which is of type CHAR.
    Unable to filter by char30 field in the report output.
    Tried to filter using the following steps:
    Selected the column which i want to filter-> then selected filter symbol of ALV toolbar.
    Selection screen appeared where select-option of that field displayed.
    Selection screen only allows user to enter 1 character.
    Even though the field contains 30 characters the filed in selection screen appeared with 1char length.
    This is the same for all the fields in that ALV. Please suggest how can i change the field length to original field length.

    In field catalog pass:
    wa_alv_fieldcat-outputlen   = p_len
    Set p_len as 30.
    'FIELD'            text-001   '01' 'X'  '30'  'L'

  • How to display field value only once in REUSE_ALV_GRID_DISPLAY

    hi experts,
                   i am using REUSE_ALV_GRID_DISPLAY, for alv outpur display.but i want one of the field in output ,not to display the value which is of same, it have to be displayed only once, I mean i have a number which contains multiple line items corresponding, here i want to display the field value only once when it is repeating , for the same header number, how can i achieve it

    Hi,
    check the sample code,
    REPORT  Z_ALV.
    Database table declaration
    TABLES:
      sflight.
    Typepool declaration
    TYPE-POOLS:
      slis.
    Selection screen elements
    SELECTION-SCREEN BEGIN OF BLOCK blk_1 WITH FRAME TITLE text-000.
    SELECT-OPTIONS:
      s_carrid FOR sflight-carrid.
    SELECTION-SCREEN END OF BLOCK blk_1.
    Field string to hold sflight data
    DATA:
      BEGIN OF fs_sflight ,
        carrid   TYPE sflight-carrid,      " Carrier Id
        connid   TYPE sflight-connid,      " Connection No
        fldate   TYPE sflight-fldate,      " Flight date
        seatsmax TYPE sflight-seatsmax,    " Maximum seats
        seatsocc TYPE sflight-seatsocc,    " Occupied seats
      END OF fs_sflight.
    Internal table to hold sflight data
    DATA:
      t_sflight LIKE
       STANDARD TABLE
             OF fs_sflight .
    Work variables
    DATA:
      t_fieldcat TYPE  slis_t_fieldcat_alv,
      fs_fieldcat LIKE
             LINE OF t_fieldcat.
    *START-OF-SELECTION
    START-OF-SELECTION.
      PERFORM get_data_sflight.            " Getting data for display
      PERFORM create_field_cat.            " Create field catalog
      PERFORM alv_display.
    *&      Form  create_field_cat
          Subroutine to create field catalog
          There is no interface paramete
    FORM create_field_cat .
      PERFORM fill_fieldcat USING   'Carrier Id'    'CARRID'   '2'.
      PERFORM fill_fieldcat USING   'Connection No' 'CONNID'   '1'.
      PERFORM fill_fieldcat USING   'Flight Date'   'FLDATE'   '3'.
      PERFORM fill_fieldcat USING   'Maxm.Seats'    'SEATSMAX' '4'.
      PERFORM fill_fieldcat USING   'Seats Occ'     'SEATSOCC' '5'.
    ENDFORM.                                    "create_field_cat
    *&      Form  fill_fieldcat
          Subroutine to fill data to field column
         -->p_seltext      Column label
         -->p_fieldname    Fieldname of database table
         -->p_col_pos      Column position
    FORM fill_fieldcat  USING
                        p_seltext    LIKE fs_fieldcat-seltext_m
                        p_fieldname  LIKE fs_fieldcat-fieldname
                        p_col_pos    LIKE fs_fieldcat-col_pos.
      fs_fieldcat-seltext_m  = p_seltext.
      fs_fieldcat-fieldname  = p_fieldname.
      fs_fieldcat-col_pos    = p_col_pos.
      APPEND fs_fieldcat TO t_fieldcat.
      CLEAR fs_fieldcat.
    ENDFORM.                    " fill_fieldcat
    *&      Form  get_data_sflight
          Subroutine to fetch data from database table
          There is no interface parameter
    FORM get_data_sflight .
      SELECT carrid
             connid
             fldate
             seatsmax
             seatsocc
        FROM sflight
        INTO TABLE t_sflight
       WHERE carrid IN s_carrid.
    ENDFORM.                    " get_data_sflight
    *&      Form  alv_display
          Subroutine for ALV display
          There is no interface parameter
    FORM alv_display .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          it_fieldcat   = t_fieldcat
        TABLES
          t_outtab      = t_sflight
        EXCEPTIONS
          program_error = 1
          OTHERS        = 2.
      IF sy-subrc NE 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " alv_display
    End of code

  • How to EDIT a particular Row in ALV using normal function module Reuse_alv_grid_display

    Hi experts..
    i got one requirement like i need to edit some rows particularly in alv....
    Edit in alv output....is it possible to get  that .....using normal function module with out using oops concept...
    could any one pls help me...

    Hi Pendurti ,
    If you want a particular field to be editable , simply define the fieldcatalog as
    wa_fieldcatalog-edit          = 'X'.
    wa_fieldcatalog-input         = 'X'.
    for that field.
    and
    Now when you use FM ' Reuse alv grid display '
    define USER_COMMAND
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = v_repid
          i_callback_pf_status_set = 'SET_PF_STATUS'
          i_callback_user_command  = 'USER_COMMAND'
          it_fieldcat              = int_fieldcatalog
          is_layout                = wa_layout
        TABLES
          t_outtab                 = t_disp.
    and now in form USER_COMMAND ; code as per following
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                                rs_selfield TYPE slis_selfield.
         DATA ref1 TYPE REF TO cl_gui_alv_grid.
         CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
           IMPORTING
             e_grid = ref1.
         CALL METHOD ref1->check_changed_data.
    endform.
    Regards,
    Yogendra Bhaskar

  • REUSE_ALV_GRID_DISPLAY with editable field -- Recuperate new value

    Hi everybody,
    I try to explain my problem. I created an ALV grid with the function REUSE_ALV_GRID_DISPLAY and an internal table.
    The user can change the value of one field and can save it. Indeed, in debbug mode, I can see in the internal table the new value entered by the user. So I can do all the actions with the launch of a routine.
    But the user can forger to save his change. So, when he clicks on "Back" I want to propose him to save. THE PROBLEM : in debbug mode, when the routine is launched, the internal table does't have the new value..
    So have you got an idea to recuperate the new value?
    Thank you very much in advance.
    Best regards.

    I had the same problem and solved it: I used SET_TABLE_FOR_FIRST_DISPLAY.
    The MT_OUTPUT tab has the ALV data and the column in here must be modifed. Steps:
    data: p_grid  type ref to lcl_gui_alv_grid.
    Step 1. Create a sub class for LCL_GUI_ALV_GRID_DEFINITION.
    *       class lcl_gui_alv_grid  definitio
    CLASS lcl_gui_alv_grid DEFINITION
            INHERITING FROM cl_gui_alv_grid.
      PUBLIC SECTION.
        METHODS: update_outtab
                   IMPORTING i_good_cells TYPE lvc_t_modi.
    **             check_changed_data.
    ENDCLASS.                    "lcl_gui_alv_grid  DEFINITIO
    Step2
    Use event data_changed_finished of LCL_EVENT_RECEIVER
    *       CLASS lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
          handle_data_changed
             FOR EVENT data_changed OF cl_gui_alv_grid
                 IMPORTING er_data_changed,
          handle_data_change_finished    "****<----------
             FOR EVENT data_changed_finished OF cl_gui_alv_grid
                 IMPORTING e_modified et_good_cells,
          handle_double_click
             FOR EVENT double_click OF cl_gui_alv_grid
                 IMPORTING e_row e_column,
          handle_after_refresh
             FOR EVENT after_refresh OF cl_gui_alv_grid.
    *Implementation
    CLASS lcl_event_receiver IMPLEMENTATION.
    METHOD handle_data_change_finished.
        DATA: lt_goodcells TYPE lvc_t_modi.
        CHECK NOT e_modified IS INITIAL AND NOT et_good_cells IS INITIAL.
        lt_goodcells[] = et_good_cells[].
        CALL METHOD p_grid->update_outtab
          EXPORTING
            i_good_cells = lt_goodcells.
        CALL METHOD p_grid->refresh_table_display.
      ENDMETHOD.                    "data_changed_finished
    *-- ALV data updated in class implementation below
    CLASS lcl_gui_alv_grid IMPLEMENTATION.
      METHOD update_outtab.
        FIELD-SYMBOLS: <tab1> TYPE STANDARD TABLE,
                       <good> TYPE lvc_s_modi,
                       <fs1> TYPE ANY,
                       <fs2> TYPE ANY.
        DATA: ls_alv TYPE type_alv,
              fldabgru(32) TYPE c VALUE '<TAB1>-ABGRU_NEW',
              fldbezei(32) TYPE c VALUE '<TAB1>-BEZEI_NEW',
              lv_bezei TYPE bezei40.
        ASSIGN mt_outtab->* TO <tab1>.  "ALV display table
        LOOP AT i_good_cells ASSIGNING <good>.
          READ TABLE <tab1> INTO ls_alv INDEX <good>-row_id.
          IF sy-subrc EQ 0.
            SELECT SINGLE bezei INTO ls_alv-bezei_new
              FROM tvagt
              WHERE spras = sy-langu
                AND abgru = ls_alv-abgru_new.
            IF sy-subrc EQ 0.
              MODIFY <tab1> FROM ls_alv INDEX <good>-row_id.
            ENDIF.
          ENDIF.
        ENDLOOP.
      ENDMETHOD.                    "update_outtab

  • Issue in header display for reuse_alv_grid_display

    Hi All,
    I have a requirement to place the items as  shown below .
    Date:      29.03.2011                                     XXX text                                         System:  xxxx
    new text:   ZRV_XXX                                                                                some text : 
    User:      u15                           Report to display the material stock                               other comment :
    So it can be seen that the various text has to be placed as left aligned , centered and even right aligned in the top_of_page.
    But as im using grid display , im unable to place this data while using :
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = t_header.
    how can i populate the t_header table so that i can use the alignements a shown.
    I have read that I_CALLBACK_HTML_TOP_OF_PAGE can be used to align.
    Actually i want to make a function module which can be used in any report and FM make such alignements before using 'REUSE_ALV_COMMENTARY_WRITE'  in any object.
    Kindly help.

    Hi,
    Thanks for your replies. The problem is solved by using cl_dd_document class.
    I used tables of  TYPE REF TO cl_dd_table_element and coloumns of TYPE REF TO cl_dd_area.
    Such top of page can be achieved using
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
             i_callback_html_top_of_page       = 'HTML_TOP_OF_PAGE'
    and use the mentioned class in the form routine HTML_TOP_OF_PAGE.
    Edited by: ujjwal_d15 on Apr 12, 2011 11:57 AM

Maybe you are looking for