cancel
Showing results for 
Search instead for 
Did you mean: 

Strange difference between Function and Class Method

StephaneBailleu
Active Contributor
0 Kudos

Funny  I execute the function

FUNCTION Z_MM_0530_AMOUNT.

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     REFERENCE(IV_PRICE) TYPE  NETWR

*"     REFERENCE(IV_CURRENCY) TYPE  WAERS

*"  EXPORTING

*"     REFERENCE(ES_AMOUNT) TYPE  FDT_S_AMOUNT

*"----------------------------------------------------------------------

ES_AMOUNT-NUMBER = IV_PRICE.

ES_AMOUNT-CURRENCY = IV_CURRENCY.

Entering as parameter 20,00 EUR I get 20,00 EUR

If I do the same in class method I get 2.000EUR

Can someone explain the difference ?

Cheers

Stephane

Accepted Solutions (0)

Answers (1)

Answers (1)

christianlechne
Active Contributor
0 Kudos

Hi Stephane

you mean in BRFplus when calling the function module/class via the call procedure expression?

BR

Christian

StephaneBailleu
Active Contributor
0 Kudos

Hi Christian,

No in fact I am working with workflow and before calling a task generated by the BRF+ where I have an amount (type FDT_S_AMOUNT) I need to assign the value to number and currency

So I build a function but there is no real integration possible in SWO1 because FDT_S_AMOUNT is not recognized so I build a method in a class

And the result was different from the function call ...

When I insert the function in the class method then everything is fine.

I find it really strange

Cheers

Stephane

christianlechne
Active Contributor
0 Kudos

Hi Stephane,

I a not sure if I understood your setup completly (might be due to my not too depp knowledge in workflow), but that sound completly strange that wrapping a function module in a class delivers different results than putting the code directly in the class. Did you check calling the class standalone without any integration into workflow? Does this already give the strange results or do ethese results appear only when integrated in workflow?

BR

Christian

StephaneBailleu
Active Contributor
0 Kudos

Christian,

I fully agree that is really really strange

But if you do have a dev system please construct a class with

IV_PRICe type NETWR

IV_CURRENCY TYPE WAERS

then a returning parameter RS_AMOUNT type FTD_S_AMOUNT

Make it static and public for testing purpose

the code is just

RS_AMOUNT-NUMBER = IV_PRICE.

RS_AMOUNT-CURRENCY = IV_CURRENCY.

You'll see that for 20,00 EUR it provides you with 2.000EUR

do the same in a function .... 20,00 EUR

That is just crazy to me

the problem occurs in a 731 005 (SAP_ABA) but correct in a 740 006....

Well things happens ....

carsten_ziegler
Active Contributor
0 Kudos

I have an idea: In BRFplus an amount is shown and dealt with internally as you expect it, means 20,00 Euro is a number 20,00 + EUR. In ABAP the value is 2000 + EUR and the EUR makes the , move to the right place. There is a difference between internal and external values. 

StephaneBailleu
Active Contributor
0 Kudos

Hi Carsten ,

Taking the opportunity, Great Book, I have already implemented some project without issue with BRF+ and with my knowledge in workflow it is really amazing what we can achieve .... really I would like the BRF+ to replace the BRF in SRM too 😉

I am part of a company of more than 250 consultant and promoting BRF+ everytime I get a chance.

Next session next week 🙂

Going back to the subject, the function I was refering to is an ABAP Function not BRF+ Function.

So that is why I don't get the difference between the same code done in a function module and in a class method. when the function is included in the Class Method the result is correct.

However I have tested in another environement and I successfully have the same result in function and Class Method.

So it might be an issue with ABAP 731 005 ??? I don't know really that is weird.

Cheers

Stephane

christianlechne
Active Contributor
0 Kudos

Hi Stephane,

then it seems to be a Kernel bug - have no 7.31 system at hand to check it.

You should definitely open an OSS on that

BR

Christian