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

[HR] Anzeige Zeitauswertungsergebnisse (Cluster B2) – Zeitsalden kumuliert (SALDO)

PT_CLSTB2 → SALDO

DATA pernr TYPE pernr_d.
DATA saldo TYPE TABLE OF pc2b5.

CALL FUNCTION 'HR_TIME_RESULTS_GET'
  EXPORTING
    get_pernr             = pernr
    get_pabrj             = CONV pabrj( sy-datum(4) )
    get_pabrp             = CONV pabrp( sy-datum(6) )
  TABLES
    get_saldo             = saldo
  EXCEPTIONS
    no_period_specified   = 1
    wrong_cluster_version = 2
    no_read_authority     = 3
    cluster_archived      = 4
    technical_error       = 5
    OTHERS                = 6.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

[Workflow] Get all Workitems and Workitem Container related to a pernr

If you have connected any workflows to a pernr via BUS1065 (like it is described here), you can receive all related workflows/workitems related to this pernr via the following code:

    NEW cl_def_im_com_bsp_workflow( )->if_ex_com_bsp_workflow~read_workitems_for_object( EXPORTING iv_swo_objtype = 'BUS1065'
                                                                                                   iv_swo_objkey  = CONV #( lv_pernr ) 
                                                                                         IMPORTING et_workitems   = DATA(lt_workitems) ).

    LOOP AT lt_workitems ASSIGNING FIELD-SYMBOL(<workitems>).
      "If you are only interested in specific workflows, you could filter here
      "WHERE wi_rh_task = 'WSxxxxxxxx' 
      "AND   wi_stat    =  'STARTED'.

      NEW /iwwrk/cl_wf_read_workitem( <workitems>-wi_id )->get_wi_container( IMPORTING et_wi_container = DATA(lt_wi_container) ).
      " access container items via lt_wi_container[ element = 'IV_PERNR'  ]-value

    ENDLOOP.

[SuccessFactors] Create JavaScript Date-Object from DateTimeOffset

The SuccessFactors oData v2 API is returning timestamps in Unix Epoch format (unix-style milliseconds since 1/1/1970).

Many timestamp fields are of type Edm.Int64. When receiving the milliseconds as Integer, you can directly create a date-object of it using Date(1658237847).

But some timestamps are of type Edm.DateTimeOffset, i.e.: "createdDate": "/Date(1652252620000+0000)/".
When binding a timestamp property with an ODataModel, the internal lib datajs will convert the /Date(...)/ value to a standard JS date-object.

But in my case I manually had to convert the timestamp and this is the shortest way I found to convert the epoch string into a JS date-object.

// SF epoch date string
const SFdateString = '/Date(1652252620000+0000)/' 

// remove the '/' on both sides and create the date object
const oDate = eval('new ' + SFdateString .slice(1, -1))

console.log(typeof oDate )
console.log(oDate )

const oDateTimeFormat = sap.ui.core.format.DateFormat.getDateTimeInstance({
          pattern: "YYYY-MM-dd HH:mm"
})
return oDateTimeFormat.format(oDate)


[ABAP] Read personnel area with text

  DATA p0001 TYPE p0001.
  cl_hcmfab_utilities=>read_infotype_record( EXPORTING iv_pernr = pernr
                                                       iv_infty = '0001'
                                             IMPORTING es_pnnnn = p0001 ).
  DATA(personnel_area_id)   = p0001-werks.
  DATA(personnel_area_text) = cl_hr_t500p=>read( p0001-werks )-name1.

Or using the class CL_HCMFAB_EMPLOYEE_API.

  DATA(lv_employee_details) = cl_hcmfab_employee_api=>get_instance( )->get_employee_details( iv_pernr          = pernr
                                                                                             iv_application_id = if_hcmfab_constants=>gc_application_id-mypersonaldata ).
  DATA(personnel_area_id)   = lv_employee_details-personnel_area_id.
  DATA(personnel_area_text) = lv_employee_details-personnel_area_text.

[Deutsch] Aliquotierung

https://de.wikipedia.org/wiki/Aliquotierung

Aliquotierung oder das zugehörige Verb aliquotieren bedeuten im allgemeinen Sprachsinn „den aliquoten Teil einer Größe bestimmen“.

https://de.wiktionary.org/wiki/Aliquotierung

[1] Betriebswirtschaft, Personalwirtschaft: die anteilsmäßige, periodenbezogene Berechnung und Ermittlung von Ansprüchen (Urlaub, Sonderzahlungen, Entgelt etc.) für einen Mitarbeiter bei dessen Ein- oder Austritt innerhalb (und nicht am Anfang oder am Ende) der Abrechnungsperiode.

[HR] TMW – Time-Manager-Workplace BAdI

Transaktion: PTMW
BAdI: PT_BLP_USER

Badi Implementierung anlegen und Filter-Ausprägungen hinzufügen. Es muss für jede benötigte Filter-Ausprägung eine eigene BAdI Implementierung und Klasse angelegt werden.

Klasse anlegen und in der Interface Methode die Kundenlogik, wie in der Dokumentation empfohlen, in eine private Methode kapseln.
Bsp.:

  METHOD if_ex_pt_blp_user~process_data.


    CHECK i_record IS BOUND.

    IF  i_record->data->category = cl_pt_tmw_tdm_const=>cat_infty
    AND i_record->data->type     = '2001'.

      "hier die erforderliche Logik rein, z.B. weitere Prüfungen
      process_it2001( EXPORTING i_record    = i_record            " Aktueller Satz
                                i_time_data = i_time_data         " Aktuelle Zeitdaten
                      IMPORTING e_messages  = e_messages          " Ausgabemeldungen für die Transaktion
                                e_time_data = e_time_data   ).    " Neue und geänderte Daten

      "An den konkreten Infotypsatz kommt man z.B. folgendermaßen:
      DATA(record_data) = CAST cl_pt_td_it2001( i_record->data ).
      DATA(p2001)       = record_data->if_pt_td_it2001~p2001.

    ENDIF.


  ENDMETHOD.