Calling a BRFplus Function From an ABAP Program

5

Click here to load reader

description

Calling a BRFplus Function From an ABAP Program

Transcript of Calling a BRFplus Function From an ABAP Program

Page 1: Calling a BRFplus Function From an ABAP Program

7/18/2019 Calling a BRFplus Function From an ABAP Program

http://slidepdf.com/reader/full/calling-a-brfplus-function-from-an-abap-program 1/5

Calling a BRFplus function from an ABAP programBusiness Rule Framework plus ( BRFplus ), also known as Formula and Derivation Tool ( FDT ), aims to "Make hard-coded rules in systems, process fows and services explicit and easy to change or business proessionals. Replacecomplex table-based determination by an intuitive rule-based approach.".

BRFplus is Business Rules Engine allows modelling and access rules. These rules consist o !uilding !locks such asdecision ta!les, decision trees and ormulas, its purpose is to allow !usiness proessionals to change the rules uickl#without the need o $T intervention ( %B%& programmer ). This wa# the s#stem !ecomes nim!ler with rules than can !echanged aster.

we !uild on the '%& tutorial Building a Ta alculation %pplication to show how we can implement the BRFplus unctionwe alread# created rom that tutorial.

*ere is a sample code that could !e used to consume our T%+%--%T/R BRFplus unction.

01111111111111111111111111111111111111111111111111111111111111111111110

0 Report 2BRF&-'TE'T

0

01111111111111111111111111111111111111111111111111111111111111111111110

0

0

01111111111111111111111111111111111111111111111111111111111111111111110

RE&/RT  3!rplustest.

&%R%4ETER'5 psalar# T6&E amount.

D%T%5 louction  T6&E REF T/ idtunction,

  locontet  T6&E REF T/ idtcontet,

  loresult  T6&E REF T/ idtresult.

D%T%5 lomessage  T6&E REF T/ cdt.

F$E-D1'64B/-'5

   T6&E  idtt#pes78smessage.

D%T%5 lsta  T6&E  idtt#pes78elementamount,

  lssalar#  T6&E  idtt#pes78elementamount.

'T%RT1/F1'E-ET$/9.

  -E%R5 lsta.

  lssalar#1num!er 7 psalar#.

  lssalar#1currenc# 7 :ER:.

  TR6 .

  " ;et BRFplus unction

  louction <7 cldtactor#78idtactor#=getinstance( )18getunction(

:D>%E?@BEAEF@ED@C>FC>EFFA>E:  ).

  " 'et the BRFplus unction contet ( input varia!les )

  locontet 7 louction18getprocesscontet( ).

  locontet18setvalue( ivname 7 :;R/'''%-%R6: iavalue 7 lssalar# ).

  " &rocess the BRFplus unction

  louction18process( E+&/RT$9; iocontet 7 locontet

  $4&/RT$9; eoresult 7 loresult ).

  " Retrieve the BRFplus unction result

Page 2: Calling a BRFplus Function From an ABAP Program

7/18/2019 Calling a BRFplus Function From an ABAP Program

http://slidepdf.com/reader/full/calling-a-brfplus-function-from-an-abap-program 2/5

  loresult18getvalue( $4&/RT$9; eavalue 7 lsta ).

  GR$TE lsta1num!er.

  GR$TE lsta1currenc#.

  %T* cdt $9T/ lomessage.

  -//& %T lomessage18mtmessage%''$;9$9; .

  GR$TE5 1tet.

  E9D-//&.

  E9DTR6.

 The BRFplus unction ;$D can !e retrieved !# going to transaction BRFplus in the unction:s ;eneral T%B.

BRFplus unction details

$ we test our rule in the Business Rule Framework we get the ollowing result.

Page 3: Calling a BRFplus Function From an ABAP Program

7/18/2019 Calling a BRFplus Function From an ABAP Program

http://slidepdf.com/reader/full/calling-a-brfplus-function-from-an-abap-program 3/5

'imulation ramework

ontet values ( BRFplus unction input values )

Page 4: Calling a BRFplus Function From an ABAP Program

7/18/2019 Calling a BRFplus Function From an ABAP Program

http://slidepdf.com/reader/full/calling-a-brfplus-function-from-an-abap-program 4/5

BRFplus untion similation steps and Result

Finall# we can check that using our program #ields the same result.

&rogram input

Page 5: Calling a BRFplus Function From an ABAP Program

7/18/2019 Calling a BRFplus Function From an ABAP Program

http://slidepdf.com/reader/full/calling-a-brfplus-function-from-an-abap-program 5/5

&rogram result