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

Try question

Former Member
0 Likes
322

Hi,

i use this commend for casting , my question is :

for the same error type like below i need to use the commend (try) once or twice?

lt_comp_tab-name =  fld1.
TRY.
    lt_comp_tab-type ?= cl_abap_datadescr=>describe_by_data( fld1 ).
  CATCH cx_sy_move_cast_error.
    APPEND lt_comp.
ENDTRY.

lt_comp_tab-name =  fld2.
TRY .
    lt_comp_tab-type ?= cl_abap_datadescr=>describe_by_data( fld2 ).
  CATCH cx_sy_move_cast_error.
    APPEND lt_comp.
ENDTRY.

Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
296

This should workTry this



loop at lt_comp_tab .

TRY.
    lt_comp_tab-type ?= cl_abap_datadescr=>describe_by_data(  lt_comp_tab-name ).
  CATCH cx_sy_move_cast_error.
    APPEND lt_comp.
ENDTRY.

endloop.


1 REPLY 1
Read only

Former Member
0 Likes
297

This should workTry this



loop at lt_comp_tab .

TRY.
    lt_comp_tab-type ?= cl_abap_datadescr=>describe_by_data(  lt_comp_tab-name ).
  CATCH cx_sy_move_cast_error.
    APPEND lt_comp.
ENDTRY.

endloop.