Difference between revisions of "SAP HCM WORKFLOW"

From SapWiki
Line 161: Line 161:
 
   ENDIF.
 
   ENDIF.
 
ENDFORM.</nowiki>
 
ENDFORM.</nowiki>
==Note 2727875 - LEA Approval: Runtime error==
+
===Note 2727875 - LEA Approval: Runtime error===
 
Symptom
 
Symptom
 
  1) When approving a CICO request , runtime error is encountered.
 
  1) When approving a CICO request , runtime error is encountered.
Line 167: Line 167:
 
  3) The status text of approved leaves are not displayed correctly
 
  3) The status text of approved leaves are not displayed correctly
  
==Note 2729462 - Runtime error by approval process for CICO/ Leave request in Fiori and ESS==
+
===Note 2729462 - Runtime error by approval process for CICO/ Leave request in Fiori and ESS===
 
Symptom
 
Symptom
 
There is a problem in ESS/Fiori by approving process.
 
There is a problem in ESS/Fiori by approving process.

Revision as of 19:33, 19 July 2022

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
  • RPTARQEMAIL - Notificaciones de absentismo: Enviar correos electrónicos

BADI

  • PT_GEN_REQ - se utiliza en el componente PT (Gestión de tiempos). Se utiliza para controlar el proceso del tratamiento de aplicaciones Employee Self-Service de la Gestión de tiempos.
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

Customizing the ESS Leave Approval using Business Workflow

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.

Note 2727875 - LEA Approval: Runtime error

Symptom

1) When approving a CICO request , runtime error is encountered.
2) When substitute is approving a leave request from My Inbox , runtime error is encountered.
3) The status text of approved leaves are not displayed correctly

Note 2729462 - Runtime error by approval process for CICO/ Leave request in Fiori and ESS

Symptom There is a problem in ESS/Fiori by approving process. -There can be an Error message like

  • RFC error
  • System error
  • Task could not be processed
  • Error while performing action. Contact system administrator
  • Aufgabe kann nicht bearbeiten werden

There can be a dump for CL_PT_REQ_REQUEST/IF_PT_REQ_REQUEST~INITIATE_STATE_TRANSITION.

Category ABAP Programming Error Runtime errors OBJECTS_OBJREF_NOT_ASSIGNED ABAP Programm CL_PT_REQ_REQUEST=============CP 
Application Component PT
Access using a 'ZERO' object reference is not possible.

It occurs by different scenarios:

  • -PTARQ->Approve documents or with "Approve Documents on Behalf"
  • -PTCOR->Approve documents or with "Approve Documents on Behalf"
  • -CICO approval in ESS
  • -CICO approval in Fiori Inbox
  • -leave request approval by substitute in Fiori Inbox