Skip to Content
Technical Articles
Author's profile photo Pawan Kesari

Fiori Elements List – Add and Implement Action Button

Recently, I 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. UI5 Demo Kit suggests using UI5 Extensions which I wanted to avoid if I could. There are some annotations related to function import which looked promising but I couldn’t find any blog/help document on how to actually use them in CDS and implement in the OData service. Then I saw actions using BOPF, but this report which I was working didn’t have any business object attached to it.

Looking at some SAP standard apps I finally figured out how to achieve this without UI5 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 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 UI5 extension in Web-IDE or using BOPF.

Setting the Scene

In this Fiori Elements List report app, I 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) I 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. I have exposed CDS View via SEGW using Data Source Reference.

CDS View: ZI_FlightConnections

@AbapCatalog.sqlViewName: 'ZISPFLI01'
@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 = CancellationInfo.carrid
                                                   and spfli.connid = CancellationInfo.connid
  association [0..1] to U99_I_Airline as _Airline     on $projection.Airline = _Airline.Airline
  association [0..1] to U99_IAIRPORT  as _AirportFrom on $projection.AirportFrom = _AirportFrom.Airport
  association [0..1] to U99_IAIRPORT  as _AirportTo   on $projection.AirportTo = _AirportTo.Airport
  association [0..1] to S_CityAirport as _CityFrom    on $projection.CityFrom = _CityFrom.City
  association [0..1] to S_CityAirport as _CityTo      on $projection.CityTo = _CityTo.City
{

      @ObjectModel.foreignKey.association: '_Airline'
      @UI: { lineItem: [{ position: 10 }] , selectionField: [{ position: 10 }]}
  key spfli.carrid    as Airline,

      @UI.lineItem: [{ position: 20 }]
  key spfli.connid    as FlightConnection,

      @ObjectModel.foreignKey.association: '_CityTo'
      @UI: { lineItem: [{ position: 40 }] , selectionField: [{ position: 15 }]}
      spfli.cityfrom  as CityFrom,

      @ObjectModel.foreignKey.association: '_AirportFrom'
      @UI: { lineItem: [{ position: 50 }] , selectionField: [{ position: 20 }]}
      spfli.airpfrom  as AirportFrom,

      @ObjectModel.foreignKey.association: '_CityTo'
      @UI: { lineItem: [{ position: 70 }] , selectionField: [{ position: 25 }]}
      spfli.cityto    as CityTo,

      @ObjectModel.foreignKey.association: '_AirportTo'
      @UI: { lineItem: [{ position: 80 }] , selectionField: [{ position: 30 }]}
      spfli.airpto    as AirportTo,

      @UI.lineItem: [{ position: 90 }]
      spfli.deptime   as DepartureTime,

      @UI.lineItem: [{ position: 100 }]
      spfli.arrtime   as ArrivalTime,

      @UI.lineItem: [{ position: 120 }]
      @EndUserText.label: 'Cancelled On'
      CancellationInfo.cancelledon,

      @UI.lineItem: [{ position: 130 }]
      @EndUserText.label: 'Cancelled By'
      CancellationInfo.cancelledby,

      @UI.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

Table: ZSPFLI_ACT

App

If you are struggling to get to this point I would recommend you check Fiori Elements Wiki Page, section How to Guides for List Report. Make note that I 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.

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.

* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Private Method ZCL_ZIFLTCON_MPC_EXT->ADD_ACTION
* +-------------------------------------------------------------------------------------------------+
* | [--->] IV_ACTION_NAME                 TYPE        /IWBEP/MED_EXTERNAL_NAME
* +--------------------------------------------------------------------------------------</SIGNATURE>
  method add_action.

    data: lv_fc_fieldvalue type /iwbep/med_annotation_value,
          lo_complex_type  type ref to /iwbep/if_mgw_odata_cmplx_type,
          lo_prop          type ref to /iwbep/if_mgw_odata_property.

    data(lo_action) = model->create_action( iv_action_name ).
    
    "set return parameter
    lo_action->set_return_entity_type( 'ZI_FlightConnectionsType' ) .
    lo_action->set_return_entity_set( 'ZI_FlightConnections' ).

    lo_action->set_http_method( 'PUT' ).
    lo_action->set_return_multiplicity( /iwbep/if_mgw_med_odata_types=>gcs_cardinality-cardinality_1_1 ).
    "specify input parameters
    data(lo_parameter) = lo_action->create_input_parameter(
                                  iv_parameter_name = 'Airline'
                                  iv_abap_fieldname = 'AIRLINE' ).
    lo_parameter->/iwbep/if_mgw_odata_property~set_type_edm_string( ).
    lo_parameter->set_maxlength( iv_max_length = 3 ).

    data(lo_parameter1) = lo_action->create_input_parameter(
                                  iv_parameter_name = 'FlightConnection'
                                  iv_abap_fieldname = 'FLIGHTCONNECTION' ).
    lo_parameter1->/iwbep/if_mgw_odata_property~set_type_edm_string( ).
    lo_parameter1->set_maxlength( iv_max_length = 4 ).

    "Is Action Active?
    concatenate 'IsActive' iv_action_name into data(lv_action_ac).

    data(lo_annotation) = lo_action->/iwbep/if_mgw_odata_annotatabl~create_annotation( 'sap' ).
    lo_annotation->add( iv_key = 'action-for' iv_value = 'ZI_FlightConnectionsType' ).
    lo_annotation = lo_action->/iwbep/if_mgw_odata_annotatabl~create_annotation( 'sap' ).
    lo_annotation->add( iv_key = 'applicable-path' iv_value = lv_action_ac ).

  endmethod.

Redefine DEFINE method in MPC_EXT class and make call to ADD_ACTION method to add function imports.

  method define.
    super->define( ) .
    add_action( iv_action_name = 'CancelFlight' ) .
    add_action( iv_action_name = 'KeepFlight' ) .
  endmethod.

Following above changes check OData service metadata have function import added to it.

Change to CDS to Add Action Buttons.

In CDS add following annotation (UI.lineitem) before field Airline. With this annotation we are defining button (label), and asking system to call respective function import on these actions.

define view ZI_FlightConnections
  as select from    spfli
    ....
{

      @ObjectModel.foreignKey.association: '_Airline'
      @UI: { lineItem: [{ position: 10 } ,
                        { type: #FOR_ACTION, invocationGrouping: #CHANGE_SET, position: 0, dataAction: 'MPC_EXT:CancelFlight',  label: 'Cancel Flight' },
                        { type: #FOR_ACTION, invocationGrouping: #CHANGE_SET, position: 1, dataAction: 'MPC_EXT:KeepFlight'  ,  label: 'Keep Flight' }] ,
             selectionField: [{ position: 10 }]}
  key spfli.carrid                                   as Airline,

....
}

After above changes and activation you should be able to see action buttons on the list page.

Code to Process Action

Fiori Element List Report uses batch processing. To enable batch processing, in DPC_EXT class redefine method /iwbep/if_mgw_appl_srv_runtime~changeset_begin. Also, we will process all requests together, hence set cv_defer_mode = abap_true.

  method /iwbep/if_mgw_appl_srv_runtime~changeset_begin.
    cv_defer_mode = abap_true .
  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

  method /iwbep/if_mgw_appl_srv_runtime~changeset_process.
    data : lo_func_import_context type ref to /iwbep/if_mgw_req_func_import,
           lt_parameters          type /iwbep/t_mgw_name_value_pair,
           ls_flight_con_status   type zspfli_act,
           ls_result              type zcl_zifltcon_mpc_ext=>ts_zi_flightconnectionstype,
           ls_changeset_response  type /iwbep/if_mgw_appl_types=>ty_s_changeset_response.

    "read requests where operation is execute action (EA)
    loop at it_changeset_request assigning field-symbol(<lfs_changeset_request>)
            where operation_type = /iwbep/if_mgw_appl_types=>gcs_operation_type-execute_action.

      "find function name
      lo_func_import_context ?= <lfs_changeset_request>-request_context .
      data(lv_function_import_name) = lo_func_import_context->get_function_import_name( ) .

      if lv_function_import_name = 'CancelFlight' or lv_function_import_name = 'KeepFlight' .

        "read parameters
        lt_parameters = lo_func_import_context->get_parameters( ).
        ls_flight_con_status-carrid = lt_parameters[ name = 'AIRLINE' ]-value .
        ls_flight_con_status-connid = lt_parameters[ name = 'FLIGHTCONNECTION' ]-value .

        "set/reset values
        case lv_function_import_name.
          when 'CancelFlight'.
            ls_flight_con_status-cancelledby = sy-uname .
            ls_flight_con_status-cancelledon = sy-datum .
          when 'KeepFlight'.
            clear ls_flight_con_status-cancelledby  .
            clear ls_flight_con_status-cancelledon  .
        endcase .

        modify zspfli_act from ls_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 .

        "prepare response with operation number and respective data,
        "insert in CT_CHANGESET_RESPONSE
        ls_changeset_response-operation_no = <lfs_changeset_request>-operation_no .
        copy_data_to_ref(
           exporting
             is_data = ls_result
           changing
             cr_data = ls_changeset_response-entity_data ).

        insert ls_changeset_response into table ct_changeset_response.
      endif .
    endloop .
  endmethod.

Result

After activation buttons should work

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 I mentioned earlier I couldn’t find way to add action using BOPF in List Report. If you have managed to do that then please share your experience.

What’s next:

I plan to write next part of this blog.

Action to download file e.g. download sales confirmation output on list of sales order.

Assigned tags

      27 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Joseph BERTHE
      Joseph BERTHE

      Hello,

      Thanks for sharing, but I would like to know why you are using ABAP code to create your Function Import whereas SEGW has wizard to do it ?

      Regards,

      Joseph

      Author's profile photo Pawan Kesari
      Pawan Kesari
      Blog Post Author

      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 I cannot select values for ‘Return Entity Set’, and the same thing happens for ‘Action for Entity Types’.

      Author's profile photo Joseph BERTHE
      Joseph BERTHE

      You rigth, to have actions we have to use BOPF.

      Regards,

      Joseph

      Author's profile photo Rufina Scott
      Rufina Scott

      Thanks for Sharing!

      Author's profile photo Christophe Bontron
      Christophe Bontron

      Hello,

      Very nice and usefull blog.

      I have done the same steps and my buttons are not active in the layout.

      I can see the function import in the metadata:

      and the code to add the button is the following:

      METHOD add_action.
      
          DATA: lv_fc_fieldvalue TYPE /iwbep/med_annotation_value,
                lo_complex_type  TYPE REF TO /iwbep/if_mgw_odata_cmplx_type,
                lo_prop          TYPE REF TO /iwbep/if_mgw_odata_property.
      
          DATA(lo_action) = model->create_action( iv_action_name ).
      
          lo_action->set_action_for( 'xLIONxC_REV_DeductionItemType' ).
      *    lo_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' ).
      
          lo_action->set_http_method( 'PUT' ).
          lo_action->set_return_multiplicity( /iwbep/if_mgw_med_odata_types=>gcs_cardinality-cardinality_1_1 ).
          "specify input parameters
          DATA(lo_parameter) = lo_action->create_input_parameter(
                                        iv_parameter_name = 'DedDoc'
                                        iv_abap_fieldname = 'DEDOC' ).
          lo_parameter->/iwbep/if_mgw_odata_property~set_type_edm_string( ).
          lo_parameter->set_maxlength( iv_max_length = 10 ).
      
        ENDMETHOD.
      in the CDS views:
      
      @ObjectModel.readOnly: true
      @EndUserText.label: 'Deduction Document'
       @UI: { identification.position: 10,
              lineItem: [{ position: 10 } ,
                              { type: #FOR_ACTION, position: 0, dataAction: 'MPC_EXT:REQBACKDATA', label: 'Request Backing Data' },
                              { type: #FOR_ACTION, position: 1, dataAction: 'MPC_EXT:AUTOMATCH',  label: 'Auto Match' },
                              { type: #FOR_ACTION, position: 2, dataAction: 'MPC_EXT:REJECTDISP', label: 'Reject Dispute' },
                              { type: #FOR_ACTION, position: 3, dataAction: 'MPC_EXT:WORKFLOW', label: 'Workflow' },
                              { type: #FOR_ACTION, position: 4, dataAction: 'MPC_EXT:DISPVALCONTR', label: 'Display Valid Contract' }
                              ] }        

      When I run the appication, i have some errors in the console related to the function import:

       

      Do you have any idea why the buttons are not active?

      Thanks in advance for your help.

      Christophe

      Author's profile photo Pawan Kesari
      Pawan Kesari
      Blog Post Author

      Hi,

      I have 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 action is available or not on that row. You can simply make it 'X'/true if it is going to be available on all rows.

      @UI.hidden:true 
      cast( 'X' as boole_d ) as IsActiveCancelFlight,
      
      @UI.hidden:true
      cast ( 'X' as boole_d ) as IsActiveKeepFlight,

      Add following lines in method ADD_ACTION towards the end.

          "Is Action Active?
          concatenate 'IsActive' iv_action_name into data(lv_action_ac).
      
          data(lo_annotation) = lo_action->/iwbep/if_mgw_odata_annotatabl~create_annotation( 'sap' ).
          lo_annotation->add( iv_key = 'action-for' iv_value = 'ZI_FlightConnectionsType' ).
          lo_annotation = lo_action->/iwbep/if_mgw_odata_annotatabl~create_annotation( 'sap' ).
          lo_annotation->add( iv_key = 'applicable-path' iv_value = lv_action_ac ).
      
      Author's profile photo Otto Csanyi
      Otto Csanyi

      Hi Pawan,

      superclass of DPC_EXT does not have a define method.
      Didn't you want to refer to MPC_EXT?

      Best regards,
      Ottó

      Author's profile photo Taylor Riley
      Taylor Riley

      This is correct. You change the DEFINE method in the MPC_EXT class.

      Author's profile photo Manasa Sanga
      Manasa Sanga

      Can you tell us the approach for Excel download

      Author's profile photo Olivier Souksamran
      Olivier Souksamran

      Manasa Sanga

      Please be aware of the steps described this  blog :

      https://blogs.sap.com/2019/10/11/sap-fiori-for-sap-s4hana-adding-export-to-excel-to-a-standard-sap-fiori-elements-app-with-a-fiori-adaptation-project/

      For a custom List-Report, you just need to execute de SAPUI5 Visual Editor on your front-app project and enable the Smart Table "export to Excel" property.

      Hope this helps.

      Regards,

      Olivier

      Author's profile photo Meinrad Funke
      Meinrad Funke

      Hi Pawan,

       

      thanks you so much for this blog! It was a good starting point for me and I think I 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

      I found this online help

      https://help.sap.com/doc/saphelp_nw75/7.5.5/en-US/07/1a1fd1465749dca2872640cba8d82e/frameset.htm

      It seems to be key to use something like

      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

          post_process_read_entityset(
            EXPORTING
              io_model                     = lo_model
              io_expand_root               = lo_expand_root
              io_request_obj               = lo_request_obj
              it_header                    = mt_headers
              iv_generate_sts              = lv_generate_sts
              iv_sts_are_ready_to_use      = lv_sts_are_ready_to_use
            CHANGING
              cv_response_body             = cv_response_body
              ct_header                    = ct_headers
              cr_entityset                 = cr_entityset
              cr_deleted_entityset         = cr_deleted_entityset
              cs_response_context          = cs_response_context
              ct_inline_info               = ct_inline_info ).
      

      (Method: /iwbep/cl_mgw_abs_data->/iwbep/if_mgw_core_srv_runtime~read_entityset)

      In debugging mode I could set Foo_ac to ‘X’ in the dereferenced table cr_entityset and the button become enabled and was working nicely.

      I hope I have some time soon to investigate further.

      But I’m happy if someone else has an idea. 🙂

      Thanks again for your work.

      Meinrad

      Author's profile photo Pawan Kesari
      Pawan Kesari
      Blog Post Author

      Hi Meinrad,

      Thank you for your feedback.

      You are absolutely right, with BOPF the way of defining and implementing action is different than how I 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.

       

      Author's profile photo Kishore Gokara
      Kishore Gokara

      Hello Pawan,

       

      Thanks for the blog. I tried exactly the same approach but I see a pop whenever I click the action button.

       

      Thanks,

      Kishore.

      Author's profile photo Kishore Gokara
      Kishore Gokara

      I figured it out!! This is the behavior when we add any non key fields as input parameters.

      Author's profile photo Axel Mohnen
      Axel Mohnen

      Hi Pawan,

      first of all thanks a lot for this excellent blog.

      I followed all your steps. The button is visible in the list report.

      The problem is when I fire the action button, first I 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

      Axel

      Author's profile photo Pawan Kesari
      Pawan Kesari
      Blog Post Author

      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.

      Author's profile photo Axel Mohnen
      Axel Mohnen

      Hi Pawan,

      thanks a lot for your reply.

      I added the field "IsActiveAssignTask" to my CDS View and enhanced the ADD_ACTION method.

      Unfortunately, I still have the same issue:

      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_ID). This is the only key field. The original key fields from the CDS View are normal entity fields now.

      I 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 I 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

       

      Author's profile photo Axel Mohnen
      Axel Mohnen

      Hi Pawan,

      I found the issue!

      By mistake I 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

      /IWBEP/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

      Author's profile photo Axel Mohnen
      Axel Mohnen

      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.

       

      Are you aware about this issue?

      Thanks a lot for your help.

      Kind regards

      Axel

      Author's profile photo Axel Mohnen
      Axel Mohnen

      Issue has been solved:

      https://answers.sap.com/questions/13291410/sap-fiori-elements-exception-handling.html#

      Author's profile photo Axel Mohnen
      Axel Mohnen

      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

      Author's profile photo Amit Pardikar
      Amit Pardikar

      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.
      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 advance!!

      Author's profile photo Rajdeep BHUVA
      Rajdeep BHUVA

      Hi,

       

      How to clear selection after action completed?

       

      Thanks,

      Rajdeep Bhuva

      Author's profile photo Leonardo Barbosa
      Leonardo Barbosa

      Hi Pawan,

       

      Thanks for this blog. It was very helpful. I recriated your example and it worked perfectly. However, when I tried to implement it in an existent app, I found some glitches:

       

      1 - If I select a line to add a comment it's not loading the data if I don't open the object page before click on the button:

       

      before open object page:

      after open object page:

       

      2 - Everytime I 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

      Author's profile photo PRAVEEN GUPTA
      PRAVEEN GUPTA

      Hi Pawan,

      Thanks for sharing the wonderful post !!

      I am facing a problem, my button is not enabled on the Fiori list application. I 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

      Author's profile photo SAP User
      SAP User

      There is another way of adding buttons, refer to SAP help link

      Display of Actions Added Using Extension Points - SAP Help Portal

      Author's profile photo Matt Harding
      Matt Harding

      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 = 'IsActiveClosePOItem' ).
      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