Skip to Content
0

How to approve dynpro form in background in workflow

Nov 15, 2016 at 10:25 AM

92

avatar image
Former Member

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.

capture.jpg (68.3 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Mike Pokraka Nov 18, 2016 at 12:17 PM
1

Use SAP_WAPI_DECISION_COMPLETE

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Nov 21, 2016 at 03:16 AM
1

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

Share
10 |10000 characters needed characters left characters exceeded
Rob Dielemans Nov 15, 2016 at 10:44 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Nov 15, 2016 at 01:25 PM
0

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.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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

0
avatar image
Former Member Nov 15, 2016 at 01:55 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded