BSSV development, how to convert mathnumeric and integers?

serenity_now

Active Member
Hi All,

I am trying to develop a custom BSSV that makes use of a standard BSFN. The BSFN needs to be passed a mathnumeric value.

I have created the internal and published components but am having trouble assigning this value between the internal and published components. I read the JDE BSSV guide and they mentioned overloading the set method of the internal value object using something like this:
---------------MathNumeric to Integer-----------------------
public void setNumberField(MathNumeric numberField){
if(numberField!= null)
this.numberField= new Integer(numberField.intValue());
}

This doesn't work for me. jDeveloper still complains about trying to set a MathNumeric to an Integer. I thought I could get around it by just changing the data type to Integer but the BSSV does not like this when run and complains about trying to cast integers to mathnumerics.

How do people get around this? I am sure I am missing something simple here?
 

Chan Rana

Legendary Poster
The way you have coded is correct so not sure why you still get the error. It may be that the data type in internal and published that you try to map/convert are not actually what you might be type casting. You can check both the variables definitions.

Chan
 

serenity_now

Active Member
Thanks for the reply.

Just so I am thinking along the right lines, the internal variable is a MathNumeric type and in the setter method for this variable I should use:
---------------MathNumeric to Integer-----------------------
public void setNumberField(MathNumeric numberField){
if(numberField!= null)
this.numberField= new Integer(numberField.intValue());
}

The published variable is a type Integer and remains this way. Whats strange is the MathNumeric to Integer code above gives an error right away about being unable to set the incompatible types MathNumeric to Integer. Will have to dig a bit deeper.
 

8152

Active Member
Hello

We use this to populate a line number when we call SO master business fucntion thru BSSV. "new MathNumeric(lineNumber)". The linenumber is an integer.

Hope this helps.

8152
 

serenity_now

Active Member
I do have definition classe imported in my internal Processor.

Attached is what the code and error I am getting looks like.
 

Attachments

  • error.jpg
    error.jpg
    76.1 KB · Views: 77

TimPierce

Reputable Poster
So if this method is for setting a MathNumeric, is the piece of code you posted supposed to accept a MathNumeric or Integer as input?

Overloading would suggest that you should have two setAssetItemNumber methods, one accepting a MathNumeric and one accepting an Integer.

The code might be 'something' like this:-

public void setMnAssetItemNumber(MathNumeric mnAssetItemNumber) {
if (mnAssetItemNumber != null)
this.mnAssetItemNumber = new MathNumeric(mnAssetItemNumber());
}

public void setMnAssetItemNumber(Integer mnAssetItemNumber) {
if (mnAssetItemNumber != null)
this.mnAssetItemNumber = new MathNumeric(mnAssetItemNumber());
}
 
Last edited:

serenity_now

Active Member
So if this method is for setting a MathNumeric, is the piece of code you posted supposed to accept a MathNumeric or Integer as input?

Overloading would suggest that you should have two setAssetItemNumber methods, one accepting a MathNumeric and one accepting an Integer.

The code might be 'something' like this:-

public void setMnAssetItemNumber(MathNumeric mnAssetItemNumber) {
if (mnAssetItemNumber != null)
this.mnAssetItemNumber = new MathNumeric(mnAssetItemNumber());
}

public void setMnAssetItemNumber(Integer mnAssetItemNumber) {
if (mnAssetItemNumber != null)
this.mnAssetItemNumber = new MathNumeric(mnAssetItemNumber());
}

Thanks all for the responses. You are correct, I was mistaken in the way I thought I understood the overloaded methods. Once I did it like the above it all kind of clicked into place and worked as expected.
 

johndanter

Legendary Poster
Hi folks,

Can I add a post to this. I am getting the same errors and am pulling my hair out over it. I declared DOCO for example like this......

public void setMnDocumentOrderInvoiceE_DOCO(MathNumeric mnDocumentOrderInvoiceE_DOCO) {
this.mnDocumentOrderInvoiceE_DOCO = mnDocumentOrderInvoiceE_DOCO;
}
public void setMnDocumentOrderInvoiceE_DOCO(Integer mnDocumentOrderInvoiceE_DOCO)
{
if ( mnDocumentOrderInvoiceE_DOCO == null )
{
this.mnDocumentOrderInvoiceE_DOCO = null;
}
else
{
setMnDocumentOrderInvoiceE_DOCO( new MathNumeric(mnDocumentOrderInvoiceE_DOCO) );
}
}
public MathNumeric getMnDocumentOrderInvoiceE_DOCO() {
return mnDocumentOrderInvoiceE_DOCO;
}

That is slightly different to the way Tim has suggested right?
There is no IF around the mathnumeric declaration. therefore am I right in thinking the mathnumeric will now override the integer one?
 

RKUSA

Active Member
For Internal, you have to format like below for math numeric
public void setMnQBEOrderNumber_DOCO(Integer iQBEOrderNumber_DOCO)
{
if (iQBEOrderNumber_DOCO != null)
{
this.mnQBEOrderNumber_DOCO = new MathNumeric(iQBEOrderNumber_DOCO);
}
}

For Publish, format would be like below for math numeric

public void setMnJobNumber_Out(MathNumeric mnJobNumber_Out)
{
if (mnJobNumber_Out != null)
this.mnJobNumber_Out = new Integer(mnJobNumber_Out.intValue());
}

For Amount, cost or line number it would be bid decimal.
 
Conversions in JAVA (BSSV) :

MathNumeric to Integer :

private Integer addressNumber = null;

public void setAddressNumber(MathNumeric addressNumber) {
this.addressNumber = new Integer(addressNumber.intValue());
}

Integer to MathNumeric :

private MathNumeric addressNumber = null;

public void setAddressNumber(Integer addressNumber) {
this.addressNumber = new MathNumeric(addressNumber);
}
 
Top