调用功能模块
模块化技术包括:子程序(Subroutine),功能模块(Function Modules),类方法(Class Methods).
?
调用功能模块
要从abap/4程序调用功能模块,需使用CALL语句。
?
语法
call function <module>
????? [exporting f1 = a1 ... fn = an]
????? [importing f1 = a1 ... fn = an]
????? [changing f1 = a1 ... fn = an]
????? [tables f1 = a1 ... fn = an]
????? [exceptions e1 = r1 ... en = rn [others = ro]].
注释:
? ----tables选项的参数必须为内表。
?
例子
?? data: text(20),
?? ? ??? ? ? front(20),
???? ? ? ? ? end(20).
??? text = 'Testing:String_Split'.
??? call function 'STRING_SPLIT'
?? ? ?? exporting delimiter = ':'? string = text
??? ? ? importing head = front? tail = end
??? ? ? exceptions not_found = 1? others = 2.
???? ? ? ? case sy-subrc.
????? ? ? ? ? when 1.
?????? ? ? ? ? ? write / 'not found'.
????? ? ? ? ? when 2.
???????? ? ? ? ? write / 'other errors'.
? ? ? ? ????? when others.
??????? ? ? ?? ? write:/ front, / end.
?????????? endcase.
?? 该函数的功能:将":"和text分别传递给delimiter和string,调用功能函数STRING_SPLIT[将字符串根据分隔符来分隔],然后将结果传递给head[head='Testing']和tail[tail='String_Split'],而exceptions就是处理例外.