cancel
Showing results for 
Search instead for 
Did you mean: 

How to trigger workflow from WDA and read workflow container into WDAscreen

Former Member
0 Kudos

Dear Expert,

Please suggest the solution for the following requirement:

1. Create 1 leave request from WDA and submit for approval

2. When User press "submit" button in WDA screen, workflow will be triggered for processing approval .

3. When 1 request is sent to approver, he logon into portal and access to UWL to process task himself.

4. After he press approval link, the system will call WDA screen to process approval ( this screen will contain full information of requester.)

5. After finishing process, the result will return workflow and end of process.

Please send simple example for step 1 and one for get data from workflow into WDA screen at step4

Any help would be appreciated

Thanks and best regards,

DucTV.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

'SUBMIT' button is linked with a action-menthod.

Write the code to trigger the workflow by using FM SAP_WAPI_START_WORKFLOW.

You get workitem id from this FM.

You must pass the approver id as the workflow container element.

With in the workflow create a task and send it to workflow.

Now request to Portal team to change the XML code with WDA appilcation and the Task number accordingly so that this can be avaliable in UWL. Also make changes in tcode SWFVISU.

Now when the approer click the link WDA will be lauched.

If the approver clicks on the "Approve" bittion...

Write the code within the action-method to complete the workflow by using FM SAP_WAPI_WORKITEM_COMPLETE.

You can also read the container using FM SAP_WAPI_READ_CONTAINER.

CALL FUNCTION 'SAP_WAPI_READ_CONTAINER'
      EXPORTING
        WORKITEM_ID           = P_WIID
      TABLES
        SIMPLE_CONTAINER = LT_CONTAINER.

Thanks and regards,

SNJY

Edited by: Sanju.pal on Jun 2, 2011 8:02 PM

Former Member
0 Kudos

Dear Sanju,

Thank you very much for your quick response,

I am developing 2 programs, one for submitting leave request and one for approval. Please help me answer the following questions:

1. Related to FM CALL FUNCTION 'SAP_WAPI_READ_CONTAINER'

EXPORTING

WORKITEM_ID = P_WIID

TABLES

SIMPLE_CONTAINER = LT_CONTAINER.

In this case, will internal table LT_CONTAINER contain workflow container or task container ?

2. Should I use 'User Decision' in WF to submit request to UWL or not ?

3. workitem id will be difference when WF is launched, right?

Please advise...

Thanks and best regards,

DucTV

former_member185167
Active Contributor
0 Kudos

Hello,

1. "In this case, will internal table LT_CONTAINER contain workflow container or task container ?"

It will contain the container associated with the workitem id. If it's the workitem id of a task, you get the container of the task.

2. "Should I use 'User Decision' in WF to submit request to UWL or not ?"

Yes.

3. "workitem id will be difference when WF is launched, right?"

Different from what?

regards

Rick Bakker

hanabi technology

bpawanchand
Active Contributor
0 Kudos

Hi,

I am not sure for what reasons you are developing a application but SAP has its own standard workflow process for applying leave from ESS portal..

1. AS soon as you click on the submit button of the applicaiton then you need to trigger a workflow right in that case you make sure that you need to pass some data to the workflow container I hope you might be using either SAP_WAPI_CREATE_EVENT or SAP_WAPI_START_WORKFLOW to start the workflow in both the function module you have to fill this table in Order to pass the values from ABAP program to workflow container.

The answer to your question is it depends on the type of the work item ID you are passing to the SAP_WAPI_READ_CONTAINER if you are passing a top work item ID then you will have workflow container in LT_CONTAINER if you are passing any of the child or dependent work item ids of the top work item id then you have that respective task container value.

2. You can make use of the any foreground activity or a decision step, it depends on how you want to get back the result, if you use a foreground activity step then in that case you have to populate the result back to the task container and if let say you are using a decision step then in that case you do not have to populate the result there will be standard container element _RESULT in the decision step it will be filled.

