Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

declare a method

Former Member
0 Likes
640

Hi All,

I am writing code to populate a key figure in a structure. The formula is like:

kf1 = nodim( kf2 ) * kf3.

nodim is a function - Value Without Dimension (Unit-free). This is used in a query to calculate a key figure. My requirement is to simulate the functionality in the code.

How to declare or define the method or function 'nodim'?

Please advise.

Message was edited by:

Sachin Guptha

5 REPLIES 5
Read only

Clemenss
Active Contributor
0 Likes
608

Hi,

try something like


CLASS calc DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS:
      nodim   
        importing kf_in  type any
        returning value(kf_out) type any.
ENDCLASS.
CLASS calc IMPLEMENTATION.
  METHOD nodim.
* do the nodim calculation here...
  kf_out = kf_in.
  ENDMETHOD.
ENDCLASS.

The code should work. Actually I have no idea about the algorithm behind NODIM.

Regards,

Clemens

Read only

Former Member
0 Likes
608

Hi Clemens,

I will try and let you know.

Thanks

Read only

Clemenss
Active Contributor
0 Likes
608

Oops,

you may have noticed that it's syntactically not correct.

returning value(kf_out) type any.

can not be type any. Specify INT4 or whatever may be applicable. Sorry.

Regards,

Clemens

Read only

Former Member
0 Likes
608

Hi,

I have a question. I am writing code to populate 2 key figures (kf1 and kf2).

kf1 = kf3 + kf4.

kf2 = nodim(kf5) * kf6.

The code for kf1 already exists in a method. Where to write the CLASS definition and implementation for populating the second key figure (kf2).

Thanks

Read only

Clemenss
Active Contributor
0 Likes
608

Hi Sachin,

possibly I don't understand in depth what you are going to do.

You said

kf1 = kf3 + kf4.

and

code for kf1 already exists in a method.

Does the method do the addition of kf3 + kf4? what's the method's name and where is it declared? Where do kf3 and kf4 come from?

Still I don't know what the nodim function is going to do. nodim is used for dimensionless. What does thius mean in your contect? And where does kf5 and kf6 come from?

CLASS definition and implementation can be written anywhere in your program or defined in the class builder making it reusable.

I think the question is: if the implemented method is thought for populating the second key figure (kf2), then how to populate values (parameters?) kf5 and kf6 and how to interpret nodim function - is it just the decimal value of an exponential number a.bcdeEnn or what?

Could you please explain the circumstances of the task (in other words: What the hell are you doing?)

Kind regards,

Clemens