Advertising:

Create your own Fiori push notifications: Difference between revisions

From SAP Knowledge Base
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 5: Line 5:
The prerequisite is that the technical setup and configuration has been carried out in the system.
The prerequisite is that the technical setup and configuration has been carried out in the system.


= Overview of the required objects and customizing =
== Overview of the required objects and customizing ==


* Creation of Y/Z notification class
* Creation of Y/Z notification class
Line 18: Line 18:
** Manage notification provider
** Manage notification provider


= Creation of Y/Z Notification class =
== Creation of Y/Z Notification class ==
For method send_notification you have to consider which parameters are required. Also the success/error handling.
For method send_notification you have to consider which parameters are required. Also the success/error handling.


<div class="toccolours mw-collapsible mw-collapsed">
Example Code
<div class="mw-collapsible-content">
<syntaxhighlight lang="abap" line copy>
<syntaxhighlight lang="abap" line copy>
  CLASS ycl_your_class_notifprov DEFINITION
  CLASS ycl_your_class_notifprov DEFINITION
Line 30: Line 33:
     INTERFACES /iwngw/if_notif_provider .
     INTERFACES /iwngw/if_notif_provider .


     CONSTANTS mc_notification_provider_id TYPE /iwngw/notif_provider_id  VALUE 'YMM_PUR_WE_MSG_PO_ITEM' ##NO_TEXT.
     CONSTANTS notification_provider_id TYPE /iwngw/notif_provider_id  VALUE 'YMODULE_NOTIF_PROV_ID' ##NO_TEXT.


     CONSTANTS:
     CONSTANTS:
       BEGIN OF mc_notification_type,
       BEGIN OF notification_type,
         general_gr                TYPE /iwngw/notification_type_key VALUE 'GenGrForAPoItem',
         general_gr                TYPE /iwngw/notification_type_key VALUE 'GenGrForAPoItem',
         gr_with_ref_to_sales_order TYPE /iwngw/notification_type_key VALUE 'SalesOrderGrForAPoItem',
         gr_with_ref_to_sales_order TYPE /iwngw/notification_type_key VALUE 'SalesOrderGrForAPoItem',
       END OF mc_notification_type.
       END OF notification_type.


     CLASS-METHODS: send_notification
     CLASS-METHODS: send_notification
                     IMPORTING iv_purchaseorder TYPE I_PurchaseOrderAPI01-PurchaseOrder
                     IMPORTING purchaseorder TYPE I_PurchaseOrderAPI01-PurchaseOrder
                     EXPORTING ev_is_sending_successful TYPE abap_bool
                     EXPORTING is_sending_successful TYPE abap_bool
                               ev_ex_msg TYPE string.
                               ex_msg TYPE string.
   PROTECTED SECTION.
   PROTECTED SECTION.
   PRIVATE SECTION.
   PRIVATE SECTION.
   CLASS-DATA: _mt_parameters type /iwngw/if_notif_provider=>ty_t_notification_parameter.
   CLASS-DATA: parameters type /iwngw/if_notif_provider=>ty_t_notification_parameter.
  ENDCLASS.
  ENDCLASS.
   
   
  CLASS ycl_your_class_notifprov IMPLEMENTATION.
  CLASS ycl_your_class_notifprov IMPLEMENTATION.
   METHOD /iwngw/if_notif_provider~get_notification_parameters ##NEEDED.
   METHOD /iwngw/if_notif_provider~get_notification_parameters ##NEEDED.
   CLEAR:et_parameter.
   CLEAR: parameter.
    
    
     SET LANGUAGE iv_language.
     SET LANGUAGE language.


     LOOP AT _mt_parameters ASSIGNING FIELD-SYMBOL(<ls_para>).
     LOOP AT parameters ASSIGNING FIELD-SYMBOL(<para>).
     MOVE-CORRESPONDING <ls_para> TO et_parameter.
     MOVE-CORRESPONDING <para> TO parameter.
     ENDLOOP.
     ENDLOOP.
     SET LANGUAGE lv_lang.
     SET LANGUAGE lang.
   ENDMETHOD.
   ENDMETHOD.


   METHOD /iwngw/if_notif_provider~get_notification_type.
   METHOD /iwngw/if_notif_provider~get_notification_type.
     DATA ls_notif_action LIKE LINE OF et_notification_action ##NEEDED.
     DATA notif_action LIKE LINE OF notification_action ##NEEDED.


     CLEAR es_notification_type.
     CLEAR notification_type.
     CLEAR et_notification_action.
     CLEAR notification_action.


     CASE iv_type_key.
     CASE type_key.
       WHEN mc_notification_type-general_gr.
       WHEN notification_type-general_gr.
         es_notification_type-type_key    = mc_notification_type-general_gr.
         notification_type-type_key    = notification_type-general_gr.
         es_notification_type-version      = 0.
         notification_type-version      = 0.
         es_notification_type-is_groupable = abap_true.
         notification_type-is_groupable = abap_true.
       WHEN mc_notification_type-gr_with_ref_to_sales_order.
       WHEN notification_type-gr_with_ref_to_sales_order.
         es_notification_type-type_key    = mc_notification_type-gr_with_ref_to_sales_order.
         notification_type-type_key    = notification_type-gr_with_ref_to_sales_order.
         es_notification_type-version      = 0.
         notification_type-version      = 0.
         es_notification_type-is_groupable = abap_true.
         notification_type-is_groupable = abap_true.
       WHEN OTHERS.
       WHEN OTHERS.
         RAISE EXCEPTION TYPE /iwngw/cx_notif_provider.
         RAISE EXCEPTION TYPE /iwngw/cx_notif_provider.
