Mostrando entradas con la etiqueta HHRR. Mostrar todas las entradas
Mostrando entradas con la etiqueta HHRR. Mostrar todas las entradas

miércoles, 15 de mayo de 2013

0HR_PA_1: BEGDAT-1 para salidas, status empleado ='0'


Un empleado cesado el  1.4.2011 en la  PA20,  va a tener en el extractor una fecha de inicio para la salida de la empresa de 31.03.2011:

 En la página Help de SAP se indica: “A special date calculation takes place for leaving actions. Actions are only identified as leaving actions if the employment status of the action is changed to the value withdrawn (STAT2 = o). For these actions, one day is subtracted from the start date of the action” http://help.sap.com/saphelp_nw04/helpdata/en/29/02b43947f80c74e10000000a114084/content.htm

Notas: Note 381239 - HR BW: Counting leavings using actions

Si queremos que en el BW sea de 1.4.2011 tenemos que Incluir este código en la transformación:


Para dia:
* ABB 15.05.2013
* 0HR_PA_1 extractor returns in BW day -1 compared with that of
* ECC whenever the Employee Status change on incative (=0)  and the
* action type ( "10") .
* To avoid this in BW you may insert in the trasformation sample code:
* Note 381239 - HR BW: Counting leavings using actions
    if SOURCE_FIELDS-STAT2 = '0' and SOURCE_FIELDS-MASSN = '10'.
      RESULT = SOURCE_FIELDS-CALDAY + 1.
else.
      RESULT = SOURCE_FIELDS-CALDAY.
    endif.

* ABB 15.05.2013
Para mes:
    data: aux_day TYPE D.
    clear aux_day.
    if SOURCE_FIELDS-STAT2 = '0' and SOURCE_FIELDS-MASSN = '10'.
      aux_day = SOURCE_FIELDS-CALDAY + 1.
      RESULT = aux_day(6).
    else.
      RESULT = SOURCE_FIELDS-CALDAY(6).
    endif.

viernes, 26 de abril de 2013

TEVEN: infotipo IT2011


Detallo un poco mas como tratar el Infotipo 2011.

Los registros del IT2011 no se almacenan en una tabla tipo PANNNN, con NNNN = Nº Infotipo, sino en la tabla TEVEN, por lo que funciones como HR_READ_INFOTYPE, no sirven para leer los datos del IT2011, entonces un ejemplo de lectura del IT2011 es como el siguiente:


Código:
     SELECT * FROM teven APPENDING TABLE it_teven
             WHERE pernr EQ gt_pernr-pernr
               AND ldate EQ gf_fecha
               AND stokz EQ space.


A su vez, para borrar un registro es aconsejable hacerlo de la siguiente manera:


Código:
   IF teven-stokz EQ space.
     teven-stokz = 'X'.
     teven-uname = sy-uname.
     teven-aedtm = sy-datum.
     UPDATE teven.
   ENDIF.


BAPI_CC1_UPLOAD_TIMEEVENT.

lunes, 25 de febrero de 2013

Problemas con decimales en el extractor 0HR_PT_2

Nota 1617680

lunes, 4 de febrero de 2013

ABAP HR


Edad


PERFORM CALCULATE_ULTIMO " last day of month

using SOURCE_FIELDS-CALMONTH

RECORD_NO

RECORD_ALL

SOURCE_SYSTEM

CHANGING ULTIMO

RETURNCODE.



CLEAR: EMPLOYEE_MD, PERSON_MD.

CLEAR: EMPLOYEE_WA, PERSON_WA.



PERFORM READ_MD_PERSON

using SOURCE_FIELDS-employee

SOURCE_FIELDS-calmonth

RECORD_NO

RECORD_ALL

SOURCE_SYSTEM

CHANGING EMPLOYEE_WA

PERSON_WA

RETURNCODE.

EMPLOYEE_MD = EMPLOYEE_WA.

PERSON_MD = PERSON_WA.



IF NOT PERSON_MD-DATEBIRTH IS INITIAL.

RESULT = ULTIMO+0(4) - PERSON_MD-DATEBIRTH+0(4).

