sapdev logo background
sapdev logo sapdev logo
Comments

SAP ST TT CAST documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

ST - tt:cast , Down Cast

Syntax
<(><<)>tt:cast [to-ref="node"|to-var="variable"]
[ref="node"|var="variable"] /

Effect
You can use the tt:cast statement to assign the content of one reference variable to another reference variable, if the static type of the source variable is more general than the static type of the target variable. This is known as downcasting .
The tt:cast statement is a special case of the tt:assign statement, in which you can declare only reference variables as source fields and target fields. You can declare reference variables as follows:
  • A node node declared in accordance with the addressing rules and to which an ABAP reference variable is bound

  • A variable or

  • parameter variable defined as a reference variable using
    tt:ref-type .
    If downcasting is not successful (if the static type of the target variable is less general than the dynamic type of the source variable when the statement runs), the ST program terminates with exception CX_ST_RUNTIME_ERROR .
    Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




    ST_TT_CALL-METHOD_WRITERREADER
    ST_TT_CLEAR




    comments powered by Disqus