on 08-29-2009 6:13 AM
Hi Experts,
I have created WD screen which fetches data from R/3 using RFC. The code is like as below.
public com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTextViewSemanticColor getMyOpenTripsColor(IPrivateList_trips_appView.IMyOpenTripsElement element)
{
//@@begin getMyOpenTripsColor(IPrivateList_trips_appView.IMyOpenTripsElement)
for(int x=0; x<wdContext.nodeMyOpenTrips().size(); x++){
if(wdContext.nodeMyOpenTrips().getMyOpenTripsElementAt(x).getRecommendedActionsTravel().equalsIgnoreCase("Change Travel Request")){
wdComponentAPI.getMessageManager().reportSuccess("i "+ wdContext.nodeMyOpenTrips().getMyOpenTripsElementAt(x).getRecommendedActionsTravel()+ " trpno "+ wdContext.nodeMyOpenTrips().getMyOpenTripsElementAt(x).getTripNumber() );
return WDTextViewSemanticColor.CRITICAL;
}
if(wdContext.nodeMyOpenTrips().getMyOpenTripsElementAt(x).getRecommendedActionsTravel().equalsIgnoreCase("***Request Cancellation***")){
wdComponentAPI.getMessageManager().reportSuccess("j");
return WDTextViewSemanticColor.MARKED1;
}
}
return null;
My problem is that there are 47 records in the table (wdContext.nodeMyOpenTrips().size() is 47). When I am executing the following code, only first record is being displayed. The wdComponentAPI.getMessageManager.reportSuccess statements return following records. There are many trip nos in addition to 1427. Why only first record is getting displayed?
hi1 47
i Change Travel Request trpno 1427
hi1 47
i Change Travel Request trpno 1427
hi1 47
i Change Travel Request trpno 1427
hi1 47
i Change Travel Request trpno 1427
..many more rows (19 rows)
Please help.
Regards,
Gary
Hi Gary,
this problem occurs when the code "return" is executed, your application return from this method, and not execute other entries of the node MyOpenTrips (only first elemento from this node is read!).
create a local object with WDTextViewSemanticColor (or arrayList) type and, in the if clausure, move the constant value "WDTextViewSemanticColor.CRITICAL" or "WDTextViewSemanticColor.MARKED1" to this variable. In the end of the method, return this variable.
Other way to resolve your problem is passing the index of element to read into MyOpenTrips node and read this in the method.
//public com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTextViewSemanticColor getMyOpenTripsColor(IPrivateList_trips_appView.IMyOpenTripsElement element)
public List getMyOpenTripsColor(IPrivateList_trips_appView.IMyOpenTripsElement element)
{
//@@begin getMyOpenTripsColor(IPrivateList_trips_appView.IMyOpenTripsElement)
List tripListColor = new ArrayList();
for(int x=0; x<wdContext.nodeMyOpenTrips().size(); x++){
if(wdContext.nodeMyOpenTrips().getMyOpenTripsElementAt(x).getRecommendedActionsTravel().equalsIgnoreCase("Change Travel Request")){
wdComponentAPI.getMessageManager().reportSuccess("i "+ wdContext.nodeMyOpenTrips().getMyOpenTripsElementAt(x).getRecommendedActionsTravel()+ " trpno "+ wdContext.nodeMyOpenTrips().getMyOpenTripsElementAt(x).getTripNumber() );
tripListColor.add(WDTextViewSemanticColor.CRITICAL);
}
if(wdContext.nodeMyOpenTrips().getMyOpenTripsElementAt(x).getRecommendedActionsTravel().equalsIgnoreCase("***Request Cancellation***")){
wdComponentAPI.getMessageManager().reportSuccess("j");
tripListColor.add(WDTextViewSemanticColor.MARKED1);
}
}
return tripListColor;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Experts,
I have modified code like as below. However the issue still persists.
Regards,
Gaurav
public com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTextViewSemanticColor getMyOpenTripsColor(IPrivateList_trips_appView.IMyOpenTripsElement element)
{
//@@begin getMyOpenTripsColor(IPrivateList_trips_appView.IMyOpenTripsElement)
Collection openTrips = new ArrayList();
for(int x=0; x<wdContext.nodeMyOpenTrips().size(); x++){
IPrivateList_trips_appView.IAllMyTripsElement i = wdContext.createAllMyTripsElement();
if(wdContext.nodeMyOpenTrips().getMyOpenTripsElementAt(x).getRecommendedActionsTravel().equalsIgnoreCase("Change Travel Request")){
wdComponentAPI.getMessageManager().reportSuccess("i "+ wdContext.nodeMyOpenTrips().getMyOpenTripsElementAt(x).getRecommendedActionsTravel()+ " trpno "+ wdContext.nodeMyOpenTrips().getMyOpenTripsElementAt(x).getTripNumber() );
openTrips.add(i);
return WDTextViewSemanticColor.CRITICAL;
}
if(wdContext.nodeMyOpenTrips().getMyOpenTripsElementAt(x).getRecommendedActionsTravel().equalsIgnoreCase("***Request Cancellation***")){
wdComponentAPI.getMessageManager().reportSuccess("j");
openTrips.add(i);
return WDTextViewSemanticColor.MARKED1;
}
}
return null;
wdComponentAPI.getMessageManager().reportSuccess returns:
i Change Travel Request trpno 1427
i Change Travel Request trpno 1427
i Change Travel Request trpno 1427
i Change Travel Request trpno 1427
i Change Travel Request trpno 1427
i Change Travel Request trpno 1427
i Change Travel Request trpno 1427
i Change Travel Request trpno 1427
i Change Travel Request trpno 1427
i Change Travel Request trpno 1427
i Change Travel Request trpno 1427
i Change Travel Request trpno 1427
i Change Travel Request trpno 1427
i Change Travel Request trpno 1427
i Change Travel Request trpno 1427
i Change Travel Request trpno 1427
i Change Travel Request trpno 1427
i Change Travel Request trpno 1427
When I am removing "return null; " from the code the code does not get compiled. I am getting following message "This method must return a result of type WDTextViewSemanticColor"
Regards,
Gary
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.