Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[FI-TV] My Travel and Expenses for Business Traveler: Change default approver

I was working with the Fiori App My Travel and Expenses for Business Traveler and implemented a new approval workflow. Unlike in the SAP standard workflow, the first approver was not the boss of the employee. The workflow was already working fine, but when sending the travel expense from the Fiori app, it still displayed the boss as approver.

Naturally, the Fiori app does not know anything from the changes on the workflow. So I had to figure out where this approver value comes from and how I could adjust it to match the workflow logic.

I first went to the official documentation to check if there is any BAdI to change/overwrite the approver.

I also checked the note 3260453 – Enablement of Custom Logic for Key User Extensibility option in S/4HANA FIORI app MTE, but it seems like no BAdI was doing the job.

Spoiler: Actually there is a BAdI called FIN_TRV_APPROVER_NAME, but it is not listed here or anywhere else in the documentation. As many times before, incomplete SAP documentation wasted hours of my life…..

Because I could not find a BAdI, I went to the RAP service, to check where the approver is set and if it’s possible to overwrite it in someway.

When clicking the Create and send button in Fiori, a POST request to the endpoint CheckTripAmounts is fired. The response of type cds_ui_travelexpensemanage.TravelExpenseType contains the required value in field TrvlExpnApproverName.

I already knew the corresponding package for RAP-Service.

In package ODATA_TRV_MTE_UI_MANAGE I found the root view entity C_TravelExpense which contained the property TrvlExpnApproverName. Its projection I_TravelExpense was located in package VDM_TRV_MTE_UI_MANAGE. I was already afraid, that the approver is somehow read via some CDS association, but it turned out to be added as empty field and properly therefore is manually filled in some behavior implementation.

cast ( ' ' as vdm_trvlexpnapprovername )                                                                             as TrvlExpnApproverName,

The related behavior implementation was in class CL_BP_I_TRAVELEXPENSE and there I found the CheckTripAmounts method, which matched the POST request I saw in the Dev console. And here I found the following logic.

    DATA l_trvlexpnapprovername TYPE char40.
    cl_trv_business_data_s4=>get_approver( EXPORTING iv_employeenumber = api->get_header( )->get_pernr( )
                                                     io_header = api->get_header(  )
                                           IMPORTING ev_approver_name  = l_trvlexpnapprovername
                                                     et_messages       = lt_return ).

When looking in the get_approver method I found the default approver logic via OM, but also a BAdI call at the end.

    DATA lo_badi TYPE REF TO fin_trv_approver_name.
    TRY.
        GET BADI lo_badi.
        DATA(ls_general_data) = io_header->get_general_data( ).
        CALL BADI lo_badi->change_approver_name
          EXPORTING
            iv_traveller_pernr = iv_employeenumber
            is_general_data    = ls_general_data
          CHANGING
            cv_approver_name   = ev_approver_name
            cv_approver_pernr  = ev_approver_pernr.
      CATCH cx_root.
    ENDTRY.

Turned out, there is BAdI to overwrite the approver, it was just not documented…………………. all other eight BAdI’s are mentionend in the documentation.

[Fiori] Meine Formulare: Entgeltnachweise ausblenden “in Vertretung von” (onBehalf)

Möchte man Führungskräften die Möglichkeit geben, in der MyForms App die Formulare ihrer Mitarbeiter einzusehen, kann dies einfach über den HCMFAB_B_COMMON BAdI in der Methode GET_CONFIGURATION realisiert werden.

      IF iv_application_id = gc_application_id-myhrforms.
        ev_enable_onbehalf = boolc( go_employee_api->is_manager( iv_application_id = iv_application_id
                                                                 iv_pernr          = iv_employee_number ) = abap_true ).
      ENDIF.

Im Standard werden der Zeitnachweis und Entgeltnachweis angezeigt. Möchte man nun für die Führungskraft den Entgeltnachweis ausblenden, kann dies über den BAdI HCMFAB_BI_MYFORMS gemacht werden.

In der Methode GET_HIDE_REM_TIME_STATEMENT kann dies z.B. so realisiert werden.

        ev_hide_rem  = abap_false.
        ev_hide_time = abap_false.

        DATA(ownpernr) = go_employee_api->get_employeenumber_from_user( ).

        IF iv_pernr <> ownpernr.
          ev_hide_rem = abap_true.
        ENDIF.

Die Variable ev_hide_rem verhindert das Hinzufügen des Entgeltnachweises im folgenden, wie ab Zeile 25 zu sehen.

Jedoch ist nach meiner Beobachtung das noch nicht ausreichend, da in der Methode FILL_FORM_TYPES der Entgeltnachweis dann doch wieder hinzugefügt wird.

