on 06-25-2008 11:33 AM
Hi,
My requirement is to create an input field at run time and its maximum length should be the same as ABAP field (Example:CHAR 10).
Here the node creation is also being done at runtime.
And as I understood, the maximum length is determined by the binding type.
So when dynamically creating a node and adding an attribute(per field), I need to pass the simple data type.
Here the need is how to create a simple data type and set its Maximum length at runtime.
I can do this at design time, but did not find any api methods to do this at run time.
Any pointers on how this can be achieved.
Regards,
Sagar
Hi,
Thanks for your reply, but now the setMaxLength expects me to set an integer but if I do that, I get the following exception:
java.lang.IllegalArgumentException
com.sap.dictionary.runtime.DdSimpleType.setMaxLength(DdSimpleType.java:716)
How to resolve this?
Regards,
Sagar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sagar,
If you need just limit the string length you don't need to create SimpleType. You can create an attribute of type string and use the method setMaxLength() to set the max length:
...
IWDNodeInfo info = wdContext.nodeTest().getNodeInfo();
info.getAttribute(IPublicTestComp.ITestElement.TEST_STRING).getModifiableSimpleType().setMaxLength(TEXT_LENGTH_10);
...
This will also affects the InputField element. If you bind value property to testString context attribute, the user will be able to enter max 10 chars.
Good luck
Ivan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I dont think it is possible to cretae a simple type at Run time but we can certainly modify it using getModifiableSimpleType()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.