cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Dynamic Data Type declaration from Parameter value

Former Member
0 Likes
750

Hi,

I have a silly question..

Is it possible to dynamically declare a variable based on the contents of a parameter...like:

Tables: RSDUPD.

Parameter: p_Daty like RSDUPD-DATU

Data: l_last_day like (p_Daty)

Thanks

View Entire Topic
Former Member
0 Likes

Use this syntax:

CREATE DATA l_last_day TYPE (p_daty).

Former Member
0 Likes

Sorry,

insert this line before that:

Data: l_last_day type ref to data.

Former Member
0 Likes

ok....thanks for the answer but its time to make the question harder.

I have the following code:

DATA: it_query_results TYPE REF TO data.

PARAMETER: prxy_cls(30).

CREATE DATA it_query_results TYPE STANDARD TABLE OF (prxy_cls).

ASSIGN it_query_results->* TO <l_it_query_result>.

....I do all sorts of processing with <l_it_query_result>.....then

CALL METHOD o_query_result->execute_asynchronous

EXPORTING

output = <l_it_query_result>.

only problem is method execute_asynchronous doesnt expect a type ref and only expects table type ZBWCOPA9030V00_QUERY_RESULT1...which is what I am entering in the parameter prxy_cls..

need help badly..

thanks

Former Member
0 Likes

To the best of knowledge, if you are calling a function module or method, and that method expects the parameter/table of a particular type, then you have to stick to that type. In only one situation it could have worked had the method you are using been having parameter/table with no type attached.

So if you using issues facing issues with that field-symbol in case of calling function/method, just declare a parameter/table of that type, pass your data from the field-symbol to that and call the function/method.e.g.

1. DATA: t_temp_table type <whatever type the method expects>.

2. Pass data from <l_it_query_result> to t_temp_table .

3. Call method.

For all other purposes internal to your program, the field-symbol <l_it_query_result> should work fine.

Please let me know if this helps.

Former Member
0 Likes

Hi,

As the specific PROXY / function expects parameter of a specific type there is not much we can do there. What you can do, is to declare a variable of the same type as that of the PROXY parameter, move the value of the dynamic vairable into that and then pass that variable to the PROXY.

Regards,

Ravi

Note : Please mark the helpful answers

Former Member
0 Likes

Thanks all,

I have resorted to writing different programs for different proxy classes.

I wanted to get the name of the proxy class as varible and then exceute the appropriate ones....but because of the type casting problems it seems that all I can do is do data declaration for all the classes and then use case statement to choose the right one based on the parameter.

On top of this there is the issue with the class parameter which expects a specific data type so I will have to follow the same logic as above.

So its no use....I finally written different programs for different proxy classes