cancel
Showing results for 
Search instead for 
Did you mean: 

How to find top 10 records using Java programming for Web Dynpro program

Former Member
0 Kudos

Hi Experts,

I have used Java Web Dynpro program to fetch records from the backend. Following code helps me and fetches record. As per the customer reqirement, we have to fetch only top 10 records (Actual Cost) from the backend. So I have to modify the Java code. How I can do so? Please help.

		wdContext.nodeGraphData().invalidate();
		IPublicCostcnt.IGraphDataElement categoryElement;
			for (int i = 0; i < wdContext.nodeItab_Final1().size(); i++) {
			categoryElement = wdContext.createGraphDataElement();
			categoryElement.setCostElement(""+ wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getDescription());
			categoryElement.setActualCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getActual_Cost().toString());
			categoryElement.setPlannedCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getPlan_Cost().toString());
			wdContext.nodeGraphData().addElement(categoryElement);
		}

Regards,

Gary

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I got the RFC changed by ABAP team. The modified ABAP code returns records in descending order of actual_cost. After that I selected top 10 records using Java code. It is simple.

I could have done the same work by sorting the records in Java. I could have used sort class.

Anyway issue got sorted out.