Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3523

regarding the change status of leave workflow.

$
0
0

hi friends,

 

i have copied the standard leave worklfow "WS12300111" and customized it just to meet our requirement means for multiple approvers.

 

everything is working fine in production  means if user ID "AIHR01' raise a leave request the workitem will go to "AIHR02" after his approving the workitem will go to the final approver means "AIHR03" after his approval the leave request will be completed and the status in the TC - PTARQ is coming as "APPROVED" means only after the approving of "AIHR03" the status is coming "APPROVED" but in some cases when user id "AIHR02" is approved instead of coming status "SENT" it is coming "APPROVED"  in TC-PTARQ and because of this status the workitem is coming blank in UWL of "AIHR03".

 

 

I have already incorporated the given below method in the "WORKFLOW" just to change the status from "APPROVED"  to "SENT" after the approval of user ID "AIHR02" but in some cases it is not working fine it is giving BUG.

 

 

-


 

 

begin_method changestatus changing container.

DATA:request TYPE ptreq_header-request_id,

          wi_id TYPE swwwihead-wi_id.

 

DATA: request_instance TYPE REF TO if_pt_req_request,

           event   TYPE tim_req_xfer_event VALUE

           cl_pt_req_const=>c_reqtrans_send,

           ex_status TYPE tim_req_status,

           container_wi TYPE swcont OCCURS 0,

           agents TYPE STANDARD TABLE OF swhactor WITH HEADER LINE.

          swc_get_element container 'REQUEST' request.

          swc_get_element container 'Wi_id' wi_id.

 

DO.

  CALL FUNCTION 'ENQUEUE_EPTREQ'

   EXPORTING

  •     MODE_PTREQ_HEADER       = 'S'

  •     MANDT                   = SY-MANDT

     request_id              = request

  •     X_REQUEST_ID            = ' '

  •     _SCOPE                  = '2'

  •     _WAIT                   = ' '

  •     _COLLECT                = ' '

   EXCEPTIONS

     foreign_lock            = 1

      system_failure          = 2

      OTHERS                  = 3

              .

    IF sy-subrc = 0.

      EXIT.

    ENDIF.

    WAIT UP TO 60 SECONDS.

  ENDDO.

  IF sy-subrc = 0.

    CALL METHOD ca_pt_req_header=>agent->get_request

      EXPORTING

        im_request_id     = request

      IMPORTING

        ex_request        = request_instance

      EXCEPTIONS

        request_not_found = 1

        OTHERS            = 2.

    IF sy-subrc = 0.

      CALL METHOD request_instance->initiate_state_trans

        EXPORTING

          im_transfer_event = event

           im_external_call  = 'X'

   

  •    im_ret_value      = 0

                 ex_new_status     = ex_status

   

  •    ex_ret_code       =

          .

      swc_set_element container 'Ex_Status' ex_status.

    ENDIF.

    CALL FUNCTION 'DEQUEUE_EPTREQ'

     EXPORTING

   

  •   MODE_PTREQ_HEADER       = 'S'

   

  •   MANDT                   = SY-MANDT

       request_id              = request

   

  •   X_REQUEST_ID            = ' '

   

  •   _SCOPE                  = '3'

   

  •   _SYNCHRON               = ' '

   

  •   _COLLECT                = ' '

              .

  ENDIF.

  swc_create_container container_wi.

  swc_set_element container_wi 'WI_ID' wi_id.

  agents-otype = 'US'.

  agents-objid = sy-uname.

  APPEND agents.

 

  CALL FUNCTION 'SWW_WI_START_SIMPLE'

    EXPORTING

      task                         = 'TS90000089'

      called_in_background         = 'X'

    TABLES

      agents                       = agents

      wi_container                 = container_wi

    EXCEPTIONS

      id_not_created               = 1

      read_failed                  = 2

      immediate_start_not_possible = 3

      execution_failed             = 4

      invalid_status               = 5

      OTHERS                       = 6.

  end_method.

 

 

-


 

 

Request you to plesase help me to solve this issue .why in some cases instead of coming status "SENT" it is coming "APPROVED"  after the approval of user id "AIHR02".

 

BECAUSE of the  "APPROVED" staus the same workitem is coming blank in the UWL OF "AIHR03".


Viewing all articles
Browse latest Browse all 3523

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>