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

Generic Table type

Former Member
0 Likes
703

Hi!

I'm developing some classes that implement an interface. This classes will have a method that differ on the return datatype, even though it always be a table type.

When i'm calling the class methods i'm using the interface .


Data:    obj        type ref to YCM_INTERFACE.

create object obj type (CLASSNAME).

call method obj->GETENTRIES(
Importing
  it_records = <it_records>
).

My problem is that if i define the exporting parameter on the interface method to ANY but when using it on the method implementation i always get an error.The excepiton occurs here:


FIELD-SYMBOLS: <it_records>   TYPE ycmx_qualcat.
assign it_records TO <it_records>.

it_records is type any (defined on the interface method definition).

Exception:

The following error text was processed in the system NSP : Type conflict with ASSIGN in program YCM_QUALIFICATIONSCATALOG=====CP .

The termination type was: RABAX_STATE

My question is what type should i use on the method definition to make this work.

Or if there's a better way to do this i'm all ears

Thanks for your help

Pedro Barbosa

1 REPLY 1
Read only

Former Member
0 Likes
277

I've solved the problem. Having any in the parameter datatype was not the problem, the problem was using it as a table. That was the reason i was trying to use the assing statements.

Anyways the solution was:

Data: it_qualcat type table of ycm_qualcat.

select * from ycm_qualcat into table it_qualcat.

if sy-subrc = 0.

it_records = it_qualcat[].

endif.

Regards

Pedro Barbosa