Difference between revisions of "SAP HCM TIME"

From SapWiki
Line 2: Line 2:
  
 
=== Leer Plan de Horario de Trabajo ===
 
=== Leer Plan de Horario de Trabajo ===
Ejemplo: Reporte RPTPSH10
+
Ejemplo: Reporte RPTPSH10
 +
<nowiki>DATA: psp LIKE ptpsp  OCCURS 0 WITH HEADER LINE.
  
  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.
  
  CLEAR:psp.
+
call function 'HR_WORK_SCHEDULE_TIMES'
  REFRESH:psp[].
+
       exporting
  CALL FUNCTION 'HR_PERSONAL_WORK_SCHEDULE'
+
          pernr                  = pernr-pernr
       EXPORTING
+
          begda                  = pn-begda
        pernr                  = pernr-pernr
+
          endda                  = pn-endda
        begda                  = pn-begda
+
      tables
        endda                  = pn-endda
+
          i0001                  = p0001
        switch_activ            = '0'
+
          i0007                  = p0007
        i0001_i0007_error      = '0'
+
          i2003                  = p2003
         read_cluster            = 'X'
+
*         I0049                  =
      TABLES
+
          perws                  = psp
        perws                  = psp
+
          daygen                  =  daygen
     EXCEPTIONS
+
          dayint                  =  dayint
      error_occured          = 1
+
     exceptions
      abort_occured          = 2
+
        error_occured          = 1
      OTHERS                 = 3.
+
        perws_error            = 2
 +
        others                 = 3
 +
          .
  
  call function 'HR_WORK_SCHEDULE_TIMES'
+
* horario teórico
      exporting
+
  CALL FUNCTION 'HR_READ_TIMEDATA_PSP'
            pernr                  = pernr-pernr
+
    EXPORTING
            begda                  = pn-begda
+
      begin_date            = p_begda
            endda                  = pn-endda
+
      end_date              = p_endda
      tables
+
      person_id            = p_pernr
          i0001                  = p0001
+
    TABLES
          i0007                  = p0007
+
      pers_avail            = lt_psp
          i2003                  = p2003
+
    EXCEPTIONS
*        I0049                  =
+
      no_capacity_available = 1
            perws                  = psp
+
      no_integration_activ  = 2
          daygen                  =  daygen
+
      timeinfo_error        = 3
          dayint                  =  dayint
+
      OTHERS                = 4.</nowiki>
    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 ===
 
=== Leer Cluster de Tiempos ===

Revision as of 20:28, 5 April 2020

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.