IF ULTIMO+4(4) LT PERSON_MD-DATEBIRTH+4(4).

RESULT = RESULT - 1.

ENDIF.

ENDIF.







%% Ocupação

if g_RECORD_NO <> RECORD_NO.

g_RECORD_NO = RECORD_NO.

clear: employee_md, person_md.

clear: employee_wa, person_wa.

endif.



perform read_md_employee

using SOURCE_FIELDS-employee

SOURCE_FIELDS-calmonth

RECORD_NO

RECORD_ALL

SOURCE_SYSTEM

changing employee_wa

RETURNCODE.

employee_md = employee_wa.

RESULT = EMPLOYEE_MD-PAYPCT.







if g_RECORD_NO <> RECORD_NO.

g_RECORD_NO = RECORD_NO.

clear: employee_md, person_md.

clear: employee_wa, person_wa.

endif.



perform read_md_employee

using SOURCE_FIELDS-employee

SOURCE_FIELDS-calmonth

RECORD_NO

RECORD_ALL

SOURCE_SYSTEM

changing employee_wa

RETURNCODE.

employee_md = employee_wa.

* fill the internal table "MONITOR", to make monitor entries



* result value of the routine

RESULT = EMPLOYEE_MD-PAYPCT / 100.







data: ultimo like sy-datum.



if g_RECORD_NO <> RECORD_NO.

g_RECORD_NO = RECORD_NO.

clear: employee_md, person_md.

clear: employee_wa, person_wa.

endif.



perform read_md_employee

using SOURCE_FIELDS-employee

SOURCE_FIELDS-calmonth

RECORD_NO

RECORD_ALL

SOURCE_SYSTEM

changing employee_wa

RETURNCODE.

employee_md = employee_wa.



perform calculate_ultimo

using SOURCE_FIELDS-calmonth

RECORD_NO

RECORD_ALL

SOURCE_SYSTEM

changing ultimo

RETURNCODE.



IF NOT EMPLOYEE_WA-ENTRYDATE IS INITIAL.

RESULT = ULTIMO+0(4) - EMPLOYEE_WA-ENTRYDATE+0(4).

IF ULTIMO+4(4) LT EMPLOYEE_WA-ENTRYDATE+4(4).

RESULT = RESULT - 1.

endif.

ENDIF.







DATA: TMP_PAYPCT TYPE I.

if g_RECORD_NO <> RECORD_NO.

g_RECORD_NO = RECORD_NO.

clear: employee_md, person_md.

clear: employee_wa, person_wa.

endif.



perform read_md_employee

using SOURCE_FIELDS-employee

SOURCE_FIELDS-calmonth

RECORD_NO

RECORD_ALL

SOURCE_SYSTEM

changing employee_wa

RETURNCODE.

employee_md = employee_wa.

* fill the internal table "MONITOR", to make monitor entries



* result value of the routine

* rounded

TMP_PAYPCT = EMPLOYEE_MD-PAYPCT.

RESULT = TMP_PAYPCT.

viernes, 22 de julio de 2011

0HR_PY_1 extractor is not runnig with delta mode

Actually, there are difference when the 0HR_PY_1 extractor is run in
init/delta mode or FULL mode. Please refer to the information provided
from our developer:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In full mode, the status of this payroll records, which is maintained
for each payroll area in transaction PA03, is NOT considered at all.
This is different in init/delta runs. In this case, we the extractor
needs to decide, whether payroll results can be considered to be
final and are not being overwritten by new payroll runs for the
same period.
This means, as long as a certain payroll period is not closed for
a given payroll area, results which are already on the database
for this period are not getting extracted, as there is the
possibility, that they are getting overwritten again by
a payroll run for the same period.
Once the payroll period is closed in PA03, the results for that
period are considered to be final, and thus extraction will
extract them. You will need to check the status of the payroll
areas in PA03.

miércoles, 8 de diciembre de 2010

Codigo para extraer las rubricas salariales

Este es un codigo curioso de como obtener las rubricas salariales, aunque al final se utilizó la call function de más abajo.

