SAP BRF+ 简单调用示例

*&---------------------------------------------------------------------*
*& Report YTEST_BRF
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ytest_brf.

DATA: lo_function TYPE REF TO if_fdt_function,
      lo_context  TYPE REF TO if_fdt_context,
      lo_result   TYPE REF TO if_fdt_result,
      lx_fdt      TYPE REF TO cx_fdt.
DATA: lv_amount1           TYPE if_fdt_types=>element_amount.
DATA: lv_amount2           TYPE if_fdt_types=>element_amount.
DATA: lv_amount_result     TYPE if_fdt_types=>element_amount.
FIELD-SYMBOLS <ls_message> TYPE if_fdt_types=>s_message.
lo_function =
cl_fdt_factory=>if_fdt_factory~get_instance(
)->get_function( iv_id = 'D3DE095E2D301EEE9E9282C35AB0951A' ).
*fill
lv_amount1 = VALUE #( number = '12.23' currency = 'CNY' ).
lv_amount2 = VALUE #( number = '12.00' currency = 'CNY' ).

TRY.
    lo_context = lo_function->get_process_context( ).
    lo_context->set_value( iv_name = 'IV_INPUT1' ia_value = lv_amount1 ).
    lo_context->set_value( iv_name = 'IV_INPUT2' ia_value = lv_amount2 ).
    lo_function->process( EXPORTING io_context = lo_context
    IMPORTING eo_result = lo_result ).

    lo_result->get_value( IMPORTING ea_value = lv_amount_result ).

    WRITE lv_amount_result-number .
    WRITE lv_amount_result-currency .

  CATCH cx_fdt INTO lx_fdt.
    LOOP AT lx_fdt->mt_message ASSIGNING <ls_message>.
      WRITE / <ls_message>-text.
    ENDLOOP.
ENDTRY.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值