赛跑网

 找回密码
 注册

QQ登录

只需一步,快速开始

快捷登录

查看: 1342|回复: 1

[FICO] abap 面向对象学习3

[复制链接]
发表于 2013-3-16 17:45:49 | 显示全部楼层 |阅读模式
REPORT  Z_OO_12.

class test definition.
  public section.
    methods: out_put IMPORTING in TYPE string
                     EXPORTING out TYPE string.
    methods: out_put2 IMPORTING in TYPE string.
    methods: out_put3 IMPORTING in TYPE string
                      RETURNING VALUE(out) TYPE string.
endclass.

class test IMPLEMENTATION.
  method out_put.
    data string TYPE string VALUE 'Hello , '.
    concatenate string in into string.
    out = string.
  endmethod.

  method out_put2.
   data string TYPE string VALUE 'This is out_put2 ,hello ,'.
   concatenate string in into string.
   WRITE:/ string.
  endmethod.

  method out_put3.
   data string TYPE string VALUE 'This is out_put3 ,hello ,'.
   concatenate string in into string.
   out = string.
  endmethod.
ENDCLASS.

start-of-selection.
data inst_test type REF TO test.
data num type string.
create object inst_test.
"一下是不同的调用方式
call method inst_test->out_put
             EXPORTING in = 'dew'
             IMPORTING out = num.

WRITE :/ num.

inst_test->out_put(  EXPORTING in = 'vivian' IMPORTING out = num ).
WRITE : / num.

inst_test->out_put2( 'vivian' ).

num = inst_test->out_put3( 'dale' ).
WRITE:/ num.

最近访客

  • sapxf
    2022-01-22
  • 斯普菜鸟
    2021-10-15




上一篇:abap 面向对象学习2
下一篇:abap 面向对象学习4 events
本楼点评(0) 收起
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|联系我们|赛跑网 ( QQ:108519493QQfsq

GMT+8, 2024-4-19 21:11 , Processed in 0.425326 second(s), 34 queries .

Powered by 91SAP X3.4

© 2001-2023 91sap Team.

快速回复 返回顶部 返回列表