cancel
Showing results for 
Search instead for 
Did you mean: 

Java.math.BigDecimal Problem!

Former Member
0 Kudos

Hi all,

I'm running a webdynpro application, inside it I'm executing a RFC that receives some parameters. Most of them are strings, but just one of them is BigDecimal type. When I run the app, I got the following error...

java.lang.NullPointerException

at java.math.BigDecimal.<init>(BigDecimal.java:181)

I appreciate any help you can give me.

Thanks in advance.

Jesus.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Jesus,

Please try this code for executing the RFC:

public void executeRFC (java.math.BigDecimal importe)

{

try {

Zbapi_createVR_Input_Input input = new Zbapi_createVR_Input_Input();

input.setImp(importe);

wdcontext.nodeZbapi_createVR_Input_Input.bind(input);

wdContext.currentZbapi_createVR_InputElement().modelObject().execute();

// modelobject didn't have () in your code

}

catch (Exception e) {

}

I am not sure whether the way you entered input parameters will work. Anyway, this is the usual way we pass parameters to RFC.

Hope this works for you.

Best Regards,

Nibu.

Former Member
0 Kudos

Hi,

That means the context attribute "Importe" is empty.

Set some value using wdContext.currentContextElement().setImporte(VALUE) and try.

Regards, Anilkumar

Former Member
0 Kudos

Hi Jesus,

Can you please paste your code here (the code where you are creating the BigDecimal object & passing to RFC) ?

Best Regards,

Nibu.

Former Member
0 Kudos

Hi Nibu,

Here you have the code that I'm using..

BigDecimal imp = new BigDecimal (

wdContext.currentContextElement().getImporte());

wdThis.wdGetVR_ControllerController.executeRFC(imp);

Then in the VR_Controller, I have created a method call executeRFC like this...

public void executeRFC (java.math.BigDecimal importe)

{

try {

wdContext.currentZbapi_createVR_InputElement().modelObject.setImp(importe);

wdContext.currentZbapi_createVR_InputElement().modelObject.execute(),

}

catch (Exception e) {

}

Thanks.

Jesus.

Former Member
0 Kudos

Hi ,

Is this field is mandatory ? may be you are not passing any value? Please check.

Regards, Anilkumar

Former Member
0 Kudos

Ok, this field is not mandatory. any other help?

Jesus.