Line 80: Line 83:


   METHOD /iwngw/if_notif_provider~get_notification_type_text.
   METHOD /iwngw/if_notif_provider~get_notification_type_text.
     DATA lv_tmp_text TYPE string.
     DATA tmp_text TYPE string.


     CLEAR es_type_text.
     CLEAR type_text.
     CLEAR et_action_text.
     CLEAR action_text.


     SET LANGUAGE iv_language.
     SET LANGUAGE language.


     CASE iv_type_key.
     CASE type_key.
       WHEN mc_notification_type-general_gr.
       WHEN notification_type-general_gr.
         lv_tmp_text = TEXT-100.
         tmp_text = TEXT-100.
         REPLACE '&1' WITH '{po}' INTO lv_tmp_text.
         REPLACE '&1' WITH '{po}' INTO tmp_text.
         REPLACE '&2' WITH '{poitem}' INTO lv_tmp_text.
         REPLACE '&2' WITH '{poitem}' INTO tmp_text.
         es_type_text-template_public    = lv_tmp_text.
         type_text-template_public    = tmp_text.
         es_type_text-template_grouped  = TEXT-101.
         type_text-template_grouped  = TEXT-101.
         CLEAR lv_tmp_text.
         CLEAR lv_tmp_text.
         lv_tmp_text = TEXT-102.
         tmp_text = TEXT-102.
         REPLACE '&1' WITH '{article}' INTO lv_tmp_text.
         REPLACE '&1' WITH '{article}' INTO tmp_text.
         REPLACE '&2' WITH '{plant}' INTO lv_tmp_text.
         REPLACE '&2' WITH '{plant}' INTO tmp_text.
         es_type_text-subtitle          = lv_tmp_text.
         type_text-subtitle          = tmp_text.
         es_type_text-description        = TEXT-103.
         type_text-description        = TEXT-103.
       WHEN mc_notification_type-gr_with_ref_to_sales_order.
       WHEN mc_notification_type-gr_with_ref_to_sales_order.
         lv_tmp_text = TEXT-200.
         tmp_text = TEXT-200.
         REPLACE '&1' WITH '{po}' INTO lv_tmp_text.
         REPLACE '&1' WITH '{po}' INTO tmp_text.
         REPLACE '&2' WITH '{poitem}' INTO lv_tmp_text.
         REPLACE '&2' WITH '{poitem}' INTO tmp_text.
         REPLACE '&3' WITH '{so}' INTO lv_tmp_text.
         REPLACE '&3' WITH '{so}' INTO tmp_text.
         es_type_text-template_public    = lv_tmp_text.
         type_text-template_public    = tmp_text.
         es_type_text-template_grouped  = TEXT-201.
         type_text-template_grouped  = TEXT-201.
         CLEAR lv_tmp_text.
         CLEAR tmp_text.
         lv_tmp_text = TEXT-202.
         tmp_text = TEXT-202.
         REPLACE '&1' WITH '{article}' INTO lv_tmp_text.
         REPLACE '&1' WITH '{article}' INTO tmp_text.
         REPLACE '&2' WITH '{plant}' INTO lv_tmp_text.
         REPLACE '&2' WITH '{plant}' INTO tmp_text.
         es_type_text-subtitle          = lv_tmp_text.
         type_text-subtitle          = tmp_text.
         es_type_text-description        = TEXT-203.
         type_text-description        = TEXT-203.
       WHEN OTHERS.
       WHEN OTHERS.
         RAISE EXCEPTION TYPE /iwngw/cx_notif_provider.
         RAISE EXCEPTION TYPE /iwngw/cx_notif_provider.
