cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

OVS in tables

Former Member
0 Kudos

Hallo everybody...

we want to implement a table with one inputfield-column. In this inputfield the OVS should be enabled, to select e.g. a material. The OVS should fill the complete row with data out of the selected material. But if we want to enable OVS, we can not create a table because of the cardinality of the node-element of the context.

If we select the cardinality "1..1" the OVS works but the table only can have one row ๐Ÿ˜• If we select the cardinality "0..n" the table can have "n" rows but the OVS is disabled.

Did anybody implements a similar application? Please help

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Backe,

It’s easy. The context cardinality is 0..n but you need create a button to add new line in table. Try use the code below in this Button

IPrivate<Name View>.I<Name Node>Element ele = wdContext.node<Name Node>().create<Name Node>Element();

wdContext.node<Name Node>().addElement(ele);

Regards,

Edson Thomaz

Former Member
0 Kudos

Hi Edson,

your hint was very useful, thank you a lot. We have implement the problem with an event, which add a new line, every time you using the OVS, instead of a button

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Backe

This is very useful, thank you a lot.

Nohemi

Former Member
0 Kudos

Hi,

How do you do a OVS in a Table Field?

I'm doning this but it does not work.

I think that the problem is in the allocation from the OVS to the table field wiht the Method WDValueServices.addOVSExtension.

you have a example?

You will be able to help me? Pls....

Nohemi

Former Member
0 Kudos

Hi Espejo,

i have learned, that the OVS is only relevant for the datatype you inserted in the inputfield. So if your table columns are disabled but the OVS addon is visible, you have to change the cardinality of the context-node.

Example:

You have a table with the colums "name", "itemnumber", "description" and "text". So in the context you have to create an "ValueNode" with the cardinality 0..n oder 1..n (in our case named "Items"). You change the cardinality in the properties-window of the "ValueNode". Under the "ValueNode" you have to create the "ValueAttributes" of "name", "itemnumber", "description" and "text".

I do not must say, that you have to create the table with an Inputfield for the column "itemnumber". Because we want to put the OVS at this column.

now you can edit the wdDoInit() in the yourView class


// so the OVS was put to the colums itemnumber
IWDAttributeInfo[] ovsStartUpAttributes = wdContext.nodeItems().getNodeInfo().getAttribute("itemnumber")};

IWDOVSContextNotificationListener listener = wdThis.wdGet<YourAppName>CompController().getOVSListener();
WDValueServices.addOVSExtension("Items Selection",
		ovsStartUpAttributes,
		wdThis.wdGet<YourAppName>CompController().getOVSInputNode(),
		wdThis.wd<YourAppName>CompController().getOVSOutputNode(),
		listener);

in your Component Controller you must insert the three methods:


public com.sap.tc.webdynpro.progmodel.api.IWDOVSContextNotificationListener getOVSListener( )
  {
    //@@begin getOVSListener()
		return ovsListener;
    //@@end
  }


public com.sap.tc.webdynpro.progmodel.api.IWDNode getOVSInputNode( )
  {
    //@@begin getOVSInputNode()
		return wdContext.node<YourBAPI>_Input();
    //@@end
  }


public com.sap.tc.webdynpro.progmodel.api.IWDNode getOVSOutputNode( )
  {
    //@@begin getOVSOutputNode()
		// this context will come out of the BAPI -> its just the return - context you want to get
		return wdContext.nodeItemnumberlist();
    //@@end
  }

you also have to implementing the IWDOVSContextNotificationListener as a private inner class of your Component Controller.


	private class OVSMyContextNotificationListener
		implements IWDOVSContextNotificationListener {

		/* @see com.sap.tc.webdynpro.progmodel.api
		* )
		.IWDOVSContextNotificationListener#onQuery(... */
		public void onQuery(IWDNodeElement queryInputNodeElement, IWDNode queryOutputNode) {
			
		}

		/* @see com.sap.tc.webdynpro.progmodel.api
		* .IWDOVSContextNotificationListener#applyResult(...)*/
		public void applyResult(
			IWDNodeElement applicationNodeElement,
			IWDNodeElement queryOutputNodeElement) {

		}

		/* @see com.sap.tc.webdynpro.progmodel.api
		* .IWOVSC
		DontextNotificationListener#applyInputValues(...) */
		public void applyInputValues(
			IWDNodeElement applicationNodeElement,
			IWDNodeElement queryInputNodeElement) {

		}
	}

now you only have to initialize your inner class in the Component Controller like


private IWDOVSContextNotificationListener ovsListener = new OVSMyContextNotificationListener();

you have to implement the last two codeexamples in the "//@@begin others"-tag of the Component Controller.

now you should only implement the three methods of your inner class.

Thats it

You only have to pay attention in the View, by creating the context-strukture. The cardinality is very important.

Former Member
0 Kudos

Hello Backe,

Use this link to do the OVS.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20jav...

Now you change the method getListener to put the value e.g. a material and change the constructor method of inner class implements IWDOVSContextNotificationListener to receive this value and use this value in method onQuery

After select material, you need set the material in the OVS.

Ex.:

IWDAttributeInfo[] ovsProduto = { wdContext.node<Node>().getNodeInfo().getAttribute("<Attribute>")};

IWDOVSContextNotificationListener listener = wdThis.wdGet<Name Custom Controller>().getListener(<<Value Material>>);

WDValueServices.addOVSExtension("XXX",

ovsProduto,

wdThis.wdGet<Name Custom Controller> ().getOVSInputNode(),

wdThis.wdGet<Name Custom Controller> ().getOVSOutputNode(),

listener);

Regards,

Edson Thomaz

Former Member
0 Kudos

Hi Edson,

thank you for your fast reply. Your hints are very useful for some introduction in OVS. My question was a little more complex. We want to include an OVS into a table-cell. So we have define a table and a context. One table-column consists of an inputfield. Now we want to add an OVS to this inputfield. But, if we create our table with the context in cardinality "0..n" the inputfield is disabled and no OVS is shown. When we create our table with the context in cardinality "1..1" the OVS is shown but the table only can have one row (thats not the functionality of a table )

Now we want to know, is there a method to put the OVS at the inputfields in the table-column and have more than one row (cardinality of the context "0..n")?