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

Syntax Error: Result Type of function method cannot be converted

Former Member
0 Likes
4,245

Perform stmt: PERFORM get_delta_position_increases USING l_p_accumulator

CHANGING l_wrk_position.

Subroutine:

FORM get_delta_position_increases

USING i_p_accumulator TYPE REF TO cl_accumulator_trg

CHANGING c_wrk_rep_position TYPE trls_rep_position.

DATA: l_p_accumulator TYPE REF TO cl_accumulator_trg,

  • Get Clone of Accmumulator

l_p_accumulator = i_p_accumulator->get_clone( ). --> Syntax error pointing here

CALL METHOD l_p_accumulator->reset_values( ).

ENDFORM.

Syntax error I am getting:

Result Type of function method cannot be converted into the type of l_p_accumulator.

Any pointers please.

Thanks,

Kiran

8 REPLIES 8
Read only

Former Member
0 Likes
2,474

what is the type of the returning parameter in method iget_clone( ) from class cl_accumulator_trg?

Read only

0 Likes
2,474

RE_CLONE type ref to IF_ACCUMULATOR_TRG.

Read only

0 Likes
2,474

Well, that's why. It's returning an interface, not a class.

I don't have your class in my system, but most likely the interface implements that class

Something you could try is

l_p_accumulator ?= i_p_accumulator->get_clone( ).

Read only

prasenjit_sharma
Active Contributor
0 Likes
2,474

Hi,

DATA: l_p_accumulator TYPE REF TO cl_accumulator_trg,

Are you actually using a comma (,) instead of period, hope not.

Well, I tried to create a routine in my system and I do not get a syntax error.

If you still get an error you may try this.

l_p_accumulator ?= i_p_accumulator->get_clone( ).

.

Regards

Prasenjit

Read only

0 Likes
2,474

Nope. I just pasted the required code. I have couple more declarations.

even the ? did not solve the error. Any more clues plz.

Thanks,

Kiran

Edited by: kiran dasari on Nov 5, 2009 3:37 AM

Read only

0 Likes
2,474

Hmm.. thats interesting.

Try to define the variable l_p_accumulator type ref to IF_ACCUMULATOR_TRG

Let me know if that helps.

Regards

Prasenjit

Read only

0 Likes
2,474

Hi Prashant,

I tried this yesterday only and still the same error. My bad...I should have included that.

ANy more clues please.

Thanks,

Kiran

Infact when I add ? to the line, save and then do syntax check...? disappears automatically. so is this something to look into also?

Thanks,

Kiran

Edited by: kiran dasari on Nov 5, 2009 9:57 PM

Read only

0 Likes
2,474

Hi Kiran,

This is really weird. When I try in my system, the code that you have given works fine. Surprizing!

As an alternative you may try this,

data l_p_accumulator type ref to object.
data method type string VALUE 'RESET_VALUES'.

Then call the method as

CALL METHOD l_p_accumulator->(METHOD).

Regards

Prasenjit