cancel
Showing results for 
Search instead for 
Did you mean: 

How to work with a workflow in Webdynpro

Former Member
0 Kudos

Hi Team,

I am new to webdynpro ABAP, i have a scenario

I have a work flow id with me, i want to start this workflow from a webdynpro application,

1. wedynpro application contains a list of inputs and user1 inputs this data that i have stored node, So node contains full data.

2. Now i have a workflow id, i want to pass this node data to this workflow on a button click

I have the button action, what code is required to pass this?

(I sow few FMs in fourms but i dont know how exactly i can use it)

3. When the approver gets the workitem, he should be able to approve,reject or send backToAuthor option he will get

how to read this data back to approver screen for the approver to take correct action ?

Please help me with some code sample, i sow few things but i am not sure about the parameters which required for this.

Thanks,

PP

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

1) In order to trigger the workflow from webdynpro and pass the list of inputs and your workitem id , i will suggest you to go for a business object.

2) If you have a business object than you can just trigger the workflow through the event (provided your workflow should be an event trigger workflow). As well as you can pass your parameters through it.

3) In order to trigger the workflow through your business object event u can use the following function module.

in the below code:-

it_container- contains the parameter u want to pass like workitem id in your case.

ZPOC_LEAVE- is my business object.

OPTIONAL- is my event which will trigger the workflow.

ty_object_key:- structure type of key fields of business object.

Note:-you have to define these values as per your business object.

* Trigger the event ZPOC_leave-CREATE to start the workflow

  DATA: it_container TYPE TABLE OF swr_cont,
             is_container LIKE LINE OF it_container.

  DATA: g_return_code TYPE sy-subrc,
             glf_event_id TYPE swr_struct-event_id.
  DATA : ls_objkey TYPE ty_objkey.
  DATA : ls_objtype TYPE swr_struct-object_typ VALUE 'ZPOC_LEAVE'.
  DATA : ls_objectkey TYPE swr_struct-object_key.
  DATA : ls_event TYPE swr_struct-event VALUE 'OPTIONAL'.
CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'
    EXPORTING
      object_type             = ls_objtype
      object_key              = ls_objectkey
      event                   = ls_event
      commit_work             = 'X'
      event_language          = sy-langu
      language                = sy-langu
      user                    = sy-uname
*   IFS_XML_CONTAINER       =
   IMPORTING
     return_code             = g_return_code
     event_id                = glf_event_id
   TABLES
     input_container         = it_container
*   MESSAGE_LINES           =
*   MESSAGE_STRUCT          =
            .

4) You also need to define the parameter(workitem id in your case) under the parameter option of your event in your business object. (you can use the transaction SWO1 for business objects).

5) Now in swdd transaction in the basic data u can mention your start event.

This should be enough to trigger your workflow and pass your workitem id to it.

Thanks and regards,

Mayank Gupta

Edited by: Mayank Gupta on Feb 4, 2011 5:52 AM

Former Member
0 Kudos

Hi Manyak,

thanks for the reply,

In my case we are not using Bussiness objects,

I have the workflow id with me , is there is any other way to start the work flow with ID?

Regards,

PP

Former Member
0 Kudos

Hi,

In order to start the workflow without business objects u can go for the following

Function modules:-

1)SAP_WAPI_START_WORKFLOW

2)EWW_WORKFLOW_START (through this u can pass container objects also-workitem id in your case)

Thanks and Regards,

Mayank

Former Member
0 Kudos

Hi Mayank,

thanks for the reply,

Could you please give me the coding to

1. start the work flow by passing WorkflowID : XXXXXX and data in internal table it_tab

2. Once it reaches to approver , how to populate data from container to screen ?

Thanks,

PP