cancel
Showing results for 
Search instead for 
Did you mean: 

Web dynpro not capable for real big numbers?

Former Member
0 Kudos

Hi,

I would like to use web dynpro for some forms with real big numbers.

So I chose decimal als type for my attribute. The underlying java type seems to be bigdecimal which can be of arbitrary length.

But it seems web dynpro cuts off the numbers in the input field after about 18 diggits. (even if I use a simple type and set the diggits to 50 for example).

Did I discover a bug? How do you handle long numbers? The only solution I can think about is using a string input field which means alot more work.

thx

Tom

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member182294
Active Contributor
0 Kudos

Hi Thomas,

Thats not the problem with WebDynpro. All basic primitive data types supports values to some extent only. But in java we have additional classess which supports big number, only problem here is we cannot map custom object value directly to the UI element value property. But we have work around which is very simple.

- Create two value attributes named BigStringValue (of type String), BigDecimalValue(of type java.math.BigDecimal).

- Set the caliculated value property of BigStringValue to <b>true</b>. setter and getter methods will be generated.

- Assign InputField value property to BigStringValue.

Add the following code to setter and getter method.

  public void setBigStringValue(IPrivateSecondView.IContextElement element, java.lang.String value)
  {
    //@@begin setBigStringValue(IPrivateSecondView.IContextElement, java.lang.String)
	try
	{
		if(value != null && value.trim().length()>0)
		{
				BigDecimal bigDec = new BigDecimal(value);	
				element.setBigDecimalValue(bigDec);	
		}
	}
	catch(NumberFormatException nfe)
	{
		IWDAttributeInfo atribInfo = wdContext.getNodeInfo().getAttribute("BigStringValue");
		wdComponentAPI.getMessageManager().reportInvalidContextAttributeException(wdContext.currentContextElement(),atribInfo,"Invalid value",false);
	}
    //@@end
  }

  public java.lang.String getBigStringValue(IPrivateSecondView.IContextElement element)
  {
    //@@begin getBigStringValue(IPrivateSecondView.IContextElement)
	return wdContext.currentContextElement().getBigDecimalValue()==null?"":wdContext.currentContextElement().getBigDecimalValue().toString();
    //@@end
  }

All validations and everthing is done.

Regards

Abhilash

Former Member
0 Kudos

If that's really the case, open an OSS message (BC-WD-JAV-RUN).

Armin