on 07-20-2006 3:21 PM
In my custom controller for an app, I have some code that looks like this:
public void wdDoInit()
{
//@@begin wdDoInit()
Bapi_Ptmgrattabs_Mngcreation_Input input1 =
new Bapi_Ptmgrattabs_Mngcreation_Input();
wdContext.nodeBapi_Ptmgrattabs_Mngcreation_Input1().bind(input1);
input1.setHrabsatt_In(wdContext.currentBapi_Ptmgrattabs_Mngcreation_Input1Element().get.....)
None of my get options appear to be correct. They are: getAttributeAsText, getAttributeValue, and getClass.
I'm looking for something along the lines of getHrabsatt_In()
Everything seems to be mapped and bound correctly, so I have no idea where else to go from here in determining why this isn't working. I am trying to have a user enter hours on one screen, and then display them on the next. The next screen shows up, but nothing is being displayed because of the above line that isn't completed. Any suggestions?
Thank you!
(As always, points will be awarded)
Hi Kathleen,
wow, your issue is a "harte Nuß" like we express it in German ('a hard nut to crack'). Let's crack it here ...
Context Structure
Context Model Node:
Bapi_Input (Model Node)
|_SomeRelation (Model Node)
|_Hugo (Model Attribute)
This context structure is a result of a simple model with two related model classes:
- Bapi_Input (Model Class): Property: Hugo
|_ SomeRelation (Model Class Relation) -> Some_In
- Some_In (Model Classe)
'Error' Symptom
The generated inner (in IPublic) context interface IBapi_InputElement does not expose a getter method for the inner model node 'SomeRelation' but only for the property 'Hugo':
wdContext.currentBapi_InputElement().get....// ????
wdContext.currentBapi_InputElement().getHugo(); // Ok, Hugo is a model class property
'Error' Reason
Solution
You must move from the context hierarchy to the model object graph. This means you must know, that the context only references objects in the model object graph. This switch from context-to-model can be done by invoking
wdContext.currentBapi_Ptmgrattabs_Mngcreation_Input1Element()<b>.modelObject().</b>getHrabsatt_In()
.
You then access the related model object of type 'Hrabsatt_In' which is not a property of the model class 'Bapi_Ptmgrattabs_Mngcreation_Input1'.
Best wishes,
Bertram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kathleen,
can you send the entire bapi execution code which you have written in doInit();
regards
karthik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Karthik-Here is everything I have in wdDoInit()
public void wdDoInit()
{
//@@begin wdDoInit()
Bapi_Ptmgrattabs_Mngcreation_Input input1 =
new Bapi_Ptmgrattabs_Mngcreation_Input();
wdContext.nodeBapi_Ptmgrattabs_Mngcreation_Input1().bind(input1);
input1.setHrabsatt_In(wdContext.currentBapi_Ptmgrattabs_Mngcreation_Input1Element().get.....??)
Thanks for the help!
Hi Kathleen,
In
input1.setHrabsatt_In(wdContext.currentBapi_Ptmgrattabs_Mngcreation_Input1Element().get.....??);
The mistake is, input1.setHrabsatt_In(),you have to set the input parameters,for executing the bapi. No you are trying to give the output of same BAPI you are executing as a input to the bapi.Only after executing the Bapi you may use output.
Kind Regards,
Saravanan K
Message was edited by: Saravanan K
Hi,
Bapi_Ptmgrattabs_Mngcreation_Input is the node whose values will be passed to the BAPI for execution. Typically these values should come from user inputs from screens/views or should be populated by the program.
What you are trying to do is not correct. Your code should be something like this:
Bapi_Ptmgrattabs_Mngcreation_Input input1 =
new Bapi_Ptmgrattabs_Mngcreation_Input();
wdContext.nodeBapi_Ptmgrattabs_Mngcreation_Input1().bind(input1);
input1.setHrabsatt_In(<some value, but not from this very node>); //This can be a string of value "Text", for example.
Regards,
Satyajit.
Kathleen,
I think the code you have written in DoInit(),
to set the value for Hrabsatt_In attribute is wrong.
the code is,
input1.setHrabsatt_In(wdContext.currentBapi_Ptmgrattabs_Mngcreation_Input1Element().get.....??)
You cannot get any value from the Bapi input node currentBapi_Ptmgrattabs_Mngcreation_Input1(). please give any other value to setHrabsatt_In and then execute.
regards
karthik
Satayajit and others...I am not sure I follow, because I have always done it this way and it has always worked. Let me give examples:
1)public void wdDoInit()
{
//@@begin wdDoInit()
Z_Pdxv_Get_Exp_Category_Data_Input input = new Z_Pdxv_Get_Exp_Category_Data_Input();
wdContext.nodeZ_Pdxv_Get_Exp_Category_Data_Input().bind(input);
input.setIn_Bukrs(wdContext.currentZ_Pdxv_Get_Exp_Category_Data_InputElement().getIn_Bukrs());
input.setIn_Datum(wdContext.currentZ_Pdxv_Get_Exp_Category_Data_InputElement().getIn_Datum());
input.setIn_Pernr(wdContext.currentZ_Pdxv_Get_Exp_Category_Data_InputElement().getIn_Pernr());
}
This takes a date, id, and company code and returns the corresponding info.
2) public void wdDoInit()
{
//@@begin wdDoInit()
Bapi_Employee_Getdata_Input input = new Bapi_Employee_Getdata_Input();
wdContext.nodeBapi_Employee_Getdata_Input().bind(input);
input.setEmployee_Id(wdContext.currentBapi_Employee_Getdata_InputElement().getEmployee_Id());
//@@end
}
This one takes an employee ID and returns the corresponding name.
So I am not sure why I would have to do it differently this time....?
Kathleen,
Just one question:
In the examples that you have mentioned, are the nodes from where you are taking the values same as the BAPI input nodes?
I mean are you sure that you have not created any value node having the same name as the BAPI input node and then doing the copying?
On second thoughts, if that's not the case, then you can use this code:
wdContext.nodeBapi_<inputnode>().currentBapi_<inputnode>Element().getAttributeAsText("<attribute name>");//This will return String.
Regards,
Satyajit.
Message was edited by: Satyajit Chakraborty
Hi Kathleen, If you give you, i suppose you set the inputelement of BAPI,such as
wdContext.CurrentZ_Pdxv_Get_Exp_Category_Data_InputElement().setgetIn_Bukrs("Input"));before assigning as input
It is not necessary.
Ok. Kindly send the node structure of BAPI such as
Zorg_List_All_Products_Input
--Zorg_List_All_Products_Output
--Zorg_List_All_Products_Output_Return
---Id
--Zorg_List_All_Products_Output_Zorgproducten
---Zorgproduct
--Zorgproducten
Regards,
Saravanan K
Hi Kathleen,
You can set the input parameters in manyways.Your's is one. You first set the values for inputelement and then u assigned inputelement as input.From your nodestructure,
try this,
input.setHrabssatt_In1(wdContext.currentBapi_Ptmgrattabs_Mngcreation_Input1.getHrabssatt_In1());
Before that you should set the value for wdContext.currentBapi_Ptmgrattabs_Mngcreation_Input1.setHrabssatt_In1("String"));
Saravanan K
That is what I am trying to do, except that the "getHrabsatt_In1()" is not possible, it gives me an error.
I did not understand what you mean when you said I should set the value for wdContext.currentBapi_Ptmgrattabs_Mngcreation_Input1.setHrabssatt_In1("String"));
Isn't that doing this: wdContext.nodeBapi_Ptmgrattabs_Mngcreation_Input1().bind(input1);
hi,,
Hrabssatt_In1 is node or attribute?
There is no inputnode for your BAPI,In other cases you have the Inputnode
(eg:Zorg_Prod_Locatie_Lijst_Input
Zorg_Prod_Locatie_Lijst_Input_Loc--Inputnode
Zorg_Prod_Locatie_Lijst_Output--Outputnode
). Your case inputnode is missing,
So try to give
input.setvalue("String")
Regards
Saravanan K
Message was edited by: Saravanan K
Hi Kathleen
Then try
Do you have any input parameters?
or
wdContext.currentHrabsatt_In1Element().setAtt_Abs_Hours(wdContext.currentHrabsatt_In1Element().getAtt_Abs_Hours());
Normally I use wdContext.currentHrabsatt_In1Element().setAtt_Abs_Hours("Value");
This value is from a string or a context attribute
Saravanan
public void wdDoInit()
{
//@@begin wdDoInit()
Bapi_Ptmgrattabs_Mngcreation_Input input1 = new Bapi_Ptmgrattabs_Mngcreation_Input();
wdContext.nodeBapi_Ptmgrattabs_Mngcreation_Input1().bind(input1);
input1.setHrabsatt_In(wdContext.currentBapi_Ptmgrattabs_Mngcreation_Input1Element().getAttributeValue(5));
//input1.setHrabsatt_In(new Bapihrabsatt_In());
//@@end
}
So with code: input1.setHrabsatt_In(wdContext.currentBapi_Ptmgrattabs_Mngcreation_Input1Element().modelObject().getHrabsatt_In()); It finally likes this line.
This is starting to make more sense to me, but I get error:
java.lang.NullPointerException at com.deere.u90373.vacationtrial.VacationCust.wdDoInit(VacationCust.java:102)
at com.deere.u90373.vacationtrial.wdp.InternalVacationCust.wdDoInit(InternalVacationCust.java:156)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingCustomController.doInit(DelegatingCustomController.java:73)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.progmodel.controller.Component.getCustomControllerInternal(Component.java:433)
at com.sap.tc.webdynpro.progmodel.controller.Component.getMappableContext(Component.java:371)
at com.sap.tc.webdynpro.progmodel.controller.Component.getMappableContext(Component.java:400)
at com.sap.tc.webdynpro.progmodel.context.MappingInfo.init(MappingInfo.java:138)
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:746)
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:761)
at com.sap.tc.webdynpro.progmodel.context.Context.init(Context.java:40)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:199)
at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:540)
at com.sap.tc.webdynpro.progmodel.view.ViewManager.bindRoot(ViewManager.java:422)
at com.sap.tc.webdynpro.progmodel.view.ViewManager.init(ViewManager.java:130)
at com.sap.tc.webdynpro.progmodel.view.InterfaceView.initController(InterfaceView.java:41)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.displayToplevelComponent(ClientComponent.java:134)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:374)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:593)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:249)
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.doGet(DispatcherServlet.java:48)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
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:94)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
Hi Kathleen,
this means that your model object graph is not correctly aggregated. The model object of type Hrabsatt_In() is not associated with its 'parent' model object of type 'Bapi_Ptmgrattabs_Mngcreation'.
Like I understand you implement this code in the wdDoInit() hooks. Make sure that all your input model objects are correctly 'filled' with the related model objects.
There are other forum threads describing this topic:
Best regards, I must leave now.
Bertram
Check if the "Typed access required" property of the context node is set to "true".
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kathleen,
Try this code,
(((<View name>.IBapioutputElement)(wdContext.node<bapioutputnode>
().getElementAt(i))).getattributename());
sample
String deb=String.valueOf(IPrivateCV_AZR_View_AW33.IZorg_Client_List_Output_PersonaldatalistElement)(wdContext.nodeZorg_Client_List_Output_Personaldatalist().getElementAt(l))).getDebno());
Hope this will helps
Saravanan K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kathleen,
are you directly bind the Bapi Input to the Input Element
Directly execute the BAPI.
Otherwise
You create the new node to bind the inputvalues.
in the Input
input1.setHrabsatt_In(wdContext.current<Node>Element().get<ParamValue>())
and execute the BAPI
Kind Regards
Karthik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
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.