Daher habe ich den Entgeltnachweis zusätzlich noch in der Methode FILL_FORM_TYPES entfernt.

      DATA(ownpernr) = go_employee_api->get_employeenumber_from_user( ).

      IF iv_pernr <> ownpernr. " Manager dürfen nur Zeitnachweise ihrer Mitarbeiter sehen
        DELETE ct_form_types WHERE form_type <> 'SAP_INT_TIM_STM'.
        RETURN.
      ENDIF.

Die Führungskraft kann nun ausschließlich den Zeitnachweis des Mitarbeiters sehen. Er selbst kann alle Formulare wie gewohnt einsehen.

[Fiori] Meine Formulare: Zeitnachweis Spalten ausblenden

In der Meine Formulare App können über den BAdI HCMFAB_B_MYFORMS ganz einfach Spalten ausgeblendet werden. Dafür eine BAdI Implementierung anlegen und die Methode FILL_FORM_SPECIFIC_FIELDS ausprogrammieren. Zum Entfernen einer Spalte muss diese einfach aus dem CHANGING Parameter ct_form_specific_fields gelöscht werden.

Dabei einfach über den FORM_TYPE auf das entsprechende Formular filtern und die gewünschte Spalte entfernen:

DELETE ct_form_specific_fields WHERE form_type = 'SAP_INT_TIM_STM' AND field_id = 'DEVIATION'.  "Abweichung entfernen

[FI-TV] Overview: Travel Management & My Travel and Expenses for Business Traveler (F6190)

Collection of useful resources, when working with the Fiori App: My Travel and Expenses for Business Traveler (F6190)

SAP Travel Management for SAP S/4HANA

SAP Help Travel Management (FI-TV)
FI-TV transactions
Reports
Tables
Good to Know: SAP Travel Management for SAP S/4HANA

Related notes:
2719018 – S4TWL – SAP Travel Management in SAP S/4HANA Suite 2022

Packet: PTRA_ADDON

My Travel and Expenses for Business Traveler (F6190)

Fiori Reference Library My Travel and Expenses for Business Traveler
SAP Help My Travel and Expenses
App Extensibility: My Travel and Expenses

Related notes:
3267811 – Default Travel Expense Start and End Date and Time settings with Travel Management S/4Hana Fiori application
3591806 – Fiori Apps Travel Management Version 3: Concurrent Employment not available → Helpful Attachment ExtensionTravelProfileVH.pdf
2164524 – Customizing of authorization object P_TRAVL for restricting creating/changing of expense reports
2633200 – Expense reports with and without mandatory travel requests
3406341 – Attachments in S4Hana Fiori apps MTE V3 and MTR V3

Packet: PAOC_TRV_S4

Workflow

Workflow Scenarios in Travel Management (FI-TV)
Approving a Trip
Standard WF for Approving Trips: WS20000040
Travel Management Workflow FAQ, Common Issues, Known Issues

Related notes:
2576990 – Workflow: Status of a trip after reject or send back for correction → Explanation, why the default workflows are a bit “uncomplete”

[Fiori] My Reporting (S/4HANA)


Kürzlich habe ich die My Reporting App in der S/4HANA Version auf einem System aktiviert. Nach der Einrichtung bin ich aber in die folgende generische Fehlermeldung gelaufen:

App kann nicht geöffnet werden, weil die SAP-UI5-Komponente der Anwendung nicht geladen werden konnte.
UI5-Komponente für Navigationsabsicht “#Manager-launchReports?scenarioId=SAP_EXAMPLE” wurde nicht geladen.

Ein Blick in die Konsole zeigte, dass versucht wurde, eine weitere Komponente namens hcm_reuselibs1 zu laden. Diese wird in der Fiori Reference Library zu der App nicht erwähnt, aber nach der Aktivierung, ließ sich die App erfolgreich laden.

[FI-TV] Travel Expense Workflow not triggered

Recently I had to configure the Travel Fiori Apps on a H4S4 System.

My Travel Requests for Business Traveler (MTR)
My Travel and Expenses for Business Traveler (MTE)
My Inbox – Approve Travel Requests
My Inbox – Approve Travel Expenses

This was pretty easy and after enabling the Apps, I activated the default Workflows WS20000050 (Approve Travel Request) and WS20000040 (Approve Trip) as well. I also checked SWE2 for BU2089 and everything looked good.

But when testing, only the Travel Request Workflow started successfully. When creating a Trip Expense, no Workflow started, instead the Trip Expense directly went to status “Trip Approved” instead of “Trip Completed“. Here you can find an overview of the possible statuses: Trip Status Directory

