Application Development 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: 

If a class method exporting a value with the generic type 'data'.

Former Member
0 Kudos

Then how can I get the information?

For exmple.

cl_my_clss->get_value( exporting ev_data = .... ) .

ev_data is a type of data.

I can not use DATA : lv_mine type data. because generic data should be used in formal parameter, however , if I use a field symbol, how to assign value with out knowing the data type?

Best regards,

4 REPLIES 4

Former Member
0 Kudos

Hello Blake,

I am a little confused about the requirement. Can you please elebroate the same so that better understanding can help me give you some precise solution...

Regards,

Kunjal

0 Kudos

Hi Kunjal,

I just want to know, for example there is a method called set_attribute:

set_attribute( importing type data )

in my program where invoke the set_attribute

I also don't know the data type of my code. Because they are get from a table.

which type I should use ? I can not use

DATA : lv_data type data.

Because it can only be used as a formal parameter.

Best regards,

Blake Le

0 Kudos

Hi Black,

In the data declaration Declare a data object with type ANY and then use this data object as the Type of importing Parameter.

like.

field-symbols <v_data> type ANY.
method get_value importing lv_data like <v_data>.

0 Kudos

Hi Blake,

As per my understanding,

You are getting the data type from the database table....

You want to use the same data type....

Lets say for example:

You have a db table x with field y having data type Z.

What you do is that, while declaring the data type for the attribute in the method use the reference as table_name-field_name(x-y).

Or....

use ANY. This will give you a chance to map any field type to this method....

Note: Using ANY will limit the syntax that you can use within the method......

Regards,

Kunjal