abap子程序
子程序
? 語(yǔ)法:
?????? form <subr>? [<pass>].
????????????? <statemnet block>.
?????? endform.
??? <subr>定義子程序名。 <pass>選項(xiàng)用于指定如何與子程序進(jìn)行數(shù)據(jù)交換。
?? 注釋:子程序中不能包含嵌套的form-endform塊。
?
內(nèi)部子程序
???? 內(nèi)部子程序調(diào)用: perform <subr> [<pass>].
?data: num1 type i,
????? num2 type i,
????? sum type i.
?????
?num1 = 2. num2 = 4.
?perform addit.
?
?num1 = 7.num2 = 11.
?perform addit.
?
?form addit.
?? sum = num1 + num2.
?? perform out.
?endform.
?
?form out.
?? write:/ 'Sum of', num1, 'and', num2, 'is', sum.
?endform.
?
?
外部子程序
????? 調(diào)用外部子程序:perform <subr> (<prog>)? [<pass>]? [if found].
? 程序.
??? report formpool.
??? form header.
??????? write:/ 'Program Test'.
??????? uline.
??? endform.
????? 可以從程序中調(diào)用子程序,方法如下。
?????? report sapmztst.
?????? perform header (formpool) if found.
總結(jié)
- 上一篇: sap屏幕元素与事件
- 下一篇: 调用功能模块