Filtering programatically in alv report

please let me know is it posible to filering in alv report.please respond immediately....

Hi anil,
here a short extract with 2 Filter-Parameters as i use:
DATA:  FILTER_1   TYPE SLIS_T_FILTER_ALV.
DATA: BEGIN OF ITEM_ALL  OCCURS 0,
      KUNNR  LIKE KNA1-KUNNR,
      VBELN  LIKE VBAP-VBELN,
      POSNR  LIKE VBAP-POSNR,
      MATNR  LIKE VBAP-MATNR,
      MATKL  LIKE MARA-MATKL,
      MAKTX  LIKE MAKT-MAKTX,
      KWMENG LIKE VBAP-KWMENG, "Menge Auftrag
      VRKME  LIKE VBAP-VRKME,
      RFMNGJ LIKE VBFA-RFMNG,  "Menge Lieferung
      RFMNGR LIKE VBFA-RFMNG,  "Menge Warenbewegung
      RFMNGM LIKE VBFA-RFMNG,  "Menge Faktura
      END   OF ITEM_ALL.
Filter für detail setzen
  WA_FILTER-TABNAME   = 'ITEM_ALL'.
  WA_FILTER-FIELDNAME = 'KUNNR'.
  WA_FILTER-SIGN0     = 'I'.
  WA_FILTER-OPTIO     = 'BT'.
  WA_FILTER-VALUF_INT = KUNNR. "From Kunnr
  WA_FILTER-VALUT_INT = KUNNR. "TO Kunnr
  APPEND WA_FILTER TO FILTER_1.
  WA_FILTER-TABNAME   = 'ITEM_ALL'.
  WA_FILTER-FIELDNAME = 'MATNR'.
  WA_FILTER-SIGN0     = 'I'.
  WA_FILTER-OPTIO     = 'BT'.
  WA_FILTER-VALUF_INT = MATNR. "From Matnr
  WA_FILTER-VALUT_INT = MATNR. "To Matnr
  APPEND WA_FILTER TO FILTER_1.
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
            I_CALLBACK_PROGRAM      = PROGNAME
            I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
            IT_FIELDCAT             = FIELDCAT_1
IT_FILTER = FILTER_1
            IT_EVENTS               = EVENTS
            IT_EVENT_EXIT           = EVENT_EXIT
            I_SCREEN_START_COLUMN   = 20
            I_SCREEN_START_LINE     = 05
            I_SCREEN_END_COLUMN     = 100
            I_SCREEN_END_LINE       = 30
       TABLES
            T_OUTTAB                = ITEM_ALL
       EXCEPTIONS
            PROGRAM_ERROR           = 1
            OTHERS                  = 2.
Regards, Dieter

