Sorting in ALV Report.

Dear Experts,
I mfacing a strange problem.
I hv an internal table containing the required data in required sorted order.
But when i call CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' function module,
the sort order gets changed. I m not sorting internal table.
The internal table is very much ok till i write statement  "CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'  ".
I hv checked in dbugging mode, (if sy-subrc = 0 in the  above function module) the sort order getting changed only in the call of function module.
Any suggestion.
Regards,
Maverick

Hi,
Define:IT_SORT TYPE SLIS_T_SORTINFO_ALV
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     I_CALLBACK_PROGRAM                 = w_repid
     I_CALLBACK_USER_COMMAND            = 'USER_COMMAND'
     I_CALLBACK_TOP_OF_PAGE             = 'TOP-OF-PAGE'
     IT_FIELDCAT                        = i_fcat[]
     I_SAVE                             = 'X'
      IT_SORT                           = it_sort
    TABLES
      T_OUTTAB                          = i_faglflexa_all
*  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.
Now in debugging if the sy-subrc = 0 then only the further process will take place.
If sy-subrc is not zero then what is the point of sorting data as Th Function module have some error.
So what  you are getting in debugging that is correct. Nothing is wrong.
regards,
Pravin
Edited by: pravin s. on Mar 15, 2010 12:22 PM
Edited by: pravin s. on Mar 15, 2010 12:25 PM

