cancel
Showing results for 
Search instead for 
Did you mean: 

EVS Validation

Former Member
0 Kudos

Hi, I'm using EVS for one of my input fields in my project.

And I've to display the text onSelect and onEnter for corresponding key value of EVS values.which is working fine.

But when enter any value manually then onEnter it should ignore the case of the letters and should display the corresponding text for the entered key in InputFeild for that I'm converting the case of the context variable in the inputfield.

and I used toUpperCase and equalsIngnoreCase both but when I run the code it was giving error the specified key value doesn't exist but when I cleck on EVS Selector it filters out the name and diplays only the name which I entered in the Input field.

I want the same thing when I do oneneter It shoud display the corresponding text for the key which I entered in Inputfield.

Code which I'm using for the same

ISimpleTypeModifiable cond1Type =

wdThis.wdGetAPI().getContext().getModifiableTypeOf(

"ctx_cnd_code1_cust");

cond1Type.setFieldLabel("Code List");

IModifiableSimpleValueSet valueSet1 =

cond1Type.getSVServices().getModifiableSimpleValueSet();

for (int i = 0; i < codeSize; i++) {

valueSet1.put(

wdContext

.nodeEt_Domvalues()

.getEt_DomvaluesElementAt(i)

.getDomain_Value(),

wdContext

.nodeEt_Domvalues()

.getEt_DomvaluesElementAt(i)

.getDomain_Text());

}

and for displaying text.

I'm using this

cond_code1 =

wdContext.currentContextElement().getCtx_cnd_code1_cust();

ISimpleTypeModifiable productsType =

wdThis.wdGetAPI().getContext().getModifiableTypeOf(

"ctx_cnd_code1_cust");

productsType.setFieldLabel("Code List");

IModifiableSimpleValueSet valueSet1 =

productsType.getSVServices().getModifiableSimpleValueSet();

desc1 =

valueSet1.getText(

wdContext.currentContextElement().getCtx_cnd_code1_cust().toUpperCase());

wdContext.currentContextElement().setCtx_cc1_desc_cust(desc1);

where toUpperCase is not working.

This method I'm callig at two places one in the view for onEnter of the inputField and one in doModifyView for onSelect to display the text in the EVS.

Please help me out as I'm running out of time.It's urgent.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

For the onEnter action, is it set to be done 'without validation'? The validation will happen prior to the action code being processed.

See the request/response phase model at: http://help.sap.com/saphelp_nw04/helpdata/en/b8/cd96edb9c8794aa362e6e8b4236a1f/frameset.htm

Also see the tutorial about validating vs. non-validating actions at: http://help.sap.com/saphelp_nw04/helpdata/en/55/3993422e26de54e10000000a155106/content.htm

Cindy

Former Member
0 Kudos

Hi cindy,

I've put checkbox on for without validation,It is working for EVS. But when submit the values then it again saying that "Enumeration doesn't Exist".Here I'm again converting the context value to Upper case as all the key values in EVS are in upper case,in ModifyView.

Former Member
0 Kudos

Niharika,

Changing values in the modify view is not a good idea.

Another option is to use a calculated context attribute for your EVS input. There is an article that talks about setting up an EVS to display the text rather than the key in the input field, but you could use it to replace the key with uppercase as well.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/0c0dcacd-0401...

I used this but had a similar problem to what you are trying to do (values in uppercase, user can enter values in lowercase). I was using a list of company codes and names. My get and set methods for the calculated attribute are as follows (it was setting the name, but you could easily set the value as the key instead):

public java.lang.String getCompanyNameCalc(IPrivateControlTestView.IContextElement element)

{

//@@begin getCompanyNameCalc(IPrivateControlTestView.IContextElement)

String attributeName = IPrivateControlTestView.IContextElement.COMPANY;

IWDAttributeInfo attributeInfo = element.node().getNodeInfo().getAttribute(attributeName);

ISimpleType simpleType = attributeInfo.getSimpleType();

ISimpleValueSet valueSet = simpleType.getSVServices().getValues();

Object key = element.getAttributeValue(attributeName);

try {

simpleType.checkValid(key);

return valueSet.getText(key);

}

catch (DdCheckException ex) {

return "";

}

//@@end

}

public void setCompanyNameCalc(IPrivateControlTestView.IContextElement element, java.lang.String value)

{

//@@begin setCompanyNameCalc(IPrivateControlTestView.IContextElement, java.lang.String)

String attributeName = IPrivateControlTestView.IContextElement.COMPANY;

IWDAttributeInfo attributeInfo = element.node().getNodeInfo().getAttribute(attributeName);

ISimpleType simpleType = attributeInfo.getSimpleType();

String companyCode = value.toUpperCase();

try {

simpleType.checkValid(companyCode);

element.setCompany(companyCode);

element.setInvalidCompanyCode("");

}

catch (DdCheckException ex) {

// do nothing, it is not valid.

element.setInvalidCompanyCode(companyCode);

}

// Below is the code the tutorial used. It doesn't validate, so I used the code above to do that.

// Precondition: the roundtrip is based on a validating action.

// For non-validating actions, the retrieved value may be invalid.

//element.setCompany(value);

//@@end

}

There is a context attribute used called InvalidCompanyCode that is set if the value is not valid and then used in a validating action later to report any invalid value.

I hope this helps.

Cindy