Sorting Table Column

HI,
I have a Webdynpro table with two columns, the first colum displays Company Names and the Second one Company Nodes.
I would like to sort the fist column by Company Name and the second one by Company codes,
i have gone through the following tutorial
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/c092333b-0601-0010-e7af-8c227fb6d052
but its bit difficult to understand..
is there any simple steps and code..
Murali

All that i did is excuted company code Bapi.
public static void wdDoModifyView(IPrivateTableCompatibilityModeView wdThis, IPrivateTableCompatibilityModeView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
    //@@begin wdDoModifyView
          if (firstTime) {
               IWDTable tablec = (IWDTable) view.getElement("CompanyTable");
                              wdContext.currentContextElement().setTableSorter(
                                   new TableSorter(tablec, wdThis.wdGetSortByCompanyNameAction(), null));     
    //@@end
========================
public void onActionsortByCompanyName(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
    //@@begin onActionsortByCompanyName(ServerEvent)
     wdContext.currentContextElement().getCCodeSorter().sort(
                    wdEvent,
                    wdContext
                         .nodeBapi_Companycode_Getlist_Input()
                         .nodeOutput()
                         .nodeCompanycode_List());
    //@@end
after clicking on the header of the table following is the error stack
=======================
java.lang.NullPointerException
     at com.sap.tut.wd.tutwd_table.tablecomp.TableCompatibilityModeView.onActionsortByCompanyName(TableCompatibilityModeView.java:329)
     at com.sap.tut.wd.tutwd_table.tablecomp.wdp.InternalTableCompatibilityModeView.wdInvokeEventHandler(InternalTableCompatibilityModeView.java:318)
     at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
     at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
     at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleAction(WebDynproMainTask.java:101)
     at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:304)
     at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:649)
     at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
     at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:248)
     at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
     at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
     at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:55)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
     at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
     at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
     at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
     at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
     at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
     at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
     at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
     at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
     at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
     at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
     at java.security.AccessController.doPrivileged(Native Method)
     at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
     at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:160)
=================
Message was edited by: Murali Manohar

Similar Messages

  • Sort table columns in a table and context created dinamically

    Hello all,
    I have implemented the table sorting several times in another developments, but now I'm facing a problem.
    I have created the table and context node that I need to sort dinamically (before somebody ask me why, I would say that it's the only way to do that for my current project, there was no possibility of doing that in dessign time). I have implemented the table sorting more or less the same way I would do with a table created in dessing time, but when I run my WD the sorting of columns doesn't work.
    In the wdDoModifyView, I have put the following code:
    if(firstTime){
    IWDAction ordenacion     = wdThis.wdCreateAction(IPrivateResultDispGlobalView.WDActionEventHandler.ORDENACION,  null);
    IWDParameters param = ordenacion.getActionParameters();
    param.addParameter("nombreNodo",nombreNodo);
    and in the code of the action
        //@@begin onActionOrdenacion(ServerEvent)
         System.err.println("**** NOMBRE NODO **** "+nombreNodo);
         wdContext.currentContextElement().getTableSorter().sort(wdEvent, wdContext.getChildNode(nombreNodo, IWDNode.LEAD_SELECTION));
        //@@end
    The name of the node ("nombreNodo) it's only correct the first time I click on a column.
    Has anybody implemented the table sorting in a dinamically created table and context node? And how do you do to make it works.
    Thank you very much

    Here is the code
    //Preparamos Navegaciones
    IWDAction abrirProyecto = wdThis.wdCreateAction(IPrivateResultDispGlobalView.WDActionEventHandler.ABRIR_PROYECTO, null);
    IWDAction abrirDisp     = wdThis.wdCreateAction(IPrivateResultDispGlobalView.WDActionEventHandler.ABRIR_DISPONIBLE,  null);
    //IWDAction ordenacion     = wdThis.wdCreateAction(IPrivateResultDispGlobalView.WDActionEventHandler.ORDENACION,  null);
    IWDAction ordenacion=wdThis.wdGetOrdenacionAction();
    IWDParameters param = ordenacion.getActionParameters();
    param.addParameter("nombreNodo",nombreNodo);
    IWDTable table = wdThis.wdGetInformesController().crearTabla(view, nombreNodo, movimientosInfo,new String[]{"Codi Projecte",null,"Nom Projecte", "Import Projecte", "Client", "Increment Disponible futur per facturació no emesa i / o anualitats pendents","Increment Disponible futur per ingressos pendents de cobrar", "Disponible"},new String[]{"10px", null,"10px", "10px","10px","10px","10px","10px"},new IWDAction[]{abrirProyecto,null, null, null, null,null,null,abrirDisp}, -1);
    //ordenar tabla
    wdContext.currentContextElement().setTableSorter(new TableSorter(table, ordenacion,null));
    containerTablasProyecto.addChild(table);
    Edited by: Mireia Romo on May 28, 2009 12:27 PM

  • Issue in sorting table column

    Hi,
    I am using Oracle Jdeveloper 11.1.1.6.2
    I am trying to apply sort functionality to a acolumn in my table. I have done this previously at many places and it worked fine, But over here we are having a switcher inside column the code is:
           <af:column sortProperty="KeywordName"
                         headerText="#{coregccomplianceuiBundle.KEYWORD_NAME}"
                         id="c1" rowHeader="unstyled" sortable="true">
                <af:switcher id="sw1" facetName="#{row.IsSystem}" defaultFacet="0">
                   <f:facet name="1">
                   <af:panelGroupLayout id="pg1" layout="horizontal">
                      <af:outputText value="#{row.KeywordName}" id="ot1"/>
                      <af:image source="/images/lock_ena.png" id="cil1"
                                shortDesc="#{coregccomplianceuiBundle.ERRMSG_ISSYSTEMENTITY_DELETE}"/>
                    </af:panelGroupLayout>
                  </f:facet>
                  <f:facet name="0">
                  <af:panelGroupLayout id="pg1-1" layout="horizontal">
                      <af:outputText value="#{row.KeywordName}" id="ot1-1"/>
                    </af:panelGroupLayout>
                  </f:facet>
                </af:switcher>
              </af:column>initially i have all the columns which come under facet 1 , i try to sort it works fine. Then i add a row of facet type 0 and then if i try to sort it does only sort the rows with facet =1.
    What can be the issue?
    Thanks,
    Tripuresh
    Edited by: Tripuresh on May 29, 2013 5:23 PM

    Thanks Prateek and Shah for the reply,
    Actually i can see now that even if i remove the switcher component completely and make the column like:
             <af:column sortProperty="KeywordName"
                         headerText="#{coregccomplianceuiBundle.KEYWORD_NAME}"
                         id="c1" rowHeader="unstyled" sortable="true">
                      <af:outputText value="#{row.KeywordName}" id="ot1"/>
              </af:column>Then also for the newly added rows sort is not working. The addition of new keyword is done by logic below:
            ComplianceLibraryAMImpl am = getDataControl();
            EmKeywordVOImpl rep = am.getEmKeywordVO1();
            NameValuePairs nvp = new NameValuePairs();
            nvp.setAttribute("KeywordName", keyword);       
            Row row1 = rep.createAndInitRow(nvp);
            rep.insertRow(row1);is there something wrong in my addition logic?

  • Sort table columns

    Hey!
    I got a table with some cols like Name, Changed, Status.
    This resolves in a lot of rows, and it whould be perfect if the user could sort the rows after wich tableheader that was pressed.
    I.E. a user press the column Name, it gets sorted on names, or if Changed is pressed, then its gets sorted on the dates.
    Anyone got any clue of how this is possible?

    HI,
    Refer this web log
    /people/bertram.ganz/blog/2006/03/07/enhanced-web-dynpro-java-tablesorter-for-sap-netweaver-04s
    I worked for Copmany code Bapi
    1) In a table i displayed Company  code (1st Cloumn) and Company Name (2nd Column) by excuting bapi in component controller
    2) in View
    public static void wdDoModifyView(IPrivateVI_TCompareView wdThis, IPrivateVI_TCompareView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
        //@@begin wdDoModifyView
              if (firstTime) {
                   IWDTable table = (IWDTable) view.getElement("CompanyTable"); <b><----- [CompanyTable Table UI Name]</b>               wdContext.currentContextElement().setSortCompanyName(
                        new TableSorter(
                             table,
                             wdThis.wdGetSortByCompanyNameAction(),
                             null));
        //@@end
      //@@begin javadoc:onActionsortByCompanyName(ServerEvent)
         /** Declared validating event handler. */
      //@@end
      public void onActionsortByCompanyName(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionsortByCompanyName(ServerEvent)
              wdContext.currentContextElement().getSortCompanyName().sort(
                   wdEvent,
                   wdContext
                        .nodeBapi_Companycode_Getlist_Input()
                        .nodeOutput()
                        .nodeCompanycode_List());
        //@@end
    hope this solves your problem
    Regards,
    RK

  • Unable to capture the adf table column sort icons using open script tool

    Hi All,
    I am new to OATS and I am trying to create script for testing ADF application using open script tool. I face issues in recording two events.
    1. I am unable to record the event of clicking adf table column sort icons that exist on the column header. I tried to use the capture tool, but that couldn't help me.
    2. The second issue is I am unable to capture the panel header text. The component can be identified but I was not able to identify the supporting attribute for the header text.

    Hi keerthi,
    1. I have pasted the code for the first issue
    web
                             .button(
                                       122,
                                       "/web:window[@index='0' or @title='Manage Network Targets - Oracle Communications Order and Service Management - Order and Service Management']/web:document[@index='0' or @name='1824fhkchs_6']/web:form[@id='pt1:_UISform1' or @name='pt1:_UISform1' or @index='0']/web:button[@id='pt1:MA:0:n1:1:pt1:qryId1::search' or @value='Search' or @index='3']")
                             .click();
                        adf
                        .table(
                                  "/web:window[@index='0' or @title='Manage Network Targets - Oracle Communications Order and Service Management - Order and Service Management']/web:document[@index='0' or @name='1c9nk1ryzv_6']/web:ADFTable[@absoluteLocator='pt1:MA:n1:pt1:pnlcltn:resId1']")
                        .columnSort("Ascending", "Name" );
         }

  • 'sort' icon in the header of table column

    Hi everybody,
    I am using table UI element in WD ABAP. Table columns can be sorted and the method fro event 'onSort' is defined.
    On each table column header a tool tip with icons  &#9650;&#9660;  appears when the cursor is moved over the right side of the column header.
    Is it possible to make this icon appear on the right of each column header permanently? 
    Thank you for your help,
    Helen

    Hi Jörg,
    We are using IE6 or IE7. And nothing appears. ONSort action exists and defined.
    May be I will create internal message for ABAP WD.
    Kind regards,
    Helen

  • I am unable to sort multiple columns in a table created in Pages.

    I had been using Appleworks up until I installed Lion and have now switched to iWork. I created a table within a Pages document and am able to sort a single column (using the Table Inspector and choosing Sort from  Edit Rows and Columns) but the Sort option is grayed out when I attempt to sort multiple columns.
    In another post, someone talked about this being a problem if you have merged fields. I do not believe I have done this (to be honest I don't know the function of merging fields).
    This is very frustrating as I was easily able to sort these tables in Appleworks.

    Sharon Anderson wrote:
    Thanks for your quick response! I have been trying that but then found that Numbers would only let me print in landscape view so I had to paste the table back into Pages. Is there a way to print in portrat view (from Numbers?)
    Not so. In the lower left corner of the window, there's an icon that looks like a piece of paper. If you see this:
    you are in Sheet View, or normal, mode. If you see this:
    You are in Print View mode. Now you see the icons for portrait and landscape modes. Click your choice. Then arrange your content to fit the pages as you wish.
    Jerry

  • How to display the sorting arrows in the table column header

    Hi
    I am doing a sorting for some columns from the click of the table column headers, In Developer studio, we are able to view the up and down arrows, I need that also to be made visible at run time, so that the user knows that there exists sorting based on that particular column. Is there any other way of doing it ? I cant place more than one control on the header or wrap the text to two lines..also. please clarify. thanks

    I assume you are using NW 04.
    The table column header contains a IWDCaption element which may display an icon and a text. See property IWDCaption.imageSource.
    The table tutorial might also be helpful.
    Armin

  • Webdynpro Table: Column Header sort icon not visible

    In design time in NWDS, my table headers have this up/down arrow icon that is visible to indicate sorting.
    At runtime it is not displayed.  How come?

    Hi KF,
    According to the Node Structure
    Employee
    |----
    name
    |----
    no
    |----
    sal
      public static void wdDoModifyView(IPrivateEmployeeView wdThis, IPrivateEmployeeView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
    if (firstTime) {
               IWDTable sortTable = (IWDTable) view.getElement("Put the table id here");
    <b>
               wdContext.currentContextElement().setEmployeeTableSorter(new TableSorter(sortTable, wdThis.wdGetSortEmployeeAction(), null,
               new String[]{"name","no","sal"})); </b>
    //Instead of column id passes the attribute name of the node that is bound with the table.
    //EmployeeTableSorter is the context attribute of type …….utils.TableSorter
      public void onActionSortEmployee(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionSortFundID(ServerEvent)
         wdContext.currentContextElement().getEmployeeTableSorter().sort(wdEvent, wdContext.nodeEmployee());
        //@@end
    Table Sorter : table not getting sorted
    Regards,
    Mithu

  • Problem with sorting a Column in Advance table .

    Dear Friends ,
    I have a OAF page developed with advanced table region , the table has several columns, now i would
    like to sort a column named "Trial number" which is of the type Number .
    To accomplish this i have given Sort Allowed : True (Property Inspector) . but when i click on the sort button
    i am unable to sort the record . Could you please some one give me some suggestion and help me out .
    Regards,
    Keerthi.k

    No there is no Transient attribute involved , could you please tell me what might cause this error .
    Basically this page is for inserting a record.
    Thanks ,
    Keerthi
    Edited by: user1140193 on Oct 21, 2011 7:15 AM
    Edited by: user1140193 on Oct 21, 2011 7:16 AM

  • Unsaved new values disappear on table column sort

    Guys,
    I have an af:table.
    I display row from a view object. One of them is from calculated attribute (attr1). I show attr1 on the table.
    1. i create a new row on the table.
    2. provide value to the attr1
    3. sort the column of attr1
    4. The value which was input in step 2 disappears.
    How this can be resolved?

    non - persistent value will not retains their values, you wont save those things.
    someother way to retains the value in theri place until session kills.
    1.take groovy support for the viewobject - attribute
    2.take getter/setter method of viewobjectimpl.

  • How to persist af:table column sort state within a session?

    Hi,
    I have an af:table in my page with the columns sortable="true".  So when click on the header of any column, we can sort the column.  Our users have a requirement that after they do the sort by clicking one of the column headers in the af:table, then they navigate to another page in our application and then come back to this page, they want to see the same sort order of data.  How can we persist the sorting state in af:table?
    Any comments are appreciated.
    Thanks
    -Mina

    Hi,
    I am not sure this is doable because the underling data collection may be changed on other views. You can use a sort listener and intercept the sort order selected by a user to persist it in the session or else where (keep in mind that using the panelCollection component you could also have a sort order that spans multiple columns). When you navigate back to the view you then have the information to order the data accordingly.
    Frank

  • Af:table column sort icon does not appear

    Hi,
    if I use the declarative way to handle column sorting the tablecolumn gets a icon which indicates sorting.
    For one column I have to set the sorting programmatically by using CoreTable's setSortCriteria method .
    In this case the sort icon doesn't appear!? Is that right?
    regards, Florian

    thanks Frank!
    It's not a question of enable/disable the sorting feature of the table column.
    It's about the requirement to sort the column like in this sql statement:
    select c1 || c2 || c3 as c123
    from myTable
    order by c1, c2, c3 asc;
    The column is sortable by default (column data is concatenated like in c123).
    I use following code in the SortListenerMethod to enable the sorting for the requirement above:
    CoreTable ct = this.getMyTable();
    List<SortCriterion> critlist = new ArrayList<SortCriterion>();
    boolean sortOrderAsc = true;
    critlist.add(new SortCriterion("c1", sortOrderAsc));
    critlist.add(new SortCriterion("c2", sortOrderAsc));
    critlist.add(new SortCriterion("c3", sortOrderAsc));
    ct.setSortCriteria(critlist);
    using this always prevent the sortIcon from showing.
    On the other hand my sortIcon comes up using the declarative way.
    Or is there a way to accomplish the sorting above by using other ways?

  • Sorting table according 2 columns

    Hello,
    I am using the TableSorter object in order to sort Dynpro tables.
    Suppose I have requirement to sort according 2 columns,
    I mean one primary and second secondary.
    The situation now is every click on another column cancel the first sort.
    I'll appreciate any suggestion.
    Thanks,
    Maya.

    Hi Maya,
    Check this links.
    /people/bertram.ganz/blog/2006/03/07/enhanced-web-dynpro-java-tablesorter-for-sap-netweaver-04s
    Re: table column sorting
    Re: execute tableSorter
    Regards,
    Mithu

  • Unable to sort table

    Hi all
    I have created an advance table and using multiple selection.I set Sort Allowed property 'Yes' for every column in property inspector.
    But when I clicked on cloumn it throws a warning "The table cannot be sorted because it has pending changes which would be lost." and I am not able to sort table.
    Can somebody give me some suggestions.
    Thanks
    Bhupendra

    I have createed sortable header.I have done this thing many times and it works.But this time only I m facing problem.I am using PPR in this table where I am enabling and disabling the checkbox.
    Please give suggestions if anybody has faced this problem.
    Thanks
    Bhupendra

Maybe you are looking for

  • FYI -- Tab Index and Safari 4 (Mac)

    I finished building a website recently and had incorporated Tab Sets on a few different pages.  Additionally some Accordion Sets as well.  Didn't think anything of it and finished off the project - let the site go live and haven't thought much about

  • How do I get full display on sony tv w/macbook pro

    how do I get full display on sony tv w/macbook pro? I am using mini dv adapter to pc input cable.(I believe hd15) not HDMI adapter.

  • IMDB Trailer Upload Problem

    Don't know why when I upload a trailer to IMDB the aspect ratio is wrong (not 16:9) and looks vertically stretched out.

  • Deploy BPM application and keep all data of old tasks

    Hi all, Currently, whenever i redeploy bpm application to weblogic server, all tasks information saved in database will be changed (the value of state attribute will be changed to 9). So i think it's not good in Production environment. I want to conf

  • Tabbing Within a Bulleted List

    Every school day I create a simple Keynote presentation for my students with the day's schedule. Along the left side of the slide is a bulleted list with the time slots of the day. The column on the right lists the activity we'll do during that time