cancel
Showing results for 
Search instead for 
Did you mean: 

Error in getter method while running the appplication ?

Former Member
0 Kudos

HI,

Experts,

I have downloaded the WD Java appplication from url

( [original link is broken])

While the running the application i am getting this error

java.lang.NoSuchMethodError: java.math.BigDecimal.<init>(I)V

at com.sap.tut.wd.tutwd_table.tablecomp.TableComp.getProductsTOTAL_PER_ARTICLE(TableComp.java:237)

at com.sap.tut.wd.tutwd_table.tablecomp.wdp.InternalTableComp.getProductsTOTAL_PER_ARTICLE(InternalTableComp.java:176)

at com.sap.tut.wd.tutwd_table.tablecomp.wdp.IPublicTableComp$IProductsElement.wdGetObject(IPublicTableComp.java:437)

at com.sap.tc.webdynpro.progmodel.context.MappedNodeElement.wdGetObject(MappedNodeElement.java:351)

at com.sap.tc.webdynpro.progmodel.context.AttributePointer.getObject(AttributePointer.java:158)

... 81 more

How to over come this

Thanks in advance,

Shabeer ahmed.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Go through the below thread:

In TableComp Controller: change the code as below in the method getProductsTOTAL_PER_ARTICLE()

public java.math.BigDecimal getProductsTOTAL_PER_ARTICLE(IPrivateTableComp.IProductsElement element)
  {
    //@@begin getProductsTOTAL_PER_ARTICLE(IPrivateTableComp.IProductsElement)
    
	BigDecimal bigDecimal0=new BigDecimal("0");
	BigDecimal bigDecimalQty=new BigDecimal(""+element.getQUANTITY());
	
	
    return element.getQUANTITY() < 0
      ? bigDecimal0  
      : bigDecimalQty.multiply(element.getPRICE());
      
    //@@end
  }

And also change the method getTotalPriceAMOUNT in TableCompBasketView as below.

public java.math.BigDecimal getTotalPriceAMOUNT(IPrivateTableCompBasketView.ITotalPriceElement element)
  {
    //@@begin getTotalPriceAMOUNT(IPrivateTableCompBasketView.ITotalPriceElement)
    BigDecimal total = new BigDecimal("0"), pricePerProduct;
    int n = wdContext.nodeProducts().size();
    for (int i = 0; i < n; ++i) { 
      total = total.add(wdContext.nodeProducts().getProductsElementAt(i).getTOTAL_PER_ARTICLE());
    }
    return total;
    //@@end
  }

Regards,

Charan

Former Member
0 Kudos

Hi,

Hav you downloaded from this loaction:

Ready-to-use project: The ready-to-use project is available to _download from SDN.

Regards,

Charan

Former Member
0 Kudos

Working with Tables in Web Dynpro

A) Creating Tables

Former Member
0 Kudos

is the "Project template" or the "Ready-to-use project"?

looks like there is an import missing... you can try to deploy and run again or open it and look at the like 237 of the component controller (TableComp.java:237) to see if it is marked as an error

Former Member
0 Kudos

Hi shabber,

I too faced this problem ...

to clear this you need to change the total_per_price datatype from string to decimal...in the component controller context..

thanks,

viswa

Former Member
0 Kudos

Hi,

I think some imports are missing in component controller of the project.

Close the Ide and open the ide once again and rebuild the project.

All the imports should be imported in component controller.

Hope this helps you..

Regards,

Saleem