0 ratings0% found this document useful (0 votes) 1K views40 pagesAdd Button and Function To CDS VIEW
Add button and function to CDS VIEW sap abap fiori
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
oo2r2024, 19:49 Fiori Elements List- Ade and Implement Acton But... SAP Community
SAP Community > Products and Technology > Technology > Technology Blogs by Members
> Flori Elements List - Add and implement Action But.
Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP
products, technology, and events. Get in the mix!
Allcommunity ¥ What are you looking for today?
Fiori Elements List - Add and Implement Action Button
Pawan_Kesari
Active Contributor
°
05-31-2019 1:07 PM
32 Kudos
Recently, | worked on a requirement where we had to add an action button on Fiori
Elements List Report. Looked at various options but nothing seems straightforward. UIS
Demo Kit suggests using UI5 Extensions which | wanted to avoid if | could. There are
some annotations related to function import which looked promising but | couldn't find
any blog/help document on how to actually use them in CDS and implement in the
OData service. Then | saw actions using BOPF, but this report which | was working didn’t
have any business object attached to it.
Looking at some SAP standard apps | finally figured out how to achieve this without UIS
extension in Web-IDE.
For the purpose of this blog, I'll use tried and tested flight data model. You should be
able to replicate the solution in your system using the code I've provided.
Code Edit Feb-2020 : Added fields IsActiveCancelFlight and IsActiveKeepFlight in
nitps:community sap.comfSitechnology-blogs-by-membersfr-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 140owas, 1949 Fri Elements List Add and Implement Action But... SAP Community
CDS ZI_FlightConnections. Added ABAP code in method ADD_ACTION towards the
end to add action-for and applicable-path annotations.
Introduction
In this blog I'll show you how to add action button(s) on Fiori Element List Page without
making UIS extension in Web-IDE or using BOPF.
Setting the Scene
In this Fiori Elements List report app, | am going to display a list of flight connections
(from table SPFLI) and I'll show to how to add actions which we can use to cancel the
flight and reverse the cancellation. In part 1 of the blog, we will see basic
implementation. To keep blog manageable (for me) | am going to keep additional
features like message handling, enable/disable action buttons in part 2 of the blog.
As a starting point, I have this Fiori Elements List App which is based on CDS View. | have
exposed CDS View via SEGW using Data Source Reference.
CDS View: ZI_FlightConnections
nitpsscommunity sap.comsitechnology-blogs-by-membersfor-slements-ist-adé-anc-mplement-action-nttonfba-p/13413880 240oo2r2024, 19:49 Fiori Elements List- Ade and Implement Acton But... SAP Community
@abapCatalog.sqlViewNane: ‘ZISPFLICL
@AbapCatalog.compiler.compareFilter: true
@accessControl -authorizationcheck: #CHECK
@EndUserText.label: ‘Flight Connections"
define view ZI_FlightConnections
as select from spfli
left outer join zspfli_act as CancellationInfo on spfli.carrid = Cance
and spfli.connid = Cance
association [@..1] to U99_I_Airline as Airline on $projection.
association [@..1] to U99_IAIRPORT as _AirportFrom on $projection.
association [@..1] to U99_IAIRPORT as AirportTo on $projection.
association [@..1] to $_CityAirport as CityFrom on $projection.
association [8..1] to $_CityAirport as _CityTo on $projection.
@0bjectModel. foreignkey.association: ‘_Airline’
wu:
key spfli.carrid as Airline,
@UI.lineItem: [{ position: 20 }]
key spfli.connid as FlightConnection,
@0bjectModel.. foreignkey associatior
wu:
spfli.cityfrom as CityFrom,
_CityTo"
@0bjectModel. foreignkey.association: ‘_AirportFrom’
wu:
spfli.airpfron as Airportfrom,
@0bjectModel. foreignkey association:
eu
spfli.cityto as CityTo,
*_CityTo*
@0bjectModel. foreignkey.association: '_AirportTo’
@UI: { lineItem: [{ position: 89 }] , selectionField: [{ positic
spfli.airpto as AirportTo,
@UI.1ineTtem: [{ position: 98 }]
spfli.deptime as DepartureTime,
@UI.lineItem: [{ position: 1¢0 }]
spfli.arrtime as ArrivalTime,
@UI.lineItem: [{ position: 120 }]
nitpsscommurity sap.comfsitechnology-blogs-by-membersfor-slements-is
1-anc-implement-action-uttonfba-p/13419880
Airlin
Airpor
‘Airpor
cityrr
CityTo
: { LineItem: [{ position: 10 }] , selectionField: [{ position: 16
{ Lineltem: [{ position: 49 }] , selectionField: [{ position: 15
{ LineItem: [{ position: 5@ }] , selectionField: [{ position: 2¢
{ lineItem: [{ position: 7@ }] , selectionField: [{ position: 25
lon: 30
40oo2r2024, 19:49
47
48
49
58
st
82
53
54.
55
GRBSASsers
Fiori Elements List- Ade and Implement Acton But... SAP Community
@EndUserText.label: ‘Cancelled On’
CancellationInfo.cancelledon,
@UL.Linertem: [{ position: 136 }]
@EndUserText.label: ‘Cancelled By’
CancellationInfo.cancelledby,
@UL.hidden:true
cast( 'X' as boole_d ) as IsActiveCancelFlight,
@UI.hidden: true
cast ( 'X’ as boole_d ) as IsActivekeepFlight,
_Airline,
_Airportfrom,
_AirportTo,
_CityFrom,
_cityTo
SEGW: ZIFLTCON
SAP Gateway Service Builder
eiti«
Cty | Dera Rares [5 te od Mer
sey Enea ‘Sid vay
Table: ZSPFLILACT
https:Ieommunty.sap.comttechnology-blogs-by-memibersiir-lemer
ist-ade-anc-implement-action-buitonfba-p!13413889
440owas, 1949 Fri Elements List Add and Implement Action But... SAP Community
Trane Tobe [ESPFETLAGT JS) Ave
Stor Desaion Tie Schete cn Do
Zebu | Daberyand Martane MIEITM troeb/Gheck | comeno/Quarty ls _| indexes
8 FIsISIA| al see a Fi
re rs a Tl ai Us| LOS
eae es ca ee
nee en meen
wie bee ee al Cafe Scan
Seine ca en Tal Operas of Peer oe Goad oe
oe = oe EmmGiaset oepeeeTierencer
App
scam EEE ans a
If you are struggling to get to this point | would recommend you check Fiori Elements
Wiki Page, section How to Guides for List Report. Make note that | have exposed CDS via
SEGW and not directly using OData.pubish annotation. This is important because its
DPC_EXT and MPC_EXT classes which we will be using to add actions and put ABAP.
code to process these actions.
Adding Action Button
We are going to add two action buttons ‘Cancel Flight’ and ‘Keep Flight’. On these
actions we will set and reset values in fields Cancelled on and Cancelled by.
To add action button first we will have to add function import in OData service following
which we will add annotation in CDS View to display buttons and link it to function import
name.
nitpsscommunity sap.comsitechnology-blogs-by-membersfor-slements-ist-adé-anc-mplement-action-nttonfba-p/13413880 540oo2r2024, 19:49 Fiori Elements List- Ade and Implement Acton But... SAP Community
Adding Function Import
In MPC_EXT class add following private method. This code add function import to OData
service. It defines importing parameters, return parameter etc.
nitpsscommunity sap.comsitechnology-blogs-by-membersfor-slements-ist-adé-anc-mplement-action-nttonfba-p/13413880 eooo2r2024, 19:49 Fiori Elements List- Ade and Implement Acton But... SAP Community
1 | * -
2. * | Instance Private Method ZCL_ZIFLTCON_MPC_EXT->ADD_ACTION
3) te
al* >] IV_ACTION_NAME TYPE /TWBEP /MED_EXTERNAL_N
5
6 | method add_action.
7
8 data: Iv_fc_fieldvalue type /inbep/med_annotation_value,
9 lo_complex_type type ref to /inbep/if_mgw_odata_cmplx_type,
10 Jo_prop type ref to /iwbep/if_mgw_odata_property.
n
R data(1o_action) = model->create_action( iv_action_nane ).
B
“ “set return parameter
15 lo_action->set_return_entity_type( ‘ZI_FlightConnectionsType" )
16 lo_action->set_return_entity_set( 'ZI_FlightConnections’ ).
2
18 Jo_action->set_http_method( ‘PUT’ ).
19 Jo_action->set_return_multiplicity( /inbep/if_mgw_med_odata_types=>gcs_
2 ‘specify input parameters
a data(1o_parameter) = lo_action->create_input_parameter(
2 iv_parameter_name = ‘Airline’
B iv_abap_fieldname = ‘ATRLINE' ).
"a 1o_paraneter->/iwbep/if_mgu_odata_property~set_type_edn_string( ).
5 lo_parameter->set_maxlength( iv_max_length = 3 ).
6
2 data(1o_parameter1) = lo_action->create_input_parameter(
28 iv_parameter_name = 'FlightConnection’
2 iv_abap_fieldname = "FLIGHTCONNECTION' ).
39 o_paraneter1->/iwbep/if_mgu_odata_property~set_type_edn_string( ).
31 Jo_parameter1->set_maxlength( iv_max_length = 4 ).
32
33 “Is Action Active?
a concatenate ‘IsActive’ iv_action_name into data(1v_action_ac).
35
36 data(1o_annotation) = lo_action->/iwbep/if_mgw_odata_annotatabl~create_
7 Jo_annotation->add( iv_key = ‘action-for' iv_value = 'Z1_FlightConnecti
38 Jo_annotation = lo_action->/iwbep/if_mgu_odata_annotatabl~create_annota
39 Jo_annotation->add( iv_key = ‘applicable-path’ iv value = 1v_action_ac
40
41 | endnethod.
Redefine DEFINE method in MPC_EXT class and make call to ADD_ACTION method to
nitpssicommurity sap.comfsitechnology-blogs-by-membersfor-slements-is
1-anc-implement-action-uttonfba-p/13419880 7140oo2r2024, 19:49 Fiori Elements List- Ade and Implement Acton But... SAP Community
add function imports.
1 | method define.
2 super->define( ) .
3 add_action( iv_action_name = ‘CancelFlight’ ) .
4 add_action( iv_action_name = ‘KeepFlight’ ) .
5 | endmethod.
Following above changes check OData service metadata have function import added to
‘eopFlight” EntySet="21FlightConmectons" sop:zpplcaiepath="TeketvekeepF light space
AIFLCON SHV. ighiConnectonsrype">
“parameter Ramme="Airines Moxangh
Change to CDS to Add Action Buttons.
In CDS add following annotation (UI.\ineitem) before field Airline. With this annotation we
are defining button (label), and asking system to call respective function import on these
actions.
1 | define view 21_FlightConnections
2| as select fron spfli
3 cee
ait
5
6 @0bjectModel.foreignkey.association: '_Airline’
7 @UT: { linerten: [{ position: 10} ,
8 { type: #FOR_ACTION, invocationGrouping: #CHANGE_SE
9 { type: #FOR_ACTION, invocationGrouping: #CHANGE_SE
18 selectionField: [{ position: 10 }]}
| key spfli.carrid as Airline,
2
B
a) }
After above changes and activation you should be able to see action buttons on the list
nitpsscommunity sap.comsitechnology-blogs-by-membersfor-slements-ist-adé-anc-mplement-action-nttonfba-p/13413880 aiooo2r2024, 19:49 Fiori Elements List- Ade and Implement Acton But... SAP Community
page.
ee io Gorn Ar Do
Code to Process Action
Fiori Element List Report uses batch processing, To enable batch processing, in
DPC_EXT class redefine method fiwbeplif_mgw_appl_srv_runtime~changeset_begin.
Also, we will process all requests together, hence set cv_defer_mode = abap_true.
1 | method /iwbep/if_ngw_appl_srv_runtime~changeset_begin.
cv_defer_mode = abap_true .
3| endmethod.
Next, redefine method /iwbep/if_mgw_appl_srv_runtime~changeset_process and put
below code in it. Inline comment in code should give you clue one whats happening
nitpsscommunity sap.comsitechnology-blogs-by-membersfor-slements-ist-adé-anc-mplement-action-nttonfba-p/13413880 40oo2r2024, 19:49 Fiori Elements List- Ade and Implement Acton But... SAP Community
nethod /iwbep/if_ngw_appl_srv_runtine~changeset_process.
data : lo_func_import_context type ref to /iwbep/if_mgw_req_func_import
1t_paraneters type /inbep/t_ngw_nane_value_pair,
Ls flight_con_status type zspfli_act,
As_result type zcl_zifltcon_mpc_ext=>ts_zi_flightco
1s_changeset_response type /imbep/if_mgw_appl_types=>ty_s_chang
“read requests where operation is execute action (EA)
loop at it_changeset_request assigning field-symbol (<1fs_changeset_requ
-gcs_operation_
where operation_type = /iwbep/if_mgw_appl_type:
“find function name
lo_func_import_context ?= <1fs_changeset_request>-request_context
data(1v_function_import_name) = lo_func_import_context->get_function_
if lv_function_import_name = ‘CancelFlight’ or 1v_function_import_nam
“read parameters
1t_parameters = 1o_func_import_context->get_parameters( ).
1s_flight_con_status-carrid = 1t_parameters[ name = ‘AIRLINE’ ]-val
* FLIGHTCONNECTI
1s_flight_con_status-connid = 1t_parameters[ name
“set/reset values
case 1v_function_import_name.
when ‘CancelFlight'.
1s_flight_con_status-cancelledby = sy-uname .
1s_flight_con_status-cancelledon = sy-datum .
when ‘KeepFlight'.
clear 1s_flight_con_status-cancelledby
clear 1s_flight_con_status-cancelledon .
endcase .
modify zspfli_act from 1s flight_con_status .
“select new values
"do you know - even if you haven't yet committed the changes,
“system will return new data
“search ‘transaction isolation levels’ to read more on this
select single from zi_flightconnections fields *
where airline = @ls_flight_con_status-carrid
and flightconnection = @ls_flight_con_status-connid
into corresponding fields of @ls_result .
repare response with operation number and respective data,
“insert in CT_CHANGESET_RESPONSE
1s_changeset_response-operation_no = <1fs_changeset_request>-operat
nitps:community sap.comstechnology-blogs-by-membersifr-slements-ist-adé-anc-mplement-action-nttonfba-p/13413880 1040oo2r2024, 19:49 Fiori Elements List- Ade and Implement Acton But... SAP Community
a7 copy_data_to_ref(
48 exporting
2 is_data = 1s_result
50 changing
Ss. cr_data = 1s_changeset_response-entity_data ).
s2
3 insert 1s_changeset_response into table ct_changeset_response.
sa endif .
55 endloop .
56 | endnethod.
Result
After activation buttons should work
© ITT rom conmetons Acton ane +
Conclusion
Action can be added to Fiori Element List Report using annotation, code in MPC_EXT
and DPC_EXT classes.
Hope you found this blog useful.
As | mentioned earlier | couldn't find way to add action using BOPF in List Report. If you
have managed to do that then please share your experience.
nitpsscommunity sap.comsitechnology-blogs-by-membersfor-slements-ist-adé-anc-mplement-action-nttonfba-p/13413880 1140owas, 1949 Fri Elements List Add and Implement Action But... SAP Community
What's next:
Iplan to write next part of this blog.
Action to download file e.g. download sales confirmation output on list of sales order.
SAP Managed Tags:
‘SAP Fiori, ABAP Development, OData
Tags:
abap cds view action button SAP Fiorielements SAP Fiori List Report
33 Comments
J Joseph_BERTHE
Active Contributor
°
06-01-2019 8:02 AM
1 Kudo
Hello,
Thanks for sharing, but | would like to know why you are using ABAP code to create your
Function Import whereas SEGW has wizard to do it ?
nitps:community sap.comfSitechnology-blogs-by-membersfr-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 20oo2r2024, 19:49 Fiori Elements List- Ade and Implement Acton But... SAP Community
Regards,
Joseph
Pawan_Kesari
Active Contributor
Q
06-03-2019 6:45 AM
0 Kudos
Hi Joseph,
Wizard option does not let you create function import on or using entities/entity types
which are coming from ‘Data Source References’. As you can see from below screenshot
cannot select values for ‘Return Entity Set’, and the same thing happens for ‘Action for
Entity Types’.
= en tam Sen ie
~«€& OO
SAP Gateway Service Builder
Die |5\/a/e)(« mlm)
Tove aR Tp ier CR ay STP kn ey Theale
Coat ey Tyee gt aes Te
>
1 Fntan inane
Coat
Das Swe Reece
Va ones va SL
costray pence
https:Ieommunty.sap.com/tStechnology-blogs-by-membersiior-slements-lst-add-anc-implement-acton-buttonba-p!13413889 1340oo2r2024, 19:50 Fiori Elements List- Ade and Implement Action But
J 2REephBERTHE
Active Contributor
0 Kudos
You rigth, to have actions we have to use BOPF.
Regards,
Joseph
former_member613184
Explorer
0 Kudos
Thanks for Sharing!
chrisgr
Explorer
0 Kudos
‘SAP Community
°
06-05-2019 7:47 AM
°
06-05-2019 9:32 AM
°
07-24-2019 5:31 PM
nitps:community sap.comfSitechnology-blogs-by-membersfr-slements-ist-adé-ancmplement-action-nttonfba-p/13413880
1440oo2r2024, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
Hello,
Very nice and usefull blog.
Ihave done the same steps and my buttons are not active in the layout.
Search Ate &
Custemer Ret: Document Dat
al Aaa sy ay a ap Fa
Ae
Detail Vow (17) Summarized View (1)
Line Items (17) 8 6
ction Document Document Date Customer Ret Bockng Doc Baking tm
| 740000265 Now24,2018 117309687 yaooo00098
in Stare Date: Nov 12, 2018
Tin End Dste: Nov 12, 2018,
can see the function import in the metadata:
15140oo2r2024, 19:50
weeyvannune
10
1
2
B
4
15
16
v7
18
19
2
2
2B
24
weVannune
10
1
2
Fiori Elements List- Ade and Implement Acton But... SAP Community
METHOD add_action.
DATA: lv_fc_fieldvalue TYPE /inbep/med_annotation_value,
Jo_complex_type TYPE REF TO /iwbep/if_mgw_odata_cmplx_type,
Jo_prop TYPE REF TO /iwbep/if_mgw_odata_property.
DATA(1o_action) = model->create_action( iv_action_name ).
1o_action-»set_action_for( ‘xLIONxC_REV_DeductionItenType" ).
* — 1o_action-»set_disabled( EXPORTING iv disabled = abap_false ).
“set return parameter
lo_action->set_return_entity_type( 'xLIONxC_REV_DeductionItemType' )
lo_action-»set_return_entity_set( 'xLIONxC_REV_DeductionItem’ ).
Jo_action->set_http_method( ‘PUT’ ).
lo_action->set_return_multiplicity( /iwbep/if_mgw_med_odata_types=>gcs_
“specify input parameters
DATA(1o_parameter) = lo_action->create_input_parameter(
iv_parameter_name = ‘DedDoc'
iv_abap_fieldname = "DEDOC’ ).
1o_paraneter->/iwbep/if_mgw_odata_property~set_type_edn_string( ).
Jo_parameter->set_maxlength( iv.max_length = 10 ).
ENDMETHOD.
in the COS views:
@objectHodel.readonly: true
@EndUserText.abel: "Deduction Document
QUI: { identification.position: 10,
LineTtem: [{ position: 10 } ,
{ type: #FOR_ACTION, position: @, dataAction: ‘MPC_
{ type: HFOR_ACTION, position: 1, dataaction: ‘MPC_
{ type: #FOR_ACTION, position: 2, dataAction: 'MPC_
{ type: #FOR_ACTION, position: 3, dataAction: ‘MPC_
{ type: HFOR_ACTION, position: 4, dataAction: ‘MPC_
1)
When I run the appication, i have some errors in the console related to the function
nitpssicommurity sap.comfsitechnology-blogs-by-membersfor-slements-is
1-anc-implement-action-uttonfba-p/13419880 640oo2r2026, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
import:
aust7-26 181s 895 Teeateanonets ve eli exch ty aegrent st rosie
i otal iy Oks emetatie = Ler
FA PETES S20 AY SUCTION SSL AOGTON te tae ee
35 the func art LAY DEDACTING SRT AY RUCTINS_ SB. Enseee RESETS Se ct Aaa Se
Do you have any idea why the buttons are not active?
Thanks in advance for your help.
Christophe
Pawan_Kesari
Active Contributor
©
08-07-2019 9:10 AM
1 Kudo
Hi,
Ihave recently noticed this issue in another system. Can you please try with below
additional code and let me know if it works. I'll update blog soon to reflect this.
In CDS add additional field of type boolean for each action, which would control whether
https:Ieommunty.sap.com/Stechnology-blogs-by-membersiier-slements-lis-add-anc-implement-acton-buttonba-p!13413889
740oo2r2026, 19:50
Fiori Elements List- Ade and Implement Acton But... SAP Community
action is available or not on that row. You can simply make it 'X'true if itis going to be
available on all rows.
ween
@UI.hidder
cast( "x
@UI. hidder
cast ( 'X' as boole_d ) as IsActivekeepFlight,
rtrue
as boole_d ) as IsActiveCancelFlight,
rue
Add following lines in method ADD_ACTION towards the end.
Noausune
"Is Action Active?
concatenate ‘IsActive’ iv_action_name into data(1v_action_ac).
data(1o_annotation) = lo_action->/iwbep/if_mgw_odata_annotatabl~create_
lo_annotation->add( iv_key = ‘action-for' iv_value = 'ZI_FlightConnecti
1o_annotation = 1o_action->/iwbep/if_mgw_odata_annotatabl~create_annota
1o_annotation->add( iv_key = ‘applicable-path’ iv_value = 1v_action_ac
AY) termer_memberz22225
Explorer
Hi Pawan,
°
02-05-2020 4:04 PM
1 Kudo
superclass of DPC_EXT does not have a define method.
Didn't you want to refer to MPC_EXT?
Best regards,
Otte
nitpsscommunity sap.comstechnology-blogs-by-membersifo-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 1840oo2r2024, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
former_member644343
Discoverer
°
03-17-2020 5:47 PM
0 Kudos
Can you tell us the approach for Excel download
former_member512938
Participant
°
05-11-2020 2:54 PM
0 Kudos
manasa_cbs
Please be aware of the steps described this blog :
https://blogs.sap.com/2019/10/1.4/sap
standard
for-sap-s4hana-adding-export-to-excel-
For a custom List-Report, you just need to execute de SAPUIS Visual Editor on your
front-app project and enable the Smart Table "export to Excel" property.
Hope this helps.
Regards,
Olivier
nitpsscommunity sap.comstechnology-blogs-by-membersifo-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 1940oo2r2024, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
tursko
Participant
°
06-09-2020 4:19 PM
1 Kudo
This is correct. You change the DEFINE method in the MPC_EXT class.
Meinrad
Participant
°
06-19-2020 6:01 PM
1 Kudo
Hi Pawan,
thanks you so much for this blog! It was a good starting point for me and I think | can
give you some update from my side. Just in case you haven't discovered yet. ?
Maybe we can avoid redefinitions in MPC_EXT and DPC_EXT
Hound this online help
hittps://help.sap.com/doc/saphelp_nw75/7.5.5/en-
US/07/1a1fd1465749dca2872640cba8d82e/frameset.htm
It seems to be key to use something like
nitps:community sap.comfSitechnology-blogs-by-membersfr-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 20140oo2r2024, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
1 | dataaction: ‘BoPF:FOO"
instead of some MPC_EXT. Of course, FOO is the action’s name in my simple case.
This annotation created a new property in my OData service. The name of the property
was “Foo_ac’,
So far, so good. But it did not work out of the box. For some reason, the value was
always false and my button was disabled
Using debugger I found the following call
1 post_process_read_entityset(
2 EXPORTING
3 io_model 1o_model
4 io_expand_root 1o_expand_root
5 io_request_obj = 1o_request_obj
6 it_header = mt_headers
7 iv_generate_sts = lv_generate_sts
8 iv_sts_are_ready_to_use = Iv_sts_are_ready_to_use
9 CHANGING
16 cv_response_body = ev_response_body
nu ct_header = ct_headers
2 cr_entityset = crentityset
B cr_deleted_entityset = cr_deleted_entityset
u cs_response_context = ¢s_response_context
15 ct_inline_info = ct_inline_info ).
(Method: wbep/cl_mgw_abs_data->/iwbep/if_mgw_core_srv_runtime~read_entityset)
In debugging mode | could set Foo_ac to ‘x’ in the dereferenced table cr_entityset and
the button become enabled and was working nicely.
I hope | have some time soon to investigate further.
But |’m happy if someone else has an idea. ©
Thanks again for your work.
nitpsscommunity sap.comsitechnology-blogs-by-membersfor-slements-ist-adé-anc-mplement-action-nttonfba-p/13413880 240oo2r2026, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
Meinrad
Pawan_Kesari
Active Contributor
Q
09-22-2020 1:13 PM
0 Kudos
Hi Meinrad,
Thank you for your feedback.
You are absolutely right, with BOPF the way of defining and implementing action is
different than how | have done in the blog.
Blog will however apply to use cases where you might not have BOPF( e.g transaction
processing is not enabled in CDS).
MPC_EXT and DPC_EXT classes are there to be redefined so if needed for a given
scenario/requirement then we should redefine methods in these classes.
On the topic of how to enable disable the action dynamically you might find this SAP
Help useful.
Pawan.
Kishore
Participant
°
11-30-2020 10:56 AM
nitps:community sap.comfSitechnology-blogs-by-membersfr-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 2240oo2r2024, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
© | okudos
Hello Pawan,
Thanks for the blog. | tried exactly the same approach but | see a pop whenever I click
the action button.
Thanks,
Kishore.
Kishore
Participant
©
11-30-2020 11:04 AM
1 Kudo
| figured it out! This is the behavior when we add any non key fields as input parameters.
https:Ieommunty.sap.com/Stechnology-blogs-by-membersiier-slements-lis-add-anc-implement-acton-buttonba-p!13413889 2340oo2r2026, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
axel_mohnen_ctie
Explorer
°
01-29-2021 2:28 PM
0 Kudos
Hi Pawan,
first of all thanks a lot for this excellent blog.
| followed all your steps. The button is visible in the list report.
The problem is when I fire the action button, first | see the popup window with the key
fields. After confirmation the backend system raises the following exception:
CX_SADL_CONTRACT_VIOLATION’,"message":"
No mapping for function import ‘AssignTask' to action
Here is my analysis:
Class: CL_SADL_METADATA_PROVIDER
Method: IF_SADL_METADATA_PROVIDER~ODATA_V2_GET_ACTION_FOR_FIMPRT
Instance attribute: mr_load->odata_v2_action_mapping
The “odata_v2_action_mapping" table is empty which is the reason for the exception.
Did you every see this error? Do you have any idea?
Thanks a lot in advance.
Kind regards
nitps:community sap.comfSitechnology-blogs-by-membersfr-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 2040oo2r2026, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
Axel
Pawan_Kesari
Active Contributor
9
02-01-2021 5:24 PM
0 Kudos
Hi Axel, if you have added only key fields in parameters then popup should not appear.
Code Edit Feb-2020 : Added fields IsActiveCancelFlight and IsActiveKeepFlight in
CDS ZI_FlightConnections. Added ABAP code in method ADD_ACTION towards the
end to add action-for and applicable-path annotations.
axel_mohnen_ctie
Explorer
°
02-04-2021 1:26 PM
0 Kudos
Hi Pawan,
thanks a lot for your reply.
l added the field "IsActiveAssignTask" to my CDS View and enhanced the ADD_ACTION
method.
Unfortunately, | still have the same issue:
nitps:community sap.comfSitechnology-blogs-by-membersfr-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 2540oo2r2026, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
CX_SADL_CONTRACT_VIOLATION","message”.”
No mapping for function import ‘AssignTask’ to action
My CDS View is an analytical view (sap:semantics="aggregate’). This is maybe the issue!
In SEGW I can see that the entity type has been generated with a new key field ID
(ABAP: GENERATED_1D). This is the only key field. The original key fields from the CDS
View are normal entity fields now.
| guess this is the reason why I'm receiving the parameter popup window (Non-key
fields).
I tried to add the auto-generated key field "ID" to the action input parameters, but I'm
getting the following error message:
Key parameter of action not found in current context: ID
How can | combine Analytical view (CDS View) with action button in SEGW?
BOPF action doesn't work, because "@ObjectModel transactionalProcessingDelegated:
true” and "@Defaultaggregation: #SUM" doesn't like each other.
Thanks a lot for your help.
Kind regards
Axel
axel_mohnen_ctie
Explorer
nitps:community sap.comfSitechnology-blogs-by-membersfr-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 26140oo2r2026, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
02-12-2021 8:19 AM
0 Kudos
Hi Pawan,
| found the issue!
By mistake | implemented the wrong methods.
This:
/IWBEP/IF_MGW_CORE_SRV_RUNTIME~CHANGESET_BEGIN
/IWBEP/IF_MGW_CORE_SRV_RUNTIME~CHANGESET_PROCESS
instead of:
/IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_BEGIN
IIWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_PROCESS
The action is working fine now.
The issue with the auto-generated key field "ID" (sap:semantics="aggregate") still
remains.
Any idea would be helpful.
Thanks,
Kind regards
Axel
nitps:community sap.comfSitechnology-blogs-by-membersfr-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 274022024, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
axel_mohnen_ctie
Explorer
°
02-15-2021 9:38 AM
0 Kudos
Hi Pawan,
I recognize another issue.
Did you every try to raise an exception (/IWBEP/CX_MGW_BUSI_EXCEPTION) in the
"CHANGESET_PROCESS" method?
The exception and corresponding error message seems to be forwarded correctly via
oData service, but in the Fiori element UI the error becomes interpreted incorrectly.
nitps:community sap.comSechnology-blogs-by-membersifior-slementsist-ade
1 implement-action-uttonfba-p/13413880 240oo2r2026, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
Are you aware about this issue?
Thanks a lot for your help.
Kind regards
Axel
axel_mohnen_ctie
Explorer
°
02-26-2021 2:39 PM
1 Kudo
Issue has been solved:
https://answers.sap.com/questions/13291410/sap-fiori-
handling, htmlét
axel_mohnen_ctie
Explorer
°
03-02-2021 9:43 AM
0 Kudos
nitps:community sap.comfSitechnology-blogs-by-membersfr-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 2040oo2r2026, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
Hi Pawan,
do you know how to make the action button active without selecting a table line?
By default the button is inactive and only when selecting a line, the button become
active
This would be helpful for a kind of line creation (+) feature.
Thanks a lot.
Kind regards
Axel
former_member212729
Explorer
©
03-08-2021 4:55 PM
0 Kudos
Hi Pawan,
Thanks for this excellent and helpful Blog!!
Can you please help me with below points,
1. Is it possible to pass the parameter to action which is not a Key field in CDS View?
when i'm trying to pass non key field in parameter it giving me popup screen for
input. In case of single row selection it's giving popup but values are filled in this
case.
nitps:community sap.comfSitechnology-blogs-by-membersfr-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 040owas, 1950 Fri Elements List Add and Implement Action But... SAP Community
2. The entry provider instance from change set request is always blank. How to get
data in this entry provider so that entity data can be read in change set process
method.
Method: /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_PROCESS
Importing Parameter: IT_CHANGESET_REQUEST-ENTRY_PROVIDER
ENTRY_PROVIDER value is always blank.
Thanks a lot in advancel!
rbhuva
Participant
8
03-21-2021 4:42 PM
0 Kudos
Hi,
How to clear selection after action completed?
Thanks,
Rajdeep Bhuva
nitps:community sap.comfSitechnology-blogs-by-membersfr-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 3140oo2r2026, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
leobarbosa
Explorer
9
03-29-2021 5:06 PM
0 Kudos
Hi Pawan,
Thanks for this blog. It was very helpful. | recriated your example and it worked perfectly.
However, when | tried to implement it in an existent app, | found some glitches:
1 - If | select a line to add a comment it's not loading the data if | don't open the object
page before click on the button:
before open object page:
after open object page:
https:Ieommunty.sap.com/Stechnology-blogs-by-membersiier-slements-lis-add-anc-implement-acton-buttonba-p!13413889 3240oo2r2026, 19:50 Fiori Elements List- Ade and Implement Acton But..- SAP Community
2 - Everytime | hit the button to perform an action, the object page opens automatically
and I have no idea why.
Can you help me with this two points?
Thanks a lot,
Leo
Pp Praveen_guptaz
Explorer
©
06-11-2021 12:12 PM
0 Kudos
Hi Pawan,
https:Ieommunty.sap.comttechnology-blogs-by-membersiir-lemer
ist-ade-anc-implement-action-buitonfba-p!13413889 3340oo2r2026, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
Thanks for sharing the wonderful post !!
1am facing a problem, my button is not enabled on the Fiori list application. | have
followed your post and updated as well your last piece of code in CDS and MPC ext.
However this is not showing up active in application.
Any clue about this issue, or i am missing any other setting a part from your post ?
Regards,
Praveen Gupta
former_member188001
Active Participant
°
06-25-2021 7:23 PM
0 Kudos
There is another way of adding buttons, refer to SAP help link
Display of Actions Added Using Extension Points - SAP Help Portal
MattHarding
Active Contributor
°
07-15-2021 12:56 AM
0 Kudos
nitps:community sap.comfSitechnology-blogs-by-membersfr-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 340oo2r2026, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
Hi Pawan,
Not sure why but on my S/4HANA version (1809), I needed to change the MPC_EXT file
to forcefully change boole_d active field to edm.boolean like so for the annotation
“sap:applicable-path=" to be added to the metadata (after this, it works as expected and
disables the button):
DATA(lo_type) = model->get_entity_type( iv_entity_name =
gc_zc_mm_myopenpurchaseorderst).
DATA(lo_prop) = lo_type->get_property( iv_property_name = ‘IsActiveClosePO!tem').
lo_prop->set_type_edm_boolean( ).
But much better doing this than adding an extension IMO.
‘One question - Is there any way to create an action like this that "deletes" the row without
needing to adjust any UI5 code? e.g. My action closes a Purchase Order, and I'd like to
remove it from the list - For now, I'm just hiding the action once they close it, and when
they next refresh it will disappear - Not a biggy but just on the off chance.
Cheers,
Matt
oghadashi
Explorer
Q
04-22-2022 3:01 PM
0 Kudos
Hi Pawan,
Thank you for informative blog,
nitps:community sap.comfSitechnology-blogs-by-membersfr-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 38140owas, 1950 Fri Elements List Add and Implement Action But... SAP Community
1am trying to develop the Fiori application using CDS and BOPF, could you please guide
me how we can add a confirmation box while Cancel Flight action ?
Regards,
Omkar
sowmiyasowmi
Member
°
08-19-2022 8:28 AM
0 Kudos
Hi.
In this case how to testidebug the Function import before creating a WEBIDE project.
abdullah_dogan
Explorer
Q
06-07-2023 3:45 PM
0 Kudos
Hi,
Uhad a same Problem. That solve it.
Thanks
nitps:community sap.comfSitechnology-blogs-by-membersfr-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 3640oo2r2026, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
ManojYadav
Explorer
9
06-09-2023 12:20 PM
0 Kudos
Hi Pawan,
Thank you for this post.
lam calling a BAPI in CHANGESET_PROCESS, inside a LOOP so that I can update
multiple records. Is COMMIT allowed here? If not, how can I update multiple records?
Also, how to pass BAPI messages for each selected records?
‘ )
sales Document SD docume... created on Sold-toPary Created By
move G sun 2,200
zisisss Jun 2, 2021
Thank you
simonweber
Explorer
°
09-29-2023 2:49 PM
0 Kudos
nitps:community sap.comfSitechnology-blogs-by-membersfr-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 3740oo2r2026, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
Hi Manoj
We have the same issue. Have you found a solution? If so, can you share it briefly?
Thank you
ManojYadav
Explorer
°
10-03-2023 5:03 AM
0 Kudos
Hi Simon,
No. It was testing app. | didn't find solution yet.
Regards,
Manoj
@ You must be a registered user to add a comment. If you've already registered,
sign in. Otherwise, register and sign in.
Comment
Labels In This Area
ABAP6 — ABAP CDS Views - BW Extraction 1
nitpsscommunity sap.comstechnology-blogs-by-membersfor-slements-ist-adé-ancmplement-action-nttonfba-p/13413880
3240oo2r2024, 19:50
Fiori Elements List- Ade and Implement Acton But... SAP Community
ABAP CDS Views - CDC (Change Data Capture) 3. ABAP Platform Trial 1
ABAP Programming 1 Advanced Event Mesh1 AEM AL1_—AIML 4.
API and Integration 1 Application Architecture 1
Application Development for SAP HANA Cloud 11 ASE1 © ASUG1_—_Authorisations 1
Automation 1 © AWS1 basis 1 __Basis Monitoring & Tcodes with Key notes 1
Best Practice1 BPC1 BPCLIVE1 BTP3 Business Arcl
cture 1
Business Partner 8 Business Partner Master Data 6 Business Technology Platform 1
CA1 calculation view1 CDQ8 Certificates 1 CL_SALV_TABLE 1
Cloud Exten:
1 Cloud Foundry 2 Cloud integration 2
Cloud Platform integration 1 Compound Employee API1 —Confluent1 CSI
Customer Data Browser app 1 Data Aging 1 Data Archiving 1 Data Governance 5
Data integration 1 data migration 1 Data Quality Data Quality Management 8
Data Synchronization 1 _datatransfer1. Data Value 4 Debugging 1
Delta Integrations 1 Developer extensibility 1 DQM1 ELA1
Employee information 1 Enterprise Architecture 1 Event Dates 1 Event Mesh 1
Event Reason 1 EventBasedintegration 1 Existing Event Changes 1 Expand 1
Fiori4 Fiori SAPUIS6 Full Stack 4 GitHub 4 HANA2 ~—_- HANAXS Advanced 1
Historical Events 1 home labs 1 html5 4 Implementation 1__input parameter 1
Integration Architecture 1 Integration Suite 1 Job Information Changes 1
Job-Related Events 1 Job_Event_Information1 Kafka 1 Kerberos for ABAP 4
Kerberos for JAVA4 Launch Wizard1 Master Data3_—_- Master Data Management 9
MDG1 MDGM1 — Migrate your Data App 1 Migration 1
Modeling in SAP HANA Cloud 4 MTA1_—MultisRecord Scenarios 1
Multiple Event Triggers 1 Neoi New Event Creation 1 Data 1
PaPM Dynamic Data Copy through Writer function 1 PAS-CO1 1
PLANNING ARCHITECTURE 1 Process Automation 1
nitpsscommunity sap.comstechnology-blogs-by-membersfor-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 30022024, 19:50 Fiori Elements List- Ade and Implement Acton But... SAP Community
Related Content
Developer Experience in SaaS development across Cloud-native and Non-Cloud-
Native >
in Technology Blogs by SAP Tuesday
‘SAP UX Innovations in Public Cloud Products, Joule, Al, Entry Points, Apple Vision
Pro and more >
in Technology Blogs by SAP Tuesday
‘Syniti RDG provides an effortless way to assign the Email Template to Workflow >
in Technology Blogs by Members Monday
SemanticObject related Annotations and their Use. >
in Technology Q&A Monday
BNAC Adapt-UI for Documents Download >
in Technology Q&A a week ago
Popular Blog Posts
Follow
f ¥v @ in
Privacy Terms of Use
Copyright Legal Disclosure
Trademark Newsletter
Support
je Preferences
nitpsscommunity sap.comstechnology-blogs-by-membersifo-slements-ist-adé-ancmplement-action-nttonfba-p/13413880 4040