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.

No hay comentarios: