Skip to Content
author's profile photo Former Member
Former Member

Table UI sort Automatically with respect to one column

Hi Experts,

My requirement is to call a Bapi from r/3 and show the result in a Table UI Element, here am doing a direct binding with the context attribute and table ui. Till now everthing is according to requirement .

Now further to it I have to automatically sort the table based on one attribute of the node say "Fpperiod". I am trying to sort the model node just after the ".....execute()" method,

1. I dont need any sorting/ filtering options in the View .

. wdContext			.nodeBapi_Get_Payroll_Result_List_Input()
				.nodeOutput()				.nodeResults_Out().sortElements(new Comparator()public int compare(Object x, Object y) {
					int iX, iY;

					IPublicTable.IResults_OutElement rx =
						(IPublicTable.IResults_OutElement) x;
					IPublicTable.IResults_OutElement ry =
						(IPublicTable.IResults_OutElement) y;
					iX = Integer.parseInt(rx.getFpperiod());

					iY = Integer.parseInt(ry.getFpperiod());
					while (rx.getFpperiod() != null && ry.getFpperiod() != null) {						rx.getFpperiod().compareTo(ry.getFpperiod());					}					return iY - iX;				}			}); 

But its not working, and also if anyone could help me how the "comapre() " works it would be of great help ...

Can anyone help me with it .

Thanks in Advance

Tony

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 07:25 AM

    What is the data type of attribute "Fpperiod" and how should it be sorted?

    For understanding the Comparator interface, please have a look at the JDK doc.

    Armin

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 08:30 AM

    Hi Armin ,

    Thank you for giving it a look . Regarding Fperiod , Model uses following Bapi,

    Bapi_Get_Payroll_Result_List_Input and Fperiod is contained in the structure of table parameter "Results.

    Fperiod determinies the period for the pay roll run .

    For Reference below mentioned is the code i am using to get the latest period, after executing the model .

    Bapi7004_Rl payperiod = null;
    	    while (itr_period.hasNext()) {
    	   payperiod = (Bapi7004_Rl) itr_period.next();
    	    pay_per.add(payperiod.getFpperiod());
                         }
    	Collections.sort(pay_per);
    	pay_str = pay_per.getLast().toString();

    Hope you can figure out from the above code .

    And as per the previous post dou you think the compare() code am using will be sufficient enough to achive sorting .

    Regards,

    Tony

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 08:59 AM

    Fpperiod type -- com.model.table.types.Faper

    Just breif you regarding sorting requirements, model returns a table , and when I display the result in the view ( Table UI element ) I want

    it to be displayed based on Fpperiod attribute of the node .

    Regards,

    Antony

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.