SlideShare uma empresa Scribd logo
1 de 49
Dr. Kerem Koseoglu
Bu doküman, SAP BRF+ ürününü anlamak ve kullanabilmek için gereken notları
içermektedir.
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+
2 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Table of Contents
Kavramlar............................................................................................................................ 4
BRF+.................................................................................................................................................................................4
Application.....................................................................................................................................................................6
Genel Bakış................................................................................................................................................................6
Faydalı Araçlar........................................................................................................................................................8
Application Exit....................................................................................................................................................10
Catalog..........................................................................................................................................................................10
Function.......................................................................................................................................................................11
Genel Bakış.............................................................................................................................................................11
ÇalışmaModları...................................................................................................................................................13
Fonksiyonu Programdan Çağırmak.............................................................................................................15
Fonksiyonu Debug Etmek.................................................................................................................................20
Data Object..................................................................................................................................................................20
Element....................................................................................................................................................................20
Structure.................................................................................................................................................................24
Table.........................................................................................................................................................................25
Expression ..................................................................................................................................................................25
Constant..................................................................................................................................................................26
Decision Table.......................................................................................................................................................27
Formula...................................................................................................................................................................29
Function Call.........................................................................................................................................................30
Loop..........................................................................................................................................................................31
Table Operation...................................................................................................................................................31
Procedure Call......................................................................................................................................................32
Random Number..................................................................................................................................................32
Decision Tree.........................................................................................................................................................33
Case...........................................................................................................................................................................34
DiğerExpression Türleri...................................................................................................................................34
Rule................................................................................................................................................................................34
Ruleset..........................................................................................................................................................................37
Ruleset Element....................................................................................................................................................39
Ruleset Rule...........................................................................................................................................................40
Final..........................................................................................................................................................................41
Action............................................................................................................................................................................42
Log Message..........................................................................................................................................................42
Procedure Call......................................................................................................................................................43
Diğer Aksiyonlar..................................................................................................................................................43
Genişletme / Kişiselleştirme............................................................................................ 44
BRF+ Nesnelerini Z’li Programda Göstermek .............................................................................................44
BRF+ Görünümlerini Kişiselleştirme..............................................................................................................44
Örnek Kodlar..................................................................................................................... 45
Dinamik İşlemler......................................................................................................................................................45
Application Yaratmak.......................................................................................................................................45
Fonksiyon Yaratmak..........................................................................................................................................46
Data Object Yaratmak.......................................................................................................................................46
Ruleset Yaratmak................................................................................................................................................47
SAP BRF+ 3
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Ruleset Değişkenlerini Tanımlamak............................................................................................................48
4 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Kavramlar
BRF+
Rule’ları barındırmak + işlemek için Framework. Business kurallarını kodun içine
ABAP’la IF / Case ile yazmak yerine, BRF+’ta Customize edilebilir şekilde ifade
ediyoruz. Bu kurallar ABAP programından çağırılabiliyor ve Power User tarafından
uyarlama gibi değiştirilebiliyor.
Kullanım mimarisi:
SAP BRF+ 5
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Avantajları:
SAP Netweaver 7.0’dan beri var (2006). SAP TM, SAM CRM ve SAP Business By
Design içinde kullanılıyor.
Kullanabilmek için; en az SAP Netweaver 7.0 Enhancement PAck 2 gerekiyor. SICF’te
aşağıdaki servislerin etkinleştirilmesi lazım:
 /SAP/BC/WEBDYNPRO/SAP/ FDT_WD_WORKBENCH
6 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
 /SAP/BC/WEBDYNPRO/SAP/ FDT_WD_OBJECT_MANAGER
 /SAP/BC/WEBDYNPRO/SAP/ FDT_WD_CATALOG_BROWSER