Make sure if you are expecting some work item in UWL and as soon as you click on the work item your application should open then configure in SWFVISU transaction and maintain DTD in UWL any portal consultant can perform this steps in few seconds.

3. When the workflow is started then the work item which you are able to get back is the one which helps to identify dependent work item ids it is the TOP or PARENT work item ID.

Regards

Pavan

Former Member
0 Kudos

Hi,

1. In this case, will internal table LT_CONTAINER contain workflow container or task container ?

This should be the workflow container.

2. Should I use 'User Decision' in WF to submit request to UWL or not ?

As you are using the WDA, then please do not use the Decision step in workflow. Create a dummy method and use it in the task just to display the link in the UWL. When ever the user clicks on the "Approve" buttion porper WDA will be launched and you need to comople the dummy step.

3. workitem id will be difference when WF is launched, right?

As you have the mother workflow id form the "SAP_WAPI_START_WORKFLOW" the you can easily fin the its dependent workitem by FM SWI_GET_DEPENDENT_WORKITEMS which is dialog type. then complete the workitem.

Sample code :

* Get the corresponding workitem ID of Approval request TASK
  CALL FUNCTION 'SWI_GET_DEPENDENT_WORKITEMS'
    EXPORTING
      WI_ID         = P_HISTORY-WORKITEM
    TABLES
      DEPENDENT_WIS = LT_DEPENDANT_WI.
  LOOP AT LT_DEPENDANT_WI INTO LS_DEPENDANT_WI WHERE WI_TYPE = 'W' .
    IF LS_DEPENDANT_WI-WI_STAT NE C_COMPLETED .
      P_WIID = LS_DEPENDANT_WI-WI_ID .
      EXIT.
    ENDIF.

  ENDLOOP.

Thanks and regards,

SNJY

Former Member
0 Kudos

Dear Pavan and Rick,

Thank very much for your support,

Currently, I have created 1 simple WF with 1 User decision(standard taskTS#8267), 1 activity to update into Ztable when request approved and 1 email will be sent for employee when his request is rejected. in WF, I have defined 1 workflow container including elements: employee number, start absence date, End absence date, reason.

I am using FM 'SWW_WI_START_SIMPLE' with to trigger WF, and WF has triggered after I pressed 'Submit' button in WEBDYNPRO ABAP screen. However, Although I have filled data into container while starting FM, but It still isn't passed it into workflow container.

I need this data to when Web Dynpro ABAP is called from UWL, it will pass approval information into WebDynPro ABAP screen to processing approval.

(P/s: I used FM SAP_WAPI_START_WORKFLOW but it has not started WF.)

FM details:

TASK = 'WS80000254'.

CALL FUNCTION 'SWW_WI_START_SIMPLE'

EXPORTING

TASK = TASK

IMPORTING

WI_ID = LV_WORKITEM_ID

TABLES

AGENTS = SWHACTOR

WI_CONTAINER = it_inputcontainer

.

Please advise... Any help would be appreciated!

Thanks and Best regards,

DucTV.

Edited by: DucTV1 on Jun 3, 2011 8:26 AM

Former Member
0 Kudos

Hi,

if you are using SAP_WAPI_START_WORKFLOW to start workflow then Wokflow template must be "General task "

Thanks and regards,

SNJY

Former Member
0 Kudos

Dear Sanju,

Thanks for your response,

I have changed my workflow template into generate task , but container could not pass into WF.

Please advise...

Best regards,

DucTV

Former Member
0 Kudos

Hi,

Please check values of tables MESSAGE_LINES and MESSAGE_STRUCT after execution of the FM SAP_WAPI_START_WORKFLOW in debug mode. You can find the root cause of the issue.

If the values of the input container is not passing to workflow please check the types of the workflow container elemets.

If the data types are mismatch then values will not be transferred. Generally workfklow container element should be charecter type.

Thanks and regards,

SNJY

bpawanchand
Active Contributor
0 Kudos

Hi,

Make sure that the container element names are same as defined in the workflow container other wise they wont be set in the workflow container..

Regards

Pavan

Answers (0)