Professional Documents
Culture Documents
BRF+
Dr.
Kerem
Koseoglu
Bu
dokman,
SAP
BRF+
rnn
anlamak
ve
kullanabilmek
iin
gereken
notlar
iermektedir.
h t t p : / / k e r e m . k o s e o g l u . i n f o
h t t p : / / w w w . t e s u j i . b i z
SAP BRF+
Table
of
Contents
Kavramlar
...................................................................................................................
4
BRF+
................................................................................................................................................................................
4
Application
....................................................................................................................................................................
6
Genel
Bak
....................................................................................................................................................................
6
Faydal
Aralar
............................................................................................................................................................
8
Application
Exit
........................................................................................................................................................
10
Catalog
.........................................................................................................................................................................
11
Function
......................................................................................................................................................................
11
Genel
Bak
.................................................................................................................................................................
11
alma
Modlar
.......................................................................................................................................................
14
Fonksiyonu
Programdan
armak
................................................................................................................
16
Fonksiyonu
Debug
Etmek
....................................................................................................................................
21
Data
Object
.................................................................................................................................................................
21
Element
........................................................................................................................................................................
21
Structure
.....................................................................................................................................................................
25
Table
.............................................................................................................................................................................
26
Expression
..................................................................................................................................................................
26
Constant
......................................................................................................................................................................
27
Decision
Table
...........................................................................................................................................................
28
Formula
.......................................................................................................................................................................
30
Function
Call
.............................................................................................................................................................
31
Loop
...............................................................................................................................................................................
32
Table
Operation
.......................................................................................................................................................
32
Procedure
Call
..........................................................................................................................................................
33
Random
Number
......................................................................................................................................................
33
Decision
Tree
.............................................................................................................................................................
34
Case
................................................................................................................................................................................
35
Dier
Expression
Trleri
......................................................................................................................................
35
Rule
...............................................................................................................................................................................
35
Ruleset
.........................................................................................................................................................................
38
Ruleset
Element
........................................................................................................................................................
40
Ruleset
Rule
................................................................................................................................................................
42
Final
..............................................................................................................................................................................
42
Action
...........................................................................................................................................................................
43
Log
Message
...............................................................................................................................................................
43
Procedure
Call
..........................................................................................................................................................
44
Dier
Aksiyonlar
......................................................................................................................................................
44
Geniletme
/
Kiiselletirme
.......................................................................................
45
BRF+
Nesnelerini
Zli
Programda
Gstermek
.............................................................................................
45
BRF+
Grnmlerini
Kiiselletirme
.............................................................................................................
45
rnek
Kodlar
..............................................................................................................
46
Dinamik
lemler
.....................................................................................................................................................
46
Application
Yaratmak
...........................................................................................................................................
46
Fonksiyon
Yaratmak
..............................................................................................................................................
47
Data
Object
Yaratmak
..........................................................................................................................................
47
Ruleset
Yaratmak
....................................................................................................................................................
48
Dr.
Kerem
Kseolu
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
3
Tesuji Consulting
http://www.tesuji.biz
SAP BRF+
Kavramlar
BRF+
Rulelar barndrmak + ilemek iin Framework. Business kurallarn kodun iine
ABAPla IF / Case ile yazmak yerine, BRF+ta Customize edilebilir ekilde ifade ediyoruz.
Bu kurallar ABAP programndan arlabiliyor ve Power User tarafndan uyarlama gibi
deitirilebiliyor.
Kullanm mimarisi:
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
5
Avantajlar:
SAP Netweaver 7.0dan beri var (2006). SAP TM, SAM CRM ve SAP Business By
Design iinde kullanlyor.
Kullanabilmek iin; en az SAP Netweaver 7.0 Enhancement PAck 2 gerekiyor. SICFte
aadaki servislerin etkinletirilmesi lazm:
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
/SAP/BC/WEBDYNPRO/SAP/ FDT_WD_WORKBENCH
/SAP/BC/WEBDYNPRO/SAP/ FDT_WD_OBJECT_MANAGER
/SAP/BC/WEBDYNPRO/SAP/ FDT_WD_CATALOG_BROWSER
Field
S_TCODE
TCD = FDT_WORKBENCH
Remark
FDT_ACT (Activity)
FDT_OBJECT FDT_OBJTYP (Object Type)
FDT_APPL (Application)
FDT_WORKB
FDT_WB_ACT (Workbench
Activity)
Application
Genel
Bak
Tm BRF+ nesneleri iin Container.
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
7
Application trleri:
Customizing: Power Usern deiiklikleri Clienta baldr. Uyarlama olarak ele
alnr.
Master data: Tm deiiklikler yereldir, tanamaz.
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
System: Kimse deiiklik yapamaz. Deiiklikler ancak Workbench Request ile
tanabilir.
Faydal
Aralar
Application Usage: Bu Applicationu kimler kullanm Where Used List
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
9
Tesuji Consulting
http://www.tesuji.biz
10
SAP
BRF+
Application
Exit
Application ierisinde, aynen User Exit veya BADI gibi, uygulamann almasna ABAP
mdahelesi gerektii durumlarda kullanlr. Detaylar: http://scn.sap.com/docs/DOC-4564
Application Exit Method
Description
If an object is accessed or shall be manipulated, BRFplus
performs an authority check first.
AUTHORITY_CHECK
CHECK
ACTIVATION_VETO
CHANGE_NOTIFICATION
SAVE_NOTIFICATION
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
11
With this exit it is possible to define a dynamically retrieved list
of valid values for a data element in BRFplus.
With this application exit the functions that are available for
GET_FORMULA_FUNCTIONALS formula expressions can be set. It is possible to restrict the list
of standard functions but also to add custom defined functions .
With this application exit the changeability of customizing
GET_CHANGEABILITY
objects can be altered.
This application exit can define the usage of a specific calendar
for date and time related operations.
GET_CALENDAR
The exit is currently not relevant for NW70x releases. It is only
used for special application platform systems based on NW710
or higher.
GET_ELEMENT_VALUES
Catalog
Farkl Applicationlardaki nesneler; kullanclar tarafndan rahat ulalabilsin diye
Cataloglar iinde toparlanabilir.
Function
Genel
Bak
BRF+ ile ABAP programlar arasndaki kprdr.
Tesuji Consulting
http://www.tesuji.biz
12
SAP
BRF+
Input > Expressions + Rulesets > Output mantyla alan bir bloktor. Bir
Application altnda pek ok Function olabilir. Functionun arkasnda snf Methodlar
tretilir.
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
13
Fonksiyon; ABAPtan arlmann yan sra, Web Service olarak da yaynlanabilir veya
dorudan n ekranda da simule edilebilmektedir.
Tesuji Consulting
http://www.tesuji.biz
14
SAP
BRF+
alma
Modlar
Functional Mode: Bildiimiz fonksiyon gibi; parametre alr, iler ve sonu dndrr.
Simple Use-Cases iin uygundur.
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
15
Event Mode: Rule Logic dorudan fonksiyon iinde yer almaz. Bunun yerine, fonksiyon
bir Event tetikler ve bu EventI dinleyen bir/birka Ruleset ilenir. Bu Rulesetler; tipik
olarak Context deerlerini deitirir ve aksiyonlar balatr. Bu mod; genelde dorudan
sonu beklenmeyen kark Use Caseler iin kullanlr. rnek: Kredi kartna bavuran
kii iin risk faktr hesaplama.
Functional and Event Mode: kisinin karmdr. nce basit bir Functional Mode
Tesuji Consulting
http://www.tesuji.biz
16
SAP
BRF+
alr, akabinde Event Mode gibi Rulesetler ilenir.
rnek
1:
*
Get
singleton
instance
of
the
FDT
factory.
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
17
lo_factory
=
cl_fdt_factory=>if_fdt_factory~get_instance(
).
*
get
the
function
GUID
according
function
name
ets_object_id
=
cl_fdt_persistence=>get_ids(
iv_object_type
=
'FU'
iv_name
=
ZDEMO_PRICING_FUNC
).
*
get
the
function
object
lo_function
=
lo_factory->get_function(
id_result
).
*
Context
itself
lo_context
=
lo_function->get_process_context(
).
*
Pass
the
input
parameter
values
lo_context->set_value(
iv_name
=
CUSTOMER'
"Customer
ia_value
=
lv_customer
).
lo_context->set_value(
iv_name
=
'ITEM'
"Item
ia_value
=
iv_item
).
lo_context->set_value(
iv_name
=
'PRICE
"Price
ia_value
=
lv_price).
lo_context->set_value
(
iv_name
=
'PROMO'
Promo
ia_value
=
iv_promotion
).
*
Call
function
and
get
result
lo_function->process
(
EXPORTING
io_context
=
lo_context
IMPORTING
eo_result
=
lo_result
).
rnek
2:
Dr.
Kerem
Kseolu
Tesuji Consulting
http://www.tesuji.biz
18
SAP
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,
lv_string
type
string.
FIELD-SYMBOLS
<ls_message>
TYPE
if_fdt_types=>s_message.
lo_function
=
cl_fdt_factory=>if_fdt_factory~get_instance(
)->get_function(
iv_id
=
00505683359D02EE98FC41EE6215CAA4
).
TRY.
lo_context
=
lo_function->get_process_context(
).
lo_context->set_value(
iv_name
=
CUSTOMER
ia_value
=
SAP
).
lo_context->set_value(
iv_name
=
ITEM
ia_value
=
Pencil
).
lo_context->set_value(
iv_name
=
PROMOTION
ia_value
=
).
lo_context->set_value(
iv_name
=
SHELF_PRICE
ia_value
=
10
).
lo_function->process(
EXPORTING
io_context
=
lo_context
IMPORTING
eo_result
=
lo_result
).
lo_result->get_value(
IMPORTING
ea_value
=
lv_string
).
WRITE
lv_string
.
CATCH
cx_fdt
INTO
lx_fdt.
LOOP
AT
lx_fdt->mt_message
ASSIGNING
<ls_message>.
WRITE
/
<ls_message>-text.
ENDLOOP.
ENDTRY.
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
19
REPORT
z_brfplus_test.
DATA: lo_message
TYPE REF TO cx_fdt.
FIELD-SYMBOLS:
TYPE if_fdt_types=>s_message.
DATA: ls_tax
TYPE if_fdt_types=>element_amount,
ls_salary
TYPE if_fdt_types=>element_amount.
START-OF-SELECTION.
CLEAR: ls_tax.
ls_salary-number
ls_salary-currency
= p_salary.
= 'EUR'.
TRY .
" Get BRFplus function
lo_fuction ?= cl_fdt_factory=>if_fdt_factory~get_instance( )>get_function( 'D4AE52BE7EF21ED284F8C146EFF7943E' ).
" Set the BRFplus function context ( input variables )
lo_context = lo_fuction->get_process_context( ).
lo_context->set_value( iv_name = 'GROSS_SALARY' ia_value =
ls_salary ).
" Process the BRFplus function
lo_fuction->process( EXPORTING io_context
IMPORTING eo_result
" Retrieve the BRFplus function result
lo_result->get_value( IMPORTING ea_value =
=
=
lo_context
lo_result ).
ls_tax ).
WRITE ls_tax-number.
WRITE ls_tax-currency.
CATCH cx_fdt INTO lo_message.
LOOP AT lo_message->mt_message ASSIGNING .
WRITE: -text.
ENDLOOP.
ENDTRY.
Tesuji Consulting
http://www.tesuji.biz
20
SAP
BRF+
Simlasyon
ekran:
SE38
ekran:
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
21
Web
Dynprodan
arma
rnei
iin:
http://scn.sap.com/docs/DOC-4578
Fonksiyonu
Debug
Etmek
BRF+
fonksiyonunu
Debug
etmek
iin,
CL_FDT_FUNCTION=>IF_FDT_FUNCTION~PROCESS
Methoduna
Break
Point
koyulabilir.
Data
Object
Bir veriyi tarif etmek iin kullanlr, yani veri tipidir. 3 temel Data Object tr vardr:
Element, Structure, Table.
Element
Element iin kullanlabilecek hazr trler:
Data Object
Description
TEXT
Tesuji Consulting
http://www.tesuji.biz
22
SAP
BRF+
NUMBER
BOOLEAN
AMOUNT
QUANTITY
TIMEPOINT
TIMESTAMP
DATE_TIME
DATE
TIME
USER_NAME
BACKGROUND
ACTION
BRFplus
Type in IF_
FDT_TYPES
Type
Length
(max.)
Decimals
(max.)
Only
Positive
Dimension
Text
255
Number
31
10
Boolean
Amount
31
ELEMENT_
AMOUNT
Quantity
31
10
ELEMENT_
QUANTITY
Timepoint
ELEMENT_
TIMEPOINT
ELEMENT_
TEXT
ELEMENT_
NUMBER
ELEMENT_
BOOLEAN
ABAP Base
Types
SSTRING
DF34_RAW
CHAR1
DF34_RAW,
CHAR5
DF34_RAW,
CHAR3
DATS,TIMS,
TIMESTAMP
Bunun yan sra; Binding zellii kullanlarak bir DDIC nesnesine referansla da
oluturulabilir.
Tek bir Data Object yaratmak:
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
23
Tesuji Consulting
http://www.tesuji.biz
24
SAP
BRF+
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
25
Bir Element iin (Domain gibi) Fix deerler de verilebilir. Mesela Itemn Computer,
Laptop veya Phone olabilmesini istiyoruz diyelim. Bu durumda; Item elementinin
Domain Values ksmna bu deerleri yazyoruz.
Structure
ABAPtan bildiimiz Work Area veya SE11deki Structuredr.
Tesuji Consulting
http://www.tesuji.biz
26
SAP
BRF+
Table
Belli bir Line Type trnde veri ieren ITAB.
Expression
Fonksiyonun iine dorudan yazlabilen; 4 ilem, fonksiyon arma gibi ilemlerdir. If,
or, unless gibi koullarn arkasndan deer hesaplayp dndrebilir.
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
27
Constant
En basit Expression trdr. Fix bir deer barndrr.
Tesuji Consulting
http://www.tesuji.biz
28
SAP
BRF+
Decision
Table
Karar tablosudur. Arka arkaya birden fazla IfI pe pee koymak yerine Decision Table
kullanlabilir.
Bitmi bir Decision Table rnei:
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
29
Tesuji Consulting
http://www.tesuji.biz
30
SAP
BRF+
Bu noktadan itibaren; her bir koul iin Insert New Row diye diye deerleri tanmlarz.
Mesela; Mteri ABC ise ve Item Computer ise, %15 indirim uygula diye tanm
yaplabilir.
Formula
Fonksiyonun herhangi bir yerinde kullanlabilen bir formldr. Mesela, bir Rule ierisinde
bir deer hesaplamak istiyorsak bir forml kullanabiliriz.
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
31
Burada grdmz ilemler (topla, kar, COS, SIN, vs) aslnda ilgili snflardaki
Methodlardr:
Function
Call
Bir Function ierisinden bir baka Function armaya yarar.
Tesuji Consulting
http://www.tesuji.biz
32
SAP
BRF+
Loop
Bildiimiz dng. 4 eit Loop vardr:
For Each
Repeat n times
Do Until
While Do
Table
Operation
Context ierisindeki ITABn verileriyle ilgili ilemlerdir. eitleri:
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
33
Procedure
Call
Static Method veya Function armaya yarar (SE24 / SE37). Raw, X, Xstring ve
referans parametreler Maplenemez.
Random
Number
Geliigzel say retmeye yarar. ki eidi vardr:
Bounded number: Verilen iki say arasnda bir deer tretir (Decimal verilebilir)
Boolean: True veya False dndrr.
Tesuji Consulting
http://www.tesuji.biz
34
SAP
BRF+
Decision
Tree
Decision Tablen daha kark, i ie Condition ieren hali
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
35
Case
ABAP Case gibi
Rule
Business Logicin tarif edildii yerdir. Bir fonksiyon iinde tek bir Rule olabilecei gibi,
Ruleset ierisinde birden fazla Rule da tarif edilebilir.
Rule yaratma rnei grelim; u anda bir Rulesetteyiz:
Tesuji Consulting
http://www.tesuji.biz
36
SAP
BRF+
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
37
Tesuji Consulting
http://www.tesuji.biz
38
SAP
BRF+
Ruleset
Arka arkaya birden fazla Rule ierir. Bu Rulelarn ilenme Conditionlarn da belirler
(ncelik, vs). Bir fonksiyona birden fazla Ruleset de konabilir.
RuleSet tanmlama ekran:
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
39
Tesuji Consulting
http://www.tesuji.biz
40
SAP
BRF+
Ruleset
Element
Bu Ruleset iinde; aynen WorkFlow Container gibi, Element yaratabiliyoruz. Buna
Ruleset Variable deniyor.
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
41
Tesuji Consulting
http://www.tesuji.biz
42
SAP
BRF+
Ruleset
Rule
Ruleset iinde arlacak her bir Ruleun bir Header blm vardr. Burada, Ruleun ne
zaman ileyeceine dair koullar verilir.
Final
Ruleset tanmlamas bittikten sonra; Enable Ruleset demeyi unutmuyoruz:
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
43
Action
Fonksiyon ierisinde yrtlecek ilemleri tanmlar.
Log
Message
Application Loga mesaj gndermeye yarar.
Tesuji Consulting
http://www.tesuji.biz
44
SAP
BRF+
Procedure
Call
ABAP Method / Fonksiyon arma ilevidir.
Dier
Aksiyonlar
E-Posta gnderme
ak balatma / tetikleme.
o Tetikleme iin rnek:
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/90109a5
3-d63e-2f10-1eb8dd45a1559c7a?QuickLink=index&overridelayout=true&53717156077789
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
45
o ak Interactionu iin rnek: http://scn.sap.com/docs/DOC-4568
Context Change: Context deikenlerinin deerleriyle oynama
Geniletme
/
Kiiselletirme
BRF+
nesnelerini,
kendi
Zli
Web
Dynpro
uygulamalarmzda
gsterebiliyoruz.
Detaylar:
http://scn.sap.com/docs/DOC-4578
Bu
balk
bata
bana
ilgin
gelse
de;
kaynaklar
ve
zellikle
"FDT_WD_DEMO_EMBED_UI"
adl
Web
Dynpro
uygulamasn
incelediimde
unu
grdm:
Buradaki
btn
hikaye,
BRF
kapsamnda
SAP
tarafndan
gelitirilmi
olan
"BRF
Object
Viewer"
Z'li
Web
Dynpro'ya
gmmekten
ibaret.
Z'li
Web
Dynpro
uygulamamza
FDT_IWD_OBJECT_MANAGER'i
dahil
ediyoruz.
Bunun
iini
de
inceledim
-
CL_FDT_WD_FACTORY=>IF_FDT_WD_FACTORY~GET_VIEWER(
)
ile
bir
Viewer
alnyor
ve
dnen
Component
Web
Dynpro'ya
gmlyor.
Bu
sayede,
ID'si
bilinen
bir
BRF+
nesnesini
(fonksiyon,
vs)
Z'li
Web
Dynpro
uygulamasnda
grntlemek
mmkn
oluyor.
Bu
sayede;
mesela
Z'li
bir
uygulama
ile
ilgisi
olan
bir
fonksiyonu,
forml,
vs
Hotspot
mantnda
Web
Dynpro
ekran
ierisinde
grntlemek
mmkn
olur.
Yaplamayacak
ey
ise;
Viewer'n
ierisine
mdahele
ederek
kendi
Z'li
Property'lerimizi,
vs
gmmek
olur.
Toolbar'
gizlemek
gibi
basit
eyler
yaplabilse
de;
mesela
Function'u
gsteren
ekran
Screen
Exit
mant
ile
modifiye
edip
kendi
zelliklerimizi
ekleyebileceimiz
ve
standart
BRF
ekrannn
sadece
iimize
geldii
kadarn
gsterebileceimiz
bir
imkan
alglayamadm.
Viewer'da
yaplabilecek
basit
modifikasyonlar;
SE24
->
IF_FDT_WD_CONFIGURATION
Method'larnda
grlebilir;
"IF_FDT_WD_USER_CONFIGURATION~SET_*"
diye
balayanlara
bakabilirsiniz.
Tesuji Consulting
http://www.tesuji.biz
46
SAP
BRF+
ya
da
sadece
belli
nesnelerin
gelmesini
(rnek:
ZBONUS_TURKEY_*)
salamak
mmkn.
Buradaki
konfigrasyonu,
akabinde
(mesela)
ZBRF
diye
bir
ilem
koduna
balayarak
BRF+'taki
Admin
grnts
yerine
basitletirilmi
grntnn
gelmesini
salayabiliyoruz.
Object
Filter:
Object
Filter'lar
sayesinde
ise;
kullanclarn
karsna
gelecek
+
deitirebilecekleri
nesneleri
batan
tanmlayabiliyoruz.
Mesela,
sadece
ZBONUS_TURKEY_APP_*
diye
balayan
nesneler
zerinde
ilem
yapabilsinler
diyebiliyoruz.
Catalog:
Son
kullanc
katalou
yaratarak,
sadece
bakm
yaplabilecek
nesneleri
listeletebiliyoruz.
rnek
Kodlar
Dinamik
lemler
Application
Yaratmak
DATA:
lo_factory
lo_application
lt_message
TYPE if_fdt_types=>t_message,
lv_boolean
TYPE abap_bool.
FIELD-SYMBOLS:
<ls_message>
TYPE
if_fdt_types=>s_message.
lo_factory
=
cl_fdt_factory=>if_fdt_factory~get_instance(
).
lo_application
=
lo_factory->get_application(
).
lo_application->if_fdt_transaction~enqueue(
).
lo_application->set_development_package(
$TMP
).
lo_application->if_fdt_admin_data~set_name(
PRICING
).
lo_application->if_fdt_admin_data~set_texts(
iv_short_text
=
Pricing
).
lo_application->if_fdt_transaction~activate(
IMPORTING
et_message
=
lt_message
ev_activation_failed
=
lv_boolean
).
write_errors
lt_message.
macro,
which
exits
in
case
of
error
lo_application->if_fdt_transaction~save(
).
lo_application->if_fdt_transaction~dequeue(
).
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
47
Get
an
application
specific
factory
instance
lo_factory
=
cl_fdt_factory=>if_fdt_factory~get_instance(
iv_application_id
=
lo_application->mv_id
).
Fonksiyon
Yaratmak
DATA:
lo_function
TYPE
REF
TO
if_fdt_function,
lts_context_id
TYPE
if_fdt_types=>ts_object_id,
lv_result_id
TYPE
if_fdt_types=>id.
lo_function
?=
lo_factory->get_function(
).
lo_function->if_fdt_transaction~enqueue(
).
lo_function->if_fdt_admin_data~set_name(
PRICE_CALCULATION
).
lo_function->if_fdt_admin_data~set_texts(
iv_short_text
=
Price
Calculation
).
lo_function->set_function_mode(
if_fdt_function=>gc_mode_event
).
*
code
for
context
creation
(lts_context_id)
and
result
*
creation
(lv_result_id)
to
be
inserted
here
lo_function->set_context_data_objects(
lts_context_id
).
lo_function->set_result_data_object(
lv_result_id
).
lo_function->if_fdt_transaction~activate(
EXPORTING
iv_deep
=
abap_true
IMPORTING
et_message
=
lt_message
ev_activation_failed
=
lv_boolean
).
write_errors
lt_message.
>>>
exit
in
case
of
error
lo_function->if_fdt_transaction~save(
EXPORTING
iv_deep
=
abap_true
).
lo_function->if_fdt_transaction~dequeue(
EXPORTING
iv_deep
=
abap_true
).
Data
Object
Yaratmak
Standart
bir
Data
Object
yaratan
rnek
kod:
DATA
lo_element
TYPE
REF
TO
if_fdt_element.
Tesuji Consulting
http://www.tesuji.biz
48
SAP
BRF+
lo_element
?=
lo_factory->get_data_object(
iv_data_object_type
=
if_fdt_constants=>gc_data_object_type_element
).
lo_element->if_fdt_transaction~enqueue(
).
lo_element->if_fdt_admin_data~set_name(
CUSTOMER
).
lo_element->if_fdt_admin_data~set_texts(
iv_short_text
=
Customer
).
lo_element->set_element_type(
if_fdt_constants=>gc_element_type_text
).
lo_element->set_element_type_attributes(
iv_length
=
30
).
INSERT
lo_element->mv_id
INTO
TABLE
lts_context_id.
Daha
detayl
zellikler
ieren
bir
Data
Object
yaratan
rnek
kod:
lo_element
?=
lo_factory->get_data_object(
iv_data_object_type
=
if_fdt_constants=>gc_data_object_type_element
).
lo_element->if_fdt_transaction~enqueue(
).
lo_element-
>if_fdt_admin_data~set_name(
FINAL_PRICE
).
lo_element-
>if_fdt_admin_data~set_texts(
iv_short_text
=
Final
Price
).
lo_element->set_element_type(
if_fdt_constants=>gc_element_type_number
).
lo_element-
>set_element_type_attributes(
iv_length
=
7
iv_decimals
=
2
iv_only_positive
=
abap_true
).
lv_result_id
=
lo_element->mv_id.
Ruleset
Yaratmak
Aadaki
kod
3
temel
admdan
olumaktadr:
Deikenleri
tanmlamak
(LTS_VARIABLE),
Expressionlar
tanmlamak
(LTS_EXPRESSION),
Rulelar
tanmlamak
(LTS_RULE)
DATA:
lo_ruleset
lts_rule
TYPE if_fdt_ruleset=>ts_rule,
Tesuji Consulting
http://www.tesuji.biz
SAP
BRF+
49
lo_ruleset->set_ruleset_switch(
iv_switch
=
if_fdt_ruleset=>gc_switch_on
).
lo_ruleset->if_fdt_admin_data~set_name(
PRICE_CALCULATION_RULES
).
lo_ruleset->if_fdt_admin_data~set_texts(
iv_short_text
=
Price
Calc.
Rules
iv_text
=
Price
Calculation
Rules
).
lo_ruleset->set_function_restriction(
iv_function_id
=
00505683359D02EE98FC41EE6215CAA4
).
*
code
for
ruleset
variables
(lts_variable)
to
be
inserted
here
lo_ruleset->set_ruleset_variables(
lts_variable
).
*
code
for
ruleset
initializations
(lts_expression)
to
be
*
inserted
here
lo_ruleset->set_ruleset_initializations(
lts_expression
).
*
code
for
rules
(lts_rule)
to
be
inserted
here
lo_ruleset->set_rules(
lts_rule
).
lo_ruleset->if_fdt_transaction~activate(
EXPORTING
iv_deep
=
abap_true
IMPORTING
et_message
=
lt_message
ev_activation_failed
=
lv_boolean
).
write_errors
lt_message.
>>>
exit
in
case
of
error
lo_ruleset->if_fdt_transaction~save(
EXPORTING
iv_deep
=
abap_true
).
lo_ruleset->if_fdt_transaction~dequeue(
EXPORTING
iv_deep
=
abap_true
).
Ruleset
Deikenlerini
Tanmlamak
Aadaki
rnekte;
iki
RuleSet
deikeni
tanmlanmtr.
DATA:
lo_element
TYPE
REF
TO
if_fdt_element,
ls_variable
TYPE
if_fdt_ruleset=>s_variable,
lv_pro_discount
TYPE
if_fdt_types=>id,
lv_cus_discount
TYPE
if_fdt_types=>id.
lo_element
?=
lo_factory->get_data_object(
iv_data_object_type
=
Tesuji Consulting
http://www.tesuji.biz
50
SAP
BRF+
if_fdt_constants=>gc_data_object_type_element
).
lo_element->if_fdt_transaction~enqueue(
).
lo_element->if_fdt_admin_data~set_name(
CUSTOMER_DISCOUNT
).
lo_element->if_fdt_admin_data~set_texts(
iv_short_text
=
Customer
Discount
).
lo_element->set_element_type(
if_fdt_constants=>gc_element_type_number
).
lo_element->set_element_type_attributes(
iv_length
=
3
iv_decimals
=
2
iv_only_positive
=
abap_true
).
ls_variable-position
=
1.
ls_variable-data_object_id
=
lo_element->mv_id.
INSERT
ls_variable
INTO
TABLE
lts_variable.
lv_cus_discount
=
lo_element->mv_id.
lo_element
?=
lo_factory->get_data_object(
iv_data_object_type
=
if_fdt_constants=>gc_data_object_type_element
).
lo_element->if_fdt_transaction~enqueue(
).
lo_element->if_fdt_admin_data~set_name(
PROMOTION_DISCOUNT
).
lo_element->if_fdt_admin_data~set_texts(
iv_short_text
=
Promotion
Discount
).
lo_element->set_element_type(
if_fdt_constants=>gc_element_type_number
).
lo_element->set_element_type_attributes(
iv_length
=
3
iv_decimals
=
2
iv_only_positive
=
abap_true
).
ls_variable-position
=
2.
ls_variable-data_object_id
=
lo_element->mv_id.
INSERT
ls_variable
INTO
TABLE
lts_variable.
lv_pro_discount
=
lo_element->mv_id.
Tesuji Consulting
http://www.tesuji.biz