Line 120: Line 123:


  METHOD /iwngw/if_notif_provider~handle_action.
  METHOD /iwngw/if_notif_provider~handle_action.
     CLEAR es_result.
     CLEAR result.


*  For now always return success if ids are set, since no persistence in this provider
*  For now always return success if ids are set, since no persistence in this provider
     IF iv_notification_id IS INITIAL.
     IF notification_id IS INITIAL.
       es_result-success = abap_false.
       result-success = abap_false.
     ELSEIF iv_action_key IS INITIAL.
     ELSEIF action_key IS INITIAL.
       es_result-success = abap_false.
       result-success = abap_false.
     ELSE.
     ELSE.
       es_result-success          = abap_true.
       result-success          = abap_true.
       es_result-delete_on_return = abap_true.
       result-delete_on_return = abap_true.
     ENDIF.
     ENDIF.
  ENDMETHOD.
  ENDMETHOD.
Line 135: Line 138:
   METHOD /iwngw/if_notif_provider~handle_bulk_action.
   METHOD /iwngw/if_notif_provider~handle_bulk_action.
*  no bulk notifications supported
*  no bulk notifications supported
     CLEAR et_notif_result.
     CLEAR notif_result.
   ENDMETHOD.
   ENDMETHOD.
    
    
  METHOD send_notification.
  METHOD send_notification.


   CLEAR _mt_parameters.
   CLEAR parameters.


     TRY.
     TRY.


     DATA: lt_recipients type /iwngw/if_notif_provider=>ty_t_notification_recipient,
     DATA: recipients type /iwngw/if_notif_provider=>ty_t_notification_recipient,
           lt_parameters type /iwngw/if_notif_provider=>ty_t_notification_parameter,
           parameters type /iwngw/if_notif_provider=>ty_t_notification_parameter,
           lv_type_key type /iwngw/notification_type_key.
           type_key type /iwngw/notification_type_key.


     IF iv_so_creator IS INITIAL.
     IF salesorder_creator IS INITIAL.
       lt_recipients = VALUE #( ( id = iv_po_creator ) ).
       recipients = VALUE #( ( id = purchaseorder_creator ) ).
       _mt_parameters = VALUE #(  ( name = 'po' value = iv_purchaseorder type = 'Edm.String' is_sensitive = abap_false )
       parameters = VALUE #(  ( name = 'po' value = purchaseorder type = 'Edm.String' is_sensitive = abap_false )
                                ( name = 'poitem' value = iv_poitem type = 'Edm.String' is_sensitive = abap_false )
                            ( name = 'poitem' value = poitem type = 'Edm.String' is_sensitive = abap_false )
                                ( name = 'article' value = iv_product type = 'Edm.String' is_sensitive = abap_false )
                            ( name = 'article' value = product type = 'Edm.String' is_sensitive = abap_false )
                                ( name = 'plant' value = iv_plant type = 'Edm.String' is_sensitive = abap_false ) ).
                            ( name = 'plant' value = plant type = 'Edm.String' is_sensitive = abap_false ) ).
       lv_type_key = mc_notification_type-general_gr.
       type_key = notification_type-general_gr.
     ELSE.
     ELSE.
       lt_recipients = VALUE #( ( id = iv_po_creator ) ( id = iv_so_creator ) ).
       recipients = VALUE #( ( id = purchaseorder_creator ) ( id = salesorder_creator ) ).
       _mt_parameters = VALUE #( ( name = 'po' value = iv_purchaseorder type = 'Edm.String' is_sensitive = abap_false )
       parameters = VALUE #( ( name = 'po' value = purchaseorder type = 'Edm.String' is_sensitive = abap_false )
                              ( name = 'poitem' value = iv_poitem type = 'Edm.String' is_sensitive = abap_false )
                            ( name = 'poitem' value = poitem type = 'Edm.String' is_sensitive = abap_false )
                              ( name = 'so' value = iv_salesorder type = 'Edm.String' is_sensitive = abap_false )
                            ( name = 'so' value = salesorder type = 'Edm.String' is_sensitive = abap_false )
                              ( name = 'article' value = iv_product type = 'Edm.String' is_sensitive = abap_false )
                            ( name = 'article' value = product type = 'Edm.String' is_sensitive = abap_false )
                              ( name = 'plant' value = iv_plant type = 'Edm.String' is_sensitive = abap_false ) ).
                            ( name = 'plant' value = plant type = 'Edm.String' is_sensitive = abap_false ) ).
       lv_type_key = mc_notification_type-gr_with_ref_to_sales_order.
       type_key = notification_type-gr_with_ref_to_sales_order.
     ENDIF.
     ENDIF.


     /iwngw/cl_notification_api=>create_notifications(
     /iwngw/cl_notification_api=>create_notifications(
                 EXPORTING
                 EXPORTING
                   iv_provider_id  = mc_notification_provider_id
                   iv_provider_id  = notification_provider_id
                   it_notification = VALUE #( ( id = cl_uuid_factory=>create_system_uuid( )->create_uuid_x16( )
                   it_notification = VALUE #( ( id = cl_uuid_factory=>create_system_uuid( )->create_uuid_x16( )
                                             type_key = lv_type_key
                                             type_key = lv_type_key
                                             type_version = '0'
                                             type_version = '0'
                                             priority = 'NEUTRAL'
                                             priority = 'NEUTRAL'
                                             navigation_parameters = VALUE #( ( name = 'MaterialDocument' value = iv_matdoc )
                                             navigation_parameters = VALUE #( ( name = 'MaterialDocument' value = matdoc )
                                                                               ( name = 'MaterialDocumentYear' value = iv_matdoc_year )
                                                                               ( name = 'MaterialDocumentYear' value = matdoc_year )
                                                                               ( name = 'sap-fiori-id' value = 'F1077' )
                                                                               ( name = 'sap-fiori-id' value = 'F1077' )
                                                                               ( name = 'StockCHangeContext' value = '' )
                                                                               ( name = 'StockCHangeContext' value = '' )
Line 179: Line 182:
                                                                               ( name = 'StockChangeType' value = '05')
                                                                               ( name = 'StockChangeType' value = '05')
                                                                               ( name = 'sap-keep-alive' value = 'restricted' )
                                                                               ( name = 'sap-keep-alive' value = 'restricted' )
                                                                               ( name = 'MaterialDocumentItem' value = iv_matdoc_item ) )
                                                                               ( name = 'MaterialDocumentItem' value = matdoc_item ) )
                                             navigation_target_object = 'MaterialDocument'
                                             navigation_target_object = 'MaterialDocument'
                                             navigation_target_action = 'displayFactSheet'
                                             navigation_target_action = 'displayFactSheet'
                                             recipients = lt_recipients
                                             recipients = recipients
                                             parameters = VALUE #( language = sy-datum
                                             parameters = VALUE #( language = sy-datum
                                                                 ( parameters = _mt_parameters ) ) ) ) ).
                                                                 ( parameters = parameters ) ) ) ) ).
       CATCH cx_uuid_error INTO DATA(lrx_uuid_error).
       CATCH cx_uuid_error INTO DATA(rx_uuid_error).
       ev_ex_msg = lrx_uuid_error->get_text( ).
       ex_msg = lrx_uuid_error->get_text( ).
        RETURN.
      RETURN.
       CATCH /iwngw/cx_notification_api INTO DATA(lrx_api).
       CATCH /iwngw/cx_notification_api INTO DATA(rx_api).
         " HANDLE ERROR
         " HANDLE ERROR
        ev_ex_msg = lrx_api->get_text( ).
      ex_msg = rx_api->get_text( ).
        RETURN.
      RETURN.
     ENDTRY.
     ENDTRY.
     ev_is_sending_successful = abap_true.
     is_sending_successful = abap_true.
   ENDMETHOD.
   ENDMETHOD.


  ENDCLASS.
  ENDCLASS.
