Web Dynpro ALV disable column sort for specific column

Hi,
I have the above mentioned problem. The Coding I use is:
DATA:  lr_field_settings  TYPE REF TO if_salv_wd_field_settings,
            lt_fields          TYPE SALV_WD_T_FIELD_REF.
FIELD-SYMBOLS:  <fs_field>  LIKE LINE OF lt_fields.
lr_field_settings ?= lr_config.
lt_fields = lr_field_settings->get_fields( ).
READ TABLE lt_fields ASSIGNING <fs_field> WITH KEY fieldname = 'ANSPRECH_DETAILS'.
IF sy-subrc EQ 0.
  <fs_field>-r_field->if_salv_wd_sort~set_sort_allowed( abap_false ).
  <fs_field>-r_field->if_salv_wd_sort~set_grouping_allowed( abap_false ).
ENDIF.
When debugging I can see that the object attributes for sort_allowed and grouping_allowed are changed from 'X' to ' '
but the running application still allows sorting and grouping for the column 'ANSPRECH_DETAILS'.
So what did I forget or what is my mistake ????
Thx for your help.
Dino Dini

I got the similar requirement and I tried to do the below way.. it worked for me..
DATA: lr_field_settings TYPE REF TO if_salv_wd_field_settings.
DATA: lr_field TYPE REF TO cl_salv_wd_field.
lr_field_settings ?= lr_table.
lr_field = lr_field_settings->get_field( 'MATNR' ).
lr_field->IF_SALV_WD_SORT~SET_SORT_ALLOWED( abap_false
you can observe in the below image that sort option is not enabled for MATNR in the ALV.

Similar Messages

  • IsCellEditable() to disable cell editing for specific columns

    Hello experts:
    My SSCCE for this question is at the below link:
    http://forum.java.sun.com/thread.jspa?threadID=5293914&messageID=10244030#10244030
    My question is how do I disable cell editing for all but the "Price" column of my table in the SSCCE. I tried adding the below lines of code right after creating the JTable. But get compilation errors.
    //Here is the block of code that I am trying to include.
         @Override                                                       
         public boolean isCellEditable(int row, int col) {     
         if (col == 7) {                                                  
                   return true;
              } else {
                   return false;
         } //Below is the method in detail03.java showing the block of code added
    private JScrollPane BuildEmptyTable() {
         model = new DefaultTableModel();
         model.addTableModelListener( this );
         model.setColumnIdentifiers(new String[] { "SKU","Qty", "Price"});
            tblDetailTest = new JTable(model);
         @Override                                                       
         public boolean isCellEditable(int row, int col) {     //     <----- I tried placing the
         if (col == 7) {                                        //                  the code block here
                   return true;
              } else {
                   return false;
         tblDetailTest.setRowHeight(20);
         tblDetailTest.setPreferredScrollableViewportSize(new Dimension(900, 100));
         JTableHeader tblHdr = tblDetailTest.getTableHeader();
         tblHdr.setBackground(Color.yellow);
         JScrollPane scrollPane = new JScrollPane(tblDetailTest);
         return scrollPane;
    }Can somebody please guide me? Thank you very much.

    oops!
    Sorry, my bad! I did not tell you what I tried. Following your suggestion, I made the following 2 changes to the code:
    In the method, BuildEmptyTable(), where I build the table structure, I have the following statement:
         tblDetail = new JTable(model){
    public boolean isCellEditable(int row, int col) {
           return col == 8;
    };And in a separate method after the table is populated with data, I have the below code:
         tblDetail.getModel().addTableModelListener(new TableModelListener() {
         public void tableChanged(TableModelEvent e) {
         if (e.getType() == TableModelEvent.UPDATE)
              int row = e.getFirstRow();
              int column = e.getColumn();
                 if (column == 8){
                   //code here
                   System.out.println("Updating item price!");
         }I do understand that the message gets displayed as many number of times equal to number of rows inserted into the table, because of the UPDATE event. But my problem is I do not know how to make a code change to do what I exactly want, as I have indicated in my previous note. Meaning I want the listener to be called only when the
    data in the editable cell changes.
    Thank You.

  • Get column value for specific columns

    I want to change the default behavior of a IKM. In a specific step, I need to call a PLSQL procedure inside the loop below, and that procedure will substitute the insert clause. The procedure uses only some attributes, and I need to check the name of each one when I use the getColList method.
         for aRecord in myCursor loop
              insert into      <%=snpRef.getTable("L","TARG_NAME","A")%>
                   <%=snpRef.getColList("", "[COL_NAME]", ",\n\t\t\t", "", "((INS AND (NOT TRG)) AND REW)")%>
                   <%=snpRef.getColList(",", "[COL_NAME]", ",\n\t\t\t", "", "((INS AND TRG) AND REW)")%>
              values
                   <%=snpRef.getColList("", "aRecord.[COL_NAME]", ", \n\t\t\t", "", "((INS AND (NOT TRG)) AND REW)")%>
                   <%=snpRef.getColList(",", "aRecord.[COL_NAME]", ", \n\t\t\t", "", "((INS AND TRG) AND REW)")%>
         end loop;
    For example, to call the procedure I do that: schema.proc_1(col1, col2, col3). However, I have more than 3 columns, and I need to restrict them when I use the getColList method. I would like to know if there is a way to get only specific columns, giving these names. I pass the name of the column, and the method should return its value. Can I use the getColList to do that? Is there any other way to do that?

    Hi Luciene,
    You can use the UD flags to do this. If you click on one of your mappings in the Diagram tab of your interface you will notice several UD flags (UD1 to UD5) you can use those to flag the columns you want to use in proc_1.
    To summarize:
    - at the interface level flag the columns you want to use in your PL/SQL code -> check UD1 for all of them
    - modify your IKM code:
    <%=odiRef.getColList(",", "COL_NAME", ",\n\t\t\t", "", "((INS AND TRG) AND REW AND UD1)")%> <- retrieve columns flagged with insert, not read only, mapped on target and with UD1 flagged. The "AND UD1" part can be used in other getColList.
    Hope this helps.
    Thanks,
    Julien

  • How to disable sorting for some columns in a ALV GRID?

    Hi i have requirement where I have to disable sorting for some columns in a ALV GRID. i am using REUSE_ALV_GRID_DISPLAY function module.
    Can anybody help me. how to acieve this? Any code snippets will really be appreciated.

    Hi,
    I have tried this but not completely successful. I think this can be done using the OOPS method.
      DATA: it_event_exit TYPE  slis_t_event_exit.
      DATA: w_exit TYPE slis_event_exit.
      w_exit-ucomm = '&ODN'.
      w_exit-before = 'X'.
      CLEAR w_exit-after.
      APPEND w_exit TO it_event_exit.
      w_exit-ucomm = '&OUP'.
      w_exit-before = 'X'.
      CLEAR w_exit-after.
      APPEND w_exit TO it_event_exit.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program          = w_repid
          i_callback_top_of_page      = 'ALV_TOP_OF_PAGE'
          i_callback_html_top_of_page = 'ALV_HTML_TOP_OF_PAGE'
          i_callback_user_command     = 'USER_COMMAND'  <- User command form
          is_layout                   = wm_layout
          it_fieldcat                 = wt_fieldcat
          it_events                   = i_events
          it_event_exit               = it_event_exit    <- Need to fill
          it_sort                     = wt_sort
          i_default                   = 'X'
    Now you can capture this events in the user command
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      IF r_ucomm = '&OUP' and rs_selfield-SEL_TAB_FIELD = 'Your field name'.
      ENDIF.
    ENDFORM.                    "user_command
    In this form you will get the function code in 'r_ucomm' and the field selected for sorting in 'rs_selfield-SEL_TAB_FIELD'. But reseting 'r_ucomm' will not work.
    May be somebody else can give some help on this.
    But this will work if you follow the oop method.
    Please see this document for more info.
    http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an easy reference for alv grid control.pdf
    Thanks
    Vinod

  • Web Dynpro ALV grid column colour

    Hi,
    I have tried to set the colour of a column for my web dynpro alv with the below code but it the colour for this column has not changed - it seems to remain the standard colour.  Is there something else i need to do?
      DATA: lt_columns TYPE salv_wd_t_column_ref
          , ls_columns  TYPE salv_wd_s_column_ref
          , lr_column TYPE REF TO cl_salv_wd_column
      lt_columns = lo_value->if_salv_wd_column_settings~get_columns( ).
      LOOP AT lt_columns INTO ls_columns.
        IF ls_columns-id CS 'TOTAL_'.
          lr_column = ls_columns-r_column.
          lr_column->set_cell_design( cl_wd_abstr_master_table_col=>e_cell_design-positive ). "CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-GROUP_LEVEL1
        ENDIF.
      ENDLOOP.

    Hi Samir,
    You will have to create an attribut WDUI_TABLE_CELL_DESIGN and bind this attribute with the cell design property of the column. Check this wiki link [https://wiki.sdn.sap.com/wiki/display/Snippets/ABAP%20Web%20Dynpro%20ALV%20-%20Change%20Cell%20Colour%20based%20on%20Content], it will solve your issue.
    Regards,
    Radhika.

  • Web Dynpro ALV grid column width

    Hi,
    I have a web dynpro alv grid that has columns titles that are long.  What is the best way of displaying the data without taking up too much space with the titles? 
    For example is it possible to wrap the title into 2 or 3 rows
    Thanks,
    Samir

    Hi,
    DATA: lr_column type ref to cl_salv_wd_column,
    lr_colheader type ref to cl_salv_wd_column_header.
              CALL METHOD lrcolumn->get_header
                RECEIVING
                  value = lr_COLHEADER.
    lr_COLHEADER->set_ddic_binding_field( if_salv_wd_c_ddic_binding=>ddic_bind_short ).
    Refer this if_salv_wd_c_ddic_binding in se24 for more.
    Regards,
    Lekha.

  • Separatate column of Web Dynpro ALV table using a vertical line

    Hi Experts!
    I have Web Dynpro ALV table and  I have a requirement to add a colored vertical line between two columns as a separator.   
    Is this possible? Is it possible to adjust border width of individual cells?
    I would be grateful for any ideas you may able to share.

    Both could be achieved by creating custom theme. But those changes will be applicable to tables and ALVs in your applications.
    Nitesh

  • WEB DYNPRO ALV GRID : CELL CONTENT - Initial Value

    I created a sort of 'Timesheet' in web dynpro...
    Unfortunatly, for all days of the month it displays '0.00' as initial value...
    Is it possible to not display this initial value or display space/empty ?
    In gui alv it is possible, I don't know if it could be done in web dynpro

    Hi,
    For the node to which the ALV is bound. For the column (context attribute) check the property of the attribute check the formatting propertioes as ZEROS AS BLANKS
    for ex: price is the context attrbiute check the properties.
    This FORMATTING options for the context attribute is found in the latest verions like EHP4.
    Regards,
    Lekha.

  • How to Email POWL Reports / Apply Web Dynpro ALV Table Layout Settings

    Hi all,
    we want to be able to automatically extract POWL reports and email them to users in a batch job.
    We can refresh a POWL report using FM POWL_QUERY_REFRESH, and access the raw report data using method CL_POWL_QUERY_ACCESSOR=>GET_CACHED_RESULTS.
    However this merely gives us a table of raw data.  No view layout (ie. Web Dynpro ALV table layout) settings have been applied, so there is no hiding or arranging of columns, row sorting, calculations or filters.
    Ideally we would like to be able to specify a query and view layout.  The batch job would then refresh and extract the data, and format the data according to the view layout before sending it on as an attachment in an email.
    Does anyone know how to determine and apply Web Dynpro ALV table layout settings to format table data outside of the Web Dynpro environment ?
    Thanks & regards,
    Grogan

    Hi Grogan,
    Did you find out how this works..i also have the same issue.
    Thanks
    Jdsouza

  • Web Dynpro ALV grid totals

    Hi,
    I have created an application that uses a web dynpro alv grid.  I want to display totals - is there a setting that can do this automatically - if so, can you please tell me how to do this?    Thanks,

    Hi
    You can take help of following code snippet to create totals for a particular column
    Data: lr_function_settings TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
            lr_column          TYPE REF TO cl_salv_wd_column,
            lt_column type salv_wd_t_column_ref,
            ls_column type salv_wd_s_column_ref.
    Data:  lr_field_amnt type REF TO CL_SALV_WD_FIELD.
    * get reference of ALV component
      lr_salv_wd_table = wd_this->wd_cpifc_OVERVIEW_EARNED_ALV( ).
      wd_this->alv_config_table = lr_salv_wd_table->get_model( ).
    *  get function settings
      lr_function_settings ?= wd_this->alv_config_table.
    * display columns in correct order
      lr_column_settings ?= wd_this->alv_config_table.
      lt_column = lr_column_settings->get_columns( ).
      loop at lt_column into ls_column.
    CASE ls_column-id.
    when 'AMOUNT'
    * aggregate field
            CALL METHOD LR_FUNCTION_SETTINGS->IF_SALV_WD_FIELD_SETTINGS~GET_FIELD
              EXPORTING
                FIELDNAME = 'AMOUNT'
              RECEIVING
                VALUE     = lr_field_amnt.
    * create aggregate rule as total
            CALL METHOD LR_FIELD_AMNT->IF_SALV_WD_AGGR~CREATE_AGGR_RULE
              EXPORTING
                AGGREGATION_TYPE = IF_SALV_WD_C_AGGREGATION=>AGGRTYPE_TOTAL
              RECEIVING
                VALUE            = lv_aggr_rule.
    endcase.
    Regards
    Manas DUa

  • Web Dynpro ALV vs. Table

    Hello,
    can u please describe the main differences between Web Dynpro ALV and Web Dynpro Table ?
    When do I choose which component for my applications ?
    Thanks in adavance
    Best regards
    hermannh

    Hi,
    SAP List Viewer (ALV) is a  tool which is used to display lists and tabular structures and provides a lot of flexibilty for report generation.
    Flexible in the sense , it has a lot of inbuilt functionalities which are used in general in a reporting and thus helps in reducing a large amount of coding.
    for eg: <code> CALL METHOD alv_grid->set_table_for_first_display
       EXPORTING
         I_STRUCTURE_NAME              = 'YCLII_CUST_STRU'
       CHANGING
         it_outtab                     = CUST_TAB
    <code>
    The above method is used for table generation. Mny more funtionalities such as sorting and re-arranging of result output is also available.
    for further info check this link.
    http://www.sap-img.com/abap/what-is-alv-programming.htm
    http://www.sdn.sap.com/irj/sdn/index?rid=/webcontent/uuid/f0b107e4-dc72-2c10-08a7-b822c9abf0e2
    Thanks

  • Input field in Web Dynpro ALV does not have correct focus

    Hello Friends,
    Our client's SAP system is recently upgraded with ECC 6.0 SP 18.
    After that the focus in the editable field of Web Dynpro ALV does not working properly by down arrow navigation.
    The common scenario:
    The ALV has more than one rows and one column is editable...
    when user is selecting field of first row and making some entries...
    after that pressing down arrow it is going to next row and coloring the field like focusing...
    but the 'cursor' is not blinking so user can not make entry without clicking by mouse...
    this was working Ok before upgrade...
    Could you please anyone have a look and propose a suitable solution?
    Thanks
    Krish

    Hello,
    The problem was with Javascript....which play an important role in layout of web dynpro ALV...
    which resides in MIME repository -> SAP ->PUBLIC - >BC ->NW5 ->JS ->SAPURI_Ie6....
    We wrote to SAP for giving us the fix...
    after we got a new file from SAP the problem is solved...
    also we have to clear server cache through SMICM and client cache...
    Thanks.
    K.

  • Web dynpro Alv ENHANCEMENT

    hI,
    i HAVE a requirement to add extra 2 columns in web dynpro alv of standard web dynpro component
    what are the steps to be taken.

    Hi Madhav,
    Please cehck Thomus answer in this thread..
    is possible to enhance standard ALV?
    Enhancement Implementation - Removing columns in standard ALV table
    Cheers,
    Kris.

  • Web Dynpro ALV grid sub totals

    Hi,
    I have managed to get totals working with web dynpro ALV using code like this :
      DATA: lr_field TYPE REF TO cl_salv_wd_field.
    For total calculations...
      lo_value->if_salv_wd_std_functions~set_aggregation_allowed( abap_true ).
      lr_field = lo_value->if_salv_wd_field_settings~get_field( 'N_OF_DLRS' ).
      lr_field->if_salv_wd_aggr~create_aggr_rule( aggregation_type = if_salv_wd_c_aggregation=>aggrtype_total ).
    Please can someone advise how i can do subtotals also.  Thanks
    Edited by: Samir Vora on Jul 15, 2009 12:40 PM

    Hi,
    For creating subtotals, you can have a look at following article:
    [Tutorial for Creation Subtotals using ALV|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-technology/wd%20abap/tutorial%20for%20creating%20totals%20and%20subtotals%20using%20alv.pdf].
    Hope this helps.
    Regards
    Manas Dua

  • Web Dynpro ALV grid equivalent of onLeadSelect

    Hi,
    I am new to web dynpro alv and would like to know how to implement the equivelent of the action onLeadSelect that you can do with a table UIElement, but I want to do this for the ALV table that I have.  Many thanks,
    Samir

    Hi,
    Go to the View's property tab and include you ALV in that.
    whenever you instantiate the ALV then in the view, METHODS tab, you can find the Event handler for the lead selection for that ALV. Implement that.
    Method name           Method type         Event        
    ONLEADSELECT     Eventhandler        ON_LEAD_SELECT
    Check out the links -
    Re: click event on ALV
    http://www.flickr.com/photos/31042772@N08/3408386623/
    Regards,
    Lekha

Maybe you are looking for

  • Scroll bars in Lion

    How do I adjust the scroll bars in Lion?  I want the scroll bars to be visible always, and wide (like they were in previous operating systems). In Lion, when I open a file, the scroll bar is invisible.  To get the scroll bar to appear, I have to stab

  • How do I add my sync items to new phone

    Hi all, I recently had a palm centro and did regular syncs to my computer. Yesterday my phone came into contact with my 2 year old and needless to say "it went to heaven", so now I am looking to buy a different palm phone maybe the pixie or maybe jus

  • PNY Quadro K5000 Mac Edition - Audio Problems via DP/HDMI adapter

    Hello, as stated in the topic I have some troubles to get the sound working on my TV witch is plugged into the Mac Pro via HDMI/DP adapter. Setup: Mac Pro 5.1 with OSX 10.9.5 Graphics PNY Quadro K5000 Mac Edition My Question ist this: Ist there a Pro

  • Brothers credit journey of BRUTE FORCE (cont)

    I remember that crazy wacko app spree like yesterday

  • REAL Solution for " Cant Unmount Disk"

    I have a G% 1.8 PPC. It is Primarily a Protools machine. I have been using it for about 6 years. One of the hdds have been attached for 4years via FW400. I recently upgraded with no problem from 10.4.11 to 10.5.8. At the same time I went from ProTool