VALUE

作者: abapCiCi | 来源:发表于2019-08-22 08:42 被阅读0次

value

Syntax :

VALUE type( ... )
When an initial value VALUE #( ) is passed to a 
generically typed formal parameter, the type is derived from the generic type.

for example

TYPES:
   BEGIN OF date,
     year  TYPE c LENGTH 4,
     month TYPE c LENGTH 2,
     day   TYPE c LENGTH 2,
   END OF date,
   dates TYPE TABLE OF date WITH EMPTY KEY.

DATA(dates) = VALUE dates(
  ( year = '2013' month = '07' day = '16' )
  ( year = '2014' month = '08' day = '31' )
  ( year = '2015' month = '09' day = '07' ) ).

If you want to add content

dates  = VALUE dates( BASE dates ( year = '2016' month = '07' day = '16'  ) ).

If you don't want rewrite multiple times

 year = '2015'
  (  month = '07' day = '16' )
  (  month = '07' day = '16' )
  ).

About struct assignment

TYPES:  BEGIN OF t_col2, 
           col1 TYPE i, 
           col2 TYPE i, 
        END OF t_col2. 
TYPES: BEGIN OF t_struct, 
         col1 TYPE i, 
         col2 TYPE t_col2, 
       END OF t_struct. 
DATA: struct TYPE t_struct, 
      col2 TYPE t_col2. 
struct = VALUE t_struct( col1 = 1 
                         col2-col1 = 1 
                         col2-col2 = 2 ). 
col2   = VALUE   t_col2( col1 = 1 
                         col2 = 2 ). 
struct = VALUE t_struct( col1 = 1 
                         col2 = col2 ). 
struct = VALUE t_struct( col1 = 1 
                         col2 = VALUE #( col1 = 1 
                                         col2 = 2 ) )."嵌套结构

using let in

struct2 = VALUE #( LET x = struct2 IN 
                   col1 = x-col2 
                   col2 = x-col1 
                   col4 = 5 
                   col3 = x-col4 ). 

using correspongding

struct1 = VALUE #( BASE CORRESPONDING #( struct2 ) col4 = 4 col5 = 5 ). 

using 'new' replace something

DATA(base2)   = `xxyyzz`. 
DATA(ref2)  = NEW struct( BASE base2 col2 = 'BB' )
 "result is  xxbbzz 

new statement to create range

DATA itab TYPE RANGE OF i. 

itab = VALUE #( sign = 'I'  option = 'BT' ( low = 1  high = 10 ) 
                                          ( low = 21 high = 30 ) 
                                          ( low = 41 high = 50 ) 
                            option = 'GE' ( low = 61 )  ). 

lines of

DATA(itab3) = itab.
itab3 = VALUE #( BASE itab3
                 ( LINES OF itab3 )"两次添加数据 
                 ( 4 )
                 ( 5 ) ).

相关文章

  • @Value注解@Value("#{}")和@Value("${

    @Value("#{}") @Value("#{}") 表示SpEl表达式通常用来获取bean的属性,或者调用be...

  • 千分位符分隔数字的巧妙实现

    var value = 1234567000; value = value.toString(); value =...

  • Spring @Value("#{}")和@Value("${}

    突然发现@Value("#{}") 这两者的区别 一.@Value("#{}") 其实是SpEL表达式的值,可以表...

  • python多线程threading示例

    运行结果: 1 value1 value22 value1 value23 value1 value24 valu...

  • 项目中页面显示富文本省略内容

    richTextFormat(value) { // value = value.replace(/<\/?[^>...

  • value

    math one grade valuehigh math 86linear algebra 32(choice ...

  • value

  • VALUE

    value Syntax : for example If you want to add content If ...

  • value

    让我觉得很欣慰的是,每次想找别人出来玩的时候,不是没有人找,而是人多不知道先找谁;每次到一个新的环境的时候总是害怕...

  • Value

    谨以此文献给Terri,感谢她对我们无私的帮助,感谢我们一起度过的图书馆的夜晚,感谢晚餐中的长谈,感谢她让我...

网友评论

      本文标题:VALUE

      本文链接:https://www.haomeiwen.com/subject/xwgisctx.html