Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Working with Value Lists when creating scripts

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

Tags:
Former Member
replied

Hi Dan,

The problem seems to be in the import statement.

It should look like below, without the .* at the end.

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

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

Hope this helps.

Regards,

Vikram

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question