SAP IXML DOWN CASTS



Get Example source ABAP code based on a different SAP table
  



ABAP_IXML - Downcasts
For reference variables with the static type of the interfaces IF_IXML_... of the iXML Library, the usual downcasts with the casting operators ?= and CAST can be used for assignments from more general to more specific types. If a downcast 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 included by every object in iXML Library can be used to simplify exception handling: special_reference ?= general_reference->query_interface( type ).
type can be used to specify the required special type by specifying a constant ixml_iid... from the type pool IXML. A successful downcast runs as if no method is called. If an error occurs, the exception is handled in the method and an initial reference returned.

ABAP_EXAMPLE_ABEXA
iXML Library, Downcasts
ABAP_EXAMPLE_END