ABAP OO小例子
生活随笔
收集整理的這篇文章主要介紹了
ABAP OO小例子
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
*類定義
class application definition.
? public section.?? "類方法
??? methods: show_text.
??? methods: show_jia.
? private section.? "類屬性
??? data text(100) type c value '輸出1'.
endclass.
"類實現
class application implementation.
? method show_text.
??? write text.
? endmethod.
? method show_jia.
??? write '輸入2'.
? endmethod.
endclass.
*全局數據聲明
data ob_app type ref to application.
start-of-selection.
? create object ob_app.
??? call method ob_app->show_text.
??? call method ob_app->show_jia.
?
1) 使用type ref to來表示引用某一具體類以聲明新的對象。
2)使用create ojbect語句創建類實例化對象
3)通過'->'或者'=>'運算符訪問類對象或組件。
總結
以上是生活随笔為你收集整理的ABAP OO小例子的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: SAP学习网站
- 下一篇: REUSE_ALV_GRID_DISPL