SAP HCM WORKFLOW
From SapWiki
Revision as of 19:35, 16 April 2020 by WikiSysop (talk | contribs) (→Workflow Solicitud de Absentismo(Vacaciones))
Workflow Solicitud de Absentismo(Vacaciones)
tablas
- PTREQ_HEADER - Cabecera de solicitud
- PTREQ_ATTABSDATA - Datos de solicitud para presencias/absentismos
- PTREQ_ACTOR - Participante solicitud
- PTREQ_NOTICE - Nota de solicitud
- PTREQ_ITEMS - Posiciones reclam.
programas
- RPTARQMASS_APPROVAL - Solicitud de vacaciones: Autorización en masa
- RPTARQDBVIEW - Visualizar notificaciones de absentismo (base de datos de solicitud)
- RPTARQAPP - Solicitudes de absentismo: Autorizar documentos en su nombre
- RPTARQPOST - Notificaciones de absentismo: Contabilizar
ID documento PTREQ_HEADER-REQUEST_ID ID del Solicitante PTREQ_ACTOR-OBJID, donde PTREQ_ACTOR-ACTOR_ID = PTREQ_HEADER-OWNER_INS Nombre del Solicitante P0002-VORNA && P0002-NACHN donde, P0002-PERNR = ID del Solicitante (leer com fecha sy-datum) ID del Aprobador PTREQ_ACTOR-OBJID, donde PTREQ_ACTOR-ACTOR_ID = PTREQ_HEADER-RESPONSIBLE_INS Nombre del Aprobador P0002-VORNA && P0002-NACHN donde, P0002-PERNR = ID del Aprobador (leer com fecha sy-datum) Correo Electrónico Aprobador P0105-USRID_LONG, donde P0105-PERNR = ID del Aprobador (leer com fecha sy-datum) Estado Solicitud PTREQ_HEADER-STATUS Última Modificación PTREQ_HEADER-MOD_TIMESTAMP Modificado por PTREQ_HEADER-MOD_USER Clase absent./pres. PTREQ_ATTABSDATA-SUBTY donde ITEM_ID = PTREQ_ITEMS-ITEM_INS, donde PTREQ_ITEMS-ITEM_LIST_ID = PTREQ_HEADER-ITEM_LIST_ID Denominación Absentismo T554T-ATEXT DONDE AWART = PTREQ_ATTABSDATA-SUBTY AND SPRSL EQ SY-LANGU Hora de Inicio PTREQ_ATTABSDATA-BEGIN_TIME Hora de Fin PTREQ_ATTABSDATA-END_TIME Horas de absentismo PTREQ_ATTABSDATA-ATTABS_HOURS Fecha Inicio PTREQ_ATTABSDATA-BEGDA Fecha Fin PTREQ_ATTABSDATA-ENDDA Días presenc./abs. PTREQ_ATTABSDATA-ABWTG Días naturales PTREQ_ATTABSDATA-KALTG Días de nómina PTREQ_ATTABSDATA-ABRTG Observaciones PTREQ_NOTICE-NOTICE_TEXT donde REQUEST_ID = PTREQ_HEADER-REQUEST_ID AND VERSION_NO = PTREQ_HEADER-VERSION_NO
Ejemplos
Autorizar documentos en su nombre
*&---------------------------------------------------------------------* *& Form search_for_action *&---------------------------------------------------------------------* * copiado de RPTARQ_ADMINREP_EVENTS *----------------------------------------------------------------------* * -->P_C_REQ_MANUAL_POST text * <--P_EVENT_ALV text *----------------------------------------------------------------------* FORM state_transition USING request_id TYPE tim_req_id event TYPE tim_req_xfer_event CHANGING p_subrc type sy-subrc p_message type bapiret2-message. DATA: application TYPE REF TO cl_pt_arq_application, "#EC NEEDED request TYPE REF TO if_pt_req_request, new_status TYPE tim_req_status. CLASS: cl_pt_arq_application DEFINITION LOAD, if_pt_req_request DEFINITION LOAD. application = cl_pt_arq_application=>get_instance( ). CALL FUNCTION 'ENQUEUE_EPTREQ' EXPORTING mode_ptreq_header = 'E' request_id = request_id EXCEPTIONS foreign_lock = 1 system_failure = 2 OTHERS = 3. IF sy-subrc <> 0. MESSAGE w058(hrtim_abs_req) INTO p_message. p_subrc = 1. ELSE. * get request from guid CALL METHOD ca_pt_req_header=>agent->get_request EXPORTING im_request_id = request_id IMPORTING ex_request = request. * Change state only for existing request object IF request IS BOUND. * execute state transition CALL METHOD request->initiate_state_transition EXPORTING im_transfer_event = event IMPORTING ex_new_status = new_status ex_ret_code = p_subrc. IF new_status <> cl_pt_req_const=>c_reqstat_approved. p_message = 'Se ha producido un error durante la autorización'(E01). p_subrc = 3. else. p_subrc = 0. ENDIF. ELSE. p_message = 'Se ha producido un error durante la autorización'(E01). p_subrc = 2. ENDIF. CALL FUNCTION 'DEQUEUE_EPTREQ' EXPORTING request_id = request_id. ENDIF. ENDFORM. " state_transition
Autorizar documentos en Nombre de una Persona (programa RPTARQMASS_APPROVAL)
FORM aprobar USING p_data TYPE ty_salida CHANGING p_subrc TYPE sy-subrc p_message TYPE bapiret2-message. DATA: go_manager TYPE REF TO cl_pt_arq_massapp_manager. DATA lt_guids TYPE ptarq_massapp_req_id_tab. DATA ls_guid TYPE LINE OF ptarq_massapp_req_id_tab. DATA l_command TYPE ptreq_command. ls_guid = p_data-request_id. APPEND ls_guid TO lt_guids. l_command = cl_pt_arq_massapp_manager=>c_status_approve_plan. * initialize manager object CREATE OBJECT go_manager EXPORTING iv_pers_no = p_data-aprobador EXCEPTIONS ex_invalid_personnel_number = 1 OTHERS = 2. IF sy-subrc = 1. MESSAGE i011(hrtim_abs_req) WITH p_data-aprobador INTO p_message. * Personnel number &1 does not exist sy-subrc = 1. RETURN. ELSEIF sy-subrc = 2. MESSAGE e016(hrtim_abs_req) INTO p_message. sy-subrc = 2. RETURN. * Internal application error: Unable to run application ENDIF. DATA(lt_requests) = go_manager->get_table( ) . IF lt_requests IS INITIAL. MESSAGE i098(hrtim_abs_req) INTO p_message. p_subrc = 3. RETURN. ENDIF. go_manager->change_status( EXPORTING iv_command = l_command it_guids = lt_guids ). DATA(l_answer) = go_manager->has_unsaved_changes( ). IF l_answer = abap_true. go_manager->save( ). *if there are unsaved changes then the save button is displayed l_answer = go_manager->has_unsaved_changes( ). IF l_answer = 'X'. p_subrc = 4. ELSE. p_subrc = 0. ENDIF. ENDIF. ENDFORM.