Skip to Content
0
Jun 04, 2008 at 01:33 PM

Syntax to call one method with the returning of another method?

140 Views

I'd like to call one method with the results of another method and I keep getting the error 'The field XYZ(' is unknown but there is a field with a similar name' Error.

Consider the simple example below:

CLASS ZLCL_HELPER DEFINITION.

PUBLIC SECTION.

CLASS-METHODS emit IMPORTING text TYPE string.

CLASS-METHODS get_text RETURNING text TYPE string.

ENDCLASS.

I'd like to call emit with value of get_text without declaring a string type object in the caller such as:

START-OF-SELECTION.

DATA: text TYPE string.

text = zlcl_helper=>get_text( ).

zlcl_helper=>emit( text ).

I'd rather do something like:

START-OF-SELECTION.

zlcl_helper=>emit( zlcl_helper=>get_text( ) ).

Is there a way to do this?

Thanks,

-Ryan