how to trigger workflow from wda and read workf

6
Getting Started Newsletters Store Products Services & Support About SCN Downloads Industries Training & Education Partnership Developer Center Lines of Business University Alliances Events & Webinars Innovation Log On Join Us Hi, Guest Search the Community Activity Communications Actions Browse Tweet 0 10 Replies Latest reply: Jun 4, 2011 4:24 AM by Pavan Bhamidipati 1857 Views Average User Rating (0 ratings) How to trigger workflow from WDA and read workflow container into WDAscreen This question has been Answered. 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. Tran Van Duc Jun 2, 2011 3:06 PM Correct Answer by Sanjay Pal on Jun 3, 2011 11:20 AM 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 Helpful Answers by Sanjay Pal, Sanjay Pal, Pavan Bhamidipati

Upload: ravibabu1620

Post on 07-Dec-2015

237 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: How to Trigger Workflow From WDA and Read Workf

7/9/2015 How to trigger workflow from WDA and read workf... | SCN

https://scn.sap.com/thread/1967152 1/6

Getting Started Newsletters Store   

Products Services & Support About SCN Downloads

Industries Training & Education Partnership Developer Center

Lines of Business University Alliances Events & Webinars Innovation

Log On Join UsHi, Guest Search the Community

Activity Communications Actions

Browse

Tweet0

10 Replies  Latest reply: Jun 4, 2011 4:24 AM by Pavan Bhamidipati  

1857 Views

Average User Rating

(0 ratings)

How to trigger workflow from WDA and readworkflow container into WDAscreenThis question has been Answered.

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 processingapproval  .   3. When 1 request is sent to approver, he logon into portal and access to UWL to process taskhimself.   4. After he press approval link, the system will call WDA screen to process approval ( this screen willcontain 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 atstep4 Any help would be appreciated Thanks and best regards,DucTV.

Tran Van Duc Jun 2, 2011 3:06 PM

Correct Answer by Sanjay Pal  on Jun 3, 2011 11:20 AM

Hi, Please check values of tables MESSAGE_LINES and MESSAGE_STRUCT  after execution of theFM 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 theworkflow container elemets.If the data types are mismatch then values will not be transferred. Generally workfklow containerelement should be charecter type. Thanks and regards,SNJY

Helpful Answers by Sanjay Pal, Sanjay Pal, Pavan Bhamidipati 

Page 2: How to Trigger Workflow From WDA and Read Workf

7/9/2015 How to trigger workflow from WDA and read workf... | SCN

https://scn.sap.com/thread/1967152 2/6

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

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 numberaccordingly 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 FMSAP_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

Like (0)

Sanjay Pal  Jun 2, 2011 4:35 PM  (in response to Tran Van Duc)

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

Dear Sanju,  Thank you very much for your quick response,  I am developing 2 programs, one for submitting leave request and one for approval. Pleasehelp 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 taskcontainer ?   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

Like (0)

Tran Van Duc  Jun 2, 2011 5:25 PM  (in response to Sanjay Pal)

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

Hello, 1. "In this case, will internal table LT_CONTAINER contain workflow container or taskcontainer ?"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 ?"

Rick Bakker  Jun 3, 2011 12:29 AM  (in response to Tran Van Duc)

Page 3: How to Trigger Workflow From WDA and Read Workf

7/9/2015 How to trigger workflow from WDA and read workf... | SCN

https://scn.sap.com/thread/1967152 3/6

Yes. 3. "workitem id will be difference when WF is launched, right?"Different from what? regardsRick Bakkerhanabi technology

Like (0)

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

Hi,     I am not sure for what reasons you are developing a application but SAP has its ownstandard 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 aworkflow right in that case you make sure that you need to pass some data to the workflowcontainer I hope you might be using either SAP_WAPI_CREATE_EVENT orSAP_WAPI_START_WORKFLOW to start the workflow  in both the function module youhave 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 passingto the SAP_WAPI_READ_CONTAINER if you are passing a top work item ID  then you willhave workflow container in LT_CONTAINER if you are passing any of the child or dependentwork 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 howyou want to get back the result, if you use a foreground activity step then in that case youhave to populate the result back to the task container and if let say you are using a decisionstep then in that case you do not have to populate the result there will be standard  containerelement _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 workitem your application should open then configure in SWFVISU transaction and maintain DTDin 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 onewhich helps to identify dependent work item ids it is the TOP or PARENT work item ID.   Regards Pavan

Like (0)

Pavan Bhamidipati  Jun 3, 2011 4:03 AM  (in response to Tran Van Duc)

Re: How to trigger workflow from WDA and read workflow container intoWDAscreen

Dear Pavan and Rick,   Thank very much for your support,   Currently, I have created 1 simple WF with 1 User decision(standard taskTS#8267), 1activity to update into Ztable when request approved and 1 email will be sent foremployee when his request is rejected. in WF, I have defined 1 workflow containerincluding 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 triggeredafter I pressed 'Submit' button in WEBDYNPRO ABAP screen. However, Although I

Tran Van Duc  Jun 3, 2011 8:26 AM  (in response to Pavan Bhamidipati)

Page 4: How to Trigger Workflow From WDA and Read Workf

7/9/2015 How to trigger workflow from WDA and read workf... | SCN

https://scn.sap.com/thread/1967152 4/6

have filled data into container while starting FM, but It still isn't passed it intoworkflow container.I need this data to when Web Dynpro ABAP is called from UWL, it will pass approvalinformation 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

Like (0)

Re: How to trigger workflow from WDA and read workflowcontainer into WDAscreen

Hi, if you are using SAP_WAPI_START_WORKFLOW  to start workflow then Wokflowtemplate must be "General task " Thanks and regards,SNJY

Like (0)

Helpful Answer

Sanjay Pal  Jun 3, 2011 8:32 AM  (in response to Tran Van Duc)

Re: How to trigger workflow from WDA and read workflow container intoWDAscreen

Dear Sanju,   Thanks for your response,   I have changed my workflow template into generate task , but container couldnot pass into WF.   Please advise... Best regards,DucTV

Like (0)

Tran Van Duc  Jun 3, 2011 10:49 AM  (in response to Sanjay Pal)

Re: How to trigger workflow from WDA and readworkflow container into WDAscreen

Hi, Please check values of tables MESSAGE_LINES andMESSAGE_STRUCT  after execution of the FMSAP_WAPI_START_WORKFLOW in debug mode. You can find the rootcause of the issue.

Correct Answer

Sanjay Pal  Jun 3, 2011 11:20 AM  (in response to Tran Van Duc)

Page 5: How to Trigger Workflow From WDA and Read Workf

7/9/2015 How to trigger workflow from WDA and read workf... | SCN

https://scn.sap.com/thread/1967152 5/6

Re: How to trigger workflow from WDA and read workflow container intoWDAscreen

Hi, 1. In this case, will internal table LT_CONTAINER contain workflow container or taskcontainer ? 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 adummy method and use it in the task just to display the link in the UWL. When ever the userclicks on the "Approve" buttion porper WDA will be launched and you need to comople thedummy 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 youcan easily fin the its dependent workitem by FM SWI_GET_DEPENDENT_WORKITEMSwhich 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

Like (0)

Helpful Answer

Sanjay Pal  Jun 3, 2011 8:05 AM  (in response to Tran Van Duc)

Re: How to trigger workflow from WDA and read workflowcontainer into WDAscreen

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

Like (0)

Helpful Answer

Pavan Bhamidipati  Jun 4, 2011 4:24 AM  (in response to Tran Van Duc)

 If the values of the input container is not passing to workflow pleasecheck 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

Like (0)