cancel
Showing results for 
Search instead for 
Did you mean: 

changing type(simpletype) of context attribute dynamically.

Former Member
0 Kudos

Dear All,

Requirement:

I have a input field in a view and based on certain conditions i need to change the length of the input filed to 10 or 15 characters in length. The input should not accept more than 10 char in one case and in another case not more than 15.

My Plan:

Now i have created a simple type(builtintype string) and in the External Length i gave 15 to restrict it to 15 char. In another condition i need to have 10 characters, So i created one moer simple type with external length as 10 char.

Now i need to dynamically change the the context attributes type (either of the 2 simple types) to which this input field is mapped to.

Kindly help me in this regard. Points will surely be awarded.

Regards

Yusuf

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi The Solution is Like.

In the Component Controller. I had a Context Atrribute "Batch", which is a Simple Type-String. I called a method in the Comp. controller from the View based on a condition. In the Method i have a coding like

if( Condition....)

{

IWDAttributeInfo info = wdContext.nodeUserInputNode().getNodeInfo().getAttribute("Batch"); // -


> Batch is Context Attribute for which i want to change the Length dynamically

ISimpleTypeModifiable myType=(ISimpleTypeModifiable)info.getModifiableSimpleType();

myType.setMaxExternalLength(15);

}

else

{

IWDAttributeInfo info = wdContext.nodeUserInputNode().getNodeInfo().getAttribute("Batch");

ISimpleTypeModifiable myType=(ISimpleTypeModifiable)info.getModifiableSimpleType();

myType.setMaxExternalLength(10);

}

Regards

Md. Yusuf

Former Member
0 Kudos

Thanks. You could maybe simplify the code by applying the distributive law.

Armin

Former Member
0 Kudos

I am not 100% sure but probably you could just use one DDIC type and use the DDIC runtime API to change the length, see

https://help.sap.com/javadocs/NW04S/current/dr/com/sap/dictionary/runtime/ISimpleTypeModifiable.html...

Armin

Former Member
0 Kudos

Thanks Armin, Your suggestion was helpful. I have awarded points.

Former Member
0 Kudos

Thanks. Could you share your solution with us?

Armin