cancel
Showing results for 
Search instead for 
Did you mean: 

how to create Dynamic simple types

konchada_saikrishna
Active Participant
0 Kudos

Hello all,

I am displaying n number of field and labels dynamically.

I need to restrict the field length, for which I need to create dynamic simple types.

Can any one help me in creating Dynamic simple types, set datatype and maxlength, assign this to the field's context attribute.

And, I am creating value help for the input fields, when I click on value help of integer field it is giving an error. Is it that value help for string values only.

If so do I need to use caliculated attribute for integers.

Thanks in advance,

sai.k.k

Accepted Solutions (0)

Answers (4)

Answers (4)

konchada_saikrishna
Active Participant
0 Kudos

Thanks for all your replies ...

former_member720137
Active Participant
0 Kudos

Hi

To create simple types dynamically.. use this code

IWDAttributeInfo name1info = wdContext.nodeTest().getNodeInfo().getAttribute("Name1");

ISimpleTypeModifiable name1 = name1info.getModifiableSimpleType();

IModifiableSimpleValueSet name1ValueSet = name1.getSVServices().getModifiableSimpleValueSet();

name1ValueSet.put(key u want to add, corresponding value u want to add);

Name1 is a value attribute inside Test node().

U just hv 2 bind this context to a UI element.

For more info read this

http://help.sap.com/saphelp_nw2004s/helpdata/en/4d/a018b505747b47a22cd7d2e446df88/frameset.htm

Do reward points if helpful!

Thanks

Puneet

Former Member
0 Kudos

Sai.k.k.

I believe, you do create 'N' context attributes as you have mentioned that UI is dynamic. If so, I would suggest that you do manipulate the simpletype at the attribute level itself. A simple example would be like this.

wdContext.node<nodeName>().getNodeInfo().getAttribute("<attributeName>").getModifiableSimpleType().setFieldLabel("<Name>");
wdContext.node<nodeName>().getNodeInfo().getAttribute("<attributeName>").getModifiableSimpleType().setMaxLength(12);
wdContext.node<nodeName>().getNodeInfo().getAttribute("<attributeName>").getModifiableSimpleType().setMinLength(3);

konchada_saikrishna
Active Participant
0 Kudos

Ramesh ,

Yes I am creating context attributes dynamically.

As you said, I added the following code:

<b>

IWDAttributeInfo Ainfo = wdContext.nodeMaterial_Create().getNodeInfo().getAttribute(resourceHandler.getString("FIELD"i"_FIELDNAME"));

Ainfo.getModifiableSimpleType().setMaxLength(5); </b>

or

<b> wdContext.nodeMaterial_Create().getNodeInfo().getAttribute(resourceHandler.getString("FIELD"i"_FIELDNAME")).getModifiableSimpleType().setMaxLength(25); </b>

both of them giving an error as :

java.lang.IllegalArgumentException

at com.sap.dictionary.runtime.DdSimpleType.setMaxLength(DdSimpleType.java:714)

at com.sap.tc.webdynpro.progmodel.context.ModifiableSimpleType.setMaxLength(ModifiableSimpleType.java:224)

Where am I doing wrong.

Former Member
0 Kudos

Konchada,

Probably the reason is that you try to apply max. length constraint to non-string data type (numeric or date)

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

former_member186016
Active Contributor
0 Kudos

Regards,

Ashwani Kr Sharma