on 08-14-2009 11:11 PM
Hello, I was trying to make a web dynpro that use a web to display data, but after I do the binding in the DoInit of the model controller I got a error when I run the dynpro.
this is the error:
java.lang.NullPointerException
at com.sap.tc.webdynpro.model.webservice.base.model.BaseGenericModelClass.retrieveTargetRoleInfo(BaseGenericModelClass.java:91)
at com.sap.tc.webdynpro.model.webservice.base.model.BaseGenericModelClass.getRelatedModelObject(BaseGenericModelClass.java:388)
at com.sap.tc.webdynpro.model.webservice.gci.WSTypedModelClass.getRelatedModelObject(WSTypedModelClass.java:65)
at com.muck.demos.wsdemo3.model.BAPI_FLIGHT_GETLIST_Request.getDESTINATION_FROM(BAPI_FLIGHT_GETLIST_Request.java:60)
at com.muck.demos.wsdemo3.wdp.IPublicWSDemo3$IDESTINATION_FROMNode.doSupplyElements(IPublicWSDemo3.java:880)
This is the component controller context [http://img194.imageshack.us/img194/2293/componentcontroller.png]
the search view context [http://img193.imageshack.us/img193/5646/searchview.png]
and the results view context [http://img299.imageshack.us/img299/4567/resultsview.png]
finaly this is the code:
public void wdDoInit()
{
FlightData model = new FlightData();
Request_BAPI_FLIGHT_GETLIST list = new Request_BAPI_FLIGHT_GETLIST(model);
BAPI_FLIGHT_GETLIST_Request request = new BAPI_FLIGHT_GETLIST_Request(model);
list.setBAPI_FLIGHT_GETLIST(request);
wdContext.nodeRequest_BAPI_FLIGHT_GETLIST().bind(list);
}
I hope that someone can help me, thank you.
HI,
I assume that this code is in Component controller or view controller. In case you want the elements to populate data from view then these two lines should suffice. I dont understand why you need to model instance and bind it.
Request_BAPI_FLIGHT_GETLIST list = new Request_BAPI_FLIGHT_GETLIST();
wdContext.nodeRequest_BAPI_FLIGHT_GETLIST().bind(list);
Regards
Srini
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That doesn't work either, if I put those lines in wdDoInit of the component controller the dynpro shows up, but the input field for the search is disabled, anyway I clicked the search button and this is the response I got 😕
com.sap.tc.webdynpro.model.webservice.base.exception.BaseModelRuntimeException: No object for mandatory target role 'FLIGHT_LIST' of model class 'BAPI_FLIGHT_GETLIST_Response' with cardinality 'ONE' maintained
at com.sap.tc.webdynpro.model.webservice.base.model.BaseGenericModelClass.getRelatedModelObject(BaseGenericModelClass.java:392)
at com.sap.tc.webdynpro.model.webservice.gci.WSTypedModelClass.getRelatedModelObject(WSTypedModelClass.java:65)
at com.muck.demos.wsdemo3.model.BAPI_FLIGHT_GETLIST_Response.getFLIGHT_LIST(BAPI_FLIGHT_GETLIST_Response.java:88)
at com.muck.demos.wsdemo3.wdp.IPublicWSDemo3$IFLIGHT_LISTNode.doSupplyElements(IPublicWSDemo3.java:1668)
at com.sap.tc.webdynpro.progmodel.context.DataNode.supplyElements(DataNode.java:100)
Hello Rafael,
Check the cardinality of the nodes. Should set it to 0..n.
Thanks
Avik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Are you useing NWDS(CE 7.1) then you have use this sort of code to bind it
Model1 model1Model = new Model1();
Bapi_Flight_Getlist_Input bapi_Flight_Getlist_Input = new Bapi_Flight_Getlist_Input(model1Model);
Bapi_Flight_Getlist_Output output = new Bapi_Flight_Getlist_Output(model1Model);
java.util.List<Bapisfldat> flight_List = new ArrayList<Bapisfldat>();
output.setFlight_List(flight_List);
wdContext.nodeBapi_Flight_Getlist_Input().bind(bapi_Flight_Getlist_Input);
and if you are using NWD 7.0 then the binding will be differ use below sample code to bind it.
Bapi_Flight_Getlist_Input input = new Bapi_Flight_Getlist_Input();
input.setDestination_From(new Bapisfldst());
input.setDestination_To( new Bapisfldst());
wdContext.nodeBapi_Flight_Getlist_Input().bind(input);
PS: Also check the cardinality should be 1..n not 0:n.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Anup,
I'm using CE 7.1 I tried your code but I got this error:
java.lang.Error: Unresolved compilation problem: The method setFLIGHT_LIST(FLIGHT_LIST) in the type BAPI_FLIGHT_GETLIST_Response is not applicable for the arguments (List<BAPISFLDAT>)
Due to this lines of code:
java.util.List<BAPISFLDAT> flight_List = new java.util.ArrayList<BAPISFLDAT>();
output.setFLIGHT_LIST(flight_List);
Regarding the cardinalities this is what I have set:
[http://img220.imageshack.us/img220/5528/cardinality.png]
They are all at the maximum relation available, where it says 1..1 is because there is not 1..n.
Thank you.
Hi,
I dont think you can directly set the List to Output class.
I had done this earlier. I remember there should be a complex data type class by name TableofBAPISFLDAT. You need to
instantiate it and then for this you need to set the list finally the complex type to output class like the following code.
TableofBAPISFLDAT flighttable = new TableofBAPISFLDAT(model1Model); // Complex type
java.util.List<BAPISFLDAT> flight_List = new java.util.ArrayList<BAPISFLDAT>(); //simple type
flighttable.add(flight_List); //add simple type to complex type such that it holds 1..n property
output.setFLIGHT_LIST(flighttable); // now set the complex type to output node
Hope this will solve your problem
Regards
Raghu
Hi Rafael Esteban,
Try this:
FlightData flightModel = new FlightData ();
Request_BAPI_FLIGHT_GETLIST list = new Request_BAPI_FLIGHT_GETLIST(flightModel);
BAPI_FLIGHT_GETLIST flightGetList = new BAPI_FLIGHT_GETLIST(flightModel);
list.setBAPI_FLIGHT_GETLIST(flightGetList);
//Try to add TableOfbapisfldat item as well
TableOfbapisfldat flightList = new TableOfbapisfldat(flightModel);
java.util.List<Bapisfldat> item = new ArrayList<Bapisfldat>();
flightList.setItem(item);
wdContext.node Request_BAPI_FLIGHT_GETLIST().bind(list);
Please revert back if this does not solve your problem.
Please reset the cardinality to default value if you have changed anything
Regards,
Siva
Hi Rafael Esteban,
It is not a big problem.
Even if you are ABAP developer you can do it easily. Just in beginning you may face little difficult.
Simply Click CtrlShiftO or right click -> Organize Imports . The error will go.
Still the error remains just comment
//TableOfbapisfldat flightList = new TableOfbapisfldat(flightModel);
// java.util.List<Bapisfldat> item = new ArrayList<Bapisfldat>();
// flightList.setItem(item);
and try.
Regards,
Siva
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.