SAP HCM ABAP FAQ
Contents
- 1 Como leer el MOLGA de un EMPLEADO
- 2 Detalle compañia ( campo BUKRS )
- 3 Nombres de MES ( util en formularios )
- 4 Sumar / Restar meses a fecha
- 5 Ultimo dia del mes
- 6 Leer Horario de trabajo de empleado
- 7 Obtener día laboral
- 8 Obtener fecha de retorno de un absentismo(P2001)
- 9 Leer caracteristica ( feature ) HR , transaccion PE03
- 10 Verificar empleado
- 11 Verificar NIF ( RUT )
- 12 Leer clase de fecha de infotipo P0041
- 13 Leer valor clase de tratamiento CC-Nomina
- 14 Leer valor clase de evaluacion CC-Nomina
- 15 Como leer texto centro de costo de empleado P0001-KOSTL
- 16 Tratamiento Infotipo 2011
- 17 Uso de CALL DIALOG para tratamiento de Infotipos
- 18 Ejemplo leer datos dinamicos empleado y exportar a MS WORD
- 19 Como leer codigo de empleado (PERNR) via usuario SAP (SY-UNAME)
- 20 Como leer textos de infotipo
- 21 Como leer datos de payroll dado un RUNID de un posting a FI
- 22 Como leer Modificaciones registradas en log en los datos de los infotipos
- 23 Como Leer Acumuladores
- 24 Lectura IT0008
- 25 Ejemplos estructura organizacional
- 26 Lectura de Datos Maestros (Grupo Funciones HRWPC_GENERAL_TEXTS)
- 27 Edad de empleado
- 28 Crear Absentismo
- 29 Rutinas para leer contingente
- 30 HR_INFOTYPE_OPERATION
- 31 PA40 - FM HR_PAD_HIRE_EMPLOYEE
- 32 Uso de FM HR_ABS_ATT_TIMES_AT_ENTRY
- 33 Obtener foto de empleado(binario)
- 34 Buscar jefe de empleado (lógica basada en lider de organización)
- 35 Obtener fecha de termino ( leaving date )
- 36 CC-nómina : valoración indirecta
- 37 Obtener N° de día de la semana de fecha: cl_rs_time_service=>get_weekday
Como leer el MOLGA de un EMPLEADO
CALL FUNCTION 'HR_COUNTRYGROUPING_GET' EXPORTING pernr = gd_pernr begda = datum endda = datum IMPORTING molga = gd_molga EXCEPTIONS not_found = 1 OTHERS = 2 .
Detalle compañia ( campo BUKRS )
call function 'FI_COMPANYCODE_GETDETAIL' exporting bukrs_int = pnpbukrs-low authority_check = space importing t001_int = comp_det tables t001z_int = appendix exceptions bukrs_not_found = 1 no_authority_display_bukrs = 2 others = 3.
Nombres de MES ( util en formularios )
call function 'MONTH_NAMES_GET' * EXPORTING * LANGUAGE = SY-LANGU * IMPORTING * RETURN_CODE = tables month_names = names exceptions month_names_not_found = 1 others = 2.
Sumar / Restar meses a fecha
call function 'HR_BR_ADD_MONTH_TO_DATE' exporting dmm_datin = first_day dmm_count = '1' dmm_oper = '-' dmm_pos = ' ' importing dmm_daout = aux_date.
Ultimo dia del mes
call function 'LAST_DAY_OF_MONTHS' exporting day_in = pnpbegda importing last_day_of_month = pnpendda exceptions day_in_no_date = 1 others = 2.
Leer Horario de trabajo de empleado
wa_pernr-pernr = p_pernr.
append wa_pernr to tb_pernr.
call function 'HR_PERSON_READ_WORK_SCHEDULE' exporting begin_date = p_begda end_date = p_endda tables pernr_tab = tb_pernr psp = tb_psp day_psp = tb_day_psp exceptions error_in_build_psp = 1 others = 2 .
Obtener día laboral
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE' EXPORTING correct_option = '+' date = lv_fecha_ent factory_calendar_id = 'CL' IMPORTING date = lv_fecha_sal EXCEPTIONS calendar_buffer_not_loadable = 1 correct_option_invalid = 2 date_after_range = 3 date_before_range = 4 date_invalid = 5 factory_calendar_not_found = 6 OTHERS = 7. IF lv_fecha_ent NE lv_fecha_sal. lv_feriado = lv_feriado + 1. ENDIF.
Obtener fecha de retorno de un absentismo(P2001)
p2001-endda = p2001-endda + 1. perform fecha_retorno using p2001-pernr changing p2001-endda. form fecha_retorno using p_pernr type p2001-pernr changing p_fch_retorno type p2001-begda. data l_feriado type flag. do 10 times. clear l_feriado. PERFORM es_dia_libre USING p_pernr p_fch_retorno CHANGING l_feriado. if l_feriado = 'X'. add 1 to p_fch_retorno. else. return. endif. enddo. endform. FORM es_dia_libre USING p_pernr TYPE p2001-pernr p_begda TYPE p2001-begda CHANGING p_libre TYPE xfeld. DATA: lt_persavail TYPE STANDARD TABLE OF pdpsp. CALL FUNCTION 'HR_READ_TIMEDATA_PSP' EXPORTING begin_date = p_begda end_date = p_begda person_id = p_pernr 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 DATA(ls_persavail) WITH KEY datum = p_begda. IF sy-subrc EQ 0. IF ls_persavail-tprog EQ 'LIBR' OR ls_persavail-tagty EQ '1'. p_libre = abap_true. ENDIF. ENDIF. ENDFORM.
Leer caracteristica ( feature ) HR , transaccion PE03
data pben0 like zben0. data l_back(5). * fill feature structure clear pben0. pben0-barea = p_barea. pben0-bplan = p_bplan. pben0-depcv = 'DEP0'. "Dummy
clear p_val. * get value of from feature (PE03 transaction) call function 'HR_FEATURE_BACKFIELD' exporting feature = 'ZBEN0' struc_content = pben0 importing back = l_back exceptions dummy = 1 error_operation = 2 no_backvalue = 3 feature_not_generated = 4 invalid_sign_in_funid = 5 field_in_report_tab_in_pe03 = 6 others = 7. if sy-subrc ne 0. p_val = space. else. if l_back <> space. p_val = 'X'. else. p_val = space. endif. endif.
Verificar empleado
FORM check_pernr USING p_app_pernr TYPE p_pernr. "#EC CALLED CALL FUNCTION 'RP_CHECK_PERNR' EXPORTING beg = sy-datum " Date pnr = p_app_pernr " Personnel number EXCEPTIONS data_fault = 1 person_not_active = 2 person_unknown = 3 pernr_missing = 4 OTHERS = 5. CASE sy-subrc. WHEN 0. "OK WHEN 1 OR 3. MESSAGE i136(72) WITH p_app_pernr. CLEAR p_app_pernr. WHEN 2. MESSAGE i273(72). CLEAR p_app_pernr. WHEN 4. MESSAGE i271(72). WHEN OTHERS. CLEAR p_app_pernr. ENDCASE. ENDFORM. " CHECK_PERNR
Verificar NIF ( RUT )
call function 'TAX_NUMBER_CHECK' exporting country = p_land1 tax_code_1 = p_stcd1 .
Leer clase de fecha de infotipo P0041
FORM get_fecha USING VALUE(p0041) TYPE p0041 p_dar TYPE p0041-dar01 CHANGING p_fecha TYPE p0041-dat01. DATA l_dat LIKE p0041-dat01. DATA l_dar LIKE p0041-dar01. CLEAR p_fecha. DO 12 TIMES VARYING l_dat FROM p0041-dat01 NEXT p0041-dat02 VARYING l_dar FROM p0041-dar01 NEXT p0041-dar02. IF l_dar = p_dar. p_fecha = l_dat. ENDIF. ENDDO. ENDFORM.
Leer valor clase de tratamiento CC-Nomina
*&---------------------------------------------------------------------* *& Form VWTCL *&---------------------------------------------------------------------* * Rescata valor de clase de tratamiento *----------------------------------------------------------------------* * -->p_LGART : ccnómina * * -->p_CLTRAT : clase de tratamiento * * <--p_V_CLTRAT : valor clase de tratamiento * *----------------------------------------------------------------------* form vwtcl using i_lgart type lgart i_cltrat type c i_date type d changing o_v_cltrat type c. data pack type i. data char100(100).
perform read_t512w using i_lgart i_date changing gst_t512w. pack = i_cltrat - 1. char100 = gst_t512w-vklas. shift char100 by pack places. o_v_cltrat(1) = char100(1). endform. "vwtcl
*---------------------------------------------------------------------* * FORM read_t512w * *---------------------------------------------------------------------* * ........ * *---------------------------------------------------------------------* form read_t512w using i_lgart i_date type d changing o_t512w like t512w.
clear o_t512w. loop at gtb_t512w into o_t512w where lgart = i_lgart and molga = '99' and endda >= i_date and begda <= i_date. endloop. if sy-subrc ne 0. select single * into o_t512w from t512w where molga = '99' and lgart = i_lgart and endda >= i_date and begda <= i_date. if sy-subrc eq 0. append o_t512w to gtb_t512w. endif. endif. endform. "read_t512w
Leer valor clase de evaluacion CC-Nomina
*&---------------------------------------------------------------------* *& Form VWECL *&---------------------------------------------------------------------* * Rescata valor de clase de evaluación *----------------------------------------------------------------------* * -->TEV_LGART : ccnómina * * -->TEV_CLEVAL : clase de evaluación * * <--TEV_V_CLEVAL : valor clase de evaluación * *----------------------------------------------------------------------* form vwecl using tev_lgart like it-lgart tev_cleval type c changing tev_v_cleval type c. cdatum = aper-endda. clgart = tev_lgart. perform re512w. pack = ( tev_cleval - 1 ) * 2. "vklas-kl - 1. char100 = t512w-aklas. shift char100 by pack places. tev_v_cleval = char100(2). endform. "vwecl
Como leer texto centro de costo de empleado P0001-KOSTL
*&---------------------------------------------------------------------* *& Form get_costcenter_text *&---------------------------------------------------------------------* form get_costcenter_text using pp_bukrs type bukrs pp_kokrs type kokrs p_inform_tab_kostl changing p_inform_tab_kname.
data: l_kostl like hrca_costc-costcenter, l_kname like hrca_costc-name, l_kokrs like hrca_costc-contrlarea.
l_kostl = p_inform_tab_kostl. if pp_kokrs is initial. call function 'HRCA_CONTROLLINGAREA_FIND' exporting companycode = pp_bukrs importing contrlarea = l_kokrs exceptions not_found = 1 others = 2. else. l_kokrs = pp_kokrs. endif.
call function 'HR_READ_FOREIGN_OBJECT_TEXT' exporting otype = 'K' costcenter = l_kostl controllingarea = l_kokrs importing costcenter_name = l_kname exceptions nothing_found = 1 wrong_objecttype = 2 missing_costcenter_data = 3 missing_object_id = 4 others = 5.
p_inform_tab_kname = l_kname. endform. " get_costcenter_text
Tratamiento 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
SELECT * FROM teven APPENDING TABLE it_teven WHERE pernr EQ it_pernr_plan-pernr AND ldate EQ fec_ev AND stokz EQ space ORDER BY pernr ldate ltime erdat ertim pdsnr.
A su vez, para borrar un registro se debe utilizar un codigo como el siguiente
teven = i_teven. IF teven-stokz EQ space. "PH9K012236 teven-stokz = 'X'. * IF teven-origf EQ space. * Bei Original-Zeitereignissen wird protokolliert, wer gelöscht hat. teven-uname = sy-uname. teven-aedtm = sy-datum. * ENDIF. UPDATE teven. ENDIF.
se observa que se marca a el flag STOKZ con una 'X'
Uso de CALL DIALOG para tratamiento de Infotipos
DATA: dialog_name TYPE dialg. DATA: BEGIN OF ps OCCURS 20. INCLUDE STRUCTURE prelp. DATA: opera, "'U'=Update,'D'=Delete,'I'=Insert auth. "qice5338 DATA: END OF ps.
DATA: BEGIN OF preftab OCCURS 5. INCLUDE STRUCTURE pref. DATA: opera(1). DATA: END OF preftab. DATA: wt TYPE STANDARD TABLE OF p0001.
DATA: BEGIN OF i582a OCCURS 20. INCLUDE STRUCTURE t582a. DATA: END OF i582a.
dialog_name = 'RP_2012'.
pspar-pernr = wa_gt_outtab-pernr. pspar-infty = '2012'. pspar-ittxt = 'Val.prefijados transfer.tmpo.'. pspar-tclas = 'A'. pspar-aktyp = 'P'. pspar-begda = fec_ev. pspar-endda = fec_ev. pspar-actio = 'FAST'. pspar-enque = 1. pspar-msgst = '1'.
CALL DIALOG dialog_name EXPORTING pspar FROM pspar psinfo FROM psinfo ps FROM ps preftab FROM preftab wt FROM wt i582a FROM i582a dynmeas FROM dynmeas initial_values FROM initial_values.
ejemplo 2
FORM ver_pa51 USING p_row. DATA: pspar_2051 LIKE pspar.
CLEAR: pspar.
READ TABLE gt_outtab INDEX p_row.
pspar_2051-pernr = gt_outtab-pernr. pspar_2051-infty = '2051'. * pspar_0006-ittxt = 'Direcciones'. pspar_2051-tclas = 'A'. pspar_2051-aktyp = 'A'. pspar_2051-actio = 'DIS'. pspar_2051-repna = 'MP205100'. pspar_2051-msgst = '1'. CONCATENATE fec_ev+0(6) '01' INTO pspar_2051-begda. pspar-endda = fec_ev. CALL DIALOG 'RP_2051' EXPORTING pspar FROM pspar_2051.
ENDFORM. " ver_pa51
Ejemplo leer datos dinamicos empleado y exportar a MS WORD
Ver programa RPLICO10
Como leer codigo de empleado (PERNR) via usuario SAP (SY-UNAME)
Funciónes BAPI_USR01DOHR_GETEMPLOYEE - RP_GET_PERNR_FROM_USERID con usrty = '0001'
Como leer textos de infotipo
ejemplo I0035
data : pskey type pskey. data : mytext TYPE HRPAD_TEXT_TAB .
loop at p0035. e_salida-begda_0035 = p0035-begda. e_salida-dat35 = p0035-dat35. e_salida-blehr = p0035-blehr.
pskey-pernr = p0035-pernr. pskey-infty = '0035'. pskey-subty = p0035-subty. pskey-endda = p0035-endda. pskey-begda = p0035-begda. *TRY. CALL METHOD CL_HRPA_TEXT_CLUSTER=>READ EXPORTING TCLAS = 'A' PSKEY = pskey NO_AUTH_CHECK = IMPORTING TEXT_TAB = mytext.
DATA : ABC LIKE line of MYTEXT.
LOOP AT MYTEXT INTO ABC.
endloop.
Como leer datos de payroll dado un RUNID de un posting a FI
*&---------------------------------------------------------------------* *& Form get_seqnr *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->I_PERNR text * -->I_RUNID text * -->O_SEQNO text *----------------------------------------------------------------------* FORM get_seqnr USING i_pernr i_runid CHANGING o_seqno. DATA ld_runid LIKE pcalac-runid.
SELECT runid seqno INTO (ld_runid,o_seqno) FROM pcalac UP TO 1 ROWS WHERE pernr = i_pernr AND runid = i_runid ORDER BY runid DESCENDING. ENDSELECT.
ENDFORM. "get_seqnr
*&---------------------------------------------------------------------* *& Form get_rgdir *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->I_PERNR text * -->I_SEQNO text * -->O_INOCR text * -->O_DATE text *----------------------------------------------------------------------* FORM get_rgdir USING i_pernr i_seqno CHANGING o_inocr o_date.
SELECT SINGLE inocr fpend INTO (o_inocr,o_date) FROM hrpy_rgdir WHERE pernr = i_pernr AND seqnr = i_seqno. IF sy-subrc NE 0. CLEAR o_inocr. CLEAR o_date. ENDIF.
ENDFORM. "get_rgdir
*&---------------------------------------------------------------------* *& Form get_payroll_data *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->I_PERNR text * -->I_RUNID text * -->O_INOCR text * -->O_FPEND text *----------------------------------------------------------------------* FORM get_payroll_data USING i_pernr i_runid CHANGING o_inocr o_fpend. DATA ld_seqno LIKE pcalac-seqno.
PERFORM get_seqnr USING i_pernr i_runid CHANGING ld_seqno.
PERFORM get_rgdir USING i_pernr ld_seqno CHANGING o_inocr o_fpend. ENDFORM. "get_payroll_data
Como leer Modificaciones registradas en log en los datos de los infotipos
Reporte RPUAUD00 para leer modificaciones en los infotipos
Como Leer Acumuladores
data: char96(96), "char-feld fuer 96 char 0/1 hexin(12) type x, "hex feld fuer 96 bit 0/1 x128 type x value '80', hex type x, hextm type x, ps type p, pc type p. data: pack type p,pack1 type p,pack2 type p.
data gd_num type i. data gd_res(1) type c.
gd_num = '85'. "acummulates in /185 perform get_kumul using gd_num gs_t512w-lgart gs_t512w-kumul changing gd_res. if gd_res eq 'X'. * acumula => do something endif.
*---------------------------------------------------------------------* * FORM HEXINCHAR * *---------------------------------------------------------------------* form hexinchar using anzahl. "und Feld HEXIN. if not hexin is initial. * maximale Laenge HEXINPUT ist 12 = L'HEXIN bzw. L'CHAR96/8 s. a. MAX do anzahl times varying hex from hexin(1) next hexin+1(1) range hexin. "UC XMS shift char96 by 8 places. ps = 0. "set sum pc = 10000000. "set char hextm = x128. "set hex do 8 times. if hex o hextm. ps = ps + pc. endif. hextm = hextm / 2. pc = pc / 10. enddo. unpack ps to char96+88(8). enddo. ps = ( 12 - anzahl ) * 8. "MAX = 12, maximale Laenge HEXINPUT shift char96 by ps places. "linksbuendig nach CHAR96 endif. endform. "END OF HEXINCHAR *---------------------------------------------------------------------* * FORM GET_KUMUL * *---------------------------------------------------------------------* form get_kumul using gc_num type i gc_lgart type lgart p_kumul changing gc_acum type c. data gc_kumula like char96.
clear: char96, hexin. clear gc_acum. hexin = p_kumul. perform hexinchar using 12. gc_kumula = char96.
if gc_kumula is not initial. pack = gc_num - 1. "vklas-kl - 1. shift gc_kumula by pack places. if gc_kumula(1) eq '1'. gc_acum = 'X'. else. gc_acum = space. endif. endif. endform. "get_kumul
Lectura IT0008
FM BAPI_BASICPAY_GETDETAIL
Ojo que esta BAPI calcula los conceptos indirectos :-)
FORM get_p0008_detail tables gt_bapi_wagetypes structure bapip0008p USING p0008 LIKE p0008. DATA ld_amount_external LIKE bapicurr-bapicurr. DATA lt_return LIKE TABLE OF bapireturn1 WITH HEADER LINE.
CLEAR gt_bapi_wagetypes[].
CALL FUNCTION 'BAPI_BASICPAY_GETDETAIL' EXPORTING employeenumber = p0008-pernr subtype = p0008-subty objectid = p0008-objps lockindicator = p0008-sprps validitybegin = p0008-begda validityend = p0008-endda recordnumber = p0008-seqnr IMPORTING return = lt_return TABLES wagetypes = gt_bapi_wagetypes.
endform.
Ejemplo lectura de cc-nóminas desde P0008
data: lv_betrg TYPE pad_amt7s, lv_lgart TYPE lgart, lv_indbw TYPE indbw. DO 40 TIMES VARYING lv_lgart FROM p0008-lga01 NEXT p0008-lga02 VARYING lv_betrg FROM p0008-bet01 NEXT p0008-bet02 VARYING lv_indbw FROM p0008-ind01 NEXT p0008-ind02. IF lv_lgart IS NOT INITIAL. ENDIF. ENDDO.
clase CL_HRPA_INFOTYPE_0008
esta clase posee código en los métodos que se pueden utilizar
Ejemplos estructura organizacional
Mostrar todos los empleados hacia abajo de una organización
CALL FUNCTION 'RH_STRUC_GET' EXPORTING act_otype = 'O' act_objid = p_objid act_wegid = 'PERS-O' act_begda = '19000101' act_endda = '99991231' authority_check = ' ' TABLES result_objec = ti_result2 EXCEPTIONS no_plvar_found = 1 no_entry_found = 2 OTHERS = 3.
el reporte RHSTRU00, hace lo mismo, pero usando base de datos.
Organizaciones desde y hacia arriba de una persona
CALL FUNCTION 'RH_STRUC_GET' EXPORTING act_otype = 'P' act_objid = p_pernr act_wegid = 'P-S-O-O' authority_check = ' ' TABLES result_objec = lt_result EXCEPTIONS no_plvar_found = 1 no_entry_found = 2 OTHERS = 3.
Leer Gerencia de empleado(caso particular)
CALL FUNCTION 'RH_STRUC_GET' EXPORTING act_otype = 'P' act_objid = l_pernr act_wegid = 'P-S-O-O' authority_check = ' ' TABLES result_objec = lt_result EXCEPTIONS ##FM_SUBRC_OK no_plvar_found = 1 no_entry_found = 2 OTHERS = 3.
LOOP AT lt_result INTO DATA(ls_result) WHERE otype EQ 'O' AND istat = '1' AND begda <= sy-datum AND endda >= sy-datum AND ( stext CP 'GERENCIA*' ). EXIT. ENDLOOP. IF sy-subrc = 0. l_gerencia = ls_result-stext. ENDIF.
Organizaciones hacia Abajo con posiciones(S) y personal(P)
* buscar organizaciones hacia abajo CALL FUNCTION 'RH_STRUC_GET' EXPORTING act_otype = 'O' act_objid = l_org act_wegid = 'O-S-P' authority_check = ' ' TABLES result_struc = lt_result_struc result_objec = lt_result_objec EXCEPTIONS no_plvar_found = 1 no_entry_found = 2 OTHERS = 3.
O-O_DOWN (Estructura organizativa (descendente)
* O-O_DOWN (Estructura organizativa (descendente) CALL FUNCTION 'RH_STRUC_GET' EXPORTING act_otype = 'O' act_objid = ls_p0001-orgeh act_wegid = 'O-O_DOWN' authority_check = ' ' TABLES result_struc = lt_result_struc EXCEPTIONS no_plvar_found = 1 no_entry_found = 2 OTHERS = 3.
Lectura de Datos Maestros (Grupo Funciones HRWPC_GENERAL_TEXTS)
FORM textdata USING p_bukrs TYPE bukrs p_werks TYPE persa p_kostl TYPE kostl p_kokrs TYPE kokrs p_plans TYPE plans p_infty TYPE infty p_subty TYPE p2001-subty p_estado CHANGING p_butxt TYPE butxt p_werkt TYPE pbtxt p_ktext TYPE ktext p_stext TYPE stext p_stext_subty TYPE stext p_itext TYPE t582s-itext p_stext_estado.
IF p_bukrs IS NOT INITIAL. CALL FUNCTION 'HRWPC_RFC_BUKRS_TEXT_GET' EXPORTING bukrs = p_bukrs IMPORTING bukrs_text = p_butxt. ENDIF.
IF p_werks IS NOT INITIAL. CALL FUNCTION 'HRWPC_RFC_WERKS_TEXT_GET' EXPORTING werks = p_werks IMPORTING werks_text = p_werkt. ENDIF.
IF p_kostl IS NOT INITIAL. CALL FUNCTION 'HRWPC_RFC_KOSTL_TEXT_GET' EXPORTING kokrs = p_kokrs kostl = p_kostl begda = sy-datum endda = sy-datum IMPORTING kostl_text = p_ktext . ENDIF.
IF p_plans IS NOT INITIAL. CALL FUNCTION 'HRWPC_RFC_PLANS_TEXT_GET' EXPORTING plans = p_plans begda = sy-datum endda = sy-datum IMPORTING plans_text2 = p_stext. ENDIF.
IF p_subty IS NOT INITIAL. CALL FUNCTION 'HRXSS_PER_GET_ESS_SUBTYPE_TEXT' EXPORTING infty = p_infty subty = p_subty molga = c_molga IMPORTING stext = p_stext_subty. ENDIF.
ENDFORM. " TEXTDATA
Edad de empleado
FORM calculo_edad USING p_pernr CHANGING p_edad. DATA: lt_p0002 TYPE TABLE OF p0002 WITH HEADER LINE. DATA: l_pernr TYPE p0000-pernr, l_agnos TYPE p, l_meses TYPE p, l_dias TYPE p. MOVE p_pernr TO l_pernr. CLEAR p_edad.
CALL FUNCTION 'HR_READ_INFOTYPE' EXPORTING pernr = l_pernr infty = '0002' begda = sy-datum endda = sy-datum TABLES infty_tab = lt_p0002 EXCEPTIONS infty_not_found = 1 OTHERS = 2. LOOP AT lt_p0002 WHERE begda <= sy-datum AND endda >= sy-datum. ENDLOOP. CHECK sy-subrc = 0. CALL FUNCTION 'HRVE_GET_TIME_BETWEEN_DATES' EXPORTING beg_date = lt_p0002-gbdat end_date = sy-datum IMPORTING days = l_dias months = l_meses years = l_agnos EXCEPTIONS invalid_period = 1 OTHERS = 2. p_edad = l_agnos. ENDFORM. " CALCULO_EDAD
Crear Absentismo
FORM crear_abs USING p_pernr p_subty p_begda p_endda p_beguz p_enduz p_simulate CHANGING p_retorno TYPE bapiret2_tab p_hrabsatt_out TYPE bapihrabsatt_out p_text. DATA: lt_retorno LIKE bapiret2 OCCURS 0 WITH HEADER LINE, ls_key TYPE bapihrtimeskey, " Campos clave BAPI p.entradas tiempos personal (HR) ls_abs TYPE bapihrabsatt_in. " Campos presencia/absentismo, entrada sin datos adicionale. CLEAR: ls_abs. ls_abs-from_date = p_begda. " Inicio de la validez ls_abs-to_date = p_endda. " Fin de la validez ls_abs-start_time = p_beguz. " Hora de inicio ls_abs-end_time = p_enduz. " Hora final ls_abs-abs_att_hours = ''. " Horas de presencia/absentismo ls_abs-previous_day = ''. " Indicador de día anterior IF p_beguz IS NOT INITIAL AND p_enduz IS NOT INITIAL. * ----> Logica de Horas para el dia ls_abs-all_day_flag = space. ELSE. * ----> Logica Considera ls_abs-all_day_flag = 'X'. ENDIF. CALL FUNCTION 'BAPI_PTMGRATTABS_MNGCREATION' EXPORTING employeenumber = p_pernr " Nro. Personal abs_att_type = p_subty " Clase de Absentismos hrabsatt_in = ls_abs " Campos presencia/absentismo, entrada sin datos adicionales simulate = p_simulate IMPORTING hrabsatt_out = p_hrabsatt_out hrabsattext = p_text TABLES return = p_retorno. " Retorno ENDFORM.
Rutinas para leer contingente
method GET_SALDO_DIAS. *--------------------------------------------------------------------* * Calculo de saldo días *--------------------------------------------------------------------* DATA: lt_abs_quota TYPE TABLE OF bapihrquota, lt_ktart TYPE tim_quota_type_tab, ra_ktart TYPE RANGE OF p2006-ktart, wa_ktart LIKE LINE OF ra_ktart. DATA lv_saldodias TYPE anzhl. *--------------------------------------------------------------------* * Calculo de saldo días *--------------------------------------------------------------------* CALL FUNCTION 'BAPI_TIMEQUOTA_GETDETAILEDLIST' EXPORTING employeenumber = i_solicitud-pernr * QUOTASELECTIONMOD = '1' "absentismos TABLES absencequotareturntable = lt_abs_quota. CALL FUNCTION 'Z_HCM_CONTINGENTE_FROM_ABS' EXPORTING i_pernr = i_solicitud-pernr i_begda = i_solicitud-begda i_endda = i_solicitud-endda i_subty = i_solicitud-subty IMPORTING e_ktart = lt_ktart. LOOP AT lt_ktart INTO DATA(ls_ktart). wa_ktart-low = ls_ktart. wa_ktart-sign = 'I'. wa_ktart-option = 'EQ'. APPEND wa_ktart TO ra_ktart. CLEAR wa_ktart. ENDLOOP. lv_saldodias = 0. IF ra_ktart[] IS NOT INITIAL. LOOP AT lt_abs_quota INTO DATA(ls_abs_quota) WHERE quotatype IN ra_ktart. lv_saldodias = lv_saldodias + ls_abs_quota-rest_free. ENDLOOP. ENDIF. lv_saldodias = lv_saldodias - i_solicitud-quota_deduction. IF lv_saldodias < 0. lv_saldodias = 0. ENDIF. r_saldo = lv_saldodias. "type anzhl endmethod. FUNCTION z_hcm_contingente_from_abs. *"---------------------------------------------------------------------- *"*"Interfase local *" IMPORTING *" REFERENCE(I_PERNR) TYPE PERNR_D *" REFERENCE(I_BEGDA) TYPE BEGDA DEFAULT SY-DATUM *" REFERENCE(I_ENDDA) TYPE ENDDA DEFAULT SY-DATUM *" REFERENCE(I_SUBTY) TYPE T554S-SUBTY *" EXPORTING *" REFERENCE(E_KTART) TYPE TIM_QUOTA_TYPE_TAB *"---------------------------------------------------------------------- DATA lt_p0001 TYPE TABLE OF p0001. DATA ls_t503 TYPE t503. DATA ls_t001p TYPE t001p. DATA ls_t554s TYPE t554s. DATA ls_t556c TYPE t556c. DATA ls_t556r TYPE t556r. CALL FUNCTION 'HR_READ_INFOTYPE' EXPORTING pernr = i_pernr infty = '0001' TABLES infty_tab = lt_p0001 EXCEPTIONS infty_not_found = 1 OTHERS = 2. IF sy-subrc <> 0. * Implement suitable error handling here ENDIF. LOOP AT lt_p0001 INTO DATA(ls_p0001) WHERE begda <= i_endda AND endda >= i_begda. ENDLOOP. IF sy-subrc <> 0. RETURN. ENDIF. SELECT SINGLE * INTO ls_t503 FROM t503 WHERE persg = ls_p0001-persg AND persk = ls_p0001-persk. SELECT SINGLE * INTO ls_t001p FROM t001p WHERE werks = ls_p0001-werks AND btrtl = ls_p0001-btrtl. SELECT SINGLE * INTO ls_t554s FROM t554s WHERE moabw = ls_t001p-moabw AND subty = i_subty AND endda >= i_begda AND begda <= i_endda. SELECT SINGLE * INTO ls_t556c FROM t556c WHERE mopgk = ls_t503-konty AND mozko = ls_t001p-mozko AND crule = ls_t554s-crule AND ctype = 'Q'. SELECT SINGLE * INTO ls_t556r FROM t556r WHERE " mopgk = ls_t503-konty AND mozko = ls_t001p-mozko AND qtype = 'A' AND dedrg = ls_t556c-deabp AND endda >= i_begda AND begda <= i_endda. * copiado de LHRTIM00QUOTADEDUCTIONF01 #986 CONSTANTS: QSTEP TYPE I VALUE 2. DATA: BEGIN OF selqtypes OCCURS 0, cktart(2) TYPE c, END OF selqtypes. DATA:qttps TYPE qttps. qttps = ls_t556r-qttps. DO 100 TIMES. selqtypes-cktart = qttps. IF selqtypes-cktart IS INITIAL. "' '" EXIT. "end-of-sequence was found ENDIF. APPEND selqtypes. SHIFT qttps BY qstep PLACES LEFT. ENDDO. loop at selqtypes. APPEND selqtypes-cktart to E_KTART. endloop. ENDFUNCTION.
La función anterior es equivalente al siguiente método:
DATA lt_p0001 TYPE p0001_tab. CALL FUNCTION 'HR_READ_INFOTYPE' EXPORTING pernr = i_pernr infty = '0001' begda = i_begda endda = i_endda TABLES infty_tab = lt_p0001 EXCEPTIONS infty_not_found = 1 OTHERS = 2. IF sy-subrc <> 0. * Implement suitable error handling here ENDIF. CALL METHOD cl_hrpaybr_absence_quotas=>get_quota_type_tab EXPORTING iv_pernr = i_pernr iv_begda = i_begda iv_endda = i_endda it_p0001 = lt_p0001 iv_subty = i_subty IMPORTING et_quota_type_tab = ra_ktart.
Tabla Contingentes: T556R - Reglamentación secuencia liquidación p.contingentes absent.
HR_INFOTYPE_OPERATION
Ejemplo 1
PERFORM infotype_operation USING c_create p0014 p_test CHANGING l_subrc. FORM infotype_operation USING p_actio TYPE pspar-actio p_infty TYPE any p_test TYPE xfeld CHANGING p_subrc. DATA: ls_bapireturn TYPE bapiret1, ls_key TYPE bapipakey, wa TYPE p0002, l_dialog_mode(1). MOVE-CORRESPONDING p_infty TO wa. * enqueue the employye CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE' EXPORTING number = wa-pernr IMPORTING return = ls_bapireturn. IF ls_bapireturn IS NOT INITIAL. p_subrc = 2. RETURN. ENDIF. l_dialog_mode = '0'. CALL FUNCTION 'HR_INFOTYPE_OPERATION' EXPORTING infty = wa-infty number = wa-pernr subtype = wa-subty validityend = wa-endda validitybegin = wa-begda record = p_infty "p9032 operation = p_actio nocommit = 'X' dialog_mode = l_dialog_mode IMPORTING return = ls_bapireturn key = ls_key EXCEPTIONS OTHERS = 0. IF NOT ls_bapireturn IS INITIAL. * error p_subrc = 1. ELSE. p_subrc = 0. IF p_test <> abap_true. COMMIT WORK AND WAIT. ENDIF. ENDIF. CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE' EXPORTING number = wa-pernr IMPORTING return = ls_bapireturn. ENDFORM.
PA40 - FM HR_PAD_HIRE_EMPLOYEE
Ver nota SAP 1913529 - Function module HR_MAINTAIN_MASTERDATA does not work as expected when hiring an employee
* Create new employee for user * Organizational assignment MOVE-CORRESPONDING p_p0001 TO ls_p0001. ls_p0001-infty = '0001'. ls_p0001-endda = ls_p0000-endda. ls_p0001-begda = ls_p0000-begda. ls_p0001-persg = p_p0000-persg. ls_p0001-persk = p_p0000-persk. ls_p0001-werks = p_p0000-werks. ASSIGN ls_p0001 TO <pnnnn>. CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp EXPORTING pnnnn = <pnnnn> IMPORTING prelp = ls_prelp. APPEND ls_prelp TO lt_prelp. CLEAR ls_prelp. CALL FUNCTION 'HR_PAD_HIRE_EMPLOYEE' EXPORTING hiringdate = ls_p0000-begda actiontype = ls_p0000-massn reasonforaction = ls_p0000-massg pnnnn_tab = lt_prelp nocommit = p_test IMPORTING return_tab = lt_return bapipakey_tab = lt_key.
Uso de FM HR_ABS_ATT_TIMES_AT_ENTRY
FORM get_abs_times USING p_pernr p_subty p_begda p_endda CHANGING p_alldf. DATA tpd TYPE TABLE OF ptm_times_per_day. DATA: " p_ABWTG LIKE P2001-ABWTG, p_abrtg LIKE p2001-abrtg, p_abrst LIKE p2001-abrst, " p_KALTG LIKE P2001-KALTG, p_hrsif LIKE p2001-hrsif, * p_ALLDF LIKE P2001-ALLDF, error_wo_exception TYPE c. DATA: p_beguz LIKE p2001-beguz, p_enduz LIKE p2001-enduz, p_vtken LIKE p2001-vtken, p_stdaz LIKE p2001-stdaz, p_breaks TYPE hrtim_att_breaks, p_abwtg LIKE p2001-abwtg, p_kaltg LIKE p2001-kaltg. DATA errors LIKE hrerror OCCURS 0 WITH HEADER LINE. DATA: p0000 TYPE TABLE OF p0000 WITH HEADER LINE, p0001 TYPE TABLE OF p0001 WITH HEADER LINE, p0002 TYPE TABLE OF p0002 WITH HEADER LINE, p0007 TYPE TABLE OF p0007 WITH HEADER LINE, p2001 TYPE TABLE OF p2001 WITH HEADER LINE, p2002 TYPE TABLE OF p2002 WITH HEADER LINE, p2003 TYPE TABLE OF p2003 WITH HEADER LINE. CALL FUNCTION 'HR_READ_INFOTYPE' EXPORTING pernr = p_pernr infty = '0000' TABLES infty_tab = p0000 EXCEPTIONS infty_not_found = 1 OTHERS = 2. IF sy-subrc <> 0. * Implement suitable error handling here ENDIF. CALL FUNCTION 'HR_READ_INFOTYPE' EXPORTING pernr = p_pernr infty = '0001' TABLES infty_tab = p0001 EXCEPTIONS infty_not_found = 1 OTHERS = 2. IF sy-subrc <> 0. * Implement suitable error handling here ENDIF. CALL FUNCTION 'HR_READ_INFOTYPE' EXPORTING pernr = p_pernr infty = '0002' TABLES infty_tab = p0002 EXCEPTIONS infty_not_found = 1 OTHERS = 2. IF sy-subrc <> 0. * Implement suitable error handling here ENDIF. CALL FUNCTION 'HR_READ_INFOTYPE' EXPORTING pernr = p_pernr infty = '0007' TABLES infty_tab = p0007 EXCEPTIONS infty_not_found = 1 OTHERS = 2. IF sy-subrc <> 0. * Implement suitable error handling here ENDIF. *CALL FUNCTION 'HR_READ_INFOTYPE' * EXPORTING * pernr = p_pernr * infty = '2001' * TABLES * infty_tab = p2001 * EXCEPTIONS * INFTY_NOT_FOUND = 1 * OTHERS = 2 * . *IF sy-subrc <> 0. ** Implement suitable error handling here *ENDIF. * CALL FUNCTION 'HR_READ_INFOTYPE' EXPORTING pernr = p_pernr infty = '2002' TABLES infty_tab = p2002 EXCEPTIONS infty_not_found = 1 OTHERS = 2. IF sy-subrc <> 0. * Implement suitable error handling here ENDIF. *CALL FUNCTION 'HR_READ_INFOTYPE' * EXPORTING * pernr = p_pernr * infty = '2003' * TABLES * infty_tab = p2003 * EXCEPTIONS * INFTY_NOT_FOUND = 1 * OTHERS = 2 * . *IF sy-subrc <> 0. ** Implement suitable error handling here *ENDIF. DATA c_6(6) VALUE ' '. p_beguz = c_6. p_enduz = c_6. CALL FUNCTION 'HR_ABS_ATT_TIMES_AT_ENTRY' EXPORTING pernr = p_pernr awart = p_subty begda = p_begda endda = p_endda IMPORTING abwtg = p_abwtg abrtg = p_abrtg "Días de Nómina abrst = p_abrst kaltg = p_kaltg hrsif = p_hrsif alldf = p_alldf error_wo_exception = error_wo_exception TABLES m0000 = p0000 m0001 = p0001 m0002 = p0002 m0007 = p0007 m2001 = p2001 m2002 = p2002 m2003 = p2003 times_per_day = tpd CHANGING beguz = p_beguz enduz = p_enduz vtken = p_vtken stdaz = p_stdaz breaks = p_breaks "YMMPH0K000026 EXCEPTIONS ##FM_SUBRC_OK it0001_missing = 1 customizing_error = 2 error_occurred = 3 "YAYP40K054237 end_before_begin = 4. "YAYP40K054237 * others = 5. IF sy-subrc <> 0. ENDIF. ENDFORM.
Obtener foto de empleado(binario)
form get_employee_photo USING iv_pernr type p0000-pernr CHANGING p_photo type xstring p_mime_type type W3CONTTYPE p_subrc type sy-subrc. DATA: ls_connect_info TYPE toav0, lt_content TYPE TABLE OF sdokcntbin, lv_len TYPE i, " #EC NEEDED lt_acinf TYPE TABLE OF scms_acinf. FIELD-SYMBOLS: <ls_acinf> TYPE scms_acinf. CLEAR: p_photo. IF iv_pernr IS NOT INITIAL. CALL FUNCTION 'HR_IMAGE_EXISTS' EXPORTING p_pernr = iv_pernr p_begda = sy-datlo p_endda = sy-datlo IMPORTING p_connect_info = ls_connect_info EXCEPTIONS error_connectiontable = 1 OTHERS = 2. IF sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. p_subrc = 1. return. ENDIF. IF ls_connect_info IS NOT INITIAL. CALL FUNCTION 'SCMS_DOC_READ' EXPORTING stor_cat = ' ' crep_id = ls_connect_info-archiv_id doc_id = ls_connect_info-arc_doc_id TABLES access_info = lt_acinf content_bin = lt_content EXCEPTIONS bad_storage_type = 1 bad_request = 2 unauthorized = 3 comp_not_found = 4 not_found = 5 forbidden = 6 conflict = 7 internal_server_error = 8 error_http = 9 error_signature = 10 error_config = 11 error_format = 12 error_parameter = 13 error = 14 OTHERS = 15. IF sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. READ TABLE lt_acinf ASSIGNING <ls_acinf> INDEX 1. IF sy-subrc EQ 0. p_mime_type = <ls_acinf>-mimetype. lv_len = <ls_acinf>-comp_size. ENDIF. CALL FUNCTION 'SCMS_BINARY_TO_XSTRING' EXPORTING input_length = lv_len IMPORTING buffer = p_photo TABLES binary_tab = lt_content EXCEPTIONS failed = 1 OTHERS = 2. IF sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDIF. ENDIF. ENDform. "get_employee_photo
obtener URL foto de empleado
FORM obtiene_foto USING i_pernr CHANGING e_foto. "copiado de FM HRXSS_COD_GET_DETAILS DATA: connect TYPE TABLE OF toav0 WITH HEADER LINE, url(4096) TYPE c, pernr_char(50) TYPE c. DATA: lv_pernr TYPE persno. lv_pernr = i_pernr. CONCATENATE lv_pernr '*' INTO pernr_char. "note 996882 CALL FUNCTION 'ARCHIV_GET_CONNECTIONS' EXPORTING objecttype = 'PREL' object_id = pernr_char documenttype = 'HRICOLFOTO' until_ar_date = sy-datum TABLES connections = connect EXCEPTIONS nothing_found = 1 OTHERS = 2. IF sy-subrc <> 0. ENDIF. CLEAR connect. LOOP AT connect. CALL FUNCTION 'SCMS_AO_URL_READ' EXPORTING arc_id = connect-archiv_id doc_id = connect-arc_doc_id document_type = connect-reserve http_url_only = 'X' loc_info = 'W' IMPORTING url = url EXCEPTIONS error = 1 OTHERS = 2. IF sy-subrc <> 0. ENDIF. EXIT. ENDLOOP. e_foto = url. ENDFORM. "obtiene_foto"obtiene_foto
Buscar jefe de empleado (lógica basada en lider de organización)
FORM busca_jefe USING p_pernr TYPE persno CHANGING p_idjefe TYPE persno p_nombrejefe TYPE pad_cname. DATA: lt_result LIKE objec OCCURS 0 WITH HEADER LINE, lt_result2 LIKE objec OCCURS 0 WITH HEADER LINE, lt_p0001 TYPE TABLE OF p0001 WITH HEADER LINE. DATA: l_objid TYPE objec-objid. CALL FUNCTION 'HR_READ_INFOTYPE' EXPORTING pernr = p_pernr infty = '0001' begda = sy-datum endda = sy-datum TABLES infty_tab = lt_p0001 EXCEPTIONS infty_not_found = 1 OTHERS = 2. IF sy-subrc <> 0. * Implement suitable error handling here ENDIF. LOOP AT lt_p0001. ENDLOOP. IF sy-subrc <> 0. RETURN. ENDIF. CALL FUNCTION 'RH_STRUC_GET' EXPORTING act_otype = 'P' act_objid = p_pernr act_wegid = 'P-S-O-O' authority_check = ' ' TABLES result_objec = lt_result EXCEPTIONS no_plvar_found = 1 no_entry_found = 2 OTHERS = 3. IF sy-subrc <> 0. RETURN. ENDIF. LOOP AT lt_result WHERE otype EQ 'O'. CALL FUNCTION 'RH_STRUC_GET' EXPORTING act_otype = 'O' act_objid = lt_result-objid act_wegid = 'B012' authority_check = ' ' TABLES result_objec = lt_result2 EXCEPTIONS no_plvar_found = 1 no_entry_found = 2 OTHERS = 3. IF sy-subrc <> 0. CONTINUE. ENDIF. READ TABLE lt_result2 WITH KEY otype = 'S'. CHECK sy-subrc = 0 AND lt_p0001-plans <> lt_result2-objid. l_objid = lt_result2-objid. REFRESH lt_result2. CALL FUNCTION 'RH_STRUC_GET' EXPORTING act_otype = 'S' act_objid = l_objid act_wegid = 'SAP_ORG' authority_check = ' ' TABLES result_objec = lt_result2 EXCEPTIONS no_plvar_found = 1 no_entry_found = 2 OTHERS = 3. IF sy-subrc <> 0. CONTINUE. ENDIF. READ TABLE lt_result2 WITH KEY otype = 'P'. CHECK sy-subrc = 0. p_idjefe = lt_result2-objid. p_nombrejefe = lt_result2-stext. EXIT. ENDLOOP. ENDFORM. " BUSCA_JEFE
Obtener fecha de termino ( leaving date )
clear p_leaving_date. "WRH L9CK045673 refresh leaving_date_tab. "WRH L9CK045673 CALL FUNCTION 'HR_LEAVING_DATE' EXPORTING PERSNR = P_PERNR IMPORTING LEAVINGDATE = P_LEAVING_DATE TABLES LEAVING_DATES = LEAVING_DATE_TAB EXCEPTIONS LEAVING_DATE_NOT_FOUND = 1 PERNR_NOT_ASSIGNED = 2 OTHERS = 3.
CC-nómina : valoración indirecta
FORM lee_valoracion_indirecta_0014. CLEAR lt_ptbindbw[]. CHECK p0014-indbw = 'I'. "Indicador para valoración indirecta MOVE-CORRESPONDING p0014 TO lt_ptbindbw. APPEND lt_ptbindbw. CALL FUNCTION 'RP_EVALUATE_INDIRECTLY_P0014' EXPORTING pbegda = p0014-begda pmolga = '39' ppernr = p0014-pernr TABLES ptbindbw = lt_ptbindbw EXCEPTIONS bad_parameters = 1 error_at_indirect_evaluation = 2 OTHERS = 3. IF sy-subrc <> 0. * Implement suitable error handling here ELSE. MOVE lt_ptbindbw-betrg TO p0014-betrg. MOVE lt_ptbindbw-anzhl TO p0014-anzhl. ENDIF. ENDFORM. "lee_valoracion_indirecta_0014 FORM lee_valoracion_indirecta_0015. CLEAR lt_ptbindbw[]. CHECK p0015-indbw = 'I'. "Indicador para valoración indirecta MOVE-CORRESPONDING p0015 TO lt_ptbindbw. APPEND lt_ptbindbw. CALL FUNCTION 'RP_EVALUATE_INDIRECTLY_P0015' EXPORTING pbegda = p0015-begda pmolga = '39' ppernr = p0015-pernr TABLES ptbindbw = lt_ptbindbw EXCEPTIONS bad_parameters = 1 error_at_indirect_evaluation = 2 OTHERS = 3. IF sy-subrc <> 0. * Implement suitable error handling here ELSE. MOVE lt_ptbindbw-betrg TO p0015-betrg. MOVE lt_ptbindbw-anzhl TO p0015-anzhl. ENDIF. ENDFORM. "lee_valoracion_indirecta_0014 ******************** CALL METHOD cl_hrpad_wagetype=>process_indirect_valuation EXPORTING tclas = tclas pernr = p0014-pernr infty = p0014-infty begda = p0014-begda wagetype = p0014-lgart read_infotype = a_read_infotype message_handler = remapper IMPORTING indval_indicator = p0014-indbw endda = dummy_endda amount = betrg is_ok = is_ok CHANGING currency = p0014-waers number = p0014-anzhl. IF is_ok = true. p0014-betrg = betrg. ENDIF. ******************** *** call indirect valuation CALL FUNCTION 'RP_EVALUATE_INDIRECTLY' EXPORTING appli = 'E' "MELN1228169 pbegda = begda pinfty = '0008' pmolga = molga ptclas = tclas ppernr = p0008-pernr PP0001 = p0001 "***!!!*** ONLY TEMP pp0007 = p0007 "***!!!*** ONLY TEMP pp0008 = p0008 pp0230 = p0230 "MELN1636872 * MSGFLG = '' * CONV_CURR = 'X' IMPORTING pendda = endda TABLES ptbindbw = ptbindbw EXCEPTIONS bad_parameters = 1 error_at_indirect_evaluation = 2 error_message = 3 OTHERS = 4.
Obtener N° de día de la semana de fecha: cl_rs_time_service=>get_weekday
IF cl_rs_time_service=>get_weekday( i_date = i_begda ) > 4. e_mensaje = 'Permiso solo aplica de lunes a jueves'. ENDIF.