调用功能模块

模块化技术包括:子程序(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就是处理例外.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值