DATA: zpa0001 TYPE TABLE OF p0001 WITH HEADER LINE.
DATA: zpa0008 TYPE TABLE OF p0008 WITH HEADER LINE,
zpa0007 TYPE TABLE OF p0007 WITH HEADER LINE,
zpa0014 TYPE TABLE OF p0014 WITH HEADER LINE,
ZPPBWLA TYPE TABLE OF PBWLA WITH HEADER LINE.


* CALL FUNCTION 'HR_READ_INFOTYPE'
* EXPORTING
* pernr = wa_c_t_data-pernr
* infty = '0008'
* begda = '18000101'
* endda = '99991231'
* TABLES
* infty_tab = zpa0008.
*
* LOOP AT zpa0008.
* IF zpa0008-BEGDA <= wa_c_t_data-BEGDA * and zpa0008-endda >= wa_c_t_data-ENDDA.
* DO 40 TIMES VARYING LGA FROM ZPa0008-LGA01 NEXT ZPa0008-LGA02
* VARYING BTE FROM ZPa0008-BET01 NEXT ZPa0008-BET02.
* IF LGA eq '0001'.
* wa_c_t_data-Z_VB_0001 = bte.
* ELSEIF LGA eq '0004'.
* wa_c_t_data-Z_IHT_0004 = bte.
* ELSEIF LGA eq '0005'.
* wa_c_t_data-Z_CH_0005 = bte.
* ELSEIF LGA eq '0006'.
* wa_c_t_data-Z_TU_0006 = bte.
* ELSEIF LGA eq '0007'.
* wa_c_t_data-Z_AS_0007 = bte.
* ENDIF.
* ENDDO.
* endif.
* endloop.



CALL FUNCTION 'RP_FILL_WAGE_TYPE_TABLE_EXT'
EXPORTING
* APPLI = 'E'
begda = wa_c_t_data-BEGDA
endda = wa_c_t_data-ENDDA
INFTY = '0008'
PERNR = wa_c_t_data-PERNR
* SUBTY = '0 '
TABLES
PP0001 = zpa0001
PP0007 = zpa0007
PP0008 = zpa0008
PPBWLA = zPPBWLA .
EXCEPTIONS
ERROR_AT_INDIRECT_EVALUATION = 1 .
IF SY-SUBRC <> 0.
ENDIF.


LOOP AT zPPBWLA.
IF zPPBWLA-BEGDA <= wa_c_t_data-BEGDA and zPPBWLA-endda >= wa_c_t_data-ENDDA.
IF zPPBWLA-LGARt eq '0001'.
wa_c_t_data-Z_VB_0001 = zPPBWLA-betrg.
ELSEIF zPPBWLA-LGARt eq '0004'.
wa_c_t_data-Z_IHT_0004 = zPPBWLA-betrg.
ELSEIF zPPBWLA-LGARt eq '0005'.
wa_c_t_data-Z_CH_0005 = zPPBWLA-betrg.
ELSEIF zPPBWLA-LGARt eq '0006'.
wa_c_t_data-Z_TU_0006 = zPPBWLA-betrg.
ELSEIF zPPBWLA-LGARt eq '0007'.
wa_c_t_data-Z_AS_0007 = zPPBWLA-betrg.
ENDIF.
endif.
endloop.


CALL FUNCTION 'RP_FILL_WAGE_TYPE_TABLE_EXT'
EXPORTING
* APPLI = 'E'
begda = wa_c_t_data-BEGDA
endda = wa_c_t_data-ENDDA
INFTY = '0014'
PERNR = wa_c_t_data-PERNR
SUBTY = '3001'
TABLES
PP0001 = zpa0001
PP0007 = zpa0007
PP0008 = zpa0008
PPBWLA = zPPBWLA
PP0014 = zpa0014 .
EXCEPTIONS
ERROR_AT_INDIRECT_EVALUATION = 1 .
IF SY-SUBRC <> 0.
ENDIF.
LOOP AT zPPBWLA.
if zPPBWLA-BEGDA <= wa_c_t_data-BEGDA and zPPBWLA-endda >= wa_c_t_data-ENDDA
and zPPBWLA-LGART EQ '3001'.
wa_c_t_data-Z_PJ_3001 = zPPBWLA-betrg.
endif.
endloop.