cancel
Showing results for 
Search instead for 
Did you mean: 

OVS - Input fields

Former Member
0 Kudos

Hi,

I am trying to implement the OVS functionality in which I need to have 2 out of the 3 import parameters on my OVS GUI. The 3rd import parameter should not appear on the GUI but I need to pass values to it through the code.

(If I remove the 3rd import parameter from my model structure, I am unable to pass values to it)

How can I achieve this?

Thanks and Regards,

Reena

Accepted Solutions (1)

Accepted Solutions (1)

balaji_bodagala5
Participant
0 Kudos

Hi,

u can restrict the user could not modify to change the value in third parameter,

normally way we can display the three,and then we can rise an exception or give the message at onQuery method,so user must know he can't able to chage the third parameter.

Thanks,

Balaji

Answers (1)

Answers (1)

monalisa_biswal
Contributor
0 Kudos

For OVS create another node with the same structure as the model node with the required number of fields.

in the onQuery method copy data from input node to the model node and set other field's value.

Former Member
0 Kudos

Hi Monalisa,

Thank you for your reply. Now I have just 2 input fields in my OVS GUI as required and am able to pass the 3rd parameter to the Bapi.

I am able to see the contents being retrieved in a temporary table that I have created for testing. But the OVS GUI is blank. I think Im going wrong while moving the contents from the table node to the OVS GUI node.

Here is how I have implemented it:

I have two nodes now as follows: NodeA has the import parameters which I need to display and NodeB has the 3rd parameter to which I need to pass value through the code.

NodeA

--OutputA

-


li_A

--importA1

--importA2

NodeB

--OutputB

-


li_B

--importB1

--importB2

--importB3

My code is as follows:

public void onQuery(IWDNodeElement queryInputNodeElement, IWDNode queryOutputNode)

{

IPublicSalesOrderCust.NodeAElement ovsInput = (IPublicSalesOrderCust.NodeAElement) queryInputNodeElement;

IPublicSalesOrderCust.ILi_ANode ovsOutput = (IPublicSalesOrderCust.ILi_ANode) queryOutputNode;

Bapi bapiinput = new Bapi();

wdContext.nodeB().bind(bapiinput);

bapiinput.setimportB1(ovsInput.getimportA1());

bapiinput.setimportB2(ovsInput.getimportA2());

bapiinput.setimportB3("abc");

try {

bapiinput.execute();

wdContext.nodeOutputB().invalidate();

// trying to move the contents here

wdContext.nodeLi_A().currentLi_AElement().setimportA1(wdContext.nodeLi_B().currentLi_BElement().getimportB1());

wdContext.nodeLi_A().currentLi_AElement().setimportA2(wdContext.nodeLi_B().currentLi_BElement().getimportB2());

}

catch (Exception e)

{

}

Any pointers regarding this?

Thanks and Regards,

Reena

Former Member
0 Kudos

Reena,

Your code


// trying to move the contents here
wdContext.nodeLi_A().currentLi_AElement().setimportA1(wdContext.nodeLi_B().currentLi_BElement().getimportB1());
wdContext.nodeLi_A().currentLi_AElement().setimportA2(wdContext.nodeLi_B().currentLi_BElement().getimportB2());

looks slightly redundant here. Also, you are silently catching the exception. Just put a debugging statement in the catch block which prints the exception.

If I understood correctly, you simply wanted the output obtained in nodeLi_B to be copied to nodeLi_A, the queryOutputNode. If yes, then simply run a loop over the nodeLi_B and get the elements and copy it to node Li_A. or use WdCopyService, if the structures of both the nodes are same.

If that is not the case, please explain your requirement clearly.

Bala

Former Member
0 Kudos

Hi Bala Krishnan,

Yes, what you have understood is correct.

Anyhow, I found a work around for it. Rather than trying to move the contents from one node to another, I simply changed my OVS output node to the Bapi Output node (keeping the input nodes different).

It works perfectly well now.

public com.sap.tc.webdynpro.progmodel.api.IWDNode getOVSOutputNode( )

{

//@@begin getOVSOutputNode()

return wdContext.nodeLi_B();

//@@end

}

public void onQuery(IWDNodeElement queryInputNodeElement, IWDNode queryOutputNode)

{

IPublicSalesOrderCust.NodeAElement ovsInput = (IPublicSalesOrderCust.NodeAElement) queryInputNodeElement;

IPublicSalesOrderCust.ILi_ANode ovsOutput = (IPublicSalesOrderCust.ILi_ANode) queryOutputNode;

Bapi bapiinput = new Bapi();

wdContext.nodeB().bind(bapiinput);

bapiinput.setimportB1(ovsInput.getimportA1());

bapiinput.setimportB2(ovsInput.getimportA2());

bapiinput.setimportB3("abc");

try {

bapiinput.execute();

wdContext.nodeOutputB().invalidate();

ovsInput.modelObject().execute();

ovsInput.node().getChildNode("OutputA",0).invalidate();

}

catch (Exception e)

{

}

Thanks for the input.

Regards,

Reena