Initially I thought, this is somehow a Workflow issue or the BUS2089 connection does throw the right event. I also found a note related to this: 2792991.
But it turned out to be a customizing problem and the answer was only one click away from the Trip Status Directory in the chapter Trip Status Assignment. Here the Feature TRVPA is mentioned. And when looking into the system and reading the documentation via PE03 I found the following

Turned out, for Feature TRVPA and Entry WRP the value 4 was set. After changing it to 3, the right trip status got set and the workflow got triggered.

As always, the solution is quite simple once you know it, but it took quite a while to figure it out.

[Fiori] MyInbox – Custom App reloads infinitely

I recently had the situation, that after a standalone Gateway System got patched, a custom app in the My Inbox app did not load anymore, when clicking on a workitem. When opening the network tab in the dev tools, you could see three requests send over and over again. It called the manifest.json, a batch request to the OData Service and some i18n.properties calls. You could also see the app files in the sources tab, which means that app had already loaded correctly but could not be displayed because it kept restarting for some reason.

When searching via Perplexity, I found the following post in the SCN: https://community.sap.com/t5/technology-q-a/sapui5-custom-app-navigation-from-myinbox-calls-app-in-infinite-loop/qaq-p/690650
But moving the “parent” property did not help, although the described issue sound similar.

Since everything worked before the system patch and the custom app wasn’t changed, it must have been related to an updated My Inbox app or to the new UI5 version, which affected the custom app.

When scrolling through my bookmarks, I found this note: 2305401 – Integration of SAPUI5 Fiori Applications into My Inbox 2.0
When checking the attached PDF, I found the following in chapter 4:

This “repeatedly loading” was exactly my problem! And since the Gateway got patched, I guess a new My Inbox version came with it. When checking the manifest.json in the custom app, there was no async property at all.
After adding "async": true to the mainfest.json, the custom app started to load successful again. Nice!

[HR] Personalisierungsdaten pflegen

Paket: FPB_PERSONALIZATION
Fuba: FPB_PERS_POST_FOR_DIALOG
Tabelle: FPB_PERSPARM

https://launchpad.support.sap.com/#/notes/0001622954

Beispiel: Reisebeauftragter (RBA) für das Travelmanagement via Dialog CO-CCA-TR

Anlegen:
Tcode FPB_MAINTAIN_PERS_S
Dialog DIA_CO-CCA-TR

Löschen:
Tcode FPB_DELETE_PERS_DATA
Dialog CO-CCA-TR

Anzeigen:
Tcode: FPB_SHOW_PERS_DATA

Siehe weitere Transaktionen im Paket.

[Fiori] Creating a Launchpad Plugin using BAS

Since there is no Wizard anymore for creating a Launchpad Plugin, as there was in WebIDE, you have to create it manually. The following two guides helped me create a Launchpad Plugin in BAS from scratch:
https://github.com/SAP-samples/fiori-custom-plugin-abap/tree/main
https://github.com/SAP-samples/launchpad-service-samples
In my scenario, I had to deploy to a normal S/4 HANA system, so I skipped all the Steampunk or WorkZone parts.

In the first sample, for some reason they use jQuery to call an OData Service, in the second sample no OData is called at all. But of course, an OData Service can be used in a Plugin the same way as you do in every other Fiori App. You just have to add your service in the manifest.json like you would normally do:

  "sap.app": {
    ...
    "dataSources": {
      "ZFLP_TEST_SRV": {
        "uri": "/sap/opu/odata/sap/ZFLP_TEST_SRV",
        "type": "OData",
        "settings": {
          "odataVersion": "2.0",
          "localUri": "localService/metadata.xml"
        }
      }
    }
  },
  ...
  "sap.ui5": {
    ...
    "models": {
      "": {
        "dataSource": "ZFLP_TEST_SRV",
        "preload": true,
        "settings": {
          "defaultCountMode": "Inline",
          "metadataUrlParams": {
            "sap-documentation": "heading"
          }
        }
      }
    }

And for i18n

  "sap.ui5": {
     ...
    "models": {
      "i18n": {
        "type": "sap.ui.model.resource.ResourceModel",
        "settings": {
          "bundleName": "ne.flp.plugin.flp_my_plugin.i18n.i18n"
        }
      }
    }

To activate the deployed Plugin, use these transactions:

  • /ui2/flp_conf_def → Define FLP Plugins → Create new entry
  • /ui2/flp_sys_conf → Make Plugin available system-wide
  • /ui2/flp_cus_conf → Make plugin available in specific clients
  • /ui2/flp → open Fiori Launchpad to test plugin