学习笔记一

 

1.测试内表的行数。lines( i_tab )
DATA: name(10)   TYPE c VALUE 'SOURCE',
      source(10) TYPE c VALUE 'Antony',
      target(10) TYPE c.
...
WRITE (name) TO target.
WRITE target.
() 是先取里面的值.
============================
计算:
两数相除:
取商
div
取余数:
mod
============================
DATA: BEGIN OF rate,
         usa TYPE f VALUE '0.6667',
         frg TYPE f VALUE '1.0',
         aut TYPE f VALUE '7.0',
      END OF rate.

DATA: BEGIN OF money,
         usa TYPE i VALUE 100,
         frg TYPE i VALUE 200,
         aut TYPE i VALUE 300,
      END OF money.
MULTIPLY-CORRESPONDING money BY rate."两数相乘
============================
DATA: BEGIN OF series,
         n1 TYPE i VALUE 10,
         n2 TYPE i VALUE 20,
         n3 TYPE i VALUE 30,
         n4 TYPE i VALUE 40,
         n5 TYPE i VALUE 50,
         n6 TYPE i VALUE 60,
      END OF series.

DATA sum TYPE i.

ADD series-n1 THEN series-n2 UNTIL series-n5 GIVING sum.
WRITE sum.

ADD series-n2 THEN series-n3 UNTIL series-n6 to sum.
WRITE / sum.
*:第二次是赋值是在第一次的基础上相加的。如果第行的to改为了GIVING那么sum上一次的150会被清空,成为200

===========================
计算数据的函数
abs ---Absolute value of the argument arg
sign ---Plus/minus sign of the argument arg: -1, if the value of arg is negative; 0 if the value of arg is 0; 1 if the value of arg is positive.
ceil ---Smallest integer number that is not smaller than the value of the argument arg.
floor ---Largest integer number that is not larger than the value of the argument arg.
trunc ---Value of the integer part of the argument arg
frac ---Value of the decimal places of the argument arg
==========================
*
Funktion func Meaning Definition Area
acos --Arcuscosinus [-1,1]
asin --Arcussinus [-1,1]
atan --Arcustangens 
cos --Cosinus 
sin --Sinus 
tan --Tangens 
cosh --Hyperbelcosinus 
sinh --Hyperbelsinus 
tanh --Hyperbeltangens 
exp --Exponential function for basis e [-709, 710]
log --Natural logarithm > 0
log10 --Logarithm for basis 10 > 0
sqrt --Square root >= 0
==========================
时间计算的例子

* date calculation

DATA: ultimo TYPE d.

ultimo      = sy-datum.
ultimo+6(2) = '01'.
ultimo      = ultimo - 1.
WRITE ultimo.

ULINE.

* time calculation

DATA: diff TYPE i,
      seconds TYPE i,
      hours TYPE i.

DATA: t1 TYPE t VALUE '200000',
      t2 TYPE t VALUE '020000'.

diff = t2 - t1.
seconds = diff MOD 86400.
hours = seconds / 3600.

WRITE: / text-001, hours.

ULINE.

* convert date


DATA: odate TYPE d VALUE '19955011',
      idate LIKE odate.

DATA  field(8) TYPE c.

field = odate.   WRITE / field.

CONVERT DATE odate INTO INVERTED-DATE idate.

field = idate.   WRITE / field.

CONVERT INVERTED-DATE idate INTO DATE odate.

field = odate.   WRITE / field.

================================================

数据类型:

Predefined ABAP Types

The table below shows the predefined ABAP types. Additional attributes can be found under value ranges and initial values.

TypeLengthStandard lengthDescription
b1 Byte 1 byte integer (internal)
c1 to 65,535 characters1 characterText field
cursoras ias iDatabase cursor
d8 characters Date field
f8 bytes Floating point number
i4 bytes 4 byte integer
n1 to 65,535 characters1 characterNumeric text
p1 to 16 bytes8 bytesPacked number
stringvariable Text string
s2 bytes 2 byte integer (internal)
t6 characters Time field
x1 to 65,535 bytes1 byteByte field
xstringvariable Byte string

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值