SAP HCM TIME

From SapWiki
Revision as of 20:19, 18 April 2020 by WikiSysop (talk | contribs)

Codigos

Leer Plan de Horario de Trabajo

Ejemplo: Reporte RPTPSH10

DATA: psp LIKE ptpsp  OCCURS 0 WITH HEADER LINE.

 CLEAR:psp.
 REFRESH:psp[].
 CALL FUNCTION 'HR_PERSONAL_WORK_SCHEDULE'
     EXPORTING
       pernr                   = pernr-pernr
       begda                   = pn-begda
       endda                   = pn-endda
       switch_activ            = '0'
       i0001_i0007_error       = '0'
       read_cluster            = 'X'
     TABLES
       perws                   = psp
   EXCEPTIONS
      error_occured           = 1
      abort_occured           = 2
      OTHERS                  = 3.

 call function 'HR_WORK_SCHEDULE_TIMES'
      exporting
           pernr                   = pernr-pernr
           begda                   = pn-begda
           endda                   = pn-endda
      tables
          i0001                   = p0001
          i0007                   = p0007
          i2003                   = p2003
*         I0049                   =
           perws                   = psp
          daygen                  =  daygen
          dayint                  =  dayint
    exceptions
         error_occured           = 1
         perws_error             = 2
         others                  = 3
           .

* horario teórico
   CALL FUNCTION 'HR_READ_TIMEDATA_PSP'
     EXPORTING
       begin_date            = p_begda
       end_date              = p_endda
       person_id             = p_pernr
     TABLES
       pers_avail            = lt_psp
     EXCEPTIONS
       no_capacity_available = 1
       no_integration_activ  = 2
       timeinfo_error        = 3
       OTHERS                = 4.

Leer Cluster de Tiempos

   CALL FUNCTION 'HR_TIME_RESULTS_GET'
     EXPORTING
       get_pernr = l_pernr
       get_pabrj = l_pabrj   "año
       get_pabrp = l_pabrp   "periodo
     TABLES
       get_zes   = gt_zes
       get_pt    = gt_pt
       get_vert  = gt_vert
       get_ab    =  gt_ab
    EXCEPTIONS
      no_period_specified         = 1
      wrong_cluster_version       = 2
      no_read_authority           = 3
      cluster_archived            = 4
      technical_error             = 5
      OTHERS                      = 6
             .

Leer mensajes

   CALL FUNCTION 'HR_FORMS_TIM_GET_B2_RESULTS'
     EXPORTING
       pernr                 = l_pernr
       begda                 = l_begda
       endda                 = l_endda
     IMPORTING
       tim_b2                = ls_b2
     EXCEPTIONS
       wrong_cluster_version = 1
       no_read_authority     = 2
       cluster_archived      = 3
       technical_error       = 4
       OTHERS                = 5.
    LOOP AT ls_b2-ft_fehler INTO ls_fehler .
* do whatever
     select single * from t555f WHERE error = ls_fehler-error
                                  and errty = ls_fehler-errty.
.
.
.
   ENDLOOP.

Ampliaciones (SMOD/CMOD)

PTIMTMW : Campos específicos del cliente en table controls del TMW (transaccion PTMW)

ejemplo EXIT_SAPLHRTIM00DVEXIT_001 asignar nombre a columna HRS1
COLUMNS_TITLES-HRS1_TITLE = 'Mi columna'.  
ejemplo EXIT_SAPLHRTIM00DVEXIT_002 calcular valor para columna HRS1
    CALL FUNCTION 'HR_TIME_RESULTS_GET'
     EXPORTING
       get_pernr = im_pernr
       get_pabrj = im_date+0(4)
       get_pabrp = im_date+4(2)
     TABLES
       get_pt    = gt_pt
    EXCEPTIONS
      no_period_specified         = 1
      wrong_cluster_version       = 2
      no_read_authority           = 3
      cluster_archived            = 4
      technical_error             = 5
      OTHERS                      = 6
             .
 LOOP AT gt_pt WHERE ldate EQ im_date.
 * do whatever
 ...
 ...
 ENDLOOP.
 columns_entries-hrs1 = l_hora.

Transacciones gestión de tiempos