SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → Data Interfaces and Communication Interfaces → ABAP and XML → Class Libraries for XML → iXML Library → iXML Library - Classes and Interfaces →iXML Library - Down Casts
For reference variables with the static type of the interfaces IF_IXML_... in iXML Library, the usual down casts with the casting operators ?= and CAST can be used for assignments from more general to more specific types. If a down cast fails, the exception CX_SY_MOVE_CAST_ERROR is raised, which can be handled in a TRY control structure (as usual).
The method QUERY_INTERFACE of the interface IF_IXML_UNKNOWN (implemented by every object in iXML Library) can be used to make handling of exceptions simpler:
type can be used to specify the required special type by specifying a constant ixml_iid... from the type group IXML. A successful down cast runs as if no method is called. If an error occurs, the exception is handled in the method and an initial reference returned.
Example