</syntaxhighlight>
</syntaxhighlight>
</div>
</div>


= Necessary customizing =
== Necessary customizing ==


== Register notification provider ==
=== Register notification provider ===
Use the “Register provider” button to register the notification provider.
Use the “Register provider” button to register the notification provider.
A name for the provider, e.g. “YMM_...” and the previously created provider class are assigned here.
A name for the provider, e.g. “YMM_...” and the created provider class are assigned here.


{| style="border:1px solid black; border-radius: 6px;”
{| style="border:1px solid black; border-radius: 6px;”
| '''Note''''
| '''Note'''
|-
|-
| The created entries are created in the respective logged-in system language (time of creation of the wiki article for release 2023). This means that if the customizing entry was made in German, it will not be visible when EN logs in. The language to be used for customizing should be agreed in the project.
| The created entries are created in the respective logged-in system language (time of creation of the wiki article for release 2023). This means that if the customizing entry was made in German, it will not be visible when EN logs in. The language to be used for customizing should be agreed in the project.
|}
|}


== Manage notification provider ==
=== Manage notification provider ===


Perse the provider is not activated, which is why you still have to activate it.
Perse the provider is not activated, which is why you still have to activate it.
Translated with DeepL.com (free version)

Latest revision as of 11:38, 31 December 2024

