SAP Help create-enhancement-determination
create-enhancement-determination
Step 1 - first create a business object enhancement
find the business object you want to enhance
Create enhancement
enter name and business object and press ok to create
Step 2 - Find business object element Determination
first find the relevant business object enhancement created above
double click on business object z enhancement
Expand the Node Elements
select change mode
and find the node you want to create an enhancement determination for (i.e. ROOT). Note you can expanding the determination
node an see all the existing determinations. Very useful to be able to find code that you might want to use in your new determination.
Step 3 - Create Enhancement Determination
Right click on the Determinatiuons node and choose "Create Determination"
Enter name/details
Click Save and then click on the class interface name you just entered. It should ask if you want to create it. Choose yes.
Now save and activate the newly created determination class interface.
Note the EXECUTE method is where you enter your own code for the determination.
Now return back to the previous BOBX screen and click on the generate button
Step 4 - Example code to update values within determination
METHOD /bobf/if_frw_determination~execute.
DATA: lt_root TYPE /scmtms/t_tor_root_k,
"ls_root TYPE /scmtms/s_tor_root_k,
ls_key TYPE /bobf/s_frw_key,
iv_key TYPE /bobf/conf_key. "/BOBF/S_FRW_KEY.
DATA: lr_root TYPE REF TO /scmtms/s_tor_root_k.
DATA: lt_fieldnames TYPE /bobf/t_frw_name,
ls_fieldnames LIKE LINE OF lt_fieldnames.
* CREATE DATA lr_root.
* lr_root->tspid = 'SSS'.
io_read->retrieve(
EXPORTING iv_node = is_ctx-node_key
it_key = it_key
iv_fill_data = abap_true
IMPORTING
et_data = lt_root
).
LOOP AT lt_root REFERENCE INTO DATA(ls_root) WHERE LABELTXT IS INITIAL.
REFRESH lt_fieldnames.
ls_fieldnames = 'LABELTXT'.
APPEND ls_fieldnames TO lt_fieldnames.
ls_fieldnames = 'TSPID'.
APPEND ls_fieldnames TO lt_fieldnames.
LOOP AT it_key INTO ls_key.
iv_key = ls_key-key.
ENDLOOP.
ls_root->tspid = 'Carrier'.
ls_root->labeltxt = 'Desc'.
io_modify->update(
EXPORTING
iv_node = is_ctx-node_key " Node
iv_key = iv_key " Key
* iv_root_key = " NodeID
is_data = ls_root "lr_root " Data
it_changed_fields = lt_fieldnames " List of Names (e.g. Fieldnames)
).
ENDLOOP.
ENDMETHOD.
Step 5 - Set Determination Trigger Conditions
Within the Trigger Conditions tab you can set what BO elements this determination is triggered for
Step 6 - Set Determination Evaluation Timepoints
Within the "Evaluation Timepoints" tab you can set when this determination is triggered (i.e. before save, after save etc)