cancel
Showing results for 
Search instead for 
Did you mean: 

How to approve dynpro form in background in workflow

Former Member
0 Kudos

Hi,

My requirement is to execute below approval process in background, so please suggest any FM or Class Available to complete this .Currently user is approving this form through SBWP Tcode.I want to execute it from a Custom Program.

Accepted Solutions (0)

Answers (5)

Answers (5)

pokrakam
Active Contributor

Use SAP_WAPI_DECISION_COMPLETE

Former Member

Hi Krishna,

Is the front end task required? Is it possible to redesign the workflow? How is the status from the other system communicated. I think it will be best on the long run to revisit the workflow design.

Regards,

Sankar

Former Member
0 Kudos

Hi rob,

It's not hard coded , Every time I am changing the work item from SWWWIHEAD table as per workflow no.

Requirement : I will get approve status from another system, Based on that status I need to execute current form depends on user (APPROVE / REJECT ) .

Former Member
0 Kudos

Hi Rob,

thanks for your reply, I am using below code to execute work item. the status is showing Completed but the next step mail triggering is failed.

but the same process is working while I am doing it in foreground. Please let me know if any other FM or classes are available.

data:EV_DECISION_KEY type SWY_RET1,
EV_WI_ID type SWW_WIID.
EV_DECISION_KEY = 'Approve'."'01'.
EV_WI_ID = '000057239313'.
LW_CONTAINER-VALUE = EV_DECISION_KEY.
LW_CONTAINER-ELEMENT = 'PROCSTATE'.
APPEND LW_CONTAINER TO LT_CONTAINER.

CALL FUNCTION 'SAP_WAPI_WRITE_CONTAINER'
EXPORTING
WORKITEM_ID = EV_WI_ID
IMPORTING
RETURN_CODE = LV_RETURN_CODE
TABLES
SIMPLE_CONTAINER = LT_CONTAINER
MESSAGE_STRUCT = LT_MSGTAB.


IF LV_RETURN_CODE EQ 0.

CALL FUNCTION 'SAP_WAPI_WORKITEM_COMPLETE'
EXPORTING
WORKITEM_ID = EV_WI_ID
IMPORTING
RETURN_CODE = LV_RETURN_CODE
NEW_STATUS = LV_NEW_STATUS
TABLES
MESSAGE_STRUCT = LT_MSGTAB2.
COMMIT WORK.

APPEND LINES OF LT_MSGTAB2 TO LT_MSGTAB.

ENDIF.

former_member186746
Active Contributor
0 Kudos

Hi,

Why do you have the workitem number hard coded?

Is this an ad-hoc solution? In that case, just use SWIA to execute the workitem and continue the process.

What is the functional requirement?

Kind regards, Rob Dielemans

former_member186746
Active Contributor
0 Kudos

Hi,

You should check the SAP_WAPI* function modules if you can execute this foreground step in the background.

If your process has been changed then you should change the workflow model.At one point in time there was a need for a user to pick up the workitem, look at it and make a decision to approve it or to reject it.

If this requirement has become obsolete then the workflow model should represent the new process flow.

Kind regards, Rob Dielemans