从实例学SAP ABAP编程(1-19章)代码(1-5章)

更新时间:2023-07-26 18:57:23 阅读: 评论:0

插入内表行:
DATA: BEGIN OF man,
      name(20) TYPE c,
      high TYPE p DECIMALS 2,
      weight TYPE p DECIMALS 2,
END OF man.
DATA: man1 LIKE TABLE OF man.
man-name =  '张参'.
man-high = '1.68'.
三级公路man-weight = 120.
INSERT man INTO TABLE man1.
man-name = '刘志'.
man-high = '1.78'.
man-weight = 160.
INSERT man INTO TABLE man1.
LOOP AT man1 INTO man.
  WRITE: / man-name,man-high,man-weight.
ENDLOOP.
ULINE.
man-name =  '钱华'.
man-high = '2.22'.
man-weight = 220.
INSERT man INTO man1 INDEX 3.
LOOP AT man1 INTO man.
  WRITE: / man-name,man-high,man-weight.
ENDLOOP.
读放文件
DATA: BEGIN OF man,
      name(20) TYPE c,
      high TYPE p DECIMALS 2,
      weight TYPE p DECIMALS 2,
END OF man.
DATA: man1 LIKE TABLE OF man.
* name = 'c:\'.
* typa = 'dat'.
CALL FUNCTION 'UPLOAD'
  EXPORTING
    codepage                = 'test'
    filename                = 'c:\'
    filetype                = 'dat'
    item                    = '读放文件'
  TABLES
    data_tab                = man1
荫补
  EXCEPTIONS
    invalid_filesize        = 1
    invalid_table_width    = 2
    invalid_type            = 3
    no_batch                = 4
    unknown_error          = 5
    gui_refu_filetransfer = 6
    OTHERS                  = 7.
IF sy-subrc <> 0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
LOOP AT man1 INTO man.
  WRITE: / man-name,man-high,man-weight.
ENDLOOP.
格式化输出
DATA wa LIKE spfli.
WRITE:/.
WRITE:10'航班承运人',40'航班连接',60'国家代码',80'起飞城市',100'起飞机场'.
SELECT * INTO wa FROM spfli.
  WRITE:/ wa-carrid UNDER '航班承运人',
        wa-connid UNDER '航班连接',
        wa-countryfr UNDER '国家代码',
吃什么补脑神经
        wa-cityfrom UNDER '起飞城市',
烟台龙口南山>pollution可数吗        wa-airpfrom UNDER '起飞机场'.
ENDSELECT.
内表排序
DATA: BEGIN OF man,
      name(20) TYPE c,
      high TYPE p DECIMALS 2,
      weight TYPE p DECIMALS 2,
END OF man.
DATA: man1 LIKE hashed TABLE OF man with unique key name.
man-name =  '张参'.
man-high = '1.68'.
man-weight = 120.
INSERT man INTO TABLE man1.
man-name = '刘志'.
man-high = '1.78'.
man-weight = 160.
INSERT man INTO TABLE man1.
man-name =  '钱华'.
man-high = '2.22'.
man-weight = 220.
INSERT man INTO table man1.
LOOP AT man1 INTO man.
  WRITE: / man-name,man-high,man-weight.
ENDLOOP.
ULINE.
sort man1 ascending by weight descending .
skip.
uline.
LOOP AT man1 INTO man.
  WRITE: / man-name,man-high,man-weight.
ENDLOOP.
内部数据存有文档
DATA: BEGIN OF man,
      name(20) TYPE c,
      high TYPE p DECIMALS 2,
      weight TYPE p DECIMALS 2,
END OF man.
DATA: man1 LIKE TABLE OF man.
DATA: name TYPE rlgrap-filename, typa TYPE rlgrap-filetype.
man-name =  '张参'.亚索怎么玩
man-high = '1.68'.
man-weight = 120.
INSERT man INTO TABLE man1.
man-name = '刘志'.
man-high = '1.78'.
man-weight = 160.
INSERT man INTO TABLE man1.
man-name =  '钱华'.
man-high = '2.22'.
man-weight = 220.
INSERT man INTO man1 INDEX 2.
name = 'c:\'.营养晚餐
typa = 'dat'.
CALL FUNCTION 'download'
  EXPORTING
    codepage                = 'testa'
    filename                = name
    filetype                = typa
    item                    = '文件测试'
  TABLES
    data_tab                = man1
  EXCEPTIONS
    invalid_filesize        = 1
    invalid_table_width    = 2
    invalid_type            = 3
    no_batch                = 4
    unknown_error          = 5
    gui_refu_filetransfer
    =6
    OTHERS                  = 7.
IF
sy-subrc
<>
0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
消息
REPORT  yth_helloworld.
DATA: msg1(20) TYPE c VALUE '测试'.
DATA: msg2(20) TYPE c VALUE 'ABAP'.
DATA: msg3(20) TYPE c VALUE '消息!'.
MESSAGE i006(ymess) WITH msg1 msg2 msg3.
data:BEGIN OF man,
    name(30) TYPE c,
    high TYPE p DECIMALS 2,
    weight TYPE p DECIMALS 2,
END OF man.
FIELD-SYMBOLS <fsa> LIKE man.
DATA man1 LIKE man.
man-name = '雨荷'.
man-high = '1.78'.
man-weight = 140.
ASSIGN man TO <fsa>.
WRITE:/ <fsa>-name,
    man-high,
<fsa>-weight.
DATA: msg1(20) TYPE c VALUE '测试'.
DATA: msg2(20) TYPE c VALUE 'ABAP'.
DATA: msg3(20) TYPE c VALUE '消息!'.
MESSAGE i001(00) WITH msg1 msg2 msg3.
DATA: c1(2) TYPE c,
      c2(2) TYPE c,
      c3(2) TYPE c,
      c4(2) TYPE c,
二年级朗诵
      c5(20) TYPE c VALUE '91* 12*23*344445',
      c9(2) TYPE c.
c9 = '* '.
WRITE: / .
WRITE c5.
SPLIT c5 AT c9 INTO c1 c2 c3 c4 .
WRITE: / c1,c2,c3,c4.

本文发布于:2023-07-26 18:57:23,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/1118647.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:起飞   航班   文件   龙口   南山   文档   表行
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图