Skip to Content
0
Former Member
Oct 31, 2012 at 02:38 PM

Working with Value Lists when creating scripts

23 Views

Hi All,

I am creating a script and have run into some issues where I am working with value lists. I have been attempting to use the help provided by Saloni in the thread http://scn.sap.com/thread/3218997 however I am not able to get my script working.

Is the correct way to work with value lists in a script done as follows:

Get from a value list:

If we have a value list extension field called client_sensitive that contains a drop down of Yes or No then use

if(doc.getExtensionField(“client_sensitive”).getDisplayName().equals(“Yes”))

{

//do something

}

Set a value list field:

If we have a value list extension field called risk_tier that is linked to a value list called project_risk that contains low/medium/high then use

import com.sap.odp.api.doccommon.masterdata.ValueListValueIBeanHomeIfc.*;

import com.sap.odp.api.doccommon.masterdata.ValueListValueIBeanIfc.*;

import com.sap.odp.api.doccommon.masterdata.ValueListTypeIBeanHomeIfc.*;

import com.sap.odp.api.doccommon.masterdata.ValueListTypeIBeanIfc.*;

vlvHome=IBeanHomeLocator.lookup(session,ValueListTypeIBeanHomeIfc.sHOME_NAME);

vlvBean=vlvHome.findByExternalId("project_risk");

valueBean=vlvBean.getCollnValueListValue().get(0);

// 0 is used here to set the field as the first entry in the value list

doc.getExtensionField("risk_tier").set(valueBean.getLocalizedObjectReference());

Currently I am getting an error of Class or variable not found: ValueListTypeIBeanHomeIfc.sHOME_NAME when I try to use this.

Any help with this would be greatly appreciated.

Many thanks

Dan