cancel
Showing results for 
Search instead for 
Did you mean: 

Creat organization tree in OVS

Former Member
0 Kudos

Hi all,

I need help on OVS.

I'm working on SAP HR and Webdynpro Java.

Now in my interface webdynpro, the user should be able to input a

organization unit ID or select one on using OVS.

Since there are more than 30000 units in the entreprise, I need display the organization tree of entreprise so that the user could search for the wanted unit in the tree.

Does anyone know how to creat a OVS like this type?

thanks a lot in advance!

Yimin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can search from the bapi to display the organizations in the ovs. To create the OVS you can follow the below steps.

1. Create the input field in View

2. Create the custom controller (ex: OVSOrgCust)

3. Create the context attribute in OVSOrgCust (ex : organization)

4. Map the attribute to View context. So attribute "organization" is available in View context

5. Write the following code in wdDoInit of View Controller

IWDAttributeInfo[] orgAttributeInfo =

{

wdContext.getNodeInfo().getAttribute(

"organization")};

IWDOVSContextNotificationListener listener =

wdThis.wdGetOVSOrgCustController().getOVSListener();

WDValueServices.addOVSExtension(

"Select Prg",

orgAttributeInfo,

wdThis.wdGetOVSOrgCustController().getOVSInputNode(),

wdThis.wdGetOVSOrgCustController().getOVSOutputNode(),

listener);

6. Go to OVSOrgCust controller and create the node with attributes (input for the model to get organzations)

ex : orgInput (node)

orgName (attribute)

7. Create the following functions in OVSOrgCust

a. public com.sap.tc.webdynpro.progmodel.api.IWDOVSContextNotificationListener getOVSListener( )

{

//@@begin getOVSListener()

return ovsListener;

//@@end

}

b. public com.sap.tc.webdynpro.progmodel.api.IWDNode getOVSInputNode( )

{

//@@begin getOVSInputNode()

return wdContext.nodeOrgInput();

//@@end

}

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

{

//@@begin getOVSOutputNode()

return wdContext.nodeorgOutput(); (This node which returns data from model)

//@@end

}

8. Map the model node (which retrives org) to OVSOrgCust context

9. Create the below mentioned class in OVSOrgCust at the end of the class (between //@@begin others and //@@end)

private class OVSDemoContextNotificationListener

implements IWDOVSContextNotificationListener {

//@@begin javadoc:onQuery()

/** Declared method. */

public void onQuery(com.sap.tc.webdynpro.progmodel.api.IWDNodeElement queryInputNodeElement, com.sap.tc.webdynpro.progmodel.api.IWDNode queryOutputNode ) {

IPublicOVSOrgCust.IOrgInputElement inputEleemnt = (IPublicOVSOrgCust.IOrgInputElement)queryInputNodeElement;

// Execute the organization model here. So orgoutput node will be filled with data

} catch (WDDynamicRFCExecuteException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

public void applyResult( com.sap.tc.webdynpro.progmodel.api.IWDNodeElement applicationNodeElement, com.sap.tc.webdynpro.progmodel.api.IWDNodeElement queryOutputNodeElement )

{

try {

//type cast the queryOutputNodeElement to your org output node and get the org id from the node

//assign the org id to context attribute "organization"

}catch(Exception e) {

}

}

public void applyInputValues( com.sap.tc.webdynpro.progmodel.api.IWDNodeElement applicationNodeElement, com.sap.tc.webdynpro.progmodel.api.IWDNodeElement queryInputNodeElement )

{

try {

}catch (Exception e) {

}

}

}

private IWDOVSContextNotificationListener ovsListener = new OVSDemoContextNotificationListener();

Hope this will help you.

Former Member
0 Kudos

Thanks a lot Tatayya!

Your answer is very helpful!

I think the Bapi should be BAPI_ORGUNITEXT_DATA_GET.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I am not sure that the OVS will render as tree.

Instead you can try creating a view which contains the following UI elements a label one or more buttons a Table Tree by Nesting

and have a button to launch this screen

Regards

Ayyapparaj