*&---------------------------------------------------------------------* *& Report Z2 *& *&---------------------------------------------------------------------* *& *& 语法课1 *&---------------------------------------------------------------------* REPORT z2. *-------------------预定义数据类型----------------------- DATA lv_c(10) TYPE c VALUE 'abcdefghij'. "字符 DATA lv_d TYPE d VALUE '20221027'. "日期 DATA lv_f TYPE f VALUE '3.14'. "浮点 DATA lv_i TYPE i VALUE 15390725. "整数 DATA lv_n(6) TYPE n VALUE '555666'. "数值 DATA lv_t TYPE t. "时间 DATA lv_p TYPE p VALUE '12345.33' DECIMALS 2. "二进制 lv_d = sy-datum. lv_d = lv_d + 30. lv_t = sy-uzeit. WRITE : / 'lv_c:',lv_c. WRITE : / 'lv_d:',lv_d. WRITE : / 'lv_f:',lv_f. WRITE : / 'lv_i:',lv_i. WRITE : / 'lv_n:',lv_n. WRITE : / 'lv_t:',lv_t. WRITE : / 'lv_p:',lv_p. WRITE sy-uline. TYPES:ty_bu_partner(10) TYPE c. TYPES:ty_bu_partner1 TYPE bu_partner. TYPES:ty_bu_partner2 TYPE ty_bu_partner. TYPES:BEGIN OF userinf, name TYPE char10, age TYPE i, tel(11) TYPE n, END OF userinf. DATA: lv_partner type ty_bu_partner, lv_partner1 type ty_bu_partner1, lv_partner2 TYPE ty_bu_partner2, lv_partnerinf TYPE userinf. lv_partner = '刘诗华'. lv_partner2 = '小胖妞'. lv_partnerinf-name = lv_partner. lv_partnerinf-age = 33. lv_partnerinf-tel = '15390725037'. SKIP. WRITE: / 'lv_partnerinf-name:', lv_partnerinf-name. WRITE: / 'lv_partnerinf-age:', lv_partnerinf-age. WRITE: / 'lv_partnerinf-tel:', lv_partnerinf-tel. WRITE / lv_partner. WRITE / lv_partner2. data:BEGIN OF userinf2, name TYPE char10, age TYPE I, tel(11) TYPE n, END OF userinf2. userinf2 = lv_partnerinf. SKIP. WRITE: / 'userinf2:', userinf2-name. WRITE: / 'userinf2:', userinf2-age. WRITE: / 'userinf2:', userinf2-tel. data:BEGIN OF customer. INCLUDE STRUCTURE userinf2. data: address type char10, END OF customer. MOVE-CORRESPONDING userinf2 to customer. SKIP. customer-address = '江西省'. WRITE: / 'customer-name:', customer-name. WRITE: / 'customer-age:', customer-age. WRITE: / 'customer-tel:', customer-tel. WRITE: / 'customer-addres:', customer-address.
标签:基本,WRITE,userinf2,partnerinf,语法,customer,ABAP,lv,TYPE From: https://www.cnblogs.com/hua900822/p/16830612.html