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

CAST with deep structure

Former Member
0 Likes
1,102

I'm trying to do a generic code but I'm having trouble with deep structure,

I have different class with different deep structure exporting parameters,

It is possible to do a "CASTING" with deep structure? Or have another way to solve my problem?


Here is the problem:


  FIELD-SYMBOLS: <fs_output> TYPE ANY.
  DATA: obj_class TYPE REF TO object.

      CREATE OBJECT obj_class TYPE (str_proxy).

      <fs_output> =  wl_output1-mt_confirma_proc_palete_transf-num_id .

      CALL METHOD obj_class->(str_method)
        EXPORTING
          output = <fs_output>. "--> CX_SY_DYN_CALL_ILLEGAL_TYPE 

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
983

Hi Bruno,

  I think you have different parameters in the method that you calling and the type of field symbol. Make sure that the type of output is ANY.

5 REPLIES 5
Read only

arindam_m
Active Contributor
0 Likes
983

Hi,

I think the parameters passing can't be generic in nature in OO ABAP.

Cheers,

Arindam

Read only

Former Member
0 Likes
984

Hi Bruno,

  I think you have different parameters in the method that you calling and the type of field symbol. Make sure that the type of output is ANY.

Read only

0 Likes
983

Yes, I have differente parameters, I need do a CAST for deep structure, something like that:

<fs_output> =  wl_output1-mt_confirma_proc_palete_transf-num_id CASTING TYPE (str_ty_deep_structure).

But this code return a Illegal casting...


Read only

0 Likes
983

Hi Bruno,

When dynamically calling methods you must use parameter table instead of exporting/importing. Refer to online help for call method (<f1>) and this doco: http://help.sap.com/abapdocu_70/en/ABAPCALL_METHOD_SHORTREF.htm

Cheers,

Custodio

Read only

0 Likes
983

Hi Bruno,

  I have given a link on field symbol casting refer to that, you may get some ideas of casting and where you going wrong.

http://scn.sap.com/docs/DOC-22613