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: 

RAISE EXCEPTON - cast error

Former Member
0 Kudos

Hi guys,

while im posting the MIRO transaction, facing this run time error.

A RAISE statement in the program "CL_EXITHANDLER================CP " raised the

exception

condition "CAST_ERROR".

Since the exception was not intercepted by a superior program

in the hierarchy, processing was terminated.

Please give me the solution to move furthur..

thanks in advance

4 REPLIES 4

anjaneya_bhardwaj2
Contributor
0 Kudos

Hi Poster. can you do a extended syntax check of your implementation . It will give you a fair idea why this rerror is occurring ? The possible cause of error is that type of refernces of sub class and super class are not compatible . Please make sure before the assignment that refrences are compatible to each other and it is possible to assign the refrences in the hierchy provided .

Former Member
0 Kudos

Hi All,

I am too facing similar kind of error, its from standard product Doculink for SAP.

Its working fine in DEV but after transport to Unit Test Client its giving error.

error at - >>>>> rtti_ref ?= cl_abap_typedescr=>describe_by_data( pi_object ).

please advice me if anyone has encountered this earlier...

Runtime Errors MOVE_CAST_ERROR

Except. CX_SY_MOVE_CAST_ERROR

Date and Time 07.10.2011 09:05:47

Short text

Dynamic type conflict when assigning references

What happened?

Error in the ABAP Application Program-

The current ABAP program "/IXOS/DC_RP1600000002" had to be terminated because

it has

come across a statement that unfortunately cannot be executed.

Error analysis

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_MOVE_CAST_ERROR', was not

caught in

procedure "SELCONDS" "(FORM)", nor was it propagated by a RAISING clause.

Since the caller of the procedure could not have anticipated that the

exception would occur, the current program is terminated.

The reason for the exception is:

It was tried to assign a reference to a rereference variable using the

'CAST' operation ('?=' or 'MOVE ?TO').

However, the current content of the source variable does not fit into

the target variable.

source type: "\CLASS=CL_ABAP_ELEMDESCR"

target type: "\CLASS=CL_ABAP_STRUCTDESCR"

Missing RAISING Clause in Interface

Program /IXOS/DC_RP1600000002

Include /IXOS/DC_RP1600000002

Row 2,249

Module type (FORM)

Module Name SELCONDS

Trigger Location of Exception

Program /IXOS/DC_RP1600000002

Include /IXOS/DC_RP1600000002

Row 2,261

Module type (FORM)

Module Name SELCONDS

Source Code Extract

Line SourceCde

2231 WHEN 'O'.

2232 O_ZLAWFBOLSTZLAWFTLIST = p_key .

2233 ASSIGN O_ZLAWFBOLSTZLAWFTLIST TO <key_structure>.

2234 WHEN 'C'.

2235 C_ZLAWFTLIST = p_key .

2236 ASSIGN C_ZLAWFTLIST TO <key_structure>.

2237 ENDCASE.

2238

2239 ENDCASE .

2240

2241 IF <key_structure> IS ASSIGNED.

2242 perform selconds USING <key_structure>

2243 CHANGING pct_selconds.

2244 ENDIF.

2245

2246 ENDFORM.

2247

2248 * Subroutine to build selconds

2249 FORM selconds

2250 USING pi_object TYPE any

2251 CHANGING pct_selconds TYPE tt_selconds.

2252

2253 * local data

2254 DATA:

2255 rtti_ref TYPE REF TO cl_abap_structdescr,

2256 ls_selconds TYPE t_selconds.

2257 FIELD-SYMBOLS: <component> type any,

2258 <field> type any,

2259 <value> type any.

2260

>>>>> rtti_ref ?= cl_abap_typedescr=>describe_by_data( pi_object ).

2262 LOOP AT rtti_ref->components ASSIGNING <component>.

2263 IF sy-tabix <> 1.

2264 ls_selconds = 'AND'.

2265 APPEND ls_selconds TO pct_selconds.

2266 ENDIF.

2267 ASSIGN COMPONENT 4 OF STRUCTURE <component> TO <field>.

2268 ASSIGN COMPONENT <field> OF STRUCTURE pi_object TO <value>.

2269 ls_selconds = <field>.

2270 append ls_selconds to pct_selconds.

2271 ls_selconds = '=' .

2272 APPEND ls_selconds TO pct_selconds.

2273 * replace single quotes with two quotes

2274 IF <value> CA ''''.

2275 REPLACE ALL OCCURRENCES OF ''''

2276 IN <value> WITH ''''''.

2277 ENDIF.

2278 CONCATENATE '''' <value> '''' INTO ls_selc

2279 APPEND ls_selconds TO pct_selconds.

2280 ENDLOOP.

0 Kudos

Hi ashishtayade ,

if its a field then you need use type ref CL_ABAP_ELEMDESCR , or if its structure then u have to use CL_ABAP_TYPEDESCR

for more info .check the documentation of each classes..

regards

Prabhu

madhu_vadlamani
Active Contributor
0 Kudos

Hi ,

While posting any key fields are you missing.

Regards,

Madhu.