cancel
Showing results for 
Search instead for 
Did you mean: 

"Missing" method

Former Member
0 Kudos

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)

Accepted Solutions (0)

Answers (5)

Answers (5)

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

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



The generated context interface for model node elements (here the interface 'IBapi_InputElement') only exposes setters and getters for the properties of the model class to which the model node is bound. These setters and getters are not created for the related model classes.

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

Former Member
0 Kudos

Hi Kathleen,

can you send the entire bapi execution code which you have written in doInit();

regards

karthik

Former Member
0 Kudos

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!

Former Member
0 Kudos

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

Former Member
0 Kudos

I do not think I understand what you are saying. Could you please explain further?

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Kathleen,

You are giving the output of the BAPI as a input to execute the BAPI,

It should be,

input.set<parameter>(value)

Use the value as a string/integer or other context attribute. Importantly not output of same bapi.

Regards,

Saravanan K

Former Member
0 Kudos

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

Former Member
0 Kudos

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....?

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Karthik-then why can I get the correct value for the other examples I listed before?

Former Member
0 Kudos

The structure is:

Bapi_Ptmgrattabs_Mngcreation_Input1

- Hrabssatt_In1

-- Abs_Att_Hours

- Output

-- Hrabssatt_Out

--- Abs_Att_Hours

Message was edited by: Kathleen Reilly

Message was edited by: Kathleen Reilly

Message was edited by: Kathleen Reilly

Former Member
0 Kudos

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

Former Member
0 Kudos

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);

Former Member
0 Kudos

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

Former Member
0 Kudos

its a node.

Att_Abs_Hours is the attribute

Former Member
0 Kudos

Is Att_Abs_Hours ia attribute of Hrabssatt_In1

?

Message was edited by: Saravanan K

Former Member
0 Kudos

Att_Abs_Hours is an attribute of Hrabsatt_In1

Former Member
0 Kudos

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

Former Member
0 Kudos

When I do that, the getAtt_Abs_Hours() generates an error saying: the method getAtt_Abs_Hours() is undefined for the type IPublicControllerCust.IHrabssatt_In1Element

Former Member
0 Kudos

HI,

Set the value as

wdContext.currentHrabsatt_In1Element().setAtt_Abs_Hours(anyvalue string or integer);

Wat you get?

Former Member
0 Kudos

It says:

The method setHrabsatt_In(Bapihrabsatt_In) in the type Bapi_Ptmgrattabs_Mngcreation_Input is not applicable for the arguments (String)

and also

The method getAttributeValue(String) in the type NodeElement is not applicable for the arguments (int)

Former Member
0 Kudos

Then try integer value

Former Member
0 Kudos

I did, I tried both integer and string, and thats what I got.

Former Member
0 Kudos

give code

Former Member
0 Kudos

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

}

Former Member
0 Kudos

Bapi_Ptmgrattabs_Mngcreation_Input input1 = new Bapi_Ptmgrattabs_Mngcreation_Input();

wdContext.currentHrabsatt_In1Element().setAtt_Abs_Hours(1);

Try this

Sarvanan K

Former Member
0 Kudos

when I get to the .set part, my only option is Att_Abs_Hours of type Big Decimal, which doesnt match up

Former Member
0 Kudos

Try the decimal value instead of 1

I give up withis effort

Saravanan K

Former Member
0 Kudos

Haha I don't blame ya! Wish I could too!

Thanks for trying

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Kathleen,

have you read my 'solution'? You must invoke the modelClass()-method first. Then your getter is visible.

Regards, Bertram

Former Member
0 Kudos

Ok one second, I'm working on yours now

Former Member
0 Kudos

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)

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

Former Member
0 Kudos

Bertram-This has not been solved just yet. I give up for the moment!

Former Member
0 Kudos

Check if the "Typed access required" property of the context node is set to "true".

Armin

Former Member
0 Kudos

Yes, it is set to true.

Former Member
0 Kudos

Also in the context where the mapping chain starts?

Armin

Former Member
0 Kudos

Armin-

Yes, it is set to true where the mapping chain starts as well.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Karthik-

"in the Input

input1.setHrabsatt_In(wdContext.current<Node>Element().get<ParamValue>())

and execute the BAPI"

Thats what I was trying to do, but nothing comes up for the .get<ParamValue>>()) part and im not sure why

Message was edited by: Kathleen Reilly

Former Member
0 Kudos

Hi Kathleen,

Did you try this,

wdContext.node<BAPI outputnode>().getBapi outputElement>ElementAt(i).get<Attribute>()

sample

wdContext.nodeZorg_Get_Uren_Productlocatie_Output_T_Uren().getZorg_Get_Uren_Productlocatie_Output_T_UrenElementAt(i).getD10()

Saravanan K