`
blueoxygen
  • 浏览: 1173891 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

赋值语句的两种方式

    博客分类:
  • SAP
阅读更多

我们赋值的时候可以 destination = source 比如 gc_d = gc_s  有时候可以看到等号前有个问好

gc_d ?= gc_s 这是因为gc_s不是一个静态类型,而是一个引用类型,而且gc_d的类型要比gc_s更加泛化一些。

 

更加详细内容,参见ABAP文档

Syntax

MOVE source {TO|?TO} destination.

destination {=|?=} source.

Effect

Both these statements assign the content of the operand source to the data object destination. The variants with the language element TO or the assignment operator = are valid for all assignments between operands that are not reference variables, and for assignments between reference variables for which the static type of source is more specific than or the same as the static type of destination(narrowing cast).

Variants with the language element ?TO or the assignment operator ?= (casting operator ) must be used if the source and destination are reference variables and the static type of source is more general than the static type of destination (widening cast). For assignments between operands that are not reference variables, use of the question mark ? is not permitted.

The data object destination can be any data object that can be listed at a write position, and the data object source can be a data object, a predefined function or a functional method (as of release 6.10). The data type of the data object destination must either be compatible with the data type of source, or it must be possible to convert the content of source into the data type of destination according to one of the conversion rules.

Notes

  • If source and/or destination are field symbols, then, as in all ABAP commands, the system works with the content of the data objects to which the field symbols point. The actual pointer content of a field symbol can only be changed using the statement ASSIGN or the addition ASSIGNING when processing internal tables (value semantics). If source and destination are reference variables, the reference contained in source is assigned to destination (reference semantics).
  • Strings and internal tables are addressed internally using references. When assignments are made between strings and between internal tables (as of release 6.10), only the reference is transferred, for performance reasons. After the assignment, the actual string or the actual table body of the source as well as the target object are addressed (sharing). When the object is accessed to change it, the sharing is canceled and a copy of the content is made. The sharing is displayed in the memory consumption display of the ABAP debugger and in the Memory Inspector tool (as of release 6.20).
  • Obsolete Form: MOVE PERCENTAGE



Exceptions

Catchable Exceptions

CX_SY_CONVERSION_NO_NUMBER

  • Cause: Operand cannot be interpreted as number
    Runtime Error: CONVT_NO_NUMBER (catchable)

CX_SY_CONVERSION_OVERFLOW

  • Cause: Overflow with arithmetic operation (type P, with specified length)
    Runtime Error: BCD_FIELD_OVERFLOW (catchable)
  • Cause: Operand too large or (intermediate) result too large
    Runtime Error: CONVT_OVERFLOW (catchable)

CX_SY_MOVE_CAST_ERROR

  • Cause: Source or target variable are not reference variables
    Runtime Error: MOVE_CAST_REF_ONLY

Non-Catchable Exceptions

  • Cause: Source field (type P) does not contain correct BCD format.
    Runtime Error: BCD_BADDATA
  • Cause: Assignment for deep structures not permitted if these overlap.
    Runtime Error: MOVE_COMPLEX_OVERLAP
  • Cause: Type conflict with the assignment between object references.
    Runtime Error: MOVE_INTERFACE_NOT_SUPPORTED,
    Runtime Error: MOVE_IREF_NOT_CONVERTIBLE,
    Runtime Error: MOVE_IREF_TO_OREF,
    Runtime Error: MOVE_OREF_NOT_CONVERTIBLE
  • Cause: Type conflict with the assignment between data references.
    Runtime Error: MOVE_DREF_NOT_COMPATIBLE
  • Cause: Assignment between the types involved not supported.
    Runtime Error: MOVE_NOT_SUPPORTED
  • Cause: Constants and literals must not be overwritten.
    Runtime Error: MOVE_TO_LIT_NOTALLOWED
  • Cause: onstants and literals must not be overwritten.
    Runtime Error: MOVE_TO_LIT_NOTALLOWED_NODATA
  • Cause: During a loop in an internal table, an attempt was made to overwrite a reference variable that is linked with the internal table by REFERENCE INTO.
    Runtime Error: MOVE_TO_LOOP_REF

 

分享到:
评论

相关推荐

    EDA/PLD中的Verilog HDL行为建模--- 过程赋值语句

    7.3 过程赋值语句Verilog HDL 中提供两种过程赋值语句 initial 和 always 语句,用这两种语句来实现行为的建模。这两种语句之间的执行是并行的,即语句的执行与位置顺序无关。这两种语句通常与语句块(begin ....end...

    VerilogHDL三种描述方式

    连续赋值语句只能用来对连线型变量进行驱动,它可以采取显式连续赋值语句和隐式连续赋值语句两种赋值方式。1.显式连续赋值语句 由两条语句构成:格式: <连续型变量类型><位宽><变量名>;//对连线型变量进行...

    Python程序设计基础教程思考与练习(合集).pdf

    Python 为程序设计人员提供了哪两 种执行方式? 4.Python 程序的扩展名是( ) 。 A..python B..p C..py D..pyth 思考与练习二 1.这样定义变量行不行:3='hello python !'? 2.在写赋值语句时,我们可以写成...

    CourseCompiler:编译原理课内实践—翻译程序设计

    Compiler赋值语句语法分析的两种实现—LR(1)分析法和Yacc Lex自动构造工具编译原理课程实践对于常用高级语言(如Pascal、C语言)的源程序从左到右进行扫描,把其中赋值语句用所学过的语法分析方法进行语法分析,判断...

    FPGA中组合逻辑和时序逻辑的区别

    2.组合逻辑的Verilog HDL 描述根据组合逻辑的电路行为,可以得到两种常用的RTL 级描述方式。第一种是always 模块的触发事件为电平敏感信号列表;第二种就是用assign 关键字描述的数据流赋值语句。 (1)always ...

    js中将多个语句写成一个语句的两种方法小结

    Javascript 中将多个语句写成一个语句的两种方法小结 一、使用逗号运算符将多个语句写成一个语句  1.一次声明多个变量  var i=1,j=1,k=1  2.多个语句用逗号间隔  i=1,j=i+2,k=j+2  二、使用花括号将多个语句写...

    4737 C++程序设计 自考串讲笔记.doc

    2.C++中的注释方式有两种: (1).从“/*”开始,直到“*/”结束; (2).运用//的方式,并且注释的有效范围从//到本行的结束。 3.命名空间: 它是一种将程序库名称封装起来的方法,它提高了程序的性能和可靠性。 4....

    EDA/PLD中的Verilog HDL混合设计描述方式

    来自always语句和initial语句(切记只有寄存器类型数据可以在这两种语句中赋值)的值能够驱动门或开关,而来自于门或连续赋值语句(只能驱动线网)的值能够反过来用于触发always语句和initial语句。 下面是混合设计...

    零基础教你学FPGA之Verilog语法基础(中)

    我们接着上篇文章继续学习,上次提到了两种赋值语句,让我们接着往下学。

    Eval 函数 | Execute 语句 | ExecuteGlobal 语句使用说明

    Eval 函数 ...第一种方式是赋值语句,将 y 的值赋予 x。第二种解释是测试 x 和 y 是否相等。如果相等,result 为 True;否则 result 为 False。Eval 方法总是采用第二种解释,而 Execute 语句总是采用第一种

    Transact-SQL语句基础

    (2)掌握为局部变量赋值的两种方法 (3)掌握常用系统函数、运算符和表达式的功能和应用 变量的应用 利用Transact-SQL语句声明一个长度为16的nchar型变量bookname,并赋初值为”SQL Server 数据库编程”。 运算符的...

    Verilog HDL阻塞属性探究及其应用

    摘 要:阻塞赋值与非阻塞赋值语句作为... Verilog HDL中,有两种过程赋值方式,即阻塞赋值(blocking)和非阻塞赋值(nonblocking)。阻塞赋值执行时,RHS(right hand statement)估值与更新LHS(left hand statem

    EDA/PLD中的Verilog HDL阻塞属性探究及其应用

    摘 要:阻塞赋值与非阻塞赋值语句作为... Verilog HDL中,有两种过程赋值方式,即阻塞赋值(blocking)和非阻塞赋值(nonblocking)。阻塞赋值执行时,RHS(right hand statement)估值与更新LHS(left hand stat

    C语言程序设计标准教程

    给变量赋初值是变量说明的一部分,赋初值后的变量与其后的其它同类变量之间仍必须用逗号间隔,而赋值语句则必须用分号结尾。 3.在变量说明中,不允许连续给多个变量赋初值。 如下述说明是错误的: int a=b=c=5 必须...

    C程序结构化设计.pptx

    循环结构,有当型循环结构(先判断后执行循环体)和直到型循环结构(先执行循环体后判断)两种形式。 两大优点: 程序易于理解、使用和维护; 提高了编程工作效率,降低了软件开发成本。 ; C语句分为5种类型,分别是...

    数据挖掘技术(第3版)

    本书从为什么学习程序设计语言入手,深入细致地讲解了命令式语言的主要结构及其设计与实现,内容涉及变量、数据类型、表达式和赋值语句、控制语句、子程序、数据抽象机制、对面向对象程序设计的支持(继承和动态方法...

    编程语言原理(第10版)

    本书从为什么学习程序设计语言入手,深入细致地讲解了命令式语言的主要结构及其设计与实现,内容涉及变量、数据类型、表达式和赋值语句、控制语句、子程序、数据抽象机制、对面向对象程序设计的支持(继承和动态方法...

    一篇文章读懂Python赋值与拷贝

    两个对象做比较有两种方式,分别是:is 与 == ,is比较的是两个对象是否相同,通过对象的ID值可识别是否为相同对象,==比较的是两个对象的值是否相等 >>> x1 = [1,2] >>> x2 = [1,2] >>> x1 is x2 Fa

Global site tag (gtag.js) - Google Analytics