How to Group Fields in ALV

Hi,
In My Report I want to group the fields in ALV i found the attribute SP_GROUP  to be set with value and the internal table IT_SPECIAL_GROUPS to be passed to set_table_for_first_display method. My requirement is such that i need few fields to be common to multiple groups so can i use multiple value to SP_GROUP attribute while defining field catalog..??  Or any other method is there please suggest me.
Thank's & Regard's
Girija

Hi,
Use sort instead, below is the sample code.
*  Internal table for storing info. for ALV grid
data: i_sort2 TYPE LVC_T_SORT.
DATA: wa_sort2      LIKE LINE OF i_sort2.
  wa_sort2-spos = 1.
  wa_sort2-fieldname = 'EBELN'.
  wa_sort2-up = 'X'.
  wa_sort2-subtot = 'X'.
  APPEND wa_sort2 TO i_sort2.
  CLEAR wa_sort2.
  wa_sort2-spos = 2.
  wa_sort2-fieldname = 'EBELP'.
  wa_sort2-up = 'X'.
  wa_sort2-subtot = space.
  APPEND wa_sort2 TO i_sort2.
  CLEAR wa_sort2.
  wa_sort2-spos = 3.
  wa_sort2-fieldname = 'EINDT'.
  wa_sort2-up = 'X'.
  wa_sort2-subtot = space.
  APPEND wa_sort2 TO i_sort2.
Now use I_sort2 table with changing parameter IT_SORT of method SET_TABLE_FOR_FIRST_DISPLAY