BRF+’a erişim için, FDT_WORKBENCHişlem kodu kullanılır. Gerekli Authorization’lar:
Authority
Object
Field Remark
S_TCODE TCD = ‘FDT_WORKBENCH’
This authority check is only executed if you use
the transaction FDT_WORKBENCH.
FDT_OBJECT
FDT_ACT (Activity)
FDT_OBJTYP (Object Type)
FDT_APPL (Application)
You can define the allowed activities (for
example, Create, Change) for an object. It is
also possible to specify the application and the
object type.
FDT_WORKB
FDT_WB_ACT (Workbench
Activity)
This authority object defines the general access
to the workbench (Activity: Start Workbe
Application
Genel Bakış
Tüm BRF+ nesneleri için Container.
Workbench  Create Application menüsü ile yaratılır.
SAP BRF+ 7
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Application türleri:
 Customizing: Power User’ın değişiklikleri Client’a bağlıdır. Uyarlama olarak ele
alınır.
 Master data: Tüm değişiklikler yereldir, taşınamaz.
8 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
 System: Kimse değişiklik yapamaz. Değişiklikler ancak Workbench Request ile
taşınabilir.
Faydalı Araçlar
Application Usage: Bu Application’u kimler kullanmış – Where Used List
Application Cleanup – Extended Program Check gibi
Simulation: Uygulamayı ön planda deneme modunda çalıştırma
SAP BRF+ 9
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Web Service Generation – Uygulamayı servis olarak yayınlama
10 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Application Exit
Application içerisinde, aynen User Exit veya BADI gibi, uygulamanın çalışmasına ABAP
müdahelesi gerektiği durumlarda kullanılır. Detaylar: http://scn.sap.com/docs/DOC-4564
Application Exit Method Description
AUTHORITY_CHECK
If an object is accessed or shall be manipulated, BRFplus
performs an authority check first.
This exit allows to enhance or even completely replace the
default authority checks of BRFplus.
CHECK
This method is called whenever a BRFplus object is checked
for consistency. Additional checks may be implemented within
this exit. The exit also affects the possibility to activate an
object. (see below)
ACTIVATION_VETO
Before a BRFplus object can be activated, it needs to be in a
consistent state and is therefore checked accordingly. With the
activation veto exit it is possible to prohibit the activation also
due to other aspects like external dependencies, that might
even only be of temporary nature.
CHANGE_NOTIFICATION
This exit sends a notification if an object is changed. This might
e.g. be used for an automatic update of a dependent BRFplus
object.
SAVE_NOTIFICATION
This exit simply gives a notification, if an object is saved.
This might e.g. be used for an automatic update of a
dependent BRFplus object.
GET_ELEMENT_VALUES
With this exit it is possible to define a dynamically retrieved list
of valid values for a data element in BRFplus.
GET_FORMULA_FUNCTIONALS
With this application exit the functions that are available for
formula expressions can be set. It is possible to restrict the list
of standard functions but also to add custom defined functions .
GET_CHANGEABILITY
With this application exit the changeability of customizing
objects can be altered.
GET_CALENDAR
This application exit can define the usage of a specific calendar
for date and time related operations.
The exit is currently not relevant for NW70x releases. It is only
used for special application platform systems based on NW710
or higher.
Catalog
Farklı Application’lardaki nesneler; kullanıcılar tarafından rahat ulaşılabilsin diye
Catalog’lar içinde toparlanabilir.
SAP BRF+ 11
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Function
Genel Bakış
BRF+ ile ABAP programları arasındaki köprüdür.
Input —> Expressions + Rulesets —> Output mantığıyla çalışan bir bloktor. Bir
Application altında pek çok Function olabilir. Function’un arkasında sınıf Method’ları
türetilir.
12 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Aldığı parametreler, Signature kısmında tanımlanır:
Fonksiyon; ABAP’tan çağırılmanın yanı sıra, Web Service olarak da yayınlanabilir veya
doğrudan ön ekranda da simule edilebilmektedir.
SAP BRF+ 13
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Çalışma Modları
Functional Mode: Bildiğimiz fonksiyon gibi; parametre alır, işler ve sonuç döndürür.
Simple Use-Cases için uygundur.
14 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Event Mode: Rule Logic doğrudan fonksiyon içinde yer almaz. Bunun yerine, fonksiyon
bir Event tetikler ve bu Event’I dinleyen bir/birkaç Ruleset işlenir. Bu Ruleset’ler; tipik
olarak Context değerlerini değiştirir ve aksiyonlar başlatır. Bu mod; genelde doğrudan
sonuç beklenmeyen karışık Use Case’ler için kullanılır. Örnek: Kredi kartına başvuran
kişi için risk faktörü hesaplama.
Functional and Event Mode: İkisinin karışımıdır. Önce basit bir Functional Mode çalışır,
akabinde Event Mode gibi Ruleset’ler işlenir.
SAP BRF+ 15
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Fonksiyonu Programdan Çağırmak
Hello World:
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,
lv_result_string TYPE string,
lx_fdt TYPE REF TO cx_fdt.
FIELD-SYMBOLS: <ls_message> TYPE if_fdt_types=>s_message.
CONSTANTS: lc_fct_id TYPE if_fdt_types=>id
VALUE ‘00145EF41CBA02DDA8819E3B1652013A’.
TRY.
lo_function = cl_fdt_factory=>get_instance( )->get_function(
iv_id = lc_fct_id ).
lo_context = lo_function->get_process_context( ).
lo_context->set_value( iv_name = ‘INPUT’
ia_value = ‘Hello World’ ).
lo_function->process( EXPORTING io_context = lo_context
IMPORTING eo_result = lo_result ).
lo_result->get_value( IMPORTING ea_value =
lv_result_string ).
CATCH cx_fdt_processing.
lv_result_string = ‘PROCESSING ERROR!’.
CATCH cx_fdt INTO lx_fdt.
LOOP AT lx_fdt->mt_message ASSIGNING <ls_message>.
WRITE: / <ls_message>-text.
ENDLOOP.
ENDTRY.
WRITE:/ ‘The result is : ‘ , lv_result_string.
Örnek 1:
* Get singleton instance of the FDT factory.
16 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
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:
SAP BRF+ 17
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
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.
Tam bir program örneği:
*---------------------------------------------------------------------*
* Report Z_BRFPLUS_TEST
*
*---------------------------------------------------------------------*
*
*
*---------------------------------------------------------------------*
18 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
REPORT z_brfplus_test.
PARAMETERS: p_salary TYPE amount.
DATA: lo_fuction TYPE REF TO if_fdt_function,
lo_context TYPE REF TO if_fdt_context,
lo_result TYPE REF TO if_fdt_result.
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 = p_salary.
ls_salary-currency = '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 = lo_context
IMPORTING eo_result = lo_result ).
" Retrieve the BRFplus function result
lo_result->get_value( IMPORTING ea_value = 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.
Bu programdaki GUID, fonksiyonun GENERAL Tab’ından alınabilir.
SAP BRF+ 19
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Simülasyon ekranı:
SE38 ekranı:
20 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Web Dynpro’dan çağırma örneği için: http://scn.sap.com/docs/DOC-4578
Fonksiyonu Debug Etmek
BRF+ fonksiyonunu Debug etmek için,
CL_FDT_FUNCTION=>IF_FDT_FUNCTION~PROCESS Method’una Break Point
koyulabilir.
Data Object
Bir veriyi tarif etmek için kullanılır, yani veri tipidir. 3 temel Data Object türü vardır:
Element, Structure, Table.
Element
Element için kullanılabilecek hazır türler:
Data Object Description
TEXT Text type without restrictions.
SAP BRF+ 21
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
NUMBER Number type without restrictions
BOOLEAN Boolean type without restrictions
AMOUNT Amount type without restrictions
QUANTITY Quantity type without restrictions
TIMEPOINT Timepoint type without restrictions
TIMESTAMP
Timepoint of type Universal Time Coordinated (UTC) timestamp, including
date and time
DATE_TIME Timepoint of type date and time (local)
DATE Timpoint of type date
TIME Timepoint of type time
USER_NAME Text type, bound to DDIC type SYUNAME
BACKGROUND Boolean type, bound to DDIC type SYBATCH
ACTION Text type, intended to store IDs of actions
Type
Length
(max.)
Decimals
(max.)
Only
Positive
Dimension
BRFplus
Type in IF_
FDT_TYPES
ABAP Base
Types
Text 255 – – – ELEMENT_
TEXT
SSTRING
Number 31 10 x – ELEMENT_
NUMBER
DF34_RAW
Boolean – – – – ELEMENT_
BOOLEAN
CHAR1
Amount 31 – x – ELEMENT_
AMOUNT
DF34_RAW,
CHAR5
Quantity 31 10 x x ELEMENT_
QUANTITY
DF34_RAW,
CHAR3
Timepoint – – – – ELEMENT_
TIMEPOINT
DATS,TIMS,
TIMESTAMP
Bunun yanı sıra; Binding özelliği kullanılarak bir DDIC nesnesine referansla da
oluşturulabilir.
Tek bir Data Object yaratmak:
22 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Aynı anda birkaç Data Object yaratma adımları:
SAP BRF+ 23
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
24 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Bir Element için (Domain gibi) Fix değerler de verilebilir. Mesela Item’ın Computer,
Laptop veya Phone olabilmesini istiyoruz diyelim. Bu durumda; Item elementinin
“Domain Values” kısmına bu değerleri yazıyoruz.
Structure
ABAP’tan bildiğimiz Work Area veya SE11’deki Structure’dır.
SAP BRF+ 25
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Table
Belli bir Line Type türünde veri içeren ITAB.
Expression
Fonksiyonun içine doğrudan yazılabilen; 4 işlem, fonksiyon çağırma gibi işlemlerdir. If,
or, unless gibi koşulların arkasından değer hesaplayıp döndürebilir.
26 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
BRFplus mimarisinde Expression’ların yeri:
Constant
En basit Expression türüdür. Fix bir değer barındırır.
SAP BRF+ 27
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Decision Table
Karar tablosudur. Arka arkaya birden fazla If’I peş peşe koymak yerine Decision Table
kullanılabilir.
Bitmiş bir Decision Table örneği:
Öncelikle; Decision Table sonucunda hesaplanacak olan Output değeri tanımlanır:
28 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Akabinde, Decision Table koşullarında kullanılacak olan değişkenler tanımlanır:
SAP BRF+ 29
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Bu noktadan itibaren; her bir koşul için “Insert New Row…” diye diye değerleri
tanımlarız. Mesela; “Müşteri ABC ise ve Item Computer ise, %15 indirim uygula” diye
tanım yapılabilir.
Formula
Fonksiyonun herhangi bir yerinde kullanılabilen bir formüldür. Mesela, bir Rule içerisinde
bir değer hesaplamak istiyorsak bir formül kullanabiliriz.
30 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Burada gördüğümüz işlemler (topla, çıkar, COS, SIN, vs) aslında ilgili sınıflardaki
Method’lardır:
İstersek kendimize özel fonksiyonlar da geliştirebiliriz. Detaylar:
http://scn.sap.com/docs/DOC-4582
Function Call
Bir Function içerisinden bir başka Function çağırmaya yarar.
SAP BRF+ 31
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Loop
Bildiğimiz döngü. 4 çeşit Loop vardır:
 For Each
 Repeat n times
 Do Until
 While Do
Table Operation
Context içerisindeki ITAB’ın verileriyle ilgili işlemlerdir. Çeşitleri:
32 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Procedure Call
Static Method veya Function çağırmaya yarar (SE24 / SE37). Raw, X, Xstring ve
referans parametreler Map’lenemez.
Random Number
Gelişigüzel sayı üretmeye yarar. İki çeşidi vardır:
 Bounded number: Verilen iki sayı arasında bir değer türetir (Decimal verilebilir)
 Boolean: True veya False döndürür.
SAP BRF+ 33
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Decision Tree
Decision Table’ın daha karışık, iç içe Condition içeren hali
34 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Case
ABAP Case gibi
Diğer Expression Türleri
Boolean
BRMS Connector: BRFplus harici Bir başka Rule Engine ile bağlantı. Detaylar:
http://scn.sap.com/docs/DOC-20056
Database Lookup: Doğrudan doğruya veritabanı okuması.
Random Number
Search Tree
Step Sequence
Value Range: Bir değer belli bir aralıkta mı değil mi?
XSL Transformation
Rule
Business Logic’in tarif edildiği yerdir. Bir fonksiyon içinde tek bir Rule olabileceği gibi,
Ruleset içerisinde birden fazla Rule da tarif edilebilir.
Rule yaratma örneği görelim; şu anda bir Ruleset’teyiz:
SAP BRF+ 35
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Burada karşımıza If… Then… Else… mantığında bir ekran gelecek.
Önce If koşulunu tanımlıyoruz:
36 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Akabinde; Then kısmına istediğimiz şeyi yerleştirebiliriz. Bu örnekte, bir Formula
yerleştiriliyor. Bunun yerine; Decision Table gibi başka bir Expression da
yerleştirebilirdik.
SAP BRF+ 37
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Ruleset
Arka arkaya birden fazla Rule içerir. Bu Rule’ların işlenme Condition’larını da belirler
(öncelik, vs). Bir fonksiyona birden fazla Ruleset de konabilir.
RuleSet tanımlama ekranı:
38 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
 Assign Function: Bu Ruleset’I barındıracak fonksiyon seçilir (sadece bir fonksiyona
ait olabilir).
 Assign Precondition: Bu Ruleset’in etkinleşmesi için gereken koşullar
tanımlanabilir.
Bitmiş bir Ruleset:
SAP BRF+ 39
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Ruleset Element
Bu Ruleset içinde; aynen WorkFlow Container gibi, Element yaratabiliyoruz. Buna
Ruleset Variable deniyor.
Her bir değişkenin nasıl Initialize edileceğini de tanımlayabiliyoruz:
40 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Ruleset Rule
Ruleset içinde çağırılacak her bir Rule’un bir Header bölümü vardır. Burada, Rule’un ne
zaman işleyeceğine dair koşullar verilir.
Ruleset içine peşi sıra yerleştirilmiş birkaç Rule, şu şekilde gözükecektir:
SAP BRF+ 41
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Görüldüğü gibi; Rule’lar arasına Exit Condition’lar da konabilmektedir. Bu şekilde, basit
uygulama mantıkları geliştirilebilir.
Final
Ruleset tanımlaması bittikten sonra; Enable Ruleset demeyi unutmuyoruz:
İçi dolu bir Ruleset örneği:
42 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Action
Fonksiyon içerisinde yürütülecek işlemleri tanımlar.
Log Message
Application Log’a mesaj göndermeye yarar.
SAP BRF+ 43
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
Procedure Call
ABAP Method / Fonksiyon çağırma işlevidir.
Diğer Aksiyonlar
 E-Posta gönderme
 İş akışı başlatma / tetikleme.
o Tetikleme için örnek:
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/90109a5
3-d63e-2f10-1eb8-
dd45a1559c7a?QuickLink=index&overridelayout=true&53717156077789
44 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
o İş akışı Interaction’u için örnek: http://scn.sap.com/docs/DOC-4568
 Context Change: Context değişkenlerinin değerleriyle oynama
Genişletme / Kişiselleştirme
BRF+ Nesnelerini Z’li Programda Göstermek
BRF+ nesnelerini, kendi Z’li Web Dynpro uygulamalarımızda gösterebiliyoruz.
Detaylar: http://scn.sap.com/docs/DOC-4578
Bu başlık başta bana ilginç gelse de; kaynakları ve özellikle
"FDT_WD_DEMO_EMBED_UI" adlı Web Dynpro uygulamasını incelediğimde şunu
gördüm: Buradaki bütün hikaye, BRF kapsamında SAP tarafından geliştirilmiş olan
"BRF Object Viewer"ı Z'li Web Dynpro'ya gömmekten ibaret. Z'li Web Dynpro
uygulamamıza FDT_IWD_OBJECT_MANAGER'i dahil ediyoruz. Bunun içini de
inceledim - CL_FDT_WD_FACTORY=>IF_FDT_WD_FACTORY~GET_VIEWER( ) ile bir
Viewer alınıyor ve dönen Component Web Dynpro'ya gömülüyor. Bu sayede, ID'si
bilinen bir BRF+ nesnesini (fonksiyon, vs) Z'li Web Dynpro uygulamasında
görüntülemek mümkün oluyor.
Bu sayede; mesela Z'li bir uygulama ile ilgisi olan bir fonksiyonu, formülü, vs
Hotspot mantığında Web Dynpro ekranı içerisinde görüntülemek mümkün olur.
Yapılamayacak şey ise; Viewer'ın içerisine müdahele ederek kendi Z'li
Property'lerimizi, vs gömmek olur. Toolbar'ı gizlemek gibi basit şeyler yapılabilse
de; mesela Function'u gösteren ekranı Screen Exit mantığı ile modifiye edip kendi
özelliklerimizi ekleyebileceğimiz ve standart BRF ekranının sadece işimize geldiği
kadarını gösterebileceğimiz bir imkan algılayamadım. Viewer'da yapılabilecek basit
modifikasyonlar; SE24 -> IF_FDT_WD_CONFIGURATION Method'larında görülebilir;
"IF_FDT_WD_USER_CONFIGURATION~SET_*" diye başlayanlara bakabilirsiniz.
BRF+ Görünümlerini Kişiselleştirme
Farklı kullanıcıların BRF+ ekranında nelerle karşılaşacağını organize edebiliyoruz.
Detaylar: http://scn.sap.com/community/brm/blog/2012/12/18/controlling-the-
ui-appearance-of-the-brfplus-workbench
Simple / Expert Mode Harici Özel Mod: CL_FDT_WD_UI_SIMPLE_MODE sınıfından
yeni bir sınıf türeterek, kullanıcının ekranında nasıl bir görüntü istiyorsak onu
tanımlayabiliyoruz. Değiştirebileceğimiz parametreler, SE24 -
> IF_FDT_WD_USER_CONFIGURATION -> Attributes içerisinde görülebilir
(GC_PARAMETER* diye başlayanlar). Burada; sadece belli bir kataloğun açılmasını,
SAP BRF+ 45
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
ya da sadece belli nesnelerin gelmesini (örnek: ZBONUS_TURKEY_*) sağlamak
mümkün. Buradaki konfigürasyonu, akabinde (mesela) ZBRF diye bir işlem koduna
bağlayarak BRF+'taki Admin görüntüsü yerine basitleştirilmiş görüntünün
gelmesini sağlayabiliyoruz.
Object Filter: Object Filter'lar sayesinde ise; kullanıcıların karşısına gelecek +
değiştirebilecekleri nesneleri baştan tanımlayabiliyoruz. Mesela, sadece
ZBONUS_TURKEY_APP_* diye başlayan nesneler üzerinde işlem yapabilsinler
diyebiliyoruz.
Catalog: Son kullanıcı kataloğu yaratarak, sadece bakımı yapılabilecek nesneleri
listeletebiliyoruz.
Örnek Kodlar
Dinamik İşlemler
Application Yaratmak
DATA: lo_factory TYPE REF TO if_fdt_factory,
lo_application TYPE REF TO if_fdt_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( ).
46 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
“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.
SAP BRF+ 47
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
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 içeren 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
Aşağıdaki kod 3 temel adımdan oluşmaktadır: Değişkenleri tanımlamak
(LTS_VARIABLE), Expression’ları tanımlamak (LTS_EXPRESSION), Rule’ları
tanımlamak (LTS_RULE)
DATA: lo_ruleset TYPE REF TO if_fdt_ruleset,
lts_rule TYPE if_fdt_ruleset=>ts_rule,
lts_variable TYPE if_fdt_ruleset=>ts_variable,
lts_expression TYPE if_fdt_ruleset=>ts_init_expr.
lo_factory = cl_fdt_factory=>if_fdt_factory~get_instance(
iv_application_id = ‘00505683359D02EE98FC41ECA7650AA3’ ).
lo_ruleset ?= lo_factory->get_ruleset( ).
lo_ruleset->if_fdt_transaction~enqueue( ).
48 SAP BRF+
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
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 Değişkenlerini Tanımlamak
Aşağıdaki örnekte; iki RuleSet değişkeni tanımlanmıştır.
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 =
SAP BRF+ 49
Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
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.

Mais conteúdo relacionado

Mais procurados

Oracle forms developer 10g vol1
Oracle forms developer 10g vol1Oracle forms developer 10g vol1
Oracle forms developer 10g vol1
abdull466
 
0106 debugging
0106 debugging0106 debugging
0106 debugging
vkyecc1
 
Chapter 02 sap script forms
Chapter 02 sap script formsChapter 02 sap script forms
Chapter 02 sap script forms
Kranthi Kumar
 
Chapter 07 debugging sap scripts
Chapter 07 debugging sap scriptsChapter 07 debugging sap scripts
Chapter 07 debugging sap scripts
Kranthi Kumar
 

Mais procurados (20)

SAP workflow events
SAP workflow eventsSAP workflow events
SAP workflow events
 
Oracle forms developer 10g vol1
Oracle forms developer 10g vol1Oracle forms developer 10g vol1
Oracle forms developer 10g vol1
 
Sap gui scripting api with guixt
Sap gui scripting api with guixtSap gui scripting api with guixt
Sap gui scripting api with guixt
 
Sap basis r3 hand book
Sap basis r3 hand bookSap basis r3 hand book
Sap basis r3 hand book
 
Step by step lsmw tutorial
Step by step lsmw tutorialStep by step lsmw tutorial
Step by step lsmw tutorial
 
0106 debugging
0106 debugging0106 debugging
0106 debugging
 
Sap pm tables
 Sap pm tables Sap pm tables
Sap pm tables
 
Find out userexits in sap
Find out userexits in sapFind out userexits in sap
Find out userexits in sap
 
Action profiles in sap
Action profiles in sapAction profiles in sap
Action profiles in sap
 
Sap User Exit for Functional Consultant
Sap User Exit for Functional ConsultantSap User Exit for Functional Consultant
Sap User Exit for Functional Consultant
 
SAP BASIS Skills for Functional Consultants
SAP BASIS Skills for Functional ConsultantsSAP BASIS Skills for Functional Consultants
SAP BASIS Skills for Functional Consultants
 
12753028 scot-configuration-troubleshooting
12753028 scot-configuration-troubleshooting12753028 scot-configuration-troubleshooting
12753028 scot-configuration-troubleshooting
 
Chapter 02 sap script forms
Chapter 02 sap script formsChapter 02 sap script forms
Chapter 02 sap script forms
 
Sap Integration Testing Test Scripting V0.1
Sap Integration Testing   Test Scripting V0.1Sap Integration Testing   Test Scripting V0.1
Sap Integration Testing Test Scripting V0.1
 
Chapter 07 debugging sap scripts
Chapter 07 debugging sap scriptsChapter 07 debugging sap scripts
Chapter 07 debugging sap scripts
 
HANA SPS07 Modeling Enhancements
HANA SPS07 Modeling EnhancementsHANA SPS07 Modeling Enhancements
HANA SPS07 Modeling Enhancements
 
SAP Basis Training Material | www.sapdocs.info
SAP Basis Training Material | www.sapdocs.infoSAP Basis Training Material | www.sapdocs.info
SAP Basis Training Material | www.sapdocs.info
 
Badi document
Badi documentBadi document
Badi document
 
Exclusive SAP Basis Training Book | www.sapdocs.info
Exclusive SAP Basis Training Book | www.sapdocs.infoExclusive SAP Basis Training Book | www.sapdocs.info
Exclusive SAP Basis Training Book | www.sapdocs.info
 
Oracle Succession Planning Setup
Oracle Succession Planning SetupOracle Succession Planning Setup
Oracle Succession Planning Setup
 

Semelhante a SAP BRF+ Kılavuzu

Metasploit Framework - Giris Seviyesi Guvenlik Denetim Rehberi
Metasploit Framework - Giris Seviyesi Guvenlik Denetim RehberiMetasploit Framework - Giris Seviyesi Guvenlik Denetim Rehberi
Metasploit Framework - Giris Seviyesi Guvenlik Denetim Rehberi
Fatih Ozavci
 
Sunucu işletim sistemi 6
Sunucu işletim sistemi 6Sunucu işletim sistemi 6
Sunucu işletim sistemi 6
Erol Dizdar
 
C#Turk.net Istanbul Universitesi ASP.NET MVC Semineri
C#Turk.net Istanbul Universitesi ASP.NET MVC SemineriC#Turk.net Istanbul Universitesi ASP.NET MVC Semineri
C#Turk.net Istanbul Universitesi ASP.NET MVC Semineri
yunusozen
 
Teknogirisim sirketkurulusrehberi
Teknogirisim sirketkurulusrehberiTeknogirisim sirketkurulusrehberi
Teknogirisim sirketkurulusrehberi
mamyz
 

Semelhante a SAP BRF+ Kılavuzu (20)

SAP Support Authorization Danışmanlık Servisi
SAP Support Authorization Danışmanlık ServisiSAP Support Authorization Danışmanlık Servisi
SAP Support Authorization Danışmanlık Servisi
 
SAP DMS kılavuzu
SAP DMS kılavuzuSAP DMS kılavuzu
SAP DMS kılavuzu
 
Metasploit Framework - Giris Seviyesi Guvenlik Denetim Rehberi
Metasploit Framework - Giris Seviyesi Guvenlik Denetim RehberiMetasploit Framework - Giris Seviyesi Guvenlik Denetim Rehberi
Metasploit Framework - Giris Seviyesi Guvenlik Denetim Rehberi
 
SAP Success Factors
SAP Success FactorsSAP Success Factors
SAP Success Factors
 
Sunucu işletim sistemi 6
Sunucu işletim sistemi 6Sunucu işletim sistemi 6
Sunucu işletim sistemi 6
 
C#Turk.net Istanbul Universitesi ASP.NET MVC Semineri
C#Turk.net Istanbul Universitesi ASP.NET MVC SemineriC#Turk.net Istanbul Universitesi ASP.NET MVC Semineri
C#Turk.net Istanbul Universitesi ASP.NET MVC Semineri
 
Davranis Odakli Gelistirmeye Giris, Behat ve Mink
Davranis Odakli Gelistirmeye Giris, Behat ve MinkDavranis Odakli Gelistirmeye Giris, Behat ve Mink
Davranis Odakli Gelistirmeye Giris, Behat ve Mink
 
Erp sisteminde dikkat edilecek konular
Erp sisteminde dikkat edilecek konularErp sisteminde dikkat edilecek konular
Erp sisteminde dikkat edilecek konular
 
SAP Forum 2009: FIT Sap Güvenlik Servisleri
SAP Forum 2009: FIT Sap Güvenlik ServisleriSAP Forum 2009: FIT Sap Güvenlik Servisleri
SAP Forum 2009: FIT Sap Güvenlik Servisleri
 
Teknogirisim sirketkurulusrehberi
Teknogirisim sirketkurulusrehberiTeknogirisim sirketkurulusrehberi
Teknogirisim sirketkurulusrehberi
 
Erp
ErpErp
Erp
 
Isgsis roportaj.pdf
Isgsis roportaj.pdfIsgsis roportaj.pdf
Isgsis roportaj.pdf
 
Edb kurumsal dunyaicinoneriler.101614
Edb kurumsal dunyaicinoneriler.101614Edb kurumsal dunyaicinoneriler.101614
Edb kurumsal dunyaicinoneriler.101614
 
SDL Trados (Studio) Pratik Kullanım İpuçları
SDL Trados (Studio) Pratik Kullanım İpuçlarıSDL Trados (Studio) Pratik Kullanım İpuçları
SDL Trados (Studio) Pratik Kullanım İpuçları
 
Growth Hacking İstanbul 2017 - Emre Güney
Growth Hacking İstanbul 2017 - Emre GüneyGrowth Hacking İstanbul 2017 - Emre Güney
Growth Hacking İstanbul 2017 - Emre Güney
 
Growth Conversion
Growth ConversionGrowth Conversion
Growth Conversion
 
NetCAD/NetPRO 5.0 Dijital Kitabi
NetCAD/NetPRO 5.0 Dijital KitabiNetCAD/NetPRO 5.0 Dijital Kitabi
NetCAD/NetPRO 5.0 Dijital Kitabi
 
Dba için oracle veritabanı 11g yeni özellikleri
Dba için oracle veritabanı 11g yeni özellikleriDba için oracle veritabanı 11g yeni özellikleri
Dba için oracle veritabanı 11g yeni özellikleri
 
Freedom ERP / Barkod Uygulama Fikir ve Örnekleri
Freedom ERP / Barkod Uygulama Fikir ve ÖrnekleriFreedom ERP / Barkod Uygulama Fikir ve Örnekleri
Freedom ERP / Barkod Uygulama Fikir ve Örnekleri
 
12factor apps
12factor apps12factor apps
12factor apps
 

Mais de Dr. Kerem Koseoglu

Mais de Dr. Kerem Koseoglu (20)

Avrupa'da ABAP Kariyeri
Avrupa'da ABAP KariyeriAvrupa'da ABAP Kariyeri
Avrupa'da ABAP Kariyeri
 
Zaman Yönetimi TEDx Sunumu
Zaman Yönetimi TEDx SunumuZaman Yönetimi TEDx Sunumu
Zaman Yönetimi TEDx Sunumu
 
ABAP 7.x New Features and Commands
ABAP 7.x New Features and CommandsABAP 7.x New Features and Commands
ABAP 7.x New Features and Commands
 
Fiori eğitimi - kod
Fiori eğitimi - kodFiori eğitimi - kod
Fiori eğitimi - kod
 
Fiori eğitimi - sunum
Fiori eğitimi - sunumFiori eğitimi - sunum
Fiori eğitimi - sunum
 
SPSS Manual (Turkish)
SPSS Manual (Turkish)SPSS Manual (Turkish)
SPSS Manual (Turkish)
 
Kordsa Design Pattern Eğitimi
Kordsa Design Pattern EğitimiKordsa Design Pattern Eğitimi
Kordsa Design Pattern Eğitimi
 
Web Dynpro
Web DynproWeb Dynpro
Web Dynpro
 
Zaman Yönetimi
Zaman YönetimiZaman Yönetimi
Zaman Yönetimi
 
Design Patterns in ABAP Objects - SAP Forum / Tech Ed sunumu (2016)
Design Patterns in ABAP Objects - SAP Forum / Tech Ed sunumu (2016)Design Patterns in ABAP Objects - SAP Forum / Tech Ed sunumu (2016)
Design Patterns in ABAP Objects - SAP Forum / Tech Ed sunumu (2016)
 
ABAP mimarisi hakkında yeni bir kitap: "Design Patterns in ABAP Objects"
ABAP mimarisi hakkında yeni bir kitap: "Design Patterns in ABAP Objects"ABAP mimarisi hakkında yeni bir kitap: "Design Patterns in ABAP Objects"
ABAP mimarisi hakkında yeni bir kitap: "Design Patterns in ABAP Objects"
 
Embedding custom ActiveX controls into SAP GUI
Embedding custom ActiveX controls into SAP GUIEmbedding custom ActiveX controls into SAP GUI
Embedding custom ActiveX controls into SAP GUI
 
SAP SmartForms ile Barkod + Türkçe karakterli etiketi yazdırma
SAP SmartForms ile Barkod + Türkçe karakterli etiketi yazdırmaSAP SmartForms ile Barkod + Türkçe karakterli etiketi yazdırma
SAP SmartForms ile Barkod + Türkçe karakterli etiketi yazdırma
 
Lotus Notes - .NET entegrasyonu
Lotus Notes - .NET entegrasyonuLotus Notes - .NET entegrasyonu
Lotus Notes - .NET entegrasyonu
 
ECC 6.0 ABAP yenilikleri
ECC 6.0 ABAP yenilikleriECC 6.0 ABAP yenilikleri
ECC 6.0 ABAP yenilikleri
 
SAP SCOT kurulum adımları
SAP SCOT kurulum adımlarıSAP SCOT kurulum adımları
SAP SCOT kurulum adımları
 
Correlation Between Proper Training / Involvement and ERP Acceptance and the ...
Correlation Between Proper Training / Involvement and ERP Acceptance and the ...Correlation Between Proper Training / Involvement and ERP Acceptance and the ...
Correlation Between Proper Training / Involvement and ERP Acceptance and the ...
 
SQL Injection - Web siteniz tehdit altında mı?
SQL Injection - Web siteniz tehdit altında mı?SQL Injection - Web siteniz tehdit altında mı?
SQL Injection - Web siteniz tehdit altında mı?
 
Organizational Behavior - Genel özet
Organizational Behavior - Genel özetOrganizational Behavior - Genel özet
Organizational Behavior - Genel özet
 
SPSS ile regresyon analizi
SPSS ile regresyon analiziSPSS ile regresyon analizi
SPSS ile regresyon analizi
 

SAP BRF+ Kılavuzu

  • 1. Dr. Kerem Koseoglu Bu doküman, SAP BRF+ ürününü anlamak ve kullanabilmek için gereken notları içermektedir. 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+
  • 2. 2 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Table of Contents Kavramlar............................................................................................................................ 4 BRF+.................................................................................................................................................................................4 Application.....................................................................................................................................................................6 Genel Bakış................................................................................................................................................................6 Faydalı Araçlar........................................................................................................................................................8 Application Exit....................................................................................................................................................10 Catalog..........................................................................................................................................................................10 Function.......................................................................................................................................................................11 Genel Bakış.............................................................................................................................................................11 ÇalışmaModları...................................................................................................................................................13 Fonksiyonu Programdan Çağırmak.............................................................................................................15 Fonksiyonu Debug Etmek.................................................................................................................................20 Data Object..................................................................................................................................................................20 Element....................................................................................................................................................................20 Structure.................................................................................................................................................................24 Table.........................................................................................................................................................................25 Expression ..................................................................................................................................................................25 Constant..................................................................................................................................................................26 Decision Table.......................................................................................................................................................27 Formula...................................................................................................................................................................29 Function Call.........................................................................................................................................................30 Loop..........................................................................................................................................................................31 Table Operation...................................................................................................................................................31 Procedure Call......................................................................................................................................................32 Random Number..................................................................................................................................................32 Decision Tree.........................................................................................................................................................33 Case...........................................................................................................................................................................34 DiğerExpression Türleri...................................................................................................................................34 Rule................................................................................................................................................................................34 Ruleset..........................................................................................................................................................................37 Ruleset Element....................................................................................................................................................39 Ruleset Rule...........................................................................................................................................................40 Final..........................................................................................................................................................................41 Action............................................................................................................................................................................42 Log Message..........................................................................................................................................................42 Procedure Call......................................................................................................................................................43 Diğer Aksiyonlar..................................................................................................................................................43 Genişletme / Kişiselleştirme............................................................................................ 44 BRF+ Nesnelerini Z’li Programda Göstermek .............................................................................................44 BRF+ Görünümlerini Kişiselleştirme..............................................................................................................44 Örnek Kodlar..................................................................................................................... 45 Dinamik İşlemler......................................................................................................................................................45 Application Yaratmak.......................................................................................................................................45 Fonksiyon Yaratmak..........................................................................................................................................46 Data Object Yaratmak.......................................................................................................................................46 Ruleset Yaratmak................................................................................................................................................47
  • 3. SAP BRF+ 3 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Ruleset Değişkenlerini Tanımlamak............................................................................................................48
  • 4. 4 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Kavramlar BRF+ Rule’ları barındırmak + işlemek için Framework. Business kurallarını kodun içine ABAP’la IF / Case ile yazmak yerine, BRF+’ta Customize edilebilir şekilde ifade ediyoruz. Bu kurallar ABAP programından çağırılabiliyor ve Power User tarafından uyarlama gibi değiştirilebiliyor. Kullanım mimarisi:
  • 5. SAP BRF+ 5 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Avantajları: SAP Netweaver 7.0’dan beri var (2006). SAP TM, SAM CRM ve SAP Business By Design içinde kullanılıyor. Kullanabilmek için; en az SAP Netweaver 7.0 Enhancement PAck 2 gerekiyor. SICF’te aşağıdaki servislerin etkinleştirilmesi lazım:  /SAP/BC/WEBDYNPRO/SAP/ FDT_WD_WORKBENCH
  • 6. 6 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz  /SAP/BC/WEBDYNPRO/SAP/ FDT_WD_OBJECT_MANAGER  /SAP/BC/WEBDYNPRO/SAP/ FDT_WD_CATALOG_BROWSER BRF+’a erişim için, FDT_WORKBENCHişlem kodu kullanılır. Gerekli Authorization’lar: Authority Object Field Remark S_TCODE TCD = ‘FDT_WORKBENCH’ This authority check is only executed if you use the transaction FDT_WORKBENCH. FDT_OBJECT FDT_ACT (Activity) FDT_OBJTYP (Object Type) FDT_APPL (Application) You can define the allowed activities (for example, Create, Change) for an object. It is also possible to specify the application and the object type. FDT_WORKB FDT_WB_ACT (Workbench Activity) This authority object defines the general access to the workbench (Activity: Start Workbe Application Genel Bakış Tüm BRF+ nesneleri için Container. Workbench  Create Application menüsü ile yaratılır.
  • 7. SAP BRF+ 7 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Application türleri:  Customizing: Power User’ın değişiklikleri Client’a bağlıdır. Uyarlama olarak ele alınır.  Master data: Tüm değişiklikler yereldir, taşınamaz.
  • 8. 8 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz  System: Kimse değişiklik yapamaz. Değişiklikler ancak Workbench Request ile taşınabilir. Faydalı Araçlar Application Usage: Bu Application’u kimler kullanmış – Where Used List Application Cleanup – Extended Program Check gibi Simulation: Uygulamayı ön planda deneme modunda çalıştırma
  • 9. SAP BRF+ 9 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Web Service Generation – Uygulamayı servis olarak yayınlama
  • 10. 10 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Application Exit Application içerisinde, aynen User Exit veya BADI gibi, uygulamanın çalışmasına ABAP müdahelesi gerektiği durumlarda kullanılır. Detaylar: http://scn.sap.com/docs/DOC-4564 Application Exit Method Description AUTHORITY_CHECK If an object is accessed or shall be manipulated, BRFplus performs an authority check first. This exit allows to enhance or even completely replace the default authority checks of BRFplus. CHECK This method is called whenever a BRFplus object is checked for consistency. Additional checks may be implemented within this exit. The exit also affects the possibility to activate an object. (see below) ACTIVATION_VETO Before a BRFplus object can be activated, it needs to be in a consistent state and is therefore checked accordingly. With the activation veto exit it is possible to prohibit the activation also due to other aspects like external dependencies, that might even only be of temporary nature. CHANGE_NOTIFICATION This exit sends a notification if an object is changed. This might e.g. be used for an automatic update of a dependent BRFplus object. SAVE_NOTIFICATION This exit simply gives a notification, if an object is saved. This might e.g. be used for an automatic update of a dependent BRFplus object. GET_ELEMENT_VALUES With this exit it is possible to define a dynamically retrieved list of valid values for a data element in BRFplus. GET_FORMULA_FUNCTIONALS With this application exit the functions that are available for formula expressions can be set. It is possible to restrict the list of standard functions but also to add custom defined functions . GET_CHANGEABILITY With this application exit the changeability of customizing objects can be altered. GET_CALENDAR This application exit can define the usage of a specific calendar for date and time related operations. The exit is currently not relevant for NW70x releases. It is only used for special application platform systems based on NW710 or higher. Catalog Farklı Application’lardaki nesneler; kullanıcılar tarafından rahat ulaşılabilsin diye Catalog’lar içinde toparlanabilir.
  • 11. SAP BRF+ 11 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Function Genel Bakış BRF+ ile ABAP programları arasındaki köprüdür. Input —> Expressions + Rulesets —> Output mantığıyla çalışan bir bloktor. Bir Application altında pek çok Function olabilir. Function’un arkasında sınıf Method’ları türetilir.
  • 12. 12 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Aldığı parametreler, Signature kısmında tanımlanır: Fonksiyon; ABAP’tan çağırılmanın yanı sıra, Web Service olarak da yayınlanabilir veya doğrudan ön ekranda da simule edilebilmektedir.
  • 13. SAP BRF+ 13 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Çalışma Modları Functional Mode: Bildiğimiz fonksiyon gibi; parametre alır, işler ve sonuç döndürür. Simple Use-Cases için uygundur.
  • 14. 14 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Event Mode: Rule Logic doğrudan fonksiyon içinde yer almaz. Bunun yerine, fonksiyon bir Event tetikler ve bu Event’I dinleyen bir/birkaç Ruleset işlenir. Bu Ruleset’ler; tipik olarak Context değerlerini değiştirir ve aksiyonlar başlatır. Bu mod; genelde doğrudan sonuç beklenmeyen karışık Use Case’ler için kullanılır. Örnek: Kredi kartına başvuran kişi için risk faktörü hesaplama. Functional and Event Mode: İkisinin karışımıdır. Önce basit bir Functional Mode çalışır, akabinde Event Mode gibi Ruleset’ler işlenir.
  • 15. SAP BRF+ 15 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Fonksiyonu Programdan Çağırmak Hello World: 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, lv_result_string TYPE string, lx_fdt TYPE REF TO cx_fdt. FIELD-SYMBOLS: <ls_message> TYPE if_fdt_types=>s_message. CONSTANTS: lc_fct_id TYPE if_fdt_types=>id VALUE ‘00145EF41CBA02DDA8819E3B1652013A’. TRY. lo_function = cl_fdt_factory=>get_instance( )->get_function( iv_id = lc_fct_id ). lo_context = lo_function->get_process_context( ). lo_context->set_value( iv_name = ‘INPUT’ ia_value = ‘Hello World’ ). lo_function->process( EXPORTING io_context = lo_context IMPORTING eo_result = lo_result ). lo_result->get_value( IMPORTING ea_value = lv_result_string ). CATCH cx_fdt_processing. lv_result_string = ‘PROCESSING ERROR!’. CATCH cx_fdt INTO lx_fdt. LOOP AT lx_fdt->mt_message ASSIGNING <ls_message>. WRITE: / <ls_message>-text. ENDLOOP. ENDTRY. WRITE:/ ‘The result is : ‘ , lv_result_string. Örnek 1: * Get singleton instance of the FDT factory.
  • 16. 16 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz 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:
  • 17. SAP BRF+ 17 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz 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. Tam bir program örneği: *---------------------------------------------------------------------* * Report Z_BRFPLUS_TEST * *---------------------------------------------------------------------* * * *---------------------------------------------------------------------*
  • 18. 18 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz REPORT z_brfplus_test. PARAMETERS: p_salary TYPE amount. DATA: lo_fuction TYPE REF TO if_fdt_function, lo_context TYPE REF TO if_fdt_context, lo_result TYPE REF TO if_fdt_result. 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 = p_salary. ls_salary-currency = '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 = lo_context IMPORTING eo_result = lo_result ). " Retrieve the BRFplus function result lo_result->get_value( IMPORTING ea_value = 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. Bu programdaki GUID, fonksiyonun GENERAL Tab’ından alınabilir.
  • 19. SAP BRF+ 19 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Simülasyon ekranı: SE38 ekranı:
  • 20. 20 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Web Dynpro’dan çağırma örneği için: http://scn.sap.com/docs/DOC-4578 Fonksiyonu Debug Etmek BRF+ fonksiyonunu Debug etmek için, CL_FDT_FUNCTION=>IF_FDT_FUNCTION~PROCESS Method’una Break Point koyulabilir. Data Object Bir veriyi tarif etmek için kullanılır, yani veri tipidir. 3 temel Data Object türü vardır: Element, Structure, Table. Element Element için kullanılabilecek hazır türler: Data Object Description TEXT Text type without restrictions.
  • 21. SAP BRF+ 21 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz NUMBER Number type without restrictions BOOLEAN Boolean type without restrictions AMOUNT Amount type without restrictions QUANTITY Quantity type without restrictions TIMEPOINT Timepoint type without restrictions TIMESTAMP Timepoint of type Universal Time Coordinated (UTC) timestamp, including date and time DATE_TIME Timepoint of type date and time (local) DATE Timpoint of type date TIME Timepoint of type time USER_NAME Text type, bound to DDIC type SYUNAME BACKGROUND Boolean type, bound to DDIC type SYBATCH ACTION Text type, intended to store IDs of actions Type Length (max.) Decimals (max.) Only Positive Dimension BRFplus Type in IF_ FDT_TYPES ABAP Base Types Text 255 – – – ELEMENT_ TEXT SSTRING Number 31 10 x – ELEMENT_ NUMBER DF34_RAW Boolean – – – – ELEMENT_ BOOLEAN CHAR1 Amount 31 – x – ELEMENT_ AMOUNT DF34_RAW, CHAR5 Quantity 31 10 x x ELEMENT_ QUANTITY DF34_RAW, CHAR3 Timepoint – – – – ELEMENT_ TIMEPOINT DATS,TIMS, TIMESTAMP Bunun yanı sıra; Binding özelliği kullanılarak bir DDIC nesnesine referansla da oluşturulabilir. Tek bir Data Object yaratmak:
  • 22. 22 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Aynı anda birkaç Data Object yaratma adımları:
  • 23. SAP BRF+ 23 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz
  • 24. 24 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Bir Element için (Domain gibi) Fix değerler de verilebilir. Mesela Item’ın Computer, Laptop veya Phone olabilmesini istiyoruz diyelim. Bu durumda; Item elementinin “Domain Values” kısmına bu değerleri yazıyoruz. Structure ABAP’tan bildiğimiz Work Area veya SE11’deki Structure’dır.
  • 25. SAP BRF+ 25 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Table Belli bir Line Type türünde veri içeren ITAB. Expression Fonksiyonun içine doğrudan yazılabilen; 4 işlem, fonksiyon çağırma gibi işlemlerdir. If, or, unless gibi koşulların arkasından değer hesaplayıp döndürebilir.
  • 26. 26 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz BRFplus mimarisinde Expression’ların yeri: Constant En basit Expression türüdür. Fix bir değer barındırır.
  • 27. SAP BRF+ 27 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Decision Table Karar tablosudur. Arka arkaya birden fazla If’I peş peşe koymak yerine Decision Table kullanılabilir. Bitmiş bir Decision Table örneği: Öncelikle; Decision Table sonucunda hesaplanacak olan Output değeri tanımlanır:
  • 28. 28 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Akabinde, Decision Table koşullarında kullanılacak olan değişkenler tanımlanır:
  • 29. SAP BRF+ 29 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Bu noktadan itibaren; her bir koşul için “Insert New Row…” diye diye değerleri tanımlarız. Mesela; “Müşteri ABC ise ve Item Computer ise, %15 indirim uygula” diye tanım yapılabilir. Formula Fonksiyonun herhangi bir yerinde kullanılabilen bir formüldür. Mesela, bir Rule içerisinde bir değer hesaplamak istiyorsak bir formül kullanabiliriz.
  • 30. 30 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Burada gördüğümüz işlemler (topla, çıkar, COS, SIN, vs) aslında ilgili sınıflardaki Method’lardır: İstersek kendimize özel fonksiyonlar da geliştirebiliriz. Detaylar: http://scn.sap.com/docs/DOC-4582 Function Call Bir Function içerisinden bir başka Function çağırmaya yarar.
  • 31. SAP BRF+ 31 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Loop Bildiğimiz döngü. 4 çeşit Loop vardır:  For Each  Repeat n times  Do Until  While Do Table Operation Context içerisindeki ITAB’ın verileriyle ilgili işlemlerdir. Çeşitleri:
  • 32. 32 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Procedure Call Static Method veya Function çağırmaya yarar (SE24 / SE37). Raw, X, Xstring ve referans parametreler Map’lenemez. Random Number Gelişigüzel sayı üretmeye yarar. İki çeşidi vardır:  Bounded number: Verilen iki sayı arasında bir değer türetir (Decimal verilebilir)  Boolean: True veya False döndürür.
  • 33. SAP BRF+ 33 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Decision Tree Decision Table’ın daha karışık, iç içe Condition içeren hali
  • 34. 34 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Case ABAP Case gibi Diğer Expression Türleri Boolean BRMS Connector: BRFplus harici Bir başka Rule Engine ile bağlantı. Detaylar: http://scn.sap.com/docs/DOC-20056 Database Lookup: Doğrudan doğruya veritabanı okuması. Random Number Search Tree Step Sequence Value Range: Bir değer belli bir aralıkta mı değil mi? XSL Transformation Rule Business Logic’in tarif edildiği yerdir. Bir fonksiyon içinde tek bir Rule olabileceği gibi, Ruleset içerisinde birden fazla Rule da tarif edilebilir. Rule yaratma örneği görelim; şu anda bir Ruleset’teyiz:
  • 35. SAP BRF+ 35 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Burada karşımıza If… Then… Else… mantığında bir ekran gelecek. Önce If koşulunu tanımlıyoruz:
  • 36. 36 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Akabinde; Then kısmına istediğimiz şeyi yerleştirebiliriz. Bu örnekte, bir Formula yerleştiriliyor. Bunun yerine; Decision Table gibi başka bir Expression da yerleştirebilirdik.
  • 37. SAP BRF+ 37 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Ruleset Arka arkaya birden fazla Rule içerir. Bu Rule’ların işlenme Condition’larını da belirler (öncelik, vs). Bir fonksiyona birden fazla Ruleset de konabilir. RuleSet tanımlama ekranı:
  • 38. 38 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz  Assign Function: Bu Ruleset’I barındıracak fonksiyon seçilir (sadece bir fonksiyona ait olabilir).  Assign Precondition: Bu Ruleset’in etkinleşmesi için gereken koşullar tanımlanabilir. Bitmiş bir Ruleset:
  • 39. SAP BRF+ 39 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Ruleset Element Bu Ruleset içinde; aynen WorkFlow Container gibi, Element yaratabiliyoruz. Buna Ruleset Variable deniyor. Her bir değişkenin nasıl Initialize edileceğini de tanımlayabiliyoruz:
  • 40. 40 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Ruleset Rule Ruleset içinde çağırılacak her bir Rule’un bir Header bölümü vardır. Burada, Rule’un ne zaman işleyeceğine dair koşullar verilir. Ruleset içine peşi sıra yerleştirilmiş birkaç Rule, şu şekilde gözükecektir:
  • 41. SAP BRF+ 41 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Görüldüğü gibi; Rule’lar arasına Exit Condition’lar da konabilmektedir. Bu şekilde, basit uygulama mantıkları geliştirilebilir. Final Ruleset tanımlaması bittikten sonra; Enable Ruleset demeyi unutmuyoruz: İçi dolu bir Ruleset örneği:
  • 42. 42 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Action Fonksiyon içerisinde yürütülecek işlemleri tanımlar. Log Message Application Log’a mesaj göndermeye yarar.
  • 43. SAP BRF+ 43 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz Procedure Call ABAP Method / Fonksiyon çağırma işlevidir. Diğer Aksiyonlar  E-Posta gönderme  İş akışı başlatma / tetikleme. o Tetikleme için örnek: http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/90109a5 3-d63e-2f10-1eb8- dd45a1559c7a?QuickLink=index&overridelayout=true&53717156077789
  • 44. 44 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz o İş akışı Interaction’u için örnek: http://scn.sap.com/docs/DOC-4568  Context Change: Context değişkenlerinin değerleriyle oynama Genişletme / Kişiselleştirme BRF+ Nesnelerini Z’li Programda Göstermek BRF+ nesnelerini, kendi Z’li Web Dynpro uygulamalarımızda gösterebiliyoruz. Detaylar: http://scn.sap.com/docs/DOC-4578 Bu başlık başta bana ilginç gelse de; kaynakları ve özellikle "FDT_WD_DEMO_EMBED_UI" adlı Web Dynpro uygulamasını incelediğimde şunu gördüm: Buradaki bütün hikaye, BRF kapsamında SAP tarafından geliştirilmiş olan "BRF Object Viewer"ı Z'li Web Dynpro'ya gömmekten ibaret. Z'li Web Dynpro uygulamamıza FDT_IWD_OBJECT_MANAGER'i dahil ediyoruz. Bunun içini de inceledim - CL_FDT_WD_FACTORY=>IF_FDT_WD_FACTORY~GET_VIEWER( ) ile bir Viewer alınıyor ve dönen Component Web Dynpro'ya gömülüyor. Bu sayede, ID'si bilinen bir BRF+ nesnesini (fonksiyon, vs) Z'li Web Dynpro uygulamasında görüntülemek mümkün oluyor. Bu sayede; mesela Z'li bir uygulama ile ilgisi olan bir fonksiyonu, formülü, vs Hotspot mantığında Web Dynpro ekranı içerisinde görüntülemek mümkün olur. Yapılamayacak şey ise; Viewer'ın içerisine müdahele ederek kendi Z'li Property'lerimizi, vs gömmek olur. Toolbar'ı gizlemek gibi basit şeyler yapılabilse de; mesela Function'u gösteren ekranı Screen Exit mantığı ile modifiye edip kendi özelliklerimizi ekleyebileceğimiz ve standart BRF ekranının sadece işimize geldiği kadarını gösterebileceğimiz bir imkan algılayamadım. Viewer'da yapılabilecek basit modifikasyonlar; SE24 -> IF_FDT_WD_CONFIGURATION Method'larında görülebilir; "IF_FDT_WD_USER_CONFIGURATION~SET_*" diye başlayanlara bakabilirsiniz. BRF+ Görünümlerini Kişiselleştirme Farklı kullanıcıların BRF+ ekranında nelerle karşılaşacağını organize edebiliyoruz. Detaylar: http://scn.sap.com/community/brm/blog/2012/12/18/controlling-the- ui-appearance-of-the-brfplus-workbench Simple / Expert Mode Harici Özel Mod: CL_FDT_WD_UI_SIMPLE_MODE sınıfından yeni bir sınıf türeterek, kullanıcının ekranında nasıl bir görüntü istiyorsak onu tanımlayabiliyoruz. Değiştirebileceğimiz parametreler, SE24 - > IF_FDT_WD_USER_CONFIGURATION -> Attributes içerisinde görülebilir (GC_PARAMETER* diye başlayanlar). Burada; sadece belli bir kataloğun açılmasını,
  • 45. SAP BRF+ 45 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz ya da sadece belli nesnelerin gelmesini (örnek: ZBONUS_TURKEY_*) sağlamak mümkün. Buradaki konfigürasyonu, akabinde (mesela) ZBRF diye bir işlem koduna bağlayarak BRF+'taki Admin görüntüsü yerine basitleştirilmiş görüntünün gelmesini sağlayabiliyoruz. Object Filter: Object Filter'lar sayesinde ise; kullanıcıların karşısına gelecek + değiştirebilecekleri nesneleri baştan tanımlayabiliyoruz. Mesela, sadece ZBONUS_TURKEY_APP_* diye başlayan nesneler üzerinde işlem yapabilsinler diyebiliyoruz. Catalog: Son kullanıcı kataloğu yaratarak, sadece bakımı yapılabilecek nesneleri listeletebiliyoruz. Örnek Kodlar Dinamik İşlemler Application Yaratmak DATA: lo_factory TYPE REF TO if_fdt_factory, lo_application TYPE REF TO if_fdt_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( ).
  • 46. 46 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz “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.
  • 47. SAP BRF+ 47 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz 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 içeren 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 Aşağıdaki kod 3 temel adımdan oluşmaktadır: Değişkenleri tanımlamak (LTS_VARIABLE), Expression’ları tanımlamak (LTS_EXPRESSION), Rule’ları tanımlamak (LTS_RULE) DATA: lo_ruleset TYPE REF TO if_fdt_ruleset, lts_rule TYPE if_fdt_ruleset=>ts_rule, lts_variable TYPE if_fdt_ruleset=>ts_variable, lts_expression TYPE if_fdt_ruleset=>ts_init_expr. lo_factory = cl_fdt_factory=>if_fdt_factory~get_instance( iv_application_id = ‘00505683359D02EE98FC41ECA7650AA3’ ). lo_ruleset ?= lo_factory->get_ruleset( ). lo_ruleset->if_fdt_transaction~enqueue( ).
  • 48. 48 SAP BRF+ Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz 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 Değişkenlerini Tanımlamak Aşağıdaki örnekte; iki RuleSet değişkeni tanımlanmıştır. 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 =
  • 49. SAP BRF+ 49 Dr. Kerem Köseoğlu Tesuji Consulting http://www.tesuji.biz 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.