Difference between revisions of "SAP HCM TIME"
From SapWiki
Line 155: | Line 155: | ||
technical_error = 4 | technical_error = 4 | ||
OTHERS = 5. | OTHERS = 5. | ||
+ | |||
+ | clear: zl[], saldo[], zes[]. | ||
+ | clear: zl, saldo, zes. | ||
+ | loop at time_results into time_results_wa. | ||
+ | append lines of time_results_wa-zes to zes. | ||
+ | append lines of time_results_wa-saldo to saldo. | ||
+ | append lines of time_results_wa-zl to zl. | ||
+ | endloop. | ||
</nowiki> | </nowiki> | ||
− | + | ||
====Ejemplo: leer saldo de vacaciones==== | ====Ejemplo: leer saldo de vacaciones==== | ||
<nowiki>FORM get_saldo_vaca USING p_pernr TYPE p0000-pernr | <nowiki>FORM get_saldo_vaca USING p_pernr TYPE p0000-pernr |
Revision as of 21:26, 12 June 2021
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 feriado
FUNCTION Z_HCM_FERIADO. *"---------------------------------------------------------------------- *"*"Interfase local *" IMPORTING *" REFERENCE(I_PERNR) TYPE PERNR_D *" REFERENCE(I_BEGDA) TYPE BEGDA *" EXPORTING *" REFERENCE(E_FERIADO) TYPE FLAG *"---------------------------------------------------------------------- DATA: lt_persavail TYPE STANDARD TABLE OF pdpsp, ls_persavail TYPE pdpsp. CALL FUNCTION 'HR_READ_TIMEDATA_PSP' EXPORTING begin_date = i_begda end_date = i_begda person_id = i_pernr * PERSON_TYP = 'P' * RP_BUILD_PSP_ERROR = ' ' TABLES pers_avail = lt_persavail EXCEPTIONS no_capacity_available = 1 no_integration_activ = 2 timeinfo_error = 3 OTHERS = 4. IF sy-subrc <> 0. * Implement suitable error handling here ELSE. ENDIF. READ TABLE lt_persavail INTO ls_persavail WITH KEY datum = i_begda. IF sy-subrc EQ 0. IF ls_persavail-tprog EQ 'LIBR' OR ls_persavail-tagty EQ '1'. e_feriado = 'X'. ENDIF. ENDIF. ENDFUNCTION.
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 cluster B2
ejemplo 1
DATA: gt_cluster TYPE table of hrf_tim_b2. CALL FUNCTION 'HR_FORMS_TIM_GET_B2_RESULTS' EXPORTING pernr = ls_pernr-pernr begda = gv_begda endda = gv_endda IMPORTING tim_b2 = gt_cluster EXCEPTIONS wrong_cluster_version = 1 no_read_authority = 2 cluster_archived = 3 technical_error = 4 OTHERS = 5. LOOP AT gt_cluster-ft_zl INTO wa_zl * do something endloop.
ejemplo 2
*-----Import der Tabellen ZES, SALDO und ZL aus Cluster B2 CALL FUNCTION 'HR_TIME_RESULTS_IN_INTERVAL' EXPORTING int_pernr = pernr-pernr int_begda = begda int_endda = endda TABLES int_time_results = time_results EXCEPTIONS wrong_cluster_version = 1 no_read_authority = 2 cluster_archived = 3 technical_error = 4 OTHERS = 5. clear: zl[], saldo[], zes[]. clear: zl, saldo, zes. loop at time_results into time_results_wa. append lines of time_results_wa-zes to zes. append lines of time_results_wa-saldo to saldo. append lines of time_results_wa-zl to zl. endloop.
Ejemplo: leer saldo de vacaciones
FORM get_saldo_vaca USING p_pernr TYPE p0000-pernr CHANGING p_saldo TYPE pc2bf-anzhl p_begda type p2001-begda. DATA: lt_zes TYPE STANDARD TABLE OF pc2b6 WITH HEADER LINE, lt_ab TYPE STANDARD TABLE OF pc20i WITH HEADER LINE, lt_zl TYPE STANDARD TABLE OF pc2bf WITH HEADER LINE. DATA: ls_b2_key TYPE pc2b0, ls_keytable TYPE ptm_clst_perview. DATA lt_pcl2 TYPE TABLE OF pcl2. DATA ls_pcl2 LIKE LINE OF lt_pcl2. DATA l_srtfdlow TYPE pcl2-srtfd. DATA l_srtfdhigh TYPE pcl2-srtfd. CONCATENATE p_pernr '18000101' INTO l_srtfdlow. CONCATENATE p_pernr '99991231' INTO l_srtfdhigh. SELECT * FROM pcl2 INTO TABLE lt_pcl2 WHERE relid EQ 'B2' AND srtfd BETWEEN l_srtfdlow AND l_srtfdhigh AND srtf2 EQ '00' ORDER BY PRIMARY KEY. "#EC PORTABLE IF sy-subrc = 0. * leer ultimo LOOP AT lt_pcl2 INTO ls_pcl2. ENDLOOP. ls_b2_key = ls_pcl2-srtfd. MOVE-CORRESPONDING ls_pcl2 TO ls_keytable. MOVE-CORRESPONDING ls_b2_key TO ls_keytable. CALL FUNCTION 'HR_TIME_RESULTS_GET' EXPORTING get_pernr = p_pernr get_pabrj = ls_keytable-pabrj get_pabrp = ls_keytable-pabrp TABLES get_zes = lt_zes get_ab = lt_ab get_zl = lt_zl. LOOP AT lt_zl WHERE lgart = '5T12'. ADD lt_zl-anzhl TO p_saldo. ENDLOOP. p_begda = ls_pcl2-aedtm. ENDIF. ENDFORM. "get_saldo_vaca
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.