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: 

CAST with deep structure

0 Kudos

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

Former Member
0 Kudos

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

arindam_m
Active Contributor
0 Kudos

Hi,

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

Cheers,

Arindam

Former Member
0 Kudos

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.

0 Kudos

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...


0 Kudos

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

0 Kudos

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