Bopf Code
Bopf Code
sqlViewName: 'ZCDSAUGMEAL'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'CDS BOPF Integration for transactional Fiori App'
@OData.publish: true
@Metadata.allowExtensions: true
@ObjectModel: {
modelCategory: #BUSINESS_OBJECT,
compositionRoot: true,
transactionalProcessingEnabled: true,
createEnabled: true,
updateEnabled: true,
deleteEnabled: true,
draftEnabled: true,
writeActivePersistence: 'ZFLIGHT_MEALS',
writeDraftPersistence: 'ZDFLIGHT_MEALS'
}
@Metadata.layer: #PARTNER
annotate view ZCDS_AUG_FLIGHT_MEAL
with
{
@UI.lineItem: [{position: 10 }]
@UI.identification: [{position: 10 }]
@UI.hidden: true
meal_id;
@UI.selectionField: [{position: 10 }]
@UI.lineItem: [{position: 10 }]
@UI.identification: [{position: 10 }]
carrid;
@UI.selectionField: [{position: 20 }]
@EndUserText.label: 'Flight Number'
@UI.lineItem: [{position: 20 }]
@UI.identification: [{position: 20 }]
connid;
@UI.selectionField: [{position: 30 }]
@UI.lineItem: [{position: 30 }]
@UI.identification: [{position: 30 }]
meal;
@UI.lineItem: [{position: 40 }]
@UI.identification: [{position: 40 }]
@UI.hidden: true
total_seats;
@UI.identification: [{position: 50, type: #FOR_ACTION, dataAction:
'BOPF:APPROVE', label: 'Approve/Reject' }]
@UI.lineItem: [{position: 50, type: #FOR_ACTION, dataAction: 'BOPF:APPROVE',
label: 'Approve/Reject' }]
status;
public section.
methods /BOBF/IF_FRW_VALIDATION~EXECUTE
redefinition .
protected section.
private section.
ENDCLASS.
method /BOBF/IF_FRW_VALIDATION~EXECUTE.
io_read->retrieve(
exporting
iv_node = is_ctx-node_key " Node Name
it_key = it_key " Key Table
importing
et_data = lt_data
).
if eo_message is initial.
eo_message = /bobf/cl_frw_factory=>get_message( ).
endif.
select single 'X' into @data(lv_exist) from scarr where carrid = @<fs>-
carrid.
if lv_exist <> 'X'.
eo_message->add_message(
exporting
is_msg = value #( msgid = 'SY' msgno = '499' msgv1 = 'Invalid
Flight Company' msgv2 = <fs>-carrid ) " Message that is to be added to the
message object
iv_node = is_ctx-node_key " Node to be used in the origin
location
iv_key = <fs>-key " Instance key to be used in the origin
location
iv_attribute = ZIF_CDS_AUG_FLIGHT_MEAL_C=>sc_node_attribute-
zcds_aug_flight_meal-carrid " Attribute to be used in the origin location
iv_lifetime = /bobf/cm_frw=>co_lifetime_transition " Lifetime
of the message
).
endif.
clear lv_exist.
select single 'X' into @lv_exist from spfli where carrid = @<fs>-carrid and
connid = @<fs>-connid.
eo_message->add_message(
exporting
is_msg = value #( msgid = 'SY' msgno = '499' msgv1 = 'Invalid
Flight Connection' msgv2 = <fs>-connid msgv3 = <fs>-carrid ) " Message that is
to be added to the message object
iv_node = is_ctx-node_key " Node to be used in the origin
location
iv_key = <fs>-key " Instance key to be used in the origin
location
iv_attribute = ZIF_CDS_AUG_FLIGHT_MEAL_C=>sc_node_attribute-
zcds_aug_flight_meal-connid " Attribute to be used in the origin location
iv_lifetime = /bobf/cm_frw=>co_lifetime_transition " Lifetime
of the message
).
endif.
endloop.
endmethod.
ENDCLASS.
public section.
methods /BOBF/IF_FRW_DETERMINATION~EXECUTE
redefinition .
protected section.
private section.
ENDCLASS.
io_read->retrieve(
exporting
iv_node = is_ctx-node_key " Node Name
it_key = it_key " Key Table
importing
* eo_message = " Message Object
et_data = lt_input_from_user " Data Return Structure
* et_failed_key = " Key Table
* et_node_cat = " Node Category Assignment
).
io_modify->update(
exporting
iv_node = is_ctx-node_key " Node
iv_key = lo_inp->key " Key
iv_root_key = lo_inp->root_key " NodeID
is_data = lo_inp " Data
it_changed_fields = value #( (
ZIF_CDS_AUG_FLIGHT_MEAL_C=>sc_node_attribute-zcds_aug_flight_meal-
total_seats ) ) " List of Names (e.g. Fieldnames)
).
endloop.
endmethod.
ENDCLASS.