Similar Messages

  • Sort in alv report

    hi!
    what values can the field group in lvc_t_sort can get,
    and what each value means?
    regard
    yifat

    hi Yifat ,
    here is a clear dec...
    Definition
    The sort table is an internal table of type LVC_T_SORT .
    Use
    You use the sort table to get the current sort criteria of the list or set these criteria dynamically (see  set_sort_criteria) or before the list is displayed for the first time (see  set_table_for_first_display).
    If you use the table in combination with method  get_subtotals, you can determine the subtotals values.
    Structure
    Field names:
    <b>SPOS</b>
    Sort order if the list is sorted by multiple columns
    <b>Field name</b> in the internal output table
    <b>UP</b>
    'X' = Sorted in ascending order
    <b>DOWN</b>
    'X' = Sorted in descending order
    <b>
    SUBTOT</b>
    'X' = Subtotal at group level change
    <u><b>GROUP</b></u>
    Once a column is sorted, it is subdivided into groups. This means there is one group for each value of the column (in the default setting, the ALV Grid Control merges cells that have the same value in the sort column). If the value in the sort colulmn changes, this is called a group level change.
    You can use this field to determine the formatting of this value when the list is printed:
    '* ' = Page break at group level change
    'UL' = Underline at group level change
    (The formatting options are fixed domain values of domain SLIS_CTRLS ).
    See also the documentation for field GRPCHGEDIT in  The Print Structure.

  • What are events in ALV report and explain how sorting is done  alv report

    events in alv report and sorting in alv report
    Moderator Message: Search before posting.
    Edited by: kishan P on Dec 21, 2011 11:13 AM

    Hi Raja,
    <<content and links removed by moderator>>
    PavanKumar.G
    Edited by: kishan P on Dec 21, 2011 11:12 AM

  • How to sort the alv

    what is the process to sort in alvs report  the output is in  decending and accending order without using standard buttenens in the output list .
             i am asking how to sort bydefault when we are executing the report ,
             output list  will automatically in sort order.
    could u plz explalin clearly with comments
    and code

    Hi
    Add this to your alv reporting
    Add Default Sorting to ALVgrid report  
    In order to display an ALV report with specific columns already sorted by default you will need to build a
    sort catalogue. This is fairly straight forward and is done in the following way:
            Step 1. Add data declaration for sort catalogue
            Step 2. Add code to build sort catalogue table 
            Step 3. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include parameter 'it_sort'
    ALV data declarations
      data: it_sortcat   type slis_sortinfo_alv occurs 1,
            wa_sort like line of it_sortcat.
    perform build_sortcat.
    *&      Form  build_sortcat
          Build Sort catalog
    FORM build_sortcat .
      wa_sort-spos      = 1.
      wa_sort-fieldname = 'EBELN'.
    gd_sortcat-tabname
      APPEND wa_sort TO it_sortcat.
      wa_sort-spos      = 2.
      wa_sort-fieldname = 'EBELP'.
    gd_sortcat-tabname
      APPEND wa_sort TO it_sortcat.
    ENDFORM.                    " build_sortcat
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE' 
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                it_sort                 = it_sortcat
                i_save                  = 'X'
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
    Thanks
    Shiva

  • ALV .  How to remove the sort buttons on toolbar in ALV report?

    Hi,experts
      As you know, in default case , the alv report will display two sort buttons(ascending ,descending) on its toolbar , So How to remove the sort buttons on toolbar in ALV report?
      Thanks for your help .

    Hi guixin,
    1. Before calling REUSE_ALV_LIST_DISPLAY
    2. Write this code :
    data : excl type SLIS_T_EXTAB.
    data : exclwa type SLIS_EXTAB.
    exclwa = '&OUP'.
    append exclwa to excl.
    exclwa = '&ODN'.
    append exclwa to excl.
    3. Then while calling the FM,
       pass this parameter also .
    IT_EXCLUDING     = excl
    It will work fantastic.
    regards,
    amit m.

  • Sort field in ALV report

    Hi Expert,
    IN  ALV report using RESUE_ALV_GRID_DISPLAY . I want to sort the second field of ALV output . In this function module  RESUE_ALV_GRID_DISPLAY  using event PF_STATUS . so can u tell me how sort the second field .
    Regards
    Bhabani

    Hi,
    check the fallowing code
    IT_SORT TYPE SLIS_T_SORTINFO_ALV,
    WA_SORT TYPE slis_sortinfo_alv,
    ****SORT LABELS AT RUN TIME
      WA_SORT-TABNAME = 'IT_FINAL1'.
      WA_SORT-FIELDNAME = 'BUDAT'.
      WA_SORT-UP = 'X'.
      WA_SORT-GROUP = 'X'.
    WA_SORT-subtot = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
      WA_SORT-TABNAME = 'IT_FINAL1'.
      WA_SORT-FIELDNAME = 'MATNR'.
      WA_SORT-UP = 'X'.
      WA_SORT-GROUP = 'X'.
    WA_SORT-subtot = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM               = SY-REPID
          I_CALLBACK_TOP_OF_PAGE           = 'TOP_OF_PAGE'
          IS_LAYOUT                        =  LAYOUT
          IT_FIELDCAT                      = IT_FIELDCAT
          IT_SORT                          = IT_SORT
          I_DEFAULT                        = 'X'
          I_SAVE                           = 'U'
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
         TABLES
           T_OUTTAB                        = IT_FINAL1
    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.
    Regards
    Nandan.N

  • Sorting in Blocked ALV Report

    Hi Experts,
    Can i achieve sorting in Blocked ALV report as we can do in ALV Grid Display.???
    If so, how can this be achieved????
    For example, if there are 3 records with the same value for a field.....say thfreee rows with name 'Gaurav'.
    I want to show 'Gaurav' only in the first row and the other two rows must be empty.
    Gaurav 1 2 3
    Gaurav 4 5 6
    Gaurav 7 8 9
    Should be seen as
    Gaurav 1 2 3
               4 5 6
               7 8 9
    Thanks and regards
    Gaurav raghav

    Here is the code.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = sy-repid
          i_structure_name       = 'ZCRM_ACTIVITY_REPORT'
        CHANGING
          ct_fieldcat            = gt_fieldcatalog[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF sy-subrc EQ 0.
          CLEAR gs_sort.
          gs_sort-fieldname = 'ORG'.
          gs_sort-tabname = 'GT_ITAB'.
          gs_sort-spos = '1'.
          gs_sort-up = 'X'.
          APPEND gs_sort TO gt_sort.
        CLEAR gs_sort.
        gs_sort-fieldname = 'EMPLOYEE'.
        gs_sort-tabname = 'GT_ITAB'.
        gs_sort-spos = '2'.
        gs_sort-up = 'X'.
        APPEND gs_sort TO gt_sort.
      ENDIF.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
          EXPORTING
            is_layout                  = gt_layout
            it_fieldcat                = gt_fieldcatalog
            i_tabname                  = 'GT_ITAB'
            it_events                  = gt_events
            it_sort                    = gt_sort
            i_text                     = 'Report 1 '
          TABLES
            t_outtab                   = gt_itab
          EXCEPTIONS
            program_error              = 1
            maximum_of_appends_reached = 2
            OTHERS                     = 3.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.

  • 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

  • Print or download ALV report with sort options

    Dear friends,
    How i can download into excel or print ALV report with sort options, like customer name column with similar values should not repeat in the print out or download file.
    Regards,
    Praveen Lobo

    Hi Praveen,
    Use this code, its working:-
    *FOR SORTING DATA
    DATA : it_sort TYPE slis_t_sortinfo_alv,
           wa_sort TYPE slis_sortinfo_alv.
    *          SORT W.R.T. CUSTOMER NAME
      wa_sort-spos = 1.
      wa_sort-fieldname = 'NAME1'. "field customer name
      wa_sort-tabname = 'IT_KNA1'. "internal table with records
      wa_sort-up = 'X'.
      APPEND wa_sort TO it_sort.
      CLEAR wa_sort.
    "this will sort the ALV o/p for customer with same name
    "now the name will not be repeated
    "records with same name will be grouped
    *          DISPLAY RECORDS IN ALV GRID
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program                = sy-repid "report id
        it_fieldcat                       = it_field "field catalog
        it_sort                           = it_sort "sort info
      TABLES
        t_outtab                          = it_kna1 "internal table
      EXCEPTIONS
        program_error                     = 1
        OTHERS                            = 2.
      IF sy-subrc <> 0.
      ENDIF.
    Hope this solves your problem.
    Thanks & Regards,
    Tarun Gambhir
    Edited by: Tarun Gambhir on Dec 31, 2008 1:13 PM

  • How we can   drill-down, sorting, traffic lights,  in ALV report

    hi gurus ,
    how we can   drill-down, sorting, traffic lights,  in ALV report .
    please any one suggest that...
    regards,
    praveen

    Check the sample code for drill-down, sorting, traffic lights,  in ALV report.
    REPORT YMS_COLOURALV NO STANDARD PAGE HEADING.
    TYPE-POOLS: SLIS, ICON.
    DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA: BEGIN OF IMARA OCCURS 0,
    LIGHT(4) TYPE C,
    MATNR TYPE MARA-MATNR,
    MTART TYPE MARA-MTART,
    MAKTX TYPE MAKT-MAKTX,
    COLOR_LINE(4) TYPE C,
    TCOLOR TYPE SLIS_T_SPECIALCOL_ALV, "cell
    END OF IMARA.
    DATA: XCOLOR TYPE SLIS_SPECIALCOL_ALV.
    START-OF-SELECTION.
    PERFORM GET_DATA.
    PERFORM WRITE_REPORT.
    FORM GET_DATA.
    WRITE ICON_GREEN_LIGHT AS ICON TO IMARA-LIGHT.
    IMARA-MATNR = 'ABC'.
    IMARA-MTART = 'ZCFG'.
    IMARA-MAKTX = 'This is description for ABC'.
    APPEND IMARA.
    WRITE ICON_YELLOW_LIGHT AS ICON TO IMARA-LIGHT.
    IMARA-MATNR = 'DEF'.
    IMARA-MTART = 'ZCFG'.
    IMARA-MAKTX = 'This is description for DEF'.
    APPEND IMARA.
    WRITE ICON_RED_LIGHT AS ICON TO IMARA-LIGHT.
    IMARA-MATNR = 'GHI'.
    IMARA-MTART = 'ZCFG'.
    IMARA-MAKTX = 'This is description for GHI'.
    APPEND IMARA.
    LOOP AT IMARA.
    IF SY-TABIX = 1.
    IMARA-COLOR_LINE = 'C410'. " color line
    ENDIF.
    IF SY-TABIX = 2. " color CELL
    CLEAR XCOLOR.
    XCOLOR-FIELDNAME = 'MTART'.
    XCOLOR-COLOR-COL = '3'.
    XCOLOR-COLOR-INT = '1'. " Intensified on/off
    XCOLOR-COLOR-INV = '0'.
    APPEND XCOLOR TO IMARA-TCOLOR.
    ENDIF.
    MODIFY IMARA.
    ENDLOOP.
    ENDFORM. "get_data
    FORM WRITE_REPORT.
    DATA: LAYOUT TYPE SLIS_LAYOUT_ALV.
    LAYOUT-COLTAB_FIELDNAME = 'TCOLOR'.
    LAYOUT-INFO_FIELDNAME = 'COLOR_LINE'.
    PERFORM BUILD_FIELD_CATALOG.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FIELDCAT
    TABLES
    T_OUTTAB = IMARA.
    ENDFORM. "write_report
    FORM BUILD_FIELD_CATALOG.
    DATA: FC_TMP TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
    CLEAR: FIELDCAT. REFRESH: FIELDCAT.
    CLEAR: FC_TMP.
    FC_TMP-REPTEXT_DDIC = 'Status'.
    FC_TMP-FIELDNAME = 'LIGHT'.
    FC_TMP-TABNAME = 'IMARA'.
    FC_TMP-OUTPUTLEN = '4'.
    FC_TMP-ICON = 'X'.
    APPEND FC_TMP TO FIELDCAT.
    CLEAR: FC_TMP.
    FC_TMP-REPTEXT_DDIC = 'Material Number'.
    FC_TMP-FIELDNAME = 'MATNR'.
    FC_TMP-TABNAME = 'IMARA'.
    FC_TMP-OUTPUTLEN = '18'.
    APPEND FC_TMP TO FIELDCAT.
    CLEAR: FC_TMP.
    FC_TMP-REPTEXT_DDIC = 'Material Type'.
    FC_TMP-FIELDNAME = 'MTART'.
    FC_TMP-TABNAME = 'IMARA'.
    FC_TMP-OUTPUTLEN = '10'.
    APPEND FC_TMP TO FIELDCAT.
    CLEAR: FC_TMP.
    FC_TMP-REPTEXT_DDIC = 'Material'.
    FC_TMP-FIELDNAME = 'MAKTX'.
    FC_TMP-TABNAME = 'IMARA'.
    FC_TMP-OUTPUTLEN = '40'.
    APPEND FC_TMP TO FIELDCAT.
    ENDFORM. "build_field_catalog

  • Hide sort(ascending and descending) buttons in an alv report.

    Hi,
    I want to hide the  sort(ascending and descending) buttons in an alv report.
    can any one help me with the code?
    I am not able to use the parameter IT_TOOLBAR_EXCLUDING
    of SET_TABLE_FOR_FIRST_DISPLAY of class  CL_GUI_ALV_GRID.
    Regards,
    Himanshu.

    Hi,
    data it_exclude type ui_functions.
    Exclude Standard Functions
        PERFORM f_excludetoolbar USING obj_cust_grid
                              CHANGING it_exclude.
    FORM f_excludetoolbar  USING  u_obj_cust_grid  TYPE REF TO cl_gui_alv_grid
                        CHANGING  c_it_exclude     TYPE ui_functions.
    Exclude Standard Functions
      CLEAR: c_it_exclude.
      APPEND u_obj_cust_grid->mc_fc_check              TO  c_it_exclude.
      APPEND u_obj_cust_grid->mc_fc_refresh            TO  c_it_exclude.
      APPEND u_obj_cust_grid->mc_fc_loc_copy           TO  c_it_exclude.
      APPEND u_obj_cust_grid->mc_fc_loc_copy_row       TO  c_it_exclude.
      APPEND u_obj_cust_grid->mc_fc_loc_cut            TO  c_it_exclude.
      APPEND u_obj_cust_grid->mc_fc_loc_delete_row     TO  c_it_exclude.
      APPEND u_obj_cust_grid->mc_fc_loc_append_row     TO  c_it_exclude.
      APPEND u_obj_cust_grid->mc_fc_loc_insert_row     TO  c_it_exclude.
      APPEND u_obj_cust_grid->mc_fc_loc_move_row       TO  c_it_exclude.
    APPEND u_obj_cust_grid->MC_FC_SORT_DSC          TO  c_it_exclude.
      APPEND u_obj_cust_grid->MC_FC_SORT_ASC  TO  c_it_exclude.
      APPEND u_obj_cust_grid->MC_FC_SORT           TO  c_it_exclude.*
    ENDFORM.                    " f_excludetoolbar
    Hope it will helpful for you.
    Reward if found helpful.
    Regards,
    SB

  • Field should not display in the subtotal row in ALV report after sorting .

    we have a requirement, after sorting and subtotaling, the output in ALV is -
    vbeln        amount1  amount2  amount3
    123           11              12            13
    123           12             13             14
    123           23             25             27 
    133           11              12            13
    133           12             13             14
    133           23             25             27
    Now the customer wants the ALV outpput in this fashion -
    123           11              12            13
    123           12             13             14
                     23             25             27    --->123 (vbeln) should not come in subtotaling row
    133           11              12            13
    133           12             13             14
                      23             25             27--->133(vbeln) should not come in subtotaling row

    Hi,
    if it helps you could create a hierachy. In this way you can define the field catalog for the lines and for the subtotal columns. The only thing is that you would always show the subtotal rows.
    You have references of hierachy alvs in
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c060fcb4-2c62-2b10-d2b2-f32407a5cc6f
    ALV Hierarchy
    alv hierarchy
    In this case it also sorts
    Sorting for ALV hierarchy
    I hope it helps.
    Edited by: Oscar Pecharroman on Aug 2, 2010 1:13 PM

  • PF STATUS IN ALV REPORT

    hi,
    How to use PF STATUS IN ALV REPORT?

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

  • In ALV Report output heading is printing twice.

    Hi Experts,
    Im working on ALV Reports.
    Im printing header text by using listheader and commentary write function module.
    the problem is when i sort any column in ALV ouput the heading is printing twice.
    Again if i sort the column the heading is printed is 4 times.
    so if anybody knows the solution how we can avoid repetition of heading ,
    Please reply me as soon as possible.
    regards
    Imrangs.

    Hi Noorie,
    Thanks a lot.
    Your answer is perfect.
    Bye.
    Regards,
    Imran

  • In ALV report is possible to display the subtotals in separate column

    Hi,
    I have made one ALV report, i need to show the subtotals of ekpo-brtwr (Gross Value)  grouped by or sorted by
    ekko-ebeln (Purshasing Doc) but in separate column  not at the end of the line items of each purshasing doc
    any idea how can i do this?
    let us say i have the following cols in my report:
    ekko-bukrs
    ekko-ebeln,
    ekko-aedat,
    kko-lifnr,
    ekpo-brtwr
    i want to add one more col for example (T-Gross) and to fill it with the suptotals of (ekpo-brtwr) sorted by the
    ekko-ebeln (Purshasing Doc).
    thanks a lot.

    If you need one more column, then you need to expand the field catalog table and data table as you did for all other fields and you need to code the logic to calculate the subtotals and populate the new column, but if you want to have row, that will be easy. For more info you can [refer |http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/4063c42a-2549-2c10-fab6-a8c99d98b9b5?quicklink=index&overridelayout=true]this:

Maybe you are looking for

  • FAQ: SWF's and loading external files in Flash Catalyst

    How do I make the images in my Flash Catalyst project external to the published SWF? You can choose whether images are embedded in your Flash Catalyst SWF, or loaded dynamically; this can help to keep your SWF's small. Simply right-click an image and

  • Access Summary column in a query

    Hi All, I am new to oracle reports. I am using report builder 10.1.2.0.2. I have a summary column in my report. I would like to use this summary column in another query. if is use this column directly in the query, i am getting the below error: "Fiel

  • E-Business on HP Blades

    We are just starting our release 12 upgrade. Our environment constist of web/forms on a W2003 server, and "everything else" on a HP Unix RP5470 server. We are looking at evolving our platform to HP Itanium. We are looking at the c7000 enclosure and b

  • Multiple File & Image uploads with Developers Toolbox

    I am considering purchasing the Developers Toolbox if it will save me some time. The online information isn't very detailed and I am curious if it has the capabilities of handling multiple image uploads. For instance I'm building a news page where a

  • Finder fails to recognize fonts and other files

    My Mac recently crashed beyond repair so I erased the disk and installed osx tiger, all updates, and all my applications. All apps run ok, files with extentions are associated properly, but all fonts and files without extensions are seen by the mac a