Skip to Content
author's profile photo Former Member
Former Member

Absence workflow - Changing Req. status

Hello, I'm using workflow for absence requests in ESS.

I created a FM with the following code, which is used in a BOR method and included in a workflow task:

  • 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.

ENDIF.

COMMIT WORK AND WAIT.

When I test the workflow, it doesn't change the status of the request, but if I have tested the FM and the method and I can change the status request. I have checked the bindings and it seems ok.

Any help?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Dec 12, 2011 at 06:50 PM

    Hi

    Make use of the below code to change the status of a leave/absence request.

    METHOD approve.
    
      DATA: request TYPE REF TO if_pt_req_request,
            event   TYPE tim_req_xfer_event VALUE cl_pt_req_const=>c_reqtrans_approve.
    
      CALL METHOD cl_pt_req_badi=>get_request
        EXPORTING
          im_req_id  = me->req_id
        IMPORTING
          ex_request = request.
    
      CALL METHOD cl_pt_req_badi=>initiate_state_transition
        EXPORTING
          im_request    = request
          im_event      = event
    *    IM_RET_VALUE  = 0
        IMPORTING
          ex_new_status = me->status.
    
    ENDMETHOD.
    

    Never use any commit work after you chnage the status of the leave request from a workflow task.

    Regards

    Pavan

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.