There is a “bell” icon in the Fiori Launchpad. All Fiori push notifications are displayed here. The aim of this wiki article is to enable you to display your own notifications there. The prerequisite is that the technical setup and configuration has been carried out in the system.

Overview of the required objects and customizing

  • Creation of Y/Z notification class
    • Interface /iwngw/if_notif_provider
    • Implementation method /iwngw/if_notif_provider~get_notification_parameters
    • Implementation method /iwngw/if_notif_provider~get_notification_type
    • Implementation method /iwngw/if_notif_provider~get_notification_type_text
    • Implementation method /iwngw/if_notif_provider~handle_action
    • Implementation method send_notification
  • Customizing
    • Register notification provider
    • Manage notification provider

Creation of Y/Z Notification class

For method send_notification you have to consider which parameters are required. Also the success/error handling.

Example Code

 CLASS ycl_your_class_notifprov DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .

  PUBLIC SECTION.
    INTERFACES /iwngw/if_notif_provider .

    CONSTANTS notification_provider_id TYPE /iwngw/notif_provider_id  VALUE 'YMODULE_NOTIF_PROV_ID' ##NO_TEXT.

    CONSTANTS:
      BEGIN OF notification_type,
        general_gr                 TYPE /iwngw/notification_type_key VALUE 'GenGrForAPoItem',
        gr_with_ref_to_sales_order TYPE /iwngw/notification_type_key VALUE 'SalesOrderGrForAPoItem',
      END OF notification_type.

    CLASS-METHODS: send_notification
                    IMPORTING purchaseorder TYPE I_PurchaseOrderAPI01-PurchaseOrder
                    EXPORTING is_sending_successful TYPE abap_bool
                              ex_msg TYPE string.
  PROTECTED SECTION.
  PRIVATE SECTION.
   CLASS-DATA: parameters type /iwngw/if_notif_provider=>ty_t_notification_parameter.
 ENDCLASS.
 
 CLASS ycl_your_class_notifprov IMPLEMENTATION.
  METHOD /iwngw/if_notif_provider~get_notification_parameters ##NEEDED.
   CLEAR: parameter.
   
    SET LANGUAGE language.

    LOOP AT parameters ASSIGNING FIELD-SYMBOL(<para>).
     MOVE-CORRESPONDING <para> TO parameter.
    ENDLOOP.
    SET LANGUAGE lang.
  ENDMETHOD.

  METHOD /iwngw/if_notif_provider~get_notification_type.
    DATA notif_action LIKE LINE OF notification_action ##NEEDED.

    CLEAR notification_type.
    CLEAR notification_action.

    CASE type_key.
      WHEN notification_type-general_gr.
        notification_type-type_key     = notification_type-general_gr.
        notification_type-version      = 0.
        notification_type-is_groupable = abap_true.
      WHEN notification_type-gr_with_ref_to_sales_order.
        notification_type-type_key     = notification_type-gr_with_ref_to_sales_order.
        notification_type-version      = 0.
        notification_type-is_groupable = abap_true.
      WHEN OTHERS.
        RAISE EXCEPTION TYPE /iwngw/cx_notif_provider.
    ENDCASE.
  ENDMETHOD.

   METHOD /iwngw/if_notif_provider~get_notification_type_text.
    DATA tmp_text TYPE string.

    CLEAR type_text.
    CLEAR action_text.

    SET LANGUAGE language.

    CASE type_key.
      WHEN notification_type-general_gr.
        tmp_text = TEXT-100.
        REPLACE '&1' WITH '{po}' INTO tmp_text.
        REPLACE '&2' WITH '{poitem}' INTO tmp_text.
        type_text-template_public    = tmp_text.
        type_text-template_grouped   = TEXT-101.
        CLEAR lv_tmp_text.
        tmp_text = TEXT-102.
        REPLACE '&1' WITH '{article}' INTO tmp_text.
        REPLACE '&2' WITH '{plant}' INTO tmp_text.
        type_text-subtitle           = tmp_text.
        type_text-description        = TEXT-103.
      WHEN mc_notification_type-gr_with_ref_to_sales_order.
        tmp_text = TEXT-200.
        REPLACE '&1' WITH '{po}' INTO tmp_text.
        REPLACE '&2' WITH '{poitem}' INTO tmp_text.
        REPLACE '&3' WITH '{so}' INTO tmp_text.
        type_text-template_public    = tmp_text.
        type_text-template_grouped   = TEXT-201.
        CLEAR tmp_text.
        tmp_text = TEXT-202.
        REPLACE '&1' WITH '{article}' INTO tmp_text.
        REPLACE '&2' WITH '{plant}' INTO tmp_text.
        type_text-subtitle           = tmp_text.
        type_text-description        = TEXT-203.
      WHEN OTHERS.
        RAISE EXCEPTION TYPE /iwngw/cx_notif_provider.
    ENDCASE.

  ENDMETHOD.

 METHOD /iwngw/if_notif_provider~handle_action.
    CLEAR result.