Similar Messages

  • The filtering , sorting , totaling action on ALV report is lost

    Hi ,
    I have an Interactive ALV report which i sort it , filter it and total it before I enter into my Z customised screen, from my Z cusomised screen when I come back to the ALV report, the report is no more sorted, no more filtered and no more totaled.
    Please help me on this its a bit urgent.

    *& Report  ZALV_SUM
    REPORT  ZNNR_ALV_SUM.
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_vbap,
      vbeln TYPE vbap-vbeln,
      matnr TYPE vbap-matnr,
      netwr TYPE vbap-netwr,
      waerk TYPE vbap-waerk,
    END OF t_vbap.
    DATA: it_vbap TYPE STANDARD TABLE OF t_vbap INITIAL SIZE 0,
          wa_vbap TYPE t_vbap.
    *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.
      fieldcatalog-fieldname   = 'VBELN'.
      fieldcatalog-seltext_m   = 'Sales Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
      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   = 'NETWR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-do_sum      = 'X'.        "Display column total
      fieldcatalog-cfieldname     = 'WAERK'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'WAERK'.
      fieldcatalog-seltext_m   = 'Price Curr'.
      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_vbap
           exceptions
                program_error           = 1
                others                  = 2.
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select vbeln matnr netwr waerk
    up to 50 rows
      from vbap
      into table it_vbap.
    endform.                    " DATA_RETRIEVAL

  • Short dump while filtering an ALV report

    Hi ,
    I have an ALV report which gives me short dump when I filter any of the 'P' type field. I tried to implement sap note 839839 in debug mode but in vain. Should I implement this note first and then check the chnage?
    the short dump error "..........
    Error in ASSIGN: Memory protection error.                                                                               
    The current program "SAPLSSEL " uses the ASSIGN statement.              
    However, the offset of the segment (20208) plus the length (69)         
    is greater than the length of the segment (20264).                      
    This is not allowed.                                                                               
    If the error is in one of your own ABAP programs or an SAP program that          
    you have modified, try to correct it.                                            
    Reduce the offset and/or length that you are using.                                                                               
    If the error occurred in a non-modified SAP program, you may be                  
    able to find a solution in the SAP note system.                                  
    If you have access to the note system yourself, use the following                
    search criteria:                                                                               
    "ASSIGN_OFFSET+LENGTH_TOOLARGE"                                   
    "SAPLSSEL " or "LSSELFDI "                                        
    "FILL_DYN_FROM_FIELD_SEL"               ........."
    I appreciate ur inputs.
    thanks in advance,
    regards,
    shan

    Hi Guys,
    I found the answer. I had to define all P type fields with eaxact length of 16 . Its working fine.
    thanks for all your help.
    regards,
    shan

  • Set Filter in ALV report, blank screen returned

    I have a standard ALV report (uses REUSE_ALV_GRID_DISPLAY).  The user has to be able to filter the results based on entries from certain columns.
    When I try to filter any columns other than a column with a date a blank screen is returned.
    This filtering problem only exists with the Single value field. I can filter the results in the "select ranges", "exclude values" and "exclude ranges" without any problems.
    Any suggestions?
    Edited by: Damien Crowe on Jul 6, 2009 5:09 PM
    Set the fieldcatalog-edit_maskto "==ALPHA".
    Edited by: Damien Crowe on Jul 14, 2009 5:35 PM

    what was the solution to this problem?
    Thanks

  • Filter not working in ALV Report....

    Hi All,
    I have developed an ALV Report using REUSE_ALV_GRID_DISPLAY.
    Everything is working perfectly except Filtering...
    When i enter data for filtering, the ALV list will become empty. Then if i choose to delete the entry made in filter window, the filter input shows only first 4 digits of the entered value.......If i delete that value, again the data will be displayed in the ALV Screen.....
    All other standard Functions like sort, export to excel sheet are working fine...
    What might be the reason for this bug..?????
    Please Help me...
    Regards
    Pavan

    Thanks Prasanth,
    This is the code...
    It has been observed that few columns can be filtered...Like date, Quantity and few more...
    But there is a column for Production Order number, which can not be filtered...
    What might be the reason..?????
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program     = v_repid
            i_callback_top_of_page = 'TOP_OF_PAGE'
            is_layout              = gs_layout
            it_fieldcat            = gt_fieldcat[]
            it_sort                = t_sort[]
            i_default              = c_x
            is_variant             = v_variant
            i_save                 = c_a
            it_events              = t_events
            is_print               = wa_prntparams
          TABLES
            t_outtab               = i_aufk
          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.

  • Filter criteria in ALV report not working

    Hi,
    In ALV report , when i click on filter button , it does not filter the report according to the filtered criteria. this happens in the cases where the selection criteria is a lengthy field. when i debug after the filter criteria it goes into standard function.
    i am using REUSE_ALV_GRID_DISPLAY
    is there any way in which i can correct this?
    thanks,
    Amit
    null

    chk this useful thread
    Re: ALV problem (with filter use)

  • Can somebody give some real time questions for alv report

    hi guru
    can somebody give some real time questions for alv report.
    answers also.
    regards
    subhasis.

    hi,
    The ALV is a set of function modules and classes and their methods which are added to program code. Developers can use the functionality of the ALV in creating new reports,  saving time which might otherwise have been spent on report enhancement
    The common features of report are column    alignment, sorting, filtering, subtotals, totals etc. <b>To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).</b>
    Using ALV, we can have three types of reports:
       1. Simple Report
       2. Block Report
       3. Hierarchical Sequential Report
    <b>Reward useful points</b>
    Siva

  • How to print page numbers like 'Page 2 of 10' on an ALV report

    Hi,
    I've seen a few threads regarding this, but haven't seen any code that actually works. 
    What I'd like to do is print page x of y (i.e. Page 2 of 10) on an ALV report once the report is printed.
    Is this actually possible?  If so, what are the steps and coding required? 
    I greatly appreciate your help experts!
    Mark

    Hi Mark,
    I think there is no better way than calculate it before doing the output. If you do not have extra-new-page, the total number of pages may be calculated as the number of lines displayed divided by lines on one page - this will depend on the lines used for top-of-page and end-of-page. Also filters and subtotals could not be used.
    An other approach could be to read the current page number in end-of-list event and then scan the whole list using READ LIST and MODIFY LIST in each page top accordingly.
    Because it is decades ago I printed a list last time I will never have the chance to try.
    Regards,
    Clemens

  • Help needed regarding ALV report

    Hi,
    I have a query regarding ALV report.
    The requirement is as follows:-
    When the user executes the ALV report and if he sums one numeric field column values and filters out some of the field columns ( for example there r 5 columns in the report and the user has filtered out 2 of them and viewing only 3 columns)
    and now the requirements is that when the user runs the report later he should see the modified report ( i mean only 3 cloumns and the total value of the column which he has made) but not the original output which was there when the report was developed.
    First of all i wanna know is it possible to do r not. If yes then how
    Hope u have got what i want.
    eagerly waiting for ur reply.
    regards,
    maqsood

    Hi
    Yes you can! You have to manage the layout variant.
    So when you call your ALV you have to set the parameter I_SAVE = 'A'.
    In this way you'll allow the user to save the variants for layout.
    After you has to have a chance to choose the variant in selection-screen.
    See the demo program BCALV_GRID_11 to manage the variant in selection-screen.
    Max

  • Download ALV report with layout to application server

    Hi Gurus,
    I have a problem as follows:
    I have one ALV Grid report. This report is very time consuming.
    That is why, user wants this to be run in background every night and in the morning when user comes to the office that ALV report should be on user's drive in excel format.
    However, it should run with one specific variant and that variant should be dynamically populated. (I have handled this part)
    It should also apply specific layout that has many filtering conditions.
    As I can not download ALV to excel in background, I decided to download it to the Application server.
    My problem is that when run in background, in spool ALV report shows o/p with proper filter conditions that is 5 out of 20 records.
    But, when I write this report o/p to Application server, it writes all the records in there, i.e., all 20 records. It does not take into account all the filters. [:(]
    I also tried downloading spool to excel, but o/p is not neatly formatted. All columns are fying here and there.
    Any suggestion, how can I write ALV o/p to Application server with layout into consideration?
    P.S. I have searched forum for this type of query, but no apt responses.
    Thanks

    did u downloaded the report with standard option provided in the alv and checked the data? that is populating all 20 records?. if so then use coding for achieving the standard one
    at the end of selection do like this ..
    SET USER-COMMAND ' %PC' .
    and in the user-command use like this..
    case sy-ucomm.
    when '  %PC'.
    give the file name ..
    do processing ..
    endcase.

  • Count of rows in ALv report

    Hi!
    I would like to get the count of rows in my ALV report . How to get the count of the rows ? Can anyone guide me in getting it dome please.
    Thanks

    Hi Gaddemmedi!
    I am attaching the report as you had asked for. I have added the things you asked me to do and now I am getting the count on the top of the page. The problem is that though it shows me the count of the lines from the LAV report on top but when I try to filter the records in the report that count first of all dosent change and remain the same as the initial number of record though after filtering records reduce and over that the count lines keep on increasing I mean the count is shown in repeated lines afet lines. Kindly help please.
    Thanks
    *& Report  ZSD_BILLING_HDR_TEXT_sum                                       *
    *&         billing doc. and associated header text report              *
    *&                            CHANGE LOG                               *
    *& jpoon 2007.08.03                  Change request: DEVK905095        *
    *& Move request: SD_1451_01          Requestor: Mona Fox               *
    *& FP14134 - original code.                                            *
    REPORT  zsd_billing_hdr_text_sum MESSAGE-ID zsd NO STANDARD PAGE HEADING.
    * For ALV usage
    TYPE-POOLS: slis.
    DATA: gs_layout   TYPE slis_layout_alv,
          tp_print    TYPE slis_print_alv,
          gt_sort     TYPE slis_t_sortinfo_alv,
          gt_events   TYPE slis_t_event,
          t_fieldcat  TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          repid       TYPE syrepid,               " ABAP Program.
          gt_list_top_of_page TYPE slis_t_listheader,     " Top of page text.
          alv_variant   TYPE disvariant," Customize Disp. Variant
          w_event type slis_alv_event.
    DATA: w_field    TYPE slis_fieldcat_alv.
    TABLES: vbrk, vbrp, vbpa.
    DATA  SLIS_EV_AFTER_OUTPUT.
    data: gs_list_top_of_page type slis_listheader.
    *data: gt_list_top_of_page type slis_t_listheader.
    * Definition of selection screen                                       *
    *   By plant, storage location, sold-to customers, material and        *
    *   posting date of the sales orders                                   *
    SELECTION-SCREEN BEGIN OF BLOCK one WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_vbeln  FOR  vbrk-vbeln,      " billing doc.
                    s_kunnr  FOR  vbpa-kunnr,      " bill-to customer number.
                    s_werks  FOR  vbrp-werks,      " line item plant.
                    s_fkdat  FOR  vbrk-fkdat,      " billing date.
                    s_fkart  FOR  vbrk-fkart,      " billing type.
                    s_vkorg  FOR  vbrk-vkorg.      " sales org.
    PARAMETERS:     p_hold   AS CHECKBOX.
    SELECTION-SCREEN END OF BLOCK one.
    * ALV display layout
    SELECTION-SCREEN BEGIN OF BLOCK layout WITH FRAME TITLE text-003.
    PARAMETERS: pa_vari TYPE slis_vari DEFAULT ' '. " Display variant.
    SELECTION-SCREEN END OF BLOCK layout.
    * Data Definitions                                                     *
    * Storing Extracted Info.
    TYPES: BEGIN OF t_extract,
             vbeln        TYPE vbeln_vf,   " Sales order number.
             posnr        TYPE posnr,      " line item
             fkart        TYPE fkart,      " billing type.
             vtext        TYPE BEZEI20,    " billing type description.
             fkdat        TYPE fkdat,      " billing date.
             werks        TYPE werks_d,    " line item plant.
             werks_name1  TYPE name1,      " plant description.
             kunnr        TYPE kunnr,      " bill-to customer.
             kunnr_name1  TYPE name1_gp,   " bill-to description.
             netwr        TYPE netwr,      " net value,invoice total $
             zzflag       TYPE boolean,    " hold indicator
             zzreason     TYPE char30,     " header text2 (reason)
             zzuser       TYPE ernam,      " last changed by
             zz_changed_date TYPE dats,    " last changed date
             zz_changed_time TYPE tims,    " last changed time
            END OF t_extract.
    DATA: it_extract  TYPE TABLE OF t_extract WITH HEADER LINE,
          it_extract2 TYPE TABLE OF t_extract WITH HEADER LINE.
    DATA: it_text TYPE TABLE OF tline WITH HEADER LINE.
    DATA: wa_thead type thead.
    DATA: w_tdname type TDOBNAME.
    DATA: L_COUNT TYPE I.
    * initialization
    INITIALIZATION.
      gs_layout-colwidth_optimize = 'X'.
      tp_print-no_print_listinfos = 'X'.
      tp_print-no_coverpage = 'X'.
      PERFORM set_fieldcat.
      PERFORM alv_eventtab_build USING:
    **    Event name     Form to execute     Event internal table
       'TOP_OF_PAGE'  'TOP_OF_PAGE'       gt_events[].
    * Dropdown list for all created ALV layouts, global or user-specific
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_vari.
      PERFORM alv_variant_f4 CHANGING pa_vari.
    * Main BODY of processing logic
    START-OF-SELECTION.
      IF s_vbeln IS INITIAL
      AND s_kunnr IS INITIAL
      AND s_werks IS INITIAL
      AND s_fkdat IS INITIAL
      AND s_fkart IS INITIAL
      AND s_vkorg IS INITIAL.
         MESSAGE i000 WITH text-037 ' ' ' ' ' '.
      ELSE.
        PERFORM extract_data.
      ENDIF.
    END-OF-SELECTION.
      IF it_extract2[] IS INITIAL.
        MESSAGE i000 WITH text-002 ' ' ' ' ' '.
      ELSE.
    * Build headings for report.
    *    PERFORM build_top_of_page  USING gt_list_top_of_page[].
    * describe table it_extract2 lines l_count.
    *write :/ 'TOTAL NO OF ENTRIES', SY-VLINE, 32 L_COUNT.
          PERFORM call_alv.
    *write :/ 'TOTAL NO OF ENTRIES', SY-VLINE, 32 L_COUNT.
      ENDIF.
    *&      Form  EXTRACT_KEY_DATA
    * Retreive the data for the report.
    FORM extract_data.
      CLEAR: it_extract.  REFRESH: it_extract.
    * read and select billing documents
      IF p_hold IS INITIAL.
        SELECT vbrk~vbeln vbrk~fkart vbrk~fkdat vbrk~netwr
               vbrk~zzflag vbrk~zzreason vbrk~zzuser
               vbrk~zz_changed_date vbrk~zz_changed_time
               vbrp~posnr vbrp~werks
          INTO CORRESPONDING FIELDS OF TABLE it_extract
          FROM vbrk INNER JOIN vbrp ON
               vbrk~vbeln = vbrp~vbeln
         WHERE vbrk~vbeln IN s_vbeln
           AND vbrk~fkart IN s_fkart
           AND vbrk~fkdat IN s_fkdat
           AND vbrk~vkorg IN s_vkorg
           AND vbrk~fksto NE 'X'
           AND vbrp~werks IN s_werks.
      ELSE.
    * read 'held' documents only as per selection
        SELECT vbrk~vbeln vbrk~fkart vbrk~fkdat vbrk~netwr
               vbrk~zzflag vbrk~zzreason vbrk~zzuser
               vbrk~zz_changed_date vbrk~zz_changed_time
               vbrp~posnr vbrp~werks
          INTO CORRESPONDING FIELDS OF TABLE it_extract
          FROM vbrk INNER JOIN vbrp ON
               vbrk~vbeln = vbrp~vbeln
         WHERE vbrk~vbeln IN s_vbeln
           AND vbrk~fkart IN s_fkart
           AND vbrk~fkdat IN s_fkdat
           AND vbrk~vkorg IN s_vkorg
           AND vbrk~fksto NE 'X'
           AND vbrk~zzflag = 'X'
           AND vbrp~werks IN s_werks.
      ENDIF.
      IF sy-subrc <> 0.
        MESSAGE i000 WITH text-002 ' ' ' ' ' '.
      ENDIF.
      CHECK sy-subrc = 0.
    * only need first line item for this report.
      SORT it_extract BY vbeln posnr.
      DELETE ADJACENT DUPLICATES FROM it_extract COMPARING vbeln.
      LOOP AT it_extract.
    * Retrieve and select by sales order bill-to on header level
    * as well as lookup bill-to customer name/description
        SELECT SINGLE kunnr FROM vbpa INTO it_extract-kunnr
         WHERE vbeln = it_extract-vbeln
           AND posnr = '000000'
           AND parvw = 'RE'.
        IF it_extract-kunnr IN s_kunnr.
          it_extract-kunnr_name1 = zcl_kna1=>get_name1( it_extract-kunnr ).
        ELSE.
          DELETE it_extract.
          CONTINUE.
        ENDIF.
    * lookup billing type description
        SELECT SINGLE vtext FROM tvfkt
          INTO it_extract-vtext
         WHERE spras = sy-langu
           AND fkart = it_extract-fkart.
        IF sy-subrc <> 0.
          clear it_extract-vtext.
        ENDIF.
    * lookup plant description
        SELECT SINGLE name1 FROM t001w
          INTO it_extract-werks_name1
         WHERE werks = it_extract-werks.
        IF sy-subrc <> 0.
          clear it_extract-werks_name1.
        ENDIF.
        MOVE-CORRESPONDING it_extract TO it_extract2.
        APPEND it_extract2.
       ENDLOOP.
    describe table it_extract2 lines l_count.
    ENDFORM.                    " EXTRACT_DATA
    *&      Form  SET_FIELDCAT
    * Create the field catalogue.
    FORM set_fieldcat .
    *CLEAR W_EVENT.
    *W_EVENT-FORM = SLIS_EV_AFTER_OUTPUT.
    *W_EVENT-NAME = SLIS_EV_AFTER_LINE_OUTPUT.
    *APPEND W_EVENT TO GT_EVENTS.
      CLEAR w_field.
      CLEAR t_fieldcat.  REFRESH t_fieldcat.
      w_field-col_pos = 1.
      w_field-fieldname = 'ZZFLAG'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Hold Printing'(005).
      APPEND w_field TO t_fieldcat.
      w_field-col_pos = 2.
      w_field-fieldname = 'ZZREASON'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Reason'(036).
      APPEND w_field TO t_fieldcat.
      w_field-col_pos = 3 .
      w_field-fieldname = 'VBELN'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Billing Doc'(028).
      w_field-emphasize = 'X'.
      w_field-hotspot   = 'X'.
      APPEND w_field TO t_fieldcat.
      CLEAR w_field.
      w_field-col_pos = 4 .
      w_field-fieldname = 'VTEXT'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Type Description'(030).
      APPEND w_field TO t_fieldcat.
      w_field-col_pos = 5 .
      w_field-fieldname = 'FKDAT'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Billing Date'(031).
      APPEND w_field TO t_fieldcat.
      w_field-col_pos = 6 .
      w_field-fieldname = 'WERKS'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Plant'(012).
      APPEND w_field TO t_fieldcat.
      w_field-col_pos = 7 .
      w_field-fieldname = 'WERKS_NAME1'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Plant Description'(032).
      APPEND w_field TO t_fieldcat.
      w_field-col_pos = 8.
      w_field-fieldname = 'KUNNR'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Bill-to Customer'(033).
      APPEND w_field TO t_fieldcat.
      w_field-col_pos = 9 .
      w_field-fieldname = 'KUNNR_NAME1'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Bill-to Description'(034).
      w_field-emphasize = 'X'.
      w_field-hotspot   = 'X'.
      APPEND w_field TO t_fieldcat.
      CLEAR w_field.
      w_field-col_pos = 10 .
      w_field-fieldname = 'NETWR'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Invoice Amount'(035).
      APPEND w_field TO t_fieldcat.
      w_field-col_pos = 11 .
      w_field-fieldname = 'ZZUSER'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Changed By'.
      APPEND w_field TO t_fieldcat.
      w_field-col_pos = 12 .
      w_field-fieldname = 'ZZ_CHANGED_DATE'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Last Changed Date'(006).
      APPEND w_field TO t_fieldcat.
      w_field-col_pos = 13 .
      w_field-fieldname = 'ZZ_CHANGED_TIME'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Last Changed Time'(007).
      APPEND w_field TO t_fieldcat.
    *  W_event-NAME = slis_ev_end_of_list.
    *  W_event-FORM = 'END_OF_LIST'.
    *  APPEND W_event  TO GT_EVENTS.
    *  CLEAR W_event .
    *  w_field-col_pos = 14 .
    *  w_field-fieldname = 'COUNT'.
    *  w_field-tabname = 'IT_EXTRACT2'.
    *  w_field-seltext_l = 'COUNT'.
    *  APPEND w_field TO t_fieldcat.
    ENDFORM.                    " SET_FIELDCAT
    *&      Form  CALL_ALV
    * Call the ALV Grid function.
    FORM call_alv .
      SORT it_extract BY vbeln.
    * repid is necessary since the ALV F.M. does not work properly with
    * sy-repid.
      repid = sy-repid.
      alv_variant-variant  = pa_vari.
      alv_variant-report   = sy-repid.
      alv_variant-username = sy-uname.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = repid
          i_callback_user_command = 'USER_COMMAND'
          is_layout               = gs_layout
          it_fieldcat             = t_fieldcat[]
          it_sort                 = gt_sort[]
          i_default               = 'X'
          i_save                  = 'A'
          is_variant              = alv_variant
          it_events               = gt_events[]
          is_print                = tp_print
        TABLES
          t_outtab                = it_extract2
        EXCEPTIONS
          program_error           = 1
          OTHERS                  = 2.
    write :/ 'TOTAL NO OF ENTRIES', SY-VLINE, 32 L_COUNT.
      IF sy-subrc NE 0.
        MESSAGE w000 WITH text-004 ' ' ' ' ' '.
      ENDIF.
    ENDFORM.                    " CALL_ALV
    *&      Form  alv_eventtab_build
    *     Pass list of events to be triggered by the ALV function module
    FORM alv_eventtab_build USING  u_name  TYPE slis_alv_event-name
                                   u_form  TYPE slis_alv_event-form
                                   alv_lt_events  TYPE slis_t_event.
      DATA: ls_event TYPE slis_alv_event.   " structure for event handling
      ls_event-name = u_name.
      ls_event-form = u_form.
      APPEND ls_event TO alv_lt_events.
    ENDFORM.                    " alv_eventtab_build
    *       FORM TOP_OF_PAGE                                              *
    FORM top_of_page.
    *gs_list_top_of_page-type = 'H'.
    GS_LIST_TOP_OF_PAGE-INFO = L_COUNT.
    APPEND GS_LIST_TOP_OF_PAGE TO GT_LIST_TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          i_logo             = 'NEWALTA_LOGO'
          it_list_commentary = gt_list_top_of_page.
    ENDFORM.                    " TOP_OF_PAGE
    *&      Form  user_command
    * Process the user command.
    *      -->R_UCOMM      User command
    *      -->RS_SELFIELD  Field selected
    FORM user_command USING r_ucomm     LIKE sy-ucomm
                            rs_selfield TYPE slis_selfield.
      DATA: ltp_vbeln TYPE vbeln.  " Sales document number.
      CASE  r_ucomm.
        WHEN '&IC1'.
          IF ( rs_selfield-fieldname = 'VBELN'
            OR rs_selfield-fieldname = 'BILL_VBELN' )
           AND rs_selfield-value IS NOT INITIAL.        " Display sales document.
            ltp_vbeln = rs_selfield-value.
            zcl_sales_doc=>display( ltp_vbeln ).
          ENDIF.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  alv_v-ariant_f4
    * Get the display variant.
    *      <--CTP_VARI  Variant name
    FORM alv_variant_f4 CHANGING ctp_vari TYPE slis_vari.
      alv_variant-report   = sy-repid.             " Report ID
      alv_variant-username = sy-uname.             " User ID
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant = alv_variant
          i_save     = 'A'
        IMPORTING
          es_variant = alv_variant
        EXCEPTIONS
          OTHERS     = 1.
      IF sy-subrc = 0.
        ctp_vari = alv_variant-variant.
      ENDIF.
    ENDFORM.                    " alv_variant_f4

  • Multiple Filtering options within ALV Output.

    Hi All,
    Being a Functional Guy,I would like to clarify few questions in ALV functionality. In one of our requirement we need to create a ALV report.
    Step1 : Enter values in selection criteria.
    Step2: Execute ALV report.
    Step3: Within Output  I should be able to filters for a particular column. For example: We have a column as Country.In the Column can I select or enter India,US,UK and output should only contain only US,UK,India.
    Step4: Within output We have columns Country and State , can we enter values like Texas in State, US in country in the filter will the output will have only values with Texas & US.
    Can you guys advice if Step 3 & step 4 is possible in ALV.
    Thanks,
    Kitcha

    Hi,
    Yes, you can hae the filtering options for all the columns of the ALV..if you can see there is a stadnard filter functionality available
    for ALV that comes by default..
    When you show the output in alv these default filter is already avaibale..first try to test it out..
    Just go through the ALV documetns..filter is already there..for your output you will get the result..
    Regards,
    Lekha.
    Edited by: Lekha on Dec 10, 2009 10:28 AM

  • What is alv report?

    hi guys, i would like to know the functionality of ALV reports.Please help me in this regard.
    reward points if answered.
    thanks in advance.

    Hi,
      ALV is ABAP LIST VIEWER.
    To have more functionalities like totals, subtotals,logos,etc we choose ALVs compared to reports.
    Check this:
    Documentation on alv:
    you can check out:
    http://www.****************/Tutorials/ALV/ALVMainPage.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
    ABAP List Viewer
    The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
    This helps us to implement all the features mentioned very effectively.
    Using ALV, We can have three types of reports:
    1. Simple Report
    2. Block Report
    3. Hierarchical Sequential Report
    There are some function modules which will enable to produce the above reports without much effort.
    All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
    1. SIMPLE REPORT.
    The important function modules are
    a. Reuse_alv_list_display
    b. Reuse_alv_fieldcatalog_merge
    c. Reuse_alv_events_get
    d. Reuse_alv_commentary_write
    e. Reuse_alv_grid_display
    A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
    The important parameters are :
    I. Export :
    i. I_callback_program : report id
    ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status
    iii. I_callback_user_command : routine where the function codes are handled
    iv. I_structure name : name of the dictionary table
    v. Is_layout : structure to set the layout of the report
    vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE
    vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
    II. Tables :
    i. t_outtab : internal table with the data to be output
    B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to
    populate a fieldcatalog which is essential to display the data in ALV.
    If the output data is from a single dictionary table and all the
    columns are selected, then we need not exclusively create the field cat
    alog. Its enough to mention the table name as a parameter
    (I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases
    we need to create it.
    The Important Parameters are :
    I. Export :
    i. I_program_name : report id
    ii. I_internal_tabname : the internal output table
    iii. I_inclname : include or the report name where all the dynamic forms are handled.
    II Changing
    ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is
    declared in the type pool SLIS.
    C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
    Parameters :
    I. Import :
    Et_Events : The event table is returned with all possible CALLBACK events
    for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
    II. Export :
    I_List_type :
    0 = simple list REUSE_ALV_LIST_DISPLAY
    1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
    2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
    3 = hierarchical-sequential block list
    REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
    Parameters :
    I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
    This internal table has three fields :
    Typ : ‘H’ – header, ‘S’ – selection , ‘A’ - action
    Key : only when typ is ‘S’.
    Info : the text to be printed
    E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
    Parameters : same as reuse_alv_list_display
    This is an example for simple list.
    2. BLOCK REPORT
    This is used to have multiple lists continuously.
    The important functions used in this report are:
    A. REUSE_ALV_BLOCK_LIST_INIT
    B. REUSE_ALV_BLOCK_LIST_APPEND
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    A. REUSE_ALV_BLOCK_LIST_INIT
    Parameters:
    I. I_CALLBACK_PROGRAM
    II. I_CALLBACK_PF_STATUS_SET
    III. I_CALLBACK_USER_COMMAND
    This function module is used to set the default gui status etc.
    B. REUSE_ALV_BLOCK_LIST_APPEND
    Parameters :
    Export :
    I. is_layout : layout settings for block
    II. it_fieldcat : field catalog
    III. i_tabname : internal table name with output data
    IV. it_events : internal table with all possible events
    Tables :
    i. t_outtab : internal table with output data.
    This function module adds the data to the block.
    Repeat this function for all the different blocks to be displayed one after the other.
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    This function module is used for hierarchical sequential blocks.
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    Parameters : All the parameters are optional.
    This function module display the list with data appended by the above function.
    Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
    3. Hierarchical reports :
    Hierarchical sequential list output.
    The function module is
    A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
    Parameters:
    I. Export:
    i. I_CALLBACK_PROGRAM
    ii. I_CALLBACK_PF_STATUS_SET
    iii. I_CALLBACK_USER_COMMAND
    iv. IS_LAYOUT
    v. IT_FIELDCAT
    vi. IT_EVENTS
    vii. i_tabname_header : Name of the internal table in the program containing the
    output data of the highest hierarchy level.
    viii. i_tabname_item : Name of the internal table in the program containing the
    output data of the lowest hierarchy level.
    ix. is_keyinfo : This structure contains the header and item table field
    names which link the two tables (shared key).
    II. Tables
    i. t_outtab_header : Header table with data to be output
    ii. t_outtab_item : Name of the internal table in the program containing the
    output data of the lowest hierarchy level.
    slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using ‘REUSE_ALV_FIELDCATALOG_MERGE’.
    Important Attributes :
    A. col_pos : position of the column
    B. fieldname : internal fieldname
    C. tabname : internal table name
    D. ref_fieldname : fieldname (dictionary)
    E. ref_tabname : table (dictionary)
    F. key(1) : column with key-color
    G. icon(1) : icon
    H. symbol(1) : symbol
    I. checkbox(1) : checkbox
    J. just(1) : (R)ight (L)eft (C)ent.
    K. do_sum(1) : sum up
    L. no_out(1) : (O)blig.(X)no out
    M. outputlen : output length
    N. seltext_l : long key word
    O. seltext_m : middle key word
    P. seltext_s : short key word
    Q. reptext_ddic : heading (ddic)
    R. ddictxt(1) : (S)hort (M)iddle (L)ong
    S. datatype : datatype
    T. hotspot(1) : hotspot
    some theory regarding alv:
    This table tells ALV which events are processed by the caller by CALLBACK.
    The table of possible events per list type can be initialized using the module REUSE_ALV_EVENTS_GET.
    You can display the names of the constants in the type pools SLIS which represent the individual events using the individual test function in the function module
    REUSE_ALV_EVENT_NAMES_GET. Only events with a form routine name are processed.
    The table structure contains the fields:
    • IT_EVENTS-NAME
    Name of the Callback event.
    Possible Callback events:
    • Action
    USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD
    Process actions on the list
    As this is a frequently-used Callback event, the form routine can also be passed directly in the interface in the IMPORTING parameter I_CALLBACK_USER_COMMAND.
    PF_STATUS_SET USING RT_EXTAB TYPE SLIS_T_EXTAB
    If a user list status is to be set, it must be done in the form routine assigned to this event. The ALV function codes, which must not be active, are in the Parameter RT_EXTAB. This table must be passed with the SET PF-STATUS command (with inactive user function codes as well, if necessary).
    The STANDARD status of the function group SALV should be used as a template for a user-specific status.
    As this is a frequently-used Callback event, its form routine can also be passed directly in the interface in the IMPORTING parameter I_CALLBACK_PF_STATUS_SET.
    ITEM_DATA_EXPAND USING RS_SELFIELD TYPE SLIS_SELFIELD RFLG_ALL TYPE C
    Only relevant for hierarchical-sequential lists using the layout parameter IS_LAYOUT-EXPAND_FIELDNAME of the structure IS_LAYOUT.
    Exit for passing item entries (ITEM table) for a header record which was expanded interactively by the user.
    RS_SELFIELD-TABINDEX contains the header table index for which the item entries are to be put in the global item output table (T_OUTTAB_SLAVE). The Callback is only called if ALV has no items for a header which is to be expanded.
    RFLG_ALL is passed with 'X' if the user shows all items. The application must ensure that entries are not repeated in the item table. RS_SELFIELD is initial in this case.
    CALLER_EXIT USING RS_DATA Is called at the beginning of the function module to make special settings. It is not usually used.
    • List processing events
    IMPORTANT: The application Callback routine must not manipulate the internal output table and/or its header record. This restriction applies to all Callbacks which are called in the list output and run under the 'List processing events'.
    TOP_OF_LIST no USING parameter. Information output at the start of the list
    END_OF_LIST no USING parameter. Information output at the end of the list
    TOP_OF_PAGE no USING parameter
    Equivalent to the list processing TOP-OF-PAGE event
    END_OF_PAGE no USING parameter. Not available for hierarchical-sequential lists.
    Information output at the end of a page. This is only called for printing.
    TOP_OF_COVERPAGE no USING parameter
    The selection information and list status are output together (if they exist) on a separate page by default. See also the documentation of the parameters:
    IS_PRINT-NO_COVERPAGE
    IS_PRINT-NO_PRINT_SELINFOS
    IS_PRINT-NO_PRINT_LISTINFOS
    IS_LAYOUT-GET_SELINFOS
    The user can format the header area of the 'cover page' himself or herself by specifying a Callback routine for this event.
    END_OF_COVERPAGE no USING parameter
    Analogously to TOP_OF_COVERPAGE the user can add other information to the information output by ALV (selection information, list status) at this event.
    FOREIGN_TOP_OF_PAGE no USING parameter
    The Top-of-page event is always processed in ALV and is only passed to the caller via the Callback mechanism. This is still the case if the caller, e.g. by a user action, processes a branch list which was not formatted by ALV (e.g. a popup with additional information about the list record selected and displayed by ALV).
    In this case, top-of-page cannot be formatted by ALV analogously to the basic list, it must be handled completely by the caller. The event top-of-page still occurs in ALV. When ALV notices a top-of-page which was not caused by an ALV output, the form routine in FOREIGN_TOP_OF_PAGE is called.
    FOREIGN_END_OF_PAGE no USING parameter
    The event end-of-page is always processed in ALV and only passed to the caller via callback. This is still the case, e.g. when the caller processes a details list which was not formatted by ALV (e.g. a popup with further information about selected list records which were displayed by ALV).
    In this case, end-of-page cannot be formatted by ALV analogously to the basic list, it must be handled completely by the caller. The event end-of-page still occurs in ALV. When ALV notices an end-of-page that was not caused by an ALV output, the form routine in FOREIGN_END_OF_PAGE is called.
    BEFORE_LINE_OUTPUT USING RS_LINEINFO TYPE SLIS_LINEINFO
    Output information before each output line. Should only be used in justified cases because it costs a lot of performance.
    AFTER_LINE_OUTPUT USING RS_LINEINFO TYPE SLIS_LINEINFO
    Output information after each output line. Should only be used in justified cases because it costs a lot of performance.
    • Internal use only
    LIST_MODIFY USING R_TABNAME TYPE SLIS_TABNAME
    R_INDEX LIKE SY-TABIX
    R_INDEX_ITEM LIKE SY-TABIX
    R_INDEX_SUM LIKE SY-TABIX
    • IT_EVENTS-FORM
    Name of the form routine which should be called in the calling program at the event.
    Field_catalog:
    Field catalog with field descriptions
    2.7.1. Description
    Field catalog containing descriptions of the list output fields (usually a subset of the internal output table fields). A field catalog is required for every ALV list output.
    The field catalog for the output table is built-up in the caller's coding. The build-up can be completely or partially automated by calling the REUSE_ALV_FIELDCATALOG_MERGE module
    See also the documentation of the function module REUSE_ALV_FIELDCATALOG_MERGE.
    The minimal field catalog is documented under 'default'. The caller can use the other optional parameters to assign output attributes to a field which differ from the default.
    A field catalog need not be built-up and passed explicitly only under the following conditions:
    • The internal table to be output has the same structure as a Data Dictionary structure which is referred to in the internal table declaration using LIKE or INCLUDE STRUCTURE.
    • all fields in this structure are to be output
    • the structure name is passed to ALV in the parameter I_STRUCTURE_NAME.
    See also the documentation of the IMPORTING paramter I_STRUCTURE_NAME.
    Positioning
    • row_pos (row position)
    value set: 0, 1 - 3
    Only relevant if the list output is to be multi-line (two or three lines) by default.
    A multi-line list can also be defined by the user interactively if the default list is one-line.
    The parameter specifies the relative output line of the column in a multi-line list.
    • col_pos (column position)
    value set: 0, 1 - 60
    only relevant when the default relative column positions differ from the field catalog field sequence. The parameter specifies the relative column position of the field in the list output. The column order can be changed interactively by the user. If this parameter is initial for all field catalog entries, columns appear in the field catalog field sequence.
    Identification
    • fieldname (field name)
    value set: internal output table field name (required parameter)
    Name of the internal output table field which is described by this field catalog entry
    • tabname (internal output table)
    value set: SPACE, internal output table name
    This parameter is used in 'manual' field catalog build-up only for hierarchical-sequential lists.
    Name of the internal output table which contains the field FIELDCAT-FIELDNAME.
    Data Dictionary reference
    • ref_fieldname (reference field name)
    value set: SPACE, Data Dictionary field name
    Name of the Data Dictionary field referred to.
    This parameter is only used when the internal output table field described by the current field catalog entry has a reference to the Data Dictionary (not a program field), and the field name in the internal output table is different from the name of the field in the Data Dictionary. If the field names are identical, naming the Data Dictionary structure or table in the FIELDCAT-REF_TABNAME parameter is sufficient.
    • ref_tabname (reference table/structure field name)
    value set: SPACE, name of a Data Dictionary structure or table
    Structure or table name of the referred Data Dictionary field.
    This parameter is only used when the internal output table field described by the current field catalog entry has a Data Dictionary reference (not a program field).
    Reference to fields with currency/measurement unit
    Each internal output table sum or quantity field whose decimal places are to be formatted appropriately for the unit in the list must follow the convention:
    • the field is of data type QUAN or CURR (internal type P) (the field must really have this physical data type. Overwriting the physical data type with the parameter FIELDCAT-DATATYPE has no effect)
    • There is a field in the internal output table which contains the associated unit.
    • There is also an entry in the field catalog for the unit field.
    (If the unit is not to appear as a column in the list, and cannot be interactively displayed as a column, e.g. because it is always unambiguous and is therefore explicitly output by the caller in the list header, the field catalog units field entry can take the parameter FIELDCAT-TECH = 'X'.
    The association of a value field to a unit affects the output as follows:
    • appropriate decimal places display for the unit
    • an initialized field with a link to a non-initial unit is output as '0' for the unit (if FIELDCAT-NO_ZERO is initial). When this field is summed, this unit affects whether the units are homogeneous.
    • an initialized field with a link to an initial unit is output as SPACE. When this field is summed, the unit SPACE does not affect the homogeneity of the units.
    • When non-initial fields with an initial unit are summed, the unit SPACE is considered to be a unit.
    Link to currency unit
    • cfieldname (currency unit field name)
    value set: SPACE, output table field name
    Only relevant for amount columns with associated unit.
    Name of the internal output table field containing the currency unit associated with the amount field FIELDCAT-FIELDNAME. The field in FIELDCAT-CFIELDNAME must have its own field catalog entry.
    • ctabname (internal currency unit field output table)
    value set: SPACE, output table field name
    only relevant for hierarchical-sequential lists
    Name of the internal output table containing the FIELDCAT-CFIELDNAME field.
    Link to measurement unit
    • qfieldname (measurement unit field name)
    value set: SPACE, output table field name
    only relevant for quantity columns with unit link.
    Name of the internal output table field containing the measurement unit associated with the quantity field FIELDCAT-FIELDNAME.
    The field in FIELDCAT-QFIELDNAME must have its own field catalog entry.
    • qtabname (internal measurement unit field output table)
    value set: SPACE, output table field name
    only relevant for hierarchical-sequential lists
    Name of the internal output table containing the FIELDCAT-QFIELDNAME field.
    Column output options
    • outputlen (column width)
    value set: 0 (initial), n
    For fields with a Data Dictionary link this parameter can be left initial.
    For fields without a Data Dictionary link (program field) the parameter must be given the value of the desired field list output length (column width).
    initial = column width is the output length of the referred Data Dictionary field (domain).
    n = column width is n characters
    • key (key column)
    value set: SPACE, 'X' 'X' = kex field (key field output in color)
    Key fields can not be interactively hidden. Parameter FIELDCAT-NO_OUT must be left initial.
    For exceptions see the documentation of the FIELDCAT-KEY_SEL parameter.
    • key_sel (hideable key column)
    value set: SPACE, 'X'
    only relevant when FIELDCAT-KEY = 'X'
    Key field which can be hidden interactively.
    The key column sequence cannot be changed interactively by the user.
    The output is controlled by the FIELDCAT-NO_OUT parameter analogously to non-key fields.
    • no_out (field in field list)
    value set: SPACE, 'X' 'X' = field is not displayed in the current list.
    The user can interactively choose the field for output from the field list.
    The user can display the contents of these fields at line level using the 'Detail' function.
    See also the 'Detail screen' documentation of the parameter IS_LAYOUT.
    • tech (technical field)
    value set: SPACE, 'X' 'X' = technical field
    Field cannot be output in the list and cannot be displayed interactively.
    Field can only be used in the field catalog (not in IT_SORT, ...).
    • emphasize (highlight columns in color)
    value set: SPACE, 'X' or 'Cxyz' (x:'1'-'9'; y,z: '0'=off '1'=on)
    'X' = column is colored with the default column highlight color.
    'Cxyz' = column is colored with a coded color:
    • C: Color (coding must begin with C)
    • x: color number
    • y: bold
    • z: inverse
    • hotspot (column as hotspot)
    value set: SPACE, 'X'
    'X' = column cells are output as hotspots
    • fix_column (fix column)
    value set: SPACE, 'X'
    Not relevant for block lists (output of several lists consecutively)
    'X' = column fixed (does not scroll horizontally)
    All columns to be fixed must have this flag, starting from the left. If a column without this flag is output, only the columns to the left of this column are fixed. The user can change the column fixing interactively. See also the documentation of the Layout parameter
    IS_LAYOUT-NO_KEYFIX of the IMPORTING paramter IS_LAYOUT.
    • do_sum (sum over column)
    value set: SPACE, 'X' 'X' = a sum is to be calculated over this internal output table field.
    This function can also be called by the user interactively.
    • no_sum (sums forbidden)
    value set: SPACE, 'X' 'X' = no sum can be calculated over this field, although the data type of the field would allow summing.
    • input (column ready for input)
    Function not available
    Format column contents
    • icon
    value set: SPACE, 'X' 'X' = column contents to be output as an icon.
    The caller must consider the printability of icons.
    • symbol
    value set: SPACE, 'X' 'X' = column contents are to be output as a symbol.
    The internal output table column must be a valid symbol character.
    The caller must consider the printability of symbols.
    Symbols can usually be printed, but may not always be output correctly, depending on the printer configuration.
    • just (justification)
    value set: SPACE, 'R', 'L', 'C'
    Only relevant for fields of data type CHAR or NUMC
    ' ' = default justification for this data type
    'R' = right-justified output
    'L' = left-justified output
    'C' = centered output
    The justification of the column header always follows the justification of the columns. Independent justification of the column neader is not possible.
    • lzero (leading zeros)
    value set: SPACE, 'X'
    Only relevant for fields of data type NUMC
    ALV outputs NUMC fields right-justified without leading zeros by default.
    'X' = output with leading zeros
    Note: If a NUMC field is output left-justified or centered by FIELDCAT-JUST, leading zeros are output. If the output of leading zeros is suppressed by a Data Dictionary reference ALPHA conversion exit, the output is always left-justified.
    • no_sign (no +/- sign) Only relevant for value fields
    value set: SPACE, 'X' 'X' = value output without +/ sign
    • no_zero (suppress zeros) Only relevant for value fields
    value set: SPACE, 'X' 'X' = suppress zeros
    • edit_mask (field formatting)
    value set: SPACE, template
    template = see documentation of WRITE formatting option USING EDIT MASK template
    The output conversion conv can be made by template = '== conv'.
    Texts
    The following text parameters should be specified for program fields without a Data Dictionary reference. The texts are taken from the Data Dictionary for fields with a Data Dictionary reference. If this is not desired, the text parameters can also be specified. The Data Dictionary texts are then ignored. If the user changes the column width interactively, the column header text with the appropriate length is always used. The interactive function 'Optimize column width' takes account of both the field contents and the column headers: if all field contents are shorter than the shortest column header, the column width depends on the column header.
    The 'long field label' is also used in display variant definition, sort, etc. popups.
    • seltext_l (long field label)
    • seltext_m (medium field label)
    • seltext_s (short field label)
    • reptext_ddic (header)
    analogous to the Data element maintenance 'Header'
    The specified text is not necessarily output in the list, an optimum among all texts is sought.
    • ddictxt (specify text)
    value set: SPACE, 'L', 'M', 'S'
    You can specify with values 'L', 'M', and 'S', the keyword that should always be used as column header. If the column width changes, no attempt is made in this case to find an appropriate header for the new output width.
    Parameters for program fields without Data Dictionary reference
    see also 'Text' parameters
    • datatype (data type)
    value set: SPACE, Data Dictionary data type (CHAR, NUMC,...)
    Only relevant for fields without Data Dictionary reference
    Program field data type
    • ddic_outputlen (external output length)
    value set: 0 (initial), n
    Only relevant for fields without Data Dictionary reference whose output is nevertheless to be modified by a conversion exit.
    Prerequisites:
    • FIELDCAT-EDIT_MASK = '==conv'
    see also the documentation of the parameter FIELDCAT-EDIT_MASK
    • FIELDCAT-INTLEN = n
    see also the documentation of the parameter FIELDCAT-INTLEN
    n = external format field output length
    The column width FIELDCAT-OUTPUTLEN need not be the same as the external format output length (FIELDCAT-DDIC_OUTPUTLEN).
    • intlen (internal output length)
    value set: 0 (initial), n
    Only relevant for fields without Data Dictionary reference whose output is nevertheless to be modified by a conversion exit.
    Prerequisites:
    • FIELDCAT-EDIT_MASK = '==conv'
    see also the documentation of the parameter FIELDCAT-EDIT_MASK
    • FIELDCAT-DDIC_OUTPUTLEN = n
    see also the documentation of the parameter FIELDCAT-DDIC_OUTPUTLEN
    n = internal format field output length
    • rollname (data element)
    value set: SPACE, Data Dictionary data element name
    F1 help can be provided for a program field without a Data Dictionary reference, or F1 help which differs from the Data Dictionary help can be provided for a field with a Data Dictionary reference, using this parameter.
    When F1 help is called for this field, the documentation of the specified data element is displayed.
    If the FIELDCAT-ROLLNAME is initial for fields with a Data Dictionary reference, the documentation of the data element of the referred Data Dictionary field is output.
    Others
    • sp_group (field group key)
    value set: SPACE, CHAR(1)
    Field group key.
    Keys are assigned to group names in the IT_SPECIAL_GROUPS parameter (see also the documentation of the parameter IT_SPECIAL_GROUPS).
    When such an assignment is made in the field catalog and in IT_SPECIAL_GROUPS, the fields are grouped correspondingly in the display variant popup.
    • reprep (Report/Report interface selection criterion)
    value set: SPACE, 'X'
    Prerequisites:
    • The system contains the Report/Report interface (function group RSTI, table TRSTI)
    • Parameter LAYOUT-REPREP = 'X'
    (see also the documentation of the parameter LAYOUT-REPREP of the IMPORTING parameter IS_LAYOUT )
    'X' = When the Report/Report interface is called, the value of this field is passed in the selected interface start record as a selection criterion.
    2.7.2. Default
    • The following entries are usually sufficient for internal table fields with a reference to a field defined in the Data Dictionary :
    • fieldname
    • ref_tabname
    Notes:
    ALV gets the remaining information from the Data Dictionary.
    If no relative column position (COL_POS) is specified, the fields are output in the list in the order in which they were added to the field catalog.
    REF_FIELDNAME need only be specifid when the name of the internal table field differs from the name of the referred Data Dictionary field.
    Information which is explicitly entered in the field catalog is not overwritten by information from the Data Dictionary.
    Priority rule:
    Entries in the field catalog have priority over differing entries in the Data Dictionary.
    • The following entries are usually sufficient for internal table fields without a reference to the Data Dictionary (program fields):
    • fieldname
    • outputlen
    • datatype
    • seltext_s
    • seltext_m
    • seltext_l
    Notes:
    F1 help can be provided for program fields by assigning a data element to the parameter ROLLNAME.
    If the parameters SELTEXT_S, SELTEXT_M, SELTEXT_L, and REPTEXT_DDIC contain appropriate field labels, the program field column headers are also adjusted appropriately when the column width changes
    sites :
    http://www.sapdevelopment.co.uk/reporting/alv/alv_variousfcat.htm
    Check out these links : top one is on slis specifcally,
    How to know about these SLIS types?
    Re: sap alv examples
    ALV reporting - Step by step
    http://help.sap.com/saphelp_nw04/helpdata/en/8d/e994374c9cd355e10000009b38f8cf/frameset.htm
    Go through with these links :
    ALV
    http://www.geocities.com/mpioud/Abap_programs.html
    ALV Group Heading
    http://www.sap-img.com/fu037.htm
    ALVGRID with refresh
    http://www.geocities.com/mpioud/Z_DEMO_ALV_REFRESH_BUTTON.htm
    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
    -->download the PDF from following link.
    www.abap4.it/download/ALV.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
    OOPS ALV tutorial.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
    Sample programs:
    http://www.geocities.com/victorav15/sapr3/abap_ood.html#d_grid
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm
    http://www.sapdevelopment.co.uk/reporting/alvhome.htm
    You can get all demo programs for ALV:
    Go to se38 and type BCALV* and press F4 for all demo porgrams.
    Check out these links
    http://www.sap-img.com/abap/what-is-alv-programming.htm
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/alv&
    http://www.sap-img.com/abap/an-interactive-alv-report.htm
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/cs/user/view/cs_msg/18628
    Regards

  • Anyone know of an ALV report in SAP that has Hotspot logic?

    Howdy,
    Does Anyone know of an ALV report in SAP that has Hotspot logic?
    I just need to implement this logic into my report and I thought I'd copy what was there.
    Also, anyone know of a report where buttons are available in the cells of an ALV grid?
    Thanksing you kindly.

    Hi Steve,
    it'a a report with alv grid, where i use hot spot event,
    i hope it helps you.
    bye
    *& Report  ZMONITOR_IP                                                 *
    REPORT  zmonitor_ip                             .
    TABLES: mapl, plko
    *****SELECTION-SCREEN.
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_matnr  FOR mapl-matnr,
                    s_plnty  FOR mapl-plnty,
                    s_zaehl  FOR plko-zaehl,
                    s_verwe  FOR plko-verwe,
                    s_plnnr  FOR plko-plnnr,
                    s_plnal  FOR plko-plnal,
                    s_plnty2 FOR plko-plnty.
    SELECTION-SCREEN: END OF BLOCK b1.
    **********TYPES:
    TYPES: BEGIN OF str_data,
             matnr    TYPE mapl-matnr,
             werks    TYPE plko-werks,
             plnal    TYPE plko-plnal,
             plnnr    TYPE plko-plnnr,
           END OF str_data.
    TYPES: BEGIN OF str_data2,
            prueflos TYPE qals-prueflos,
            art      TYPE qals-art,
            herkunft TYPE qals-herkunft,
            enstehdat TYPE qals-enstehdat,
            END OF str_data2.
    ****Global data.
    DATA: tb_plko TYPE TABLE OF plko,
          wa_plko TYPE plko,
          tb_mapl TYPE TABLE OF mapl,
          wa_mapl TYPE TABLE OF mapl,
          tb_data TYPE TABLE OF str_data,
          wa_data TYPE str_data,
          pos1 TYPE i,
          pos2 TYPE i,
          pos3 TYPE i,
          pos4 TYPE i,
          pos5 TYPE i,
          okcode_100 TYPE sy-ucomm,
          tb_data2 TYPE TABLE OF str_data2.
    ***********************VARIABILI E STRUTTURE PER ALV********************
    *       CLASS lcl_event_handler DEFINITION
    CLASS lcl_event_handler DEFINITION .
      PUBLIC SECTION .
        METHODS:
    *To add new functional buttons to the ALV toolbar
    *Hotspot click control
    handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
                         IMPORTING e_row_id e_column_id es_row_no,
    *Double-click control
    handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
                        IMPORTING e_row e_column es_row_no.
    ENDCLASS.                    "lcl_event_handler DEFINITION
    *       CLASS lcl_event_handler IMPLEMENTATION
    CLASS lcl_event_handler IMPLEMENTATION.
      METHOD handle_hotspot_click.
    *Handle Hotspot Click METHOD handle_hotspot_click .
        PERFORM handle_hotspot_click USING e_row_id e_column_id es_row_no .
      ENDMETHOD .                    "lcl_event_handler
    *Handle Double Click
      METHOD handle_double_click .
        PERFORM handle_double_click USING e_row e_column es_row_no .
      ENDMETHOD .                    "handle_double_click
    ENDCLASS.                    "lcl_event_handler IMPLEMENTATION
    *--- ALV Grid instance reference
    DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid.
    DATA gr_alvgrid2 TYPE REF TO cl_gui_alv_grid.
    *--- Name of the custom control added on the screen
    DATA gc_custom_control_name TYPE scrfname VALUE 'CC_ALV'.
    DATA gc_custom_control_name2 TYPE scrfname VALUE 'CC_ALV2'.
    *--- Customer contanier instance reference
    DATA gr_ccontainer TYPE REF TO cl_gui_custom_container.
    DATA gr_ccontainer2 TYPE REF TO cl_gui_custom_container.
    *--- Field catalog table
    DATA gt_fieldcat TYPE lvc_t_fcat.
    DATA gt_fieldcat2 TYPE lvc_t_fcat.
    *--- Layout structure
    DATA gs_layout TYPE lvc_s_layo.
    DATA gs_layout2 TYPE lvc_s_layo.
    DATA ls_variant       TYPE disvariant.
    DATA gr_event_handler TYPE REF TO lcl_event_handler .
    ****INITIALIZZATION
    INITIALIZATION.
      pos1 = 4.
      pos2 = pos1 + 20.
      pos3 = pos2 + 10.
      pos4 = pos3 + 10.
      pos5 = pos4 + 10.
    *****TOP OF PAGE
    TOP-OF-PAGE.
      WRITE AT /pos1 'Material'.
      WRITE AT pos2  'Plan'.
      WRITE AT pos3 'Group'.
      WRITE AT pos4 'Group Count'.
      SKIP 1.
    *****AT USER COMMAND.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'BACK'.
          SET SCREEN 0.
          LEAVE SCREEN.
      ENDCASE.
    AT LINE-SELECTION.
      PERFORM select_line.
    *****START-OF-SELECTION.
    START-OF-SELECTION.
      PERFORM select_data.
      PERFORM output.
    END-OF-SELECTION.
    ****END-OF-SELCTION.
    *&      Form  select_data
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM select_data .
      SELECT   b~werks b~plnal b~plnnr a~matnr
               FROM plko AS b
               JOIN mapl AS a
               ON ( a~plnty = b~plnty AND
                   a~plnnr = b~plnnr AND
                   a~plnal = b~plnal )
               INTO CORRESPONDING FIELDS OF TABLE tb_data
               WHERE
                 a~matnr IN s_matnr  AND
                 a~plnty IN s_plnty  AND
                 b~zaehl IN s_zaehl  AND
                 b~verwe IN s_verwe  AND
                 b~plnnr IN s_plnnr  AND
                 b~plnal IN s_plnal  AND
                 b~plnty IN s_plnty2 .
    ENDFORM.                    " select_data
    *&      Form  OUTPUT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM output .
      CALL SCREEN '0100'.
    ENDFORM.                    " OUTPUT
    *&      Form  SELECT_LINE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM select_line .
      DATA line TYPE i.
      CLEAR wa_data.
      GET CURSOR LINE line.
      READ LINE line FIELD VALUE wa_data-matnr  INTO wa_data-matnr.
      READ LINE line FIELD VALUE wa_data-werks  INTO wa_data-werks.
      READ LINE line FIELD VALUE wa_data-plnnr  INTO wa_data-plnnr.
      READ LINE line FIELD VALUE wa_data-plnal  INTO wa_data-plnal.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      SET PARAMETER ID 'MAT' FIELD wa_data-matnr.
      SET PARAMETER ID 'WRK' FIELD wa_data-werks.
      SET PARAMETER ID 'QHK' FIELD '89'.
      SET PARAMETER ID 'PLN' FIELD wa_data-plnnr.
      SET PARAMETER ID 'PAL' FIELD wa_data-plnal.
      CALL TRANSACTION 'QA01' AND SKIP FIRST SCREEN.
      SET PARAMETER ID 'PLN' FIELD ' '.
      SET PARAMETER ID 'PAL' FIELD ' '.
    ENDFORM.                    " SELECT_LINE
    *&      Form  prepare_field_catalog
    *       text
    *      -->PT_FIELDCATtext
    FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat .
      DATA ls_fcat TYPE lvc_s_fcat .
      ls_fcat-fieldname = 'MATNR' .
    *  ls_fcat-inttype = 'C' .
      ls_fcat-outputlen = '18' .
      ls_fcat-hotspot = 'X'.
      ls_fcat-coltext = 'Material' .
      ls_fcat-seltext = 'Material' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
      ls_fcat-fieldname = 'WERKS' .
    *  ls_fcat-outputlen = '30' .
      ls_fcat-coltext = 'Plant' .
      ls_fcat-seltext = 'Plant' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
      ls_fcat-fieldname = 'PLNNR' .
    *  ls_fcat-outputlen = '6' .
      ls_fcat-coltext = 'Orig. IP' .
      ls_fcat-seltext = 'Orig. IP' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
      ls_fcat-fieldname = 'PLNAL' .
    *  ls_fcat-outputlen = '6' .
      ls_fcat-coltext = 'Orig. IP Conuter' .
      ls_fcat-seltext = 'Orig. IP Conuter' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
    ENDFORM .                    "prepare_field_catalog
    *&      Form  prepare_layout
    *       text
    *      -->PS_LAYOUT  text
    FORM prepare_layout CHANGING ps_layout TYPE lvc_s_layo.
      ps_layout-zebra = 'X' .
      ps_layout-grid_title = '' .
      ps_layout-smalltitle = 'X' .
      ps_layout-sel_mode = 'B'.
    ENDFORM. " prepare_layout
    *&      Module  DISPLAY  OUTPUT
    *       text
    MODULE display OUTPUT.
    ***ALV.
      IF gr_alvgrid IS INITIAL AND
         gr_alvgrid2 IS INITIAL.
    *----Creating custom container instance
        CREATE OBJECT gr_ccontainer
           EXPORTING
           container_name = gc_custom_control_name
           EXCEPTIONS
           cntl_error = 1
           cntl_system_error = 2
           create_error = 3
           lifetime_error = 4
           lifetime_dynpro_dynpro_link = 5
           OTHERS = 6 .
        CREATE OBJECT gr_ccontainer2
            EXPORTING
            container_name = gc_custom_control_name2
            EXCEPTIONS
            cntl_error = 1
            cntl_system_error = 2
            create_error = 3
            lifetime_error = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS = 6 .
    *----creating alv grid instance
        CREATE OBJECT gr_alvgrid
        EXPORTING
        i_parent = gr_ccontainer
        EXCEPTIONS
        error_cntl_create = 1
        error_cntl_init = 2
        error_cntl_link = 3
        error_dp_create = 4
        OTHERS = 5 .
        CREATE OBJECT gr_event_handler .
        SET HANDLER gr_event_handler->handle_hotspot_click FOR gr_alvgrid .
        SET HANDLER gr_event_handler->handle_double_click FOR gr_alvgrid .
    *----Preparing field catalog.
        PERFORM prepare_field_catalog CHANGING gt_fieldcat .
    *----Preparing layout structure
        PERFORM prepare_layout CHANGING gs_layout .
    *----Here will be additional preparations
    *--e.g. initial sorting criteria, initial filtering criteria, excluding
    *--functions
        CALL METHOD gr_alvgrid->set_table_for_first_display
        EXPORTING
    * I_BUFFER_ACTIVE =
    * I_CONSISTENCY_CHECK =
    * I_STRUCTURE_NAME =
    is_variant = ls_variant
    i_save = 'A'
    * I_DEFAULT = 'X'
        is_layout = gs_layout
    * IS_PRINT =
    * IT_SPECIAL_GROUPS =
    * IT_TOOLBAR_EXCLUDING =
    * IT_HYPERLINK =
        CHANGING
        it_outtab = tb_data
        it_fieldcatalog = gt_fieldcat
    * IT_SORT =
    * IT_FILTER =
        EXCEPTIONS
        invalid_parameter_combination = 1
        program_error = 2
        too_many_lines = 3
        OTHERS = 4 .
      ELSE .
        CALL METHOD gr_alvgrid->refresh_table_display
    * EXPORTING
    * IS_STABLE =
    * I_SOFT_REFRESH =
        EXCEPTIONS
        finished = 1
        OTHERS = 2 .
      ENDIF .
    ENDMODULE.                 " DISPLAY  OUTPUT
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'MONITOR'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE okcode_100.
        WHEN 'BACK'.
          SET SCREEN 0.
          LEAVE SCREEN.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  handle_hotspot_click
    *       text
    *      -->I_ROW_ID   text
    *      -->I_COLUMN_IDtext
    *      -->IS_ROW_NO  text
    FORM handle_hotspot_click USING i_row_id TYPE lvc_s_row
                                    i_column_id TYPE lvc_s_col
                                    is_row_no TYPE lvc_s_roid.
      READ TABLE tb_data INDEX is_row_no-row_id INTO wa_data.
      SELECT * FROM qals INTO CORRESPONDING FIELDS OF TABLE tb_data2
                WHERE selmatnr = wa_data-matnr AND
                      werk     = wa_data-werks .
      IF gr_alvgrid2 IS INITIAL.
        CREATE OBJECT gr_alvgrid2
      EXPORTING
      i_parent = gr_ccontainer2
      EXCEPTIONS
      error_cntl_create = 1
      error_cntl_init = 2
      error_cntl_link = 3
      error_dp_create = 4
      OTHERS = 5 .
    *----preparing field catalog.
        PERFORM prepare_field_catalog2 CHANGING gt_fieldcat2 .
    *----Preparing layout structure
        PERFORM prepare_layout CHANGING gs_layout2 .
    *----Here will be additional preparations
    *--e.g. initial sorting criteria, initial filtering criteria, excluding
    *--functions
        CALL METHOD gr_alvgrid2->set_table_for_first_display
        EXPORTING
    * I_BUFFER_ACTIVE =
    * I_CONSISTENCY_CHECK =
    * I_STRUCTURE_NAME =
    is_variant = ls_variant
    i_save = 'A'
    * I_DEFAULT = 'X'
        is_layout = gs_layout2
    * IS_PRINT =
    * IT_SPECIAL_GROUPS =
    * IT_TOOLBAR_EXCLUDING =
    * IT_HYPERLINK =
        CHANGING
        it_outtab = tb_data2
        it_fieldcatalog = gt_fieldcat2
    * IT_SORT =
    * IT_FILTER =
        EXCEPTIONS
        invalid_parameter_combination = 1
        program_error = 2
        too_many_lines = 3
        OTHERS = 4 .
      ELSE.
        CALL METHOD gr_alvgrid2->refresh_table_display
    * EXPORTING
    * IS_STABLE =
    * I_SOFT_REFRESH =
      EXCEPTIONS
      finished = 1
      OTHERS = 2 .
      ENDIF.
    *  call screen 100.
    ENDFORM .                    "handle_hotspot_click
    *&      Form  prepare_field_catalog2
    *       text
    *      <--P_GT_FIELDCAT2  text
    FORM prepare_field_catalog2 CHANGING pt_fieldcat TYPE lvc_t_fcat .
      DATA ls_fcat TYPE lvc_s_fcat .
      ls_fcat-fieldname = 'PRUEFLOS' .
      ls_fcat-outputlen = '23' .
      ls_fcat-coltext = 'Inspection Lot Number' .
      ls_fcat-seltext = 'Inspection Lot Number' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
      ls_fcat-fieldname = 'ART' .
      ls_fcat-coltext = 'Inspection Type' .
      ls_fcat-seltext = 'Inspection Type' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
      ls_fcat-fieldname = 'HERKUNFT' .
      ls_fcat-coltext = 'Inspection Lot Origin' .
      ls_fcat-seltext = 'Inspection Lot Origin' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
      ls_fcat-fieldname = 'ENSTEHDAT' .
      ls_fcat-coltext = 'Date of Lot Creation' .
      ls_fcat-seltext = 'Date of Lot Creation' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
    ENDFORM.                    " prepare_field_catalog2
    *&      Form  handle_double_click
    *       text
    *      -->I_ROW      text
    *      -->I_COLUMN   text
    *      -->IS_ROW_NO  text
    FORM handle_double_click USING i_row TYPE lvc_s_row
                                   i_column TYPE lvc_s_col
                                   is_row_no TYPE lvc_s_roid.
      CLEAR wa_data.
      READ TABLE tb_data INDEX i_row-index INTO wa_data.
      SET PARAMETER ID 'MAT' FIELD wa_data-matnr.
      SET PARAMETER ID 'WRK' FIELD wa_data-werks.
      SET PARAMETER ID 'QHK' FIELD '89'.
      SET PARAMETER ID 'PLN' FIELD wa_data-plnnr.
      SET PARAMETER ID 'PAL' FIELD wa_data-plnal.
      CALL TRANSACTION 'QA01' AND SKIP FIRST SCREEN.
      SET PARAMETER ID 'PLN' FIELD ' '.
      SET PARAMETER ID 'PAL' FIELD ' '.
    ENDFORM .                    "handle_double_click

  • Problem in downloading ALV report to Excel

    hi All,
    i am facing the problem when i am trying to download the ALV report to Excel format i should have the option to  save as  the Excel file from the dropdown where as instead of it i am getting the option to save as XML file.
    is it something related to settings in SAP or is it done through programatically.
    thanks,

    Anyways is this happening for every one in your team or just for one. If the latter, looks like the user has selected the download in XML format & checked the "remember these settings" checkbox
    You can refer to this link on how to change the default settings: [http://home4sap.com/Blog/2010/03/ecc5-0-alv-default-file-format-when-extracting-files-to-excel/|http://home4sap.com/Blog/2010/03/ecc5-0-alv-default-file-format-when-extracting-files-to-excel/]
    You can also check this SAP offers the possibility to make from transaction FAGLB03 a download
    Edited by: Suhas Saha on Apr 13, 2010 4:40 PM

Maybe you are looking for