Similar Messages

  • How to find fields in ALV variant

    Hi,
    How do we find the fields in ALV layout? I have a layout name. I want to find what are all the fields that are available in the layout

    link:[http://wiki.sdn.sap.com/wiki/display/stage/ToGetFieldDetailsSavedinVariant+Layout]

  • How to group data in ALV grid display

    Hello Experts,
    I am using REUSE_ALV_GRID_DISPLAY to display my data.
    here, I am using SLIS_T_FIELDCAT_ALV to create field catalog.
    My requirement is data of 1 field/column in ALV had to be displayed by grouping.
    Is there any field any fieldcatalog which I can set so that data will be displayed as after grouping.
    I had searched a lot but found solution for OO ALV but not for function modules.
    Edited by: shubh_ag on Sep 2, 2011 4:38 PM

    Hi shubh,
    try this,
    * Declarations related to ALV Display
    TYPE-POOLS : slis.
    DATA : gt_fcat TYPE slis_t_fieldcat_alv ,
           gs_fcat TYPE slis_fieldcat_alv,
           list_gt_fcat TYPE slis_t_fieldcat_alv ,
           list_gs_fcat TYPE slis_fieldcat_alv,
           gt_listheader TYPE slis_t_listheader,
           gs_listheader TYPE slis_listheader,
           gs_layout TYPE slis_layout_alv,
           list_gs_layout TYPE slis_layout_alv,
           gs_wvar TYPE i VALUE 1.
    DATA: gt_events           TYPE slis_t_event,
          gs_events           LIKE LINE OF gt_events,
          gt_sort             TYPE  slis_t_sortinfo_alv,
          gs_sort             TYPE slis_sortinfo_alv.
    DATA:gs_ovar TYPE disvariant.
    FORM alv_display .
      PERFORM field_catalog.
      PERFORM display_data.
    ENDFORM.                    " ALV_DISPLAY
    *&      Form  FIELD_CATALOG
          text
    -->  p1        text
    <--  p2        text
    FORM field_catalog .
      gs_fcat-col_pos   = gs_wvar.
      gs_fcat-tabname   = 'GT_FINAL'.
      gs_fcat-fieldname = 'MATERIAL'.
      gs_fcat-do_sum    = 'X'.
      gs_fcat-seltext_m = text-001.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'DESCRIPTION'.
      gs_fcat-seltext_m = text-011.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'TYPE'.
      gs_fcat-seltext_m = text-002.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'UOM'.
      gs_fcat-seltext_m = text-003.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'PLANT'.
      gs_fcat-do_sum    = 'X'.
      gs_fcat-seltext_m = text-004.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'PURCHASING_GROUP'.
      gs_fcat-seltext_m = text-005.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'MRP_TYPE'.
      gs_fcat-seltext_m = text-006.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'MRP_CONTROLLER'.
      gs_fcat-seltext_m = text-007.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'SPECIAL_PRO '.
      gs_fcat-seltext_m = text-008.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'STORAGE_LOCATION'.
      gs_fcat-seltext_m = text-009.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos   = gs_wvar.
      gs_fcat-tabname   = 'GT_FINAL'.
      gs_fcat-fieldname = 'UNRESTRCITED_STOCK'.
      gs_fcat-do_sum    = 'X'.
      gs_fcat-seltext_m = text-010.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_sort-fieldname = 'MATERIAL'.
      gs_sort-tabname = 'GT_FINAL'.
      gs_sort-subtot = 'X'.
      APPEND gs_sort TO gt_sort.
      gs_sort-fieldname = 'PLANT'.
      gs_sort-tabname = 'GT_FINAL'.
      gs_sort-subtot = 'X'.
      APPEND gs_sort TO gt_sort.
    ENDFORM.                    " FIELD_CATALOG
    *&      Form  DISPLAY_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM display_data .
      DATA:c_top  TYPE slis_formname.
      c_top  = 'TOP'.
    " For avoiding EPC warnings
    CLEAR sy-index.
    IF sy-index EQ 1.
      PERFORM top.
    ENDIF.
      gs_layout-zebra = 'X'.
      gs_layout-colwidth_optimize = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = sy-cprog
          i_callback_user_command = 'USER_COMMAND'
          i_callback_top_of_page  = c_top
          is_layout               = gs_layout
          it_fieldcat             = gt_fcat[]
          it_sort                 = gt_sort
          i_default               = 'X'
          i_save                  = 'U'
          is_variant              = gs_ovar
        TABLES
          t_outtab                = gt_final
        EXCEPTIONS
          program_error           = 1
          OTHERS                  = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " DISPLAY_DATA
    Regards,
    Abhisek

  • Field in Alv Top-of-page

    How to pass field in Alv Top-of-page
    Edited by: Deepak  Mathrani on Aug 12, 2008 12:40 PM
    <THREAD LOCKED. Please read the [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] to discover why>
    Edited by: Mike Pokraka on Aug 12, 2008 2:58 PM

    Hi
    sample program
    *& Report  ZNNR_ALVSAMPLE
    REPORT  znnr_alvsample NO STANDARD PAGE HEADING.
    TABLES:     ekko.
    TYPE-POOLS: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE slis_layout_alv,
          gd_repid     LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but can
    also allow you  more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such as
    total. You may need to provide more information than if you were
    simply displaying the result
                  I.e. Field type may be required in-order for
                       the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-do_sum      = 'X'.        "Display column total
      fieldcatalog-datatype     = 'CURR'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      fieldcatalog-EDIT = 'X'.
      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'(001)  "see FORM
               i_callback_user_command = 'USER_COMMAND'
               i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_special_groups       = gd_tabgroup
               IT_EVENTS                = GT_XEVENTS
                i_save                  = 'X'
               is_variant              = z_template
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into table it_ekko.
    endform.                    " DATA_RETRIEVAL
    Form  TOP-OF-PAGE                                                 *
    ALV Report Header                                                 *
    Form top-of-page.
    *ALV Header declarations
    data: t_header type slis_t_listheader,
          wa_header type slis_listheader,
          t_line like wa_header-info,
          ld_lines type i,
          ld_linesc(10) type c.
    Title
      wa_header-typ  = 'H'.
      wa_header-info = 'EKKO Table Report'.
      append wa_header to t_header.
      clear wa_header.
    Date
      wa_header-typ  = 'S'.
      wa_header-key = 'Date: '.
      CONCATENATE  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
                   sy-datum(4) INTO wa_header-info.   "todays date
      append wa_header to t_header.
      clear: wa_header.
    Total No. of Records Selected
      describe table it_ekko lines ld_lines.
      ld_linesc = ld_lines.
      concatenate 'Total No. of Records Selected: ' ld_linesc
                        into t_line separated by space.
      wa_header-typ  = 'A'.
      wa_header-info = t_line.
      append wa_header to t_header.
      clear: wa_header, t_line.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = t_header.
               i_logo             = 'Z_LOGO'.
    endform.

  • How to make optional fields in alv report

    Hello Experts,
                             Can anyone tell me how to do fields as optional in ALV report Output. My requirement is I want to display only few fields as default in my output and remaining fields will be added if needed by clicking the layout button.For clear example i have totally 10 fields in that fields i want to display only 5 fields and remaining 5 fields will be optional and when i click on layout button then i can add those 5 fields also. Can anyone tell me how to do this.
    Thanks,
    Vinod.

    Hi Vinod,
    As suggested by Eitan, kindly use the attribute NO_OUT = 'X' in field catalog for the appropriate column.  Based on that we can hide the fields.
         L_FIELDCAT-NO_OUT = 'X'.
    Also we can group the hidden fields in layout using SP_GROUP attribute in Field catalog as shown below. Based on that, we can separate the fields based on category/group.
         L_FIELDCAT-SP_GROUP = 'A'.
    Regards
    Rajkumar Narasimman

  • How can we sort up currency field in alv grid??

    Hi GUrus,
    Can any one suggest me how to sort the currency field in alv grid...Please help me out of this issue..
    Thanks in advance!!!
    regards,
    Kranthi.

    hii,
    SAP provides a set of ALV (ABAP List Viewer) & function modules, which can be used to enhance the readability and functionality of any report output.
    ALV is a flexible tool used for displaying lists.The tool provides common list functions & can be enhanced by self-defined options.
    so u will get the option for sorting in your alv report.
    Thanks

  • How to assign a tooltip for a field in ALV editable grid?

    I have to display some instructions ( 50 chars long) for an editable field in alv.
    How to do this?
    BCALV_DEMO_TOOLTIP tells about assiging tooltip to an icon or symbol.
    Thanks,
    Ven..

    Neither of these two example programs help much in regards to tooltips against any field of any row. Both of these examples use tooltips for Icons. I have also been looking for a single example of tooltips usage outside of these two programs, and have found nothing in SAP, or on the internet, so far.
    Having said that, I have tried to implement the same method used by the later example, but have not got this to work. What I think we need is an example of this functionality where these Icons are not used!. I believe.
    Gary King

  • How to provide hyperlink for a particular field in ALV

    Hi,
      How to provide hyperlink for a particular field in alv report.
    Regards,
    Ramu.

    Yes you can do that. using the fieldcatalog there is an option for that. give HOT_SPOT = 'X'. for the column you want.
    wa_field-hotspot = 'X'.
    REPORT  ztest_alv.
    TYPE-POOLS:slis.
    DATA:it_fieldcat  TYPE  slis_t_fieldcat_alv,
         wa_field LIKE LINE OF it_fieldcat.
    DATA: BEGIN OF it_likp OCCURS 0,
           vbeln TYPE likp-vbeln,
          END OF it_likp.
    DATA: layout TYPE slis_layout_alv.
    wa_field-fieldname = 'VBELN'.
    wa_field-tabname = 'IT_LIKP'.
    wa_field-hotspot = 'X'.
    wa_field-outputlen = 10.
    wa_field-no_zero = 'X'.
    wa_field-seltext_l = 'Sales'.
    APPEND wa_field TO it_fieldcat.
    SELECT vbeln FROM likp
    UP TO 10 ROWS
    INTO TABLE it_likp.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program      = sy-repid
        is_layout               = layout
        i_callback_user_command = 'USER_COMMAND'
        it_fieldcat             = it_fieldcat
      TABLES
        t_outtab                = it_likp
      EXCEPTIONS
        program_error           = 1.
    *&      Form  user_Command
    *       text
    *      -->UCOMM      text
    *      -->SELFIELD   text
    FORM user_command USING ucomm TYPE sy-ucomm
                        selfield TYPE slis_selfield.
      CASE ucomm.
        WHEN '&IC1'.
          SET PARAMETER ID 'VL'  FIELD selfield-value.
          CALL TRANSACTION 'VL02N' AND SKIP FIRST SCREEN.
      ENDCASE.
    ENDFORM.                    "user_Command

  • Group Quantity field in ALV GRID

    hi all,
        how to group the Quantity fileds in ALV grid output here fldcat-group = 'X' is not useful.
    ex : in my for a order qty column values are 10.00,10.00,10.00,10.00 for a given sales order then i have to display only one 10.00 instead of 4 times.
    any idea..?
    Regards
    Ashok P

    Hi Ashok,
          If can you check this using Onchange of in a loop statement.
    Regards,
    Prashanth

  • Search criteria is not working in Responsible Group field in sap crm could you please help me this how to achieve.

    search criteria is not working in Responsible Group field in sap crm could you please help me this how to achieve.I have writen code on EH_ONSEARCH .as per below...what changess i need to do..and through partner function and adding the selection params please send the sample .
    code. partner funtction - ZRG DATA :
    DATA : lv_partner_fct type .
    types: begin of ty_resp,
           partner    type but000-partner,
           name_last  type but000-name_last,
           name_first type but000-name_first,
           mc_name1   type but000-mc_name1,
           mc_name2   type but000-mc_name2,
           end of ty_resp.
    DATA: lv_resp_bp type STANDARD TABLE OF ty_resp INITIAL SIZE 0,
           lw_resp_bp type ty_resp.
    IF lv_attr_name = 'Rgroup'.
    lr_entity->get_property_as_value( EXPORTING iv_attr_name = if_crm_srqm_uiu_const=>gc_attr_low
                                       IMPORTING ev_result = lv_low ).
    IF lv_low IS INITIAL.
    SELECT partner
           name_last
           name_first
           mc_name1
          mc_name2
    FROM but000 INTO table lv_resp_bp
    WHERE mc_name2 = lv_low and bu_group = '0010'.
    loop at lv_resp_bp into lw_resp_bp.
        lv_low = lw_resp_bp-mc_name2.
      lr_query_service2->add_selection_param( iv_attr_name = 'Rgroup'
                                                iv_sign = lv_sign
                                                iv_option = lv_option
                                                iv_low = lv_low
                                                iv_high = lv_high ).
      ENDLOOP.
    if lv_partner_fct = 'ZRG'.
      lr_entity = lr_iterator->get_next( ).
    CONTINUE.
    ENDIF.
    lv_attr_name = 'BU_PARTNER'.
    ENDIF.

    <b>You can acheive   this .... first by creating the search help exit    ... by  creating the maintaince  view   then   using it in the   Creation of the search help </b> ...
    see the link for attaching the view   to the serach help .
    <a href="http://">http://www.sapdevelopment.co.uk/dictionary/shelp/shelp_elementary.htm</a>
    reward  points if it is usefull...
    Girish

  • How to display the fields in ALV Output without using Field catalog?

    How to display the fields in ALV Output without using Field catalog?
    Could you pls tell me the coding?
    Akshitha.

    Hi,
    u mean without building field catalog. is it? I that case, we can use the FM REUSE_ALV_FIELDCATALOG_MERGE.
    data: itab type table of mara.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_structure_name = itab
    CHANGING
    ct_fieldcat = lt_fieldcat[]
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    *Pass that field catalog into the fillowing FM
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_grid_title            = 'REPORTING'
                is_layout              = gt_layout
                it_fieldcat             = lt_fieldcat[]
           tables
                t_outtab                = itab.

  • How to modify person or group field value with new value

    Hi
    I have person or group field having property Person Only.
    Thsi firls already have one value. Now I want to update it but this code to update value is not working.
    string myName = @"ABC\myname";
    web.EnsureUser(myName);
    SPUser myUser = web.SiteUsers[myName];
    SPFieldUserValue myNamevlaue = new SPFieldUserValue(web, myUser.ID, myUser.LoginName);
    oSplistItem["My_x0020_User"] = myNamevalue;
    oSplistItem.Update();
    I am getting myNamevalue correct in the veriable. But why its not updating in the list?
    is there any issue in the above code?
    Do I need to delete previous value and then update new value in this field? How?

    Hi,
    The format of the user value in people/Group field must be
    ID;#Name, you can use the following code snippets to update the people/group field.
    string loginName = "ABC\\myname";
    SPUser user = web.SiteUsers[loginName];
    SPList list = web.Lists.TryGetList("ListName");
    if (list == null)
    Console.WriteLine("list is not exist!");
    return;
    SPListItem item = list.GetItemById(3);
    item["My_x0020_User"] = user.ID.ToString() + ";#" + user.Name;
    item.Update();
    Thanks,
    Jason
    Please remember to mark the reply as answer if it help, and unmark the answer if it provide no help.

  • How to populate field catalogue fields in ALV using  dynamic internal table

    Hi All,
    Please let me know how to populate field catalogue fields in ALV using  dynamic internal table.
    I have created <dyn_table> using code below.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
                     EXPORTING
                       it_fieldcatalog = g_t_ifc
                        it_fieldcatalog = g_t_fieldcat
                     IMPORTING
                        ep_table        = dy_table.
      ASSIGN dy_table->* TO <dyn_table>.
    Create dynamic work area and assign to FS
      CREATE DATA dy_line LIKE LINE OF <dyn_table>.
      ASSIGN dy_line->* TO <dyn_wa>.
    Now this  <dyn_table>  has fields like idoc no.,creation date ,
    segment field 1, segment field 2 etc..Now idoc no.,creation date  are static fields from table EDIDC. And segment field 1, segment field 2 etc are dynamic fields from table EDSAPPL.
    In my  ALV report I am getting the final layout properly but I am unable to move values to corresponding fields in the final layout shown.Please let me know how to populate these fields from different tables.
    I tried this way but its not working.
    SORT g_t_edid4 BY docnum.
      LOOP AT g_t_edidc INTO g_r_edidc.
        READ TABLE g_t_edid4 into g_r_edid4
                         WITH KEY docnum = g_r_edidc-docnum
                                        BINARY SEARCH.
        IF sy-subrc = 0.
          <dyn_wa> =  g_r_edid4-sdata.
         MOVE-CORRESPONDING g_r_edid4 to <dyn_wa>.
       CLEAR g_r_edid4.
        ENDIF.
    MOVE-CORRESPONDING g_r_edidc to <dyn_wa>.
    APPEND <dyn_wa> TO <dyn_table>.

    You have to assign each field to field symbol and then assign the value to that field symbol and asssign that field symbol to workarea field symbol.
    LOOP AT g_t_edidc INTO g_r_edidc.
    READ TABLE g_t_edid4 into g_r_edid4
    WITH KEY docnum = g_r_edidc-docnum
    BINARY SEARCH.
    IF sy-subrc = 0.
    ASSIGN COMPONENT 'SDATA' OF STRUCTURE <DYN_WA> TO <DYN_FLD>.
    <DYN_FLD> = g_r_edid4-sdata.
    " <dyn_wa> = g_r_edid4-sdata.
    " Assign each fields like this.
    " MOVE-CORRESPONDING g_r_edid4 to <dyn_wa>.
    CLEAR g_r_edid4.
    ENDIF.
    " MOVE-CORRESPONDING g_r_edidc to <dyn_wa>.
    APPEND <dyn_wa> TO <dyn_table>.
    Regards,
    Naimesh Patel

  • How to display subtotal in ALV, where the field is not a numeric.

    Hi
    We are having a requirement to display the sub total for a field using ALV grid display, where the field is not numeric.
    The field is characte, Status field(consists of values Submit, Approve ,Reject), where the subtotal should be value of count of group by status .
    say status with submit are 10 records, so after all records with submit status are, displyed, we need to display its subtotal as 10.
    Thanks & Advance

    Hi Satya,
    REPORT z_alv_subtotal.*&---------------------------------------------------------------------*
    *& Table declaration
    *&---------------------------------------------------------------------*TABLES: ekko.*&---------------------------------------------------------------------*
    *& Type pool declaration
    TYPE-POOLS: slis. " Type pool for ALV*&---------------------------------------------------------------------*
    *& Selection screen
    SELECT-OPTIONS: s_ebeln FOR ekko-ebeln.*&---------------------------------------------------------------------*
    *& Type declaration
    *&---------------------------------------------------------------------** Type declaration for internal table to store EKPO data
    TYPES: BEGIN OF x_data,
           ebeln  TYPE char30,  " Document no.
           ebelp  TYPE ebelp,   " Item no
           matnr  TYPE matnr,   " Material no
           matnr1 TYPE matnr,   " Material no
           werks  TYPE werks_d, " Plant
           werks1 TYPE werks_d, " Plant
           ntgew  TYPE entge,   " Net weight
           gewe   TYPE egewe,   " Unit of weight                          
           END OF x_data.*&---------------------------------------------------------------------*
    *& Internal table declaration
    DATA:* Internal table to store EKPO data
      i_ekpo TYPE STANDARD TABLE OF x_data INITIAL SIZE 0,
    * Internal table for storing field catalog information
      i_fieldcat TYPE slis_t_fieldcat_alv,
    * Internal table for Top of Page info. in ALV Display
      i_alv_top_of_page TYPE slis_t_listheader,
    * Internal table for ALV Display events
      i_events TYPE slis_t_event,
    * Internal table for storing ALV sort information
      i_sort TYPE  slis_t_sortinfo_alv,
      i_event TYPE slis_t_event.*&---------------------------------------------------------------------*
    *& Work area declaration
    *&---------------------------------------------------------------------*DATA:
      wa_ekko TYPE x_data,
      wa_layout     TYPE slis_layout_alv,
      wa_events         TYPE slis_alv_event,
      wa_sort TYPE slis_sortinfo_alv.*&---------------------------------------------------------------------*
    *& Constant declaration
    *&---------------------------------------------------------------------*CONSTANTS:
       c_header   TYPE char1
                  VALUE 'H',                    "Header in ALV
       c_item     TYPE char1
                  VALUE 'S'.*&---------------------------------------------------------------------*
    *& Start-of-selection event
    *&---------------------------------------------------------------------*START-OF-SELECTION.* Select data from ekpo
      SELECT ebeln " Doc no
             ebelp " Item
             matnr " Material
             matnr " Material
             werks " Plant
             werks " Plant
             ntgew " Quantity
             gewei " Unit
             FROM ekpo
             INTO TABLE i_ekpo
             WHERE ebeln IN s_ebeln
             AND ntgew NE '0.00'.  IF sy-subrc = 0.
        SORT i_ekpo BY ebeln ebelp matnr .
      ENDIF.* To build the Page header
      PERFORM sub_build_header.* To prepare field catalog
      PERFORM sub_field_catalog.* Perform to populate the layout structure
      PERFORM sub_populate_layout.* Perform to populate the sort table.
      PERFORM sub_populate_sort.* Perform to populate ALV event
      PERFORM sub_get_event.END-OF-SELECTION.* Perform to display ALV report
      PERFORM sub_alv_report_display.
    *&      Form  sub_build_header
    *       To build the header
    *       No Parameter
    FORM sub_build_header .* Local data declaration
      DATA: l_system     TYPE char10 ,          "System id
            l_r_line     TYPE slis_listheader,  "Hold list header
            l_date       TYPE char10,           "Date
            l_time       TYPE char10,           "Time
            l_success_records TYPE i,           "No of success records
            l_title(300) TYPE c.                " Title
    * Title  Display
      l_r_line-typ = c_header.               " header
      l_title = 'Test report'(001).
      l_r_line-info = l_title.
      APPEND l_r_line TO i_alv_top_of_page.
      CLEAR l_r_line.* Run date Display
      CLEAR l_date.
      l_r_line-typ  = c_item.                " Item
      WRITE: sy-datum  TO l_date MM/DD/YYYY.
      l_r_line-key = 'Run Date :'(002).
      l_r_line-info = l_date.
      APPEND l_r_line TO i_alv_top_of_page.
      CLEAR: l_r_line,
             l_date.ENDFORM.                    " sub_build_header
    *&      Form  sub_field_catalog
    *       Build Field Catalog
    *       No Parameter
    FORM sub_field_catalog .*  Build Field Catalog
      PERFORM sub_fill_alv_field_catalog USING:     '01' '01' 'EBELN' 'I_EKPO' 'L'
         'Doc No'(003) ' ' ' ' ' ' ' ',     '01' '02' 'EBELP' 'I_EKPO' 'L'
         'Item No'(004) 'X' 'X' ' ' ' ',     '01' '03' 'MATNR' 'I_EKPO' 'L'
         'Material No'(005) 'X' 'X' ' ' ' ',     '01' '03' 'MATNR1' 'I_EKPO' 'L'
         'Material No'(005) ' ' ' ' ' ' ' ',
         '01' '04' 'WERKS' 'I_EKPO' 'L'
         'Plant'(006) 'X' 'X' ' ' ' ',     '01' '04' 'WERKS1' 'I_EKPO' 'L'
         'Plant'(006) ' ' ' ' ' ' ' ',     '01' '05' 'NTGEW' 'I_EKPO' 'R'
         'Net Weight'(007) ' ' ' ' 'GEWE' 'I_EKPO'.ENDFORM.                    " sub_field_catalog*&---------------------------------------------------------------------*
    *&     Form  sub_fill_alv_field_catalog
    *&     For building Field Catalog
    *&     p_rowpos   Row position
    *&     p_colpos   Col position
    *&     p_fldnam   Fldname
    *&     p_tabnam   Tabname
    *&     p_justif   Justification
    *&     p_seltext  Seltext
    *&     p_out      no out
    *&     p_tech     Technical field
    *&     p_qfield   Quantity field
    *&     p_qtab     Quantity table
    FORM sub_fill_alv_field_catalog  USING  p_rowpos    TYPE sycurow
                                            p_colpos    TYPE sycucol
                                            p_fldnam    TYPE fieldname
                                            p_tabnam    TYPE tabname
                                            p_justif    TYPE char1
                                            p_seltext   TYPE dd03p-scrtext_l
                                            p_out       TYPE char1
                                            p_tech      TYPE char1
                                            p_qfield    TYPE slis_fieldname
                                            p_qtab      TYPE slis_tabname.* Local declaration for field catalog
      DATA: wa_lfl_fcat    TYPE  slis_fieldcat_alv.  wa_lfl_fcat-row_pos        =  p_rowpos.     "Row
      wa_lfl_fcat-col_pos        =  p_colpos.     "Column
      wa_lfl_fcat-fieldname      =  p_fldnam.     "Field Name
      wa_lfl_fcat-tabname        =  p_tabnam.     "Internal Table Name
      wa_lfl_fcat-just           =  p_justif.     "Screen Justified
      wa_lfl_fcat-seltext_l      =  p_seltext.    "Field Text
      wa_lfl_fcat-no_out         =  p_out.        "No output
      wa_lfl_fcat-tech           =  p_tech.       "Technical field
      wa_lfl_fcat-qfieldname     =  p_qfield.     "Quantity unit
      wa_lfl_fcat-qtabname       =  p_qtab .      "Quantity table  IF p_fldnam = 'NTGEW'.
        wa_lfl_fcat-do_sum  = 'X'.
      ENDIF.
      APPEND wa_lfl_fcat TO i_fieldcat.
      CLEAR wa_lfl_fcat.
    ENDFORM.                    " sub_fill_alv_field_catalog*&---------------------------------------------------------------------*
    *&      Form  sub_populate_layout
    *       Populate ALV layout
    *       No Parameter
    FORM sub_populate_layout .  CLEAR wa_layout.
      wa_layout-colwidth_optimize = 'X'." Optimization of Col widthENDFORM.                    " sub_populate_layout*&---------------------------------------------------------------------*
    *&      Form  sub_populate_sort
    *       Populate ALV sort table
    *       No Parameter
    FORM sub_populate_sort .* Sort on material
      wa_sort-spos = '01' .
      wa_sort-fieldname = 'MATNR'.
      wa_sort-tabname = 'I_EKPO'.
      wa_sort-up = 'X'.
      wa_sort-subtot = 'X'.
      APPEND wa_sort TO i_sort .
      CLEAR wa_sort.* Sort on plant
      wa_sort-spos = '02'.
      wa_sort-fieldname = 'WERKS'.
      wa_sort-tabname = 'I_EKPO'.
      wa_sort-up = 'X'.
      wa_sort-subtot = 'X'.
      APPEND wa_sort TO i_sort .
      CLEAR wa_sort.
    ENDFORM.                    " sub_populate_sort*&---------------------------------------------------------------------*
    *&      Form  sub_get_event
    *       Get ALV grid event and pass the form name to subtotal_text
    *       event
    *       No Parameter
    FORM sub_get_event .
      CONSTANTS : c_formname_subtotal_text TYPE slis_formname VALUE
    'SUBTOTAL_TEXT'.  DATA: l_s_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 4
        IMPORTING
          et_events       = i_event
        EXCEPTIONS
          list_type_wrong = 0
          OTHERS          = 0.* Subtotal
      READ TABLE i_event  INTO l_s_event
                        WITH KEY name = slis_ev_subtotal_text.
      IF sy-subrc = 0.
        MOVE c_formname_subtotal_text TO l_s_event-form.
        MODIFY i_event FROM l_s_event INDEX sy-tabix.
      ENDIF.ENDFORM.                    " sub_get_event*&---------------------------------------------------------------------*
    *&      Form  sub_alv_report_display
    *       For ALV Report Display
    *       No Parameter
    FORM sub_alv_report_display .
      DATA: l_repid TYPE syrepid .
      l_repid = sy-repid .* This function module for displaying the ALV report
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = l_repid
          i_callback_top_of_page   = 'SUB_ALV_TOP_OF_PAGE'
          is_layout                = wa_layout
          it_fieldcat              = i_fieldcat
          it_sort = i_sort
          it_events                = i_event
          i_default                = 'X'
          i_save                   = 'A'
        TABLES
          t_outtab                 = i_ekpo
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
    *    MESSAGE i000 WITH 'Error in ALV report display'(055).
      ENDIF.ENDFORM.                    " sub_alv_report_display*&---------------------------------------------------------------------*
    *       FORM sub_alv_top_of_page
    *       Call ALV top of page
    *       No parameter
    *---------------------------------------------------------------------*FORM sub_alv_top_of_page.                                   "#EC CALLED* To write header for the ALV
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = i_alv_top_of_page.
    ENDFORM.                    "alv_top_of_page*&---------------------------------------------------------------------*
    *&      Form  subtotal_text
    *       Build subtotal text
    *       P_total  Total
    *       p_subtot_text Subtotal text info
    FORM subtotal_text CHANGING
                   p_total TYPE any
                   p_subtot_text TYPE slis_subtot_text.
    * Material level sub total
      IF p_subtot_text-criteria = 'MATNR'.
        p_subtot_text-display_text_for_subtotal
        = 'Material level total'(009).
      ENDIF.* Plant level sub total
      IF p_subtot_text-criteria = 'WERKS'.
        p_subtot_text-display_text_for_subtotal = 'Plant level total'(010).
      ENDIF.
    ENDFORM.                    "subtotal_text
    Regards,
    Pravin

  • How to pass custom search help(F4 help) for a field in ALV output?

    Hi,
    I want to activate the F4 help in ALV output for a field for which we do not have search help assigned at table ,data element and domain level.
    In field catalog i have enabled it by below line.
    ls_fcat-F4AVAILABL = 'X'.
    but because there are no standard input help available it is giving message as "No input help is available".
    so how to pass our custom search help (g_search) for any field in ALV output.
    I am using object oriented ALV grid display.
    Thanks!!!
    Rajesh Gupta.

    hi,
    check this out:
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b3d5e890-0201-0010-c0ac-bba85ec2ae8d
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/acdefb13-0701-0010-f1a2-8eeefa7d3780
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b3d5e890-0201-0010-c0ac-bba85ec2ae8d?quicklink=index&overridelayout=true

Maybe you are looking for

  • IF statement in java

    Hi gurus, how can i write this following code in java ? if (conv.getInt("LP_ID") == 9,5,7,6,3) doing something.... Thanks in advance.

  • Sale order doesn;t exist issue in APO

    Hi , I am facing issue while trying ot create outbound delivery from sale order. But during delivery creation , BAPI_OUTB_DELIVERY_CREATE_SLS , bapi throws error as " SALE order xxxxxxxxx doesn't exist in APO , Only 0 EA of material is available..."

  • Updating Content in Flash? Possible?

    I'd like to know if the following is possible: Let's say I develop a game and post it on several different sites. In the game, there is an ad for widgets. I find another sponsor after the orignal sponsor's agreement runs out. I would like to update t

  • Java.io.FileNotFound Exception

    when trying to call autoConfigure() got following java.io.FileNotFoundException: /../../abc.xml (No such file or directory) Please throw some light thanks, Srikanth

  • Why does the displacement effect is not appearing on my adobe muse effects menu?

    I have seen tutorials about the displacement effect but when i open the effects menu, it doesnt appear, and I dont know why, can someone help me with this issue please