‎2021 Apr 28 3:54 AM
Hi Experts
I am ready for calulating ball volume, the code and screent is following . But there is some error that I don't define get_volumn.
Can you help me ? Thanks

REPORT zjgltest02.
CLASS ball DEFINITION.
PUBLIC SECTION.
CONSTANTS pi TYPE f VALUE '3.14'.
METHODS: get_volumn IMPORTING VALUE(radius) TYPE i
RETURNING VALUE(volumn) TYPE f.
ENDCLASS.
CLASS ball IMPLEMENTATION.
METHOD get_volumn.
volumn = 4 * pi * radius * radius * radius / 3.
ENDMETHOD.
ENDCLASS.
DATA:volumn TYPE f,
ball_obj TYPE REF TO ball.
DATA:res TYPE p DECIMALS 2.
PARAMETERS:radius TYPE i.
START-OF-SELECTION.
CREATE OBJECT ball_obj.
volumn = ball_obj->get_volumn(radius).
MOVE volumn TO res.
WRITE:/res.
‎2021 Apr 28 4:43 AM
Hi!
Yes, whey you type
volumn = ball_obj->get_volumn(radius).The systems thinks that get_volumn is a variable and that you want to specify the length to read with (radius). Instead, you need to include spaces around radius so it is interpreted as a method call:
volumn = ball_obj->get_volumn( radius ).You also need to add spaces to the WRITE statement:
WRITE: / res.
‎2021 Apr 28 4:43 AM
Hi!
Yes, whey you type
volumn = ball_obj->get_volumn(radius).The systems thinks that get_volumn is a variable and that you want to specify the length to read with (radius). Instead, you need to include spaces around radius so it is interpreted as a method call:
volumn = ball_obj->get_volumn( radius ).You also need to add spaces to the WRITE statement:
WRITE: / res.