abap子程序
子程序
? 語法:
?????? form <subr>? [<pass>].
????????????? <statemnet block>.
?????? endform.
??? <subr>定義子程序名。 <pass>選項用于指定如何與子程序進行數據交換。
?? 注釋:子程序中不能包含嵌套的form-endform塊。
?
內部子程序
???? 內部子程序調用: 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.
?
?
外部子程序
????? 調用外部子程序:perform <subr> (<prog>)? [<pass>]? [if found].
? 程序.
??? report formpool.
??? form header.
??????? write:/ 'Program Test'.
??????? uline.
??? endform.
????? 可以從程序中調用子程序,方法如下。
?????? report sapmztst.
?????? perform header (formpool) if found.
總結
                            
                        - 上一篇: sap屏幕元素与事件
 - 下一篇: 调用功能模块