*   For now always return success if ids are set, since no persistence in this provider
    IF notification_id IS INITIAL.
      result-success = abap_false.
    ELSEIF action_key IS INITIAL.
      result-success = abap_false.
    ELSE.
      result-success          = abap_true.
      result-delete_on_return = abap_true.
    ENDIF.
 ENDMETHOD.
 
   METHOD /iwngw/if_notif_provider~handle_bulk_action.
*   no bulk notifications supported
    CLEAR notif_result.
  ENDMETHOD.
  
 METHOD send_notification.

   CLEAR parameters.

    TRY.

     DATA: recipients type /iwngw/if_notif_provider=>ty_t_notification_recipient,
           parameters type /iwngw/if_notif_provider=>ty_t_notification_parameter,
           type_key type /iwngw/notification_type_key.

     IF salesorder_creator IS INITIAL.
      recipients = VALUE #( ( id = purchaseorder_creator ) ).
      parameters = VALUE #(  ( name = 'po' value = purchaseorder type = 'Edm.String' is_sensitive = abap_false )
                             ( name = 'poitem' value = poitem type = 'Edm.String' is_sensitive = abap_false )
                             ( name = 'article' value = product type = 'Edm.String' is_sensitive = abap_false )
                             ( name = 'plant' value = plant type = 'Edm.String' is_sensitive = abap_false ) ).
      type_key = notification_type-general_gr.
     ELSE.
      recipients = VALUE #( ( id = purchaseorder_creator ) ( id = salesorder_creator ) ).
      parameters = VALUE #( ( name = 'po' value = purchaseorder type = 'Edm.String' is_sensitive = abap_false )
                            ( name = 'poitem' value = poitem type = 'Edm.String' is_sensitive = abap_false )
                            ( name = 'so' value = salesorder type = 'Edm.String' is_sensitive = abap_false )
                            ( name = 'article' value = product type = 'Edm.String' is_sensitive = abap_false )
                            ( name = 'plant' value = plant type = 'Edm.String' is_sensitive = abap_false ) ).
      type_key = notification_type-gr_with_ref_to_sales_order.
     ENDIF.

     /iwngw/cl_notification_api=>create_notifications(
                EXPORTING
                  iv_provider_id  = notification_provider_id
                  it_notification = VALUE #( ( id = cl_uuid_factory=>create_system_uuid( )->create_uuid_x16( )
                                             type_key = lv_type_key
                                             type_version = '0'
                                             priority = 'NEUTRAL'
                                             navigation_parameters = VALUE #( ( name = 'MaterialDocument' value = matdoc )
                                                                              ( name = 'MaterialDocumentYear' value = matdoc_year )
                                                                              ( name = 'sap-fiori-id' value = 'F1077' )
                                                                              ( name = 'StockCHangeContext' value = '' )
                                                                              ( name = 'StockCHangeContext' value = '01' )
                                                                              ( name = 'StockChangeType' value = '05')
                                                                              ( name = 'sap-keep-alive' value = 'restricted' )
                                                                              ( name = 'MaterialDocumentItem' value = matdoc_item ) )
                                             navigation_target_object = 'MaterialDocument'
                                             navigation_target_action = 'displayFactSheet'
                                             recipients = recipients
                                             parameters = VALUE #( language = sy-datum
                                                                 ( parameters = parameters ) ) ) ) ).
      CATCH cx_uuid_error INTO DATA(rx_uuid_error).
       ex_msg = lrx_uuid_error->get_text( ).
       RETURN.
      CATCH /iwngw/cx_notification_api INTO DATA(rx_api).
        " HANDLE ERROR
       ex_msg = rx_api->get_text( ).
       RETURN.
    ENDTRY.
    is_sending_successful = abap_true.
  ENDMETHOD.

 ENDCLASS.

Necessary customizing

Register notification provider

Use the “Register provider” button to register the notification provider. A name for the provider, e.g. “YMM_...” and the created provider class are assigned here.

Note
The created entries are created in the respective logged-in system language (time of creation of the wiki article for release 2023). This means that if the customizing entry was made in German, it will not be visible when EN logs in. The language to be used for customizing should be agreed in the project.

Manage notification provider

Perse the provider is not activated, which is why you still have to activate it.


This is a wiki created in the spare time of a private person working in the SAP ERP area. The aim is to collect knowledge for the own use. The wiki is maintained to the best of knowledge and belief.
All products shown, including in form of screenshots, belong to SAP SE. Their trademarks are, among others: SAP®,ABAP®,SAP Fiori®,SAP HANA®,SAP NetWeaver®,SAP® R/3®,SAP S/4HANA®,SAP S/4HANA® Cloud