Skip to Content

In a Think outside the box – enhance  processes with Universal Worklist Action Handlers! we introduced UWL action handlers. In this blog focus on the ABAP Web Dynpro action handler.

In our example we have a basic workflow in our backend system. In this workflow, we have steps that are serving as place holders. Our ABAP Web Dynpro will launch the actual application the workflow step should execute.

In this example our business workflow manages the process steps, but the ABAP Web Dynpro is actually what we want to launch.

How the workflow looks

Our workflow has two steps: data entry and approval.

  image

The first step has you enter travel data, the approval happens in the second step.  For the purposes of this discussion, we will only refer to the first step in the workflow.

Our first step, data entry (TS65507956), is really just a place holder.  The actual form to enter data comes from the ABAP Web Dynpro.  The actual task is defined as:

image

Our object type is WEBSERVICE, however, it does not have to be WEBSERVICE.  Since the ABAP Web Dynpro will receive the work item ID at runtime and will access the container, the object and method can be anything.

Highlights of the ABAP Web Dynpro

The ABAP Web Dynpro was written by my colleague Alan Rickayzen. I think he used the ABAP Web Dynpro tutorial in online help to assist him with creating the ABAP Web Dynpro.

If you are a workflow person, then you can get with your Web Dynpro gurus to work on this together. What is cool here is how with just a few lines of code, you can access the workflow container.

The Web Dynpro itself has the WI_ID (work item ID) defined as a parameter. This work item ID for the task is passed via the UWL. The following is a code snippet from the data entry view of the Web Dynpro. This brings in the work item ID that was passed via UWL.


workflowrawdata =
    wd_context->get_child_node(
  'WORKFLOWRAWDATA' ).

  CALL METHOD
              WORKFLOWRAWDATA->GET_ATTRIBUTE
     EXPORTING
             NAME   = 'WI_ID'
     IMPORTING
              VALUE  = wi_id.    

At the point where you want to read the container data from the workflow, use:

</body>

  • read the container

CALL FUNCTION ‘SAP_WAPI_READ_CONTAINER’

    EXPORTING

      WORKITEM_ID = WI_ID

    IMPORTING

      RETURN_CODE = rc

    TABLES

      SIMPLE_CONTAINER   = l_cont.

When your ABAP Web Dynpro completes processing, use the following code to write back to the container and complete the work item.

</body>

  • write back to the workflow container

CALL FUNCTION ‘SAP_WAPI_WRITE_CONTAINER’

    EXPORTING

      WORKITEM_ID = WI_ID

    IMPORTING

      RETURN_CODE = rc

    TABLES

      SIMPLE_CONTAINER   = l_cont.

  • set the work item to complete

CALL FUNCTION ‘SAP_WAPI_WORKITEM_COMPLETE’

  EXPORTING

         WORKITEM_ID   = wi_id.

Using transaction code SWFVISU

The other step we must do is ensure UWL knows to launch our custom Web Dynpro.  We could create the XML ourselves and upload it into UWL, or we could use transaction code SWFVISU.  Transaction code SWFVISU allows you to enter a task, it will generate the XML for you.

image

In transaction code you create a new entry for your task.  In our workflow, TS66507956 is the task for our data entry step in our workflow. 

Then you enter parameters such as APPLICATION, which the name of your Web Dynpro.  You also enter the DYNAMIC PARAMETER for the work item ID.  The other parameter you need is NAMESPACE.  An optional parameter is SYSTEM_ALIAS.  If used, the SYSTEM_ALIAS field provides the name of the system where the Web Dynpro application lives.

Once you have completed SWFVISU,  re-register the work items for the system in UWL.  This is done via the portal.  Go to System Administration – System Configuration – Universal Worklist – Administration. 

image

Select to “Re-Register” the work items.  This will read your new TS tasks and read the settings in SWFVISU and create XML. 

Notice the task, it is TS000008267, which you probably recognize as the generic decision task.  So, here I’ve said that for that task, launch my Web Dynpro.  We’ve said that the system B7QCLNT000 is the system that hosts the Web Dynpro.  

When I loaded this XML into my UWL, I made it a high priority and had it apply to all systems.  I currently have several systems tied to my portal.  ERP2004 systems, BI systems, and several other systems.  In my ERP2004 system I went to SWU3 and started the basic verification workflow.  This creates a user decision in my inbox.  Notice what I get in my UWL:

image

It is the normal task from the verification workflow.  Since I’ve got customized XML tied to TS00008267, the details of my task look like:

image

I don’t have the normal decision steps.  The customized XML has been applied and the “launchWebDynProABAP” button is tied to the action to launch my specific Web Dynpro.

Note:  In NetWeaver 2004, when you setup a system for UWL, you see a new field called “Web Dynpro Launch System”.  Let us say you are registering an R/3 4.7 system.  However, your Web Dynpro is running on a different system.  Let us assume your R/3 system is PRDCLNT800, your Web Dynpro was developed on a system called B7QCLNT000.  In the UWL system registration you are adding PRDCLNT800, but in the “Web Dynpro Launch System” you could add B7QCLNT000.   This defaults a system to use for Web Dynpro launches for every task in the system.  

Additionally, you could override this default by using SYSTEM_ALIAS in either SWFVISU or in manually created XML.  The SYSTEM_ALIAS field indicates the Web Dynpro system to use for a particular task.

How it looks at runtime in the UWL

When using an action handler,  at runtime work items appear in my UWL as normal.  Now they have a link to start the Web Dynpro.

image

image

ABAP Web Dynpro only exists on NetWeaver 2004S.  But the action handler works in the same way for the Java Web Dynpro as well.    I will discuss this in my next blog.

So, use Universal Worklist to renovate and innovate!

To report this post you need to login first.

32 Comments

You must be Logged on to comment or reply to a post.

  1. Abdul Hakim
    Hi Ginger.
    Your weblog is simply superb.
    keep up ur good work.
    Whether the scope of ABAP will be improved equivalent to Java in the areas like EP/MI/XI?
    Will SAP do it or the current situation will continue?

    Regards,
    Abdul

    (0) 
    1. Ginger Gatling Post author
      Hello Abdhul,
      In the case of developing UI’s, I think ABAP Web Dynpro will be a great alternative for people with ABAP experience.  As far as the future direction of ABAP and Java, that is not in my area of experience.  Boht have a critical and distinct role to play. 
      Best regards
      Ginger
      (0) 
      1. surya suresh
        Hi ginger

        your blog’s are simply superb….

        in this your mentioned abt the ABAP WEBDYNPRO , i need same type of settings for JAVA WEBDYNPRO.

        especially how the data will flow from
        workflow—-> java webdynpro container &
        java webdynpro container —–> workflow container .

        (0) 
        1. Anonymous
          Hi

          I just wanted to add a reply on the post before.. I would need exactly what you described for JAVA WEBDYNPRO, too. Do you know a source, where we can get this blog “translated to java” ?

          Thank you very much and keep on with such super blogs!!
          regards tolga

          (0) 
  2. Bruno Ricciardi
    I can’t back to UWL from webdynpro… How can I call this application? You show here the oposite then I need.

    I need to put a back button in my WD app and its back to the UWL..

    Are you know how can I do that?

    I think then I need to put a fire plug for call this app, correct?

    (0) 
  3. Thomas Hjorth Hørlyck
    I just wanted to point out that you will have problems calling SAP_WAPI_WORKITEM_COMPLETE if the workitem is in status READY. If this is the case you should call SAP_WAPI_SET_WORKITEM_STATUS and set status to STARTED before completing the workitem.

    Best regards,
    Thomas

    (0) 
  4. RK RK
    Hi,

    I understood how to launch the webdynpro application from UWL, but I didnt understand how did you add buttons “assign me”, “resubmit” etc… after that “lauchwebdynpro”..can you please clarify.

    Thanks
    Reddy

    (0) 
    1. RK RK
      are they default ones. my intention is to add new button with some functionality in it. is it possible, if so could you please guide me in achieving that?
      (0) 
  5. Alan Rickayzen
    Hi Ginger,
    Great blog – It should be very useful to ERP customers.

    The DYNPARAM is not needed for ABAP Web Dynpro any longer. You can leave out this parameter.
    Best regards,
    Alan

    (0) 
  6. sateesh kumar
    Hi Ginger,
    i developed a new webdynpro leave approval application and a leave approval workflow. I am using the standard BO FORMABSENC in the workflow.
    I configured the uwl xml for the approval task and  i am able to launch the dynpro application for that task type.
    when the approver performs the action on the application, first i am explicitly updating the status in the SWXFORMABS table and then  iam reading the container and writing back the container with the ‘_WI_Result’ element/value using SAP_WAPI_WRITE_CONTAINER fm by passing the work item id.
    This is not updating my container and the workflow is not proceeding further.
    Can you please analyze where i might have went wrong?(backend : ECC6.0; portal : EP7.0)
    Is there any other alternative?
    i posted a forum but not one responded positively..

    PLEASE HELP ME..

    Regards,
    Sateesh.

    (0) 
    1. Ginger Gatling Post author
      Hello Satesh,
      Have you put  your WD in debug mode?  Maybe the write is not getting called….that’s all I can think of..I also assume the write if followed by a complete?  

      Not too many folks have done this – although one customer will speak about it at ASUG – but in debugging – is the FM getting called?

      Regards,
      Ginger

      (0) 
      1. sateesh kumar
        Ginger,
        Thanks for the reply.
        whe action performed on the screen(java dynpro) its calling a RFC and in it iam manually updating the status in th SWXFORMABS table and the i am writing the result to the workflow caontainer with work item id.

        I even manually tested the RFC.the WRITE FM is getting called , the return code of the FM is zero and other custom container elements are being written but the actual result(_WI_RESULT) of the approve method is not getting writed.

        Due to this the workflow is not proceeding further.
        Even i am using teh STATUS COMPLETE method affter writing.
        Can’t we write the result of the method ?
        Is ther any alternative ….

        Please suggest.

        Regards,
        Sateesh.

        (0) 
  7. Anonymous
    I’m using ABAP WD appliaction, we need not the text “Launch WebDynpro” but another text. Is it possible to change this?
    (0) 
    1. Ginger Gatling Post author
      In the XML “Action name” name the button whatever you like, however, this cannot be translated based on the user.  You would probably need a different task for each language, and the action name button is tied to the task for the language you want.
      (0) 
  8. Anonymous
    We used the UWL for handling workflow work items for a manager decision
    in the approval of course registration in the SAP Learning Solution.

    With the SWFVISU first we used the Task Visualization, in the parameters the
    DYNPARAM was WI_ID=${item.externalId}. On the ABAP WD we wrote
    an application which reads the URL parameter and the used some WAPI
    function modules to get the work item attachments of objects and from there
    we got to the data we wanted to show to the managers.

    However we discovered that the SWFVISU overwrites the default handling of
    the task. The default brings the decision buttons as well in the UWL but when
    adding the WSFVISU parameters we get only the “Launch ABAP
    WebDynpro” button. Therefore we turned to change the Task Visualization to
    Object Visualization (Objects on the work item are the Attachments on the
    UWL).

    Now we got the real problem: the field of ${item.externalId} equals to null
    and we cannot identify the work item. I saw what Alan Rickayzen worte on
    your blog about “The DYNPARAM is not needed for ABAP Web Dynpro any
    longer”, but with no detail about it.

    If I click on the attachment and open the ABAP WD application, do I know
    the object I clicked on? And if yes, how do I address it?

    There is no documentation on this not on the SAPHelp nor on the SDN.

    I use ECC6 and EP7.

    Thanks for this

    Tomer Patron

    (0) 
    1. Ginger Gatling Post author
      Hello Tomer,
      I apologize for my delayed response, I have been out for some time. Did you get an answer?  I would suggest you first remove the SWFVISU setting, the reregister the system, and now your task should work as it does inthe backend. Then you can either do SWFVISU to add your ABAP WD or upload the XML yourself.  I have another blog on the XML to upload for the ABAP WD.   
      I apologize – I know you probably already have this solved – at least I hope so.  Once you get it, perhaps you could post a blog on it.
      -ginger
      (0) 
      1. Tal Preas
        not solved yet, the object i guess is transfered using the UWL to the ABAP WD, but i don’t know how to access it. No Task is relevant for use here but only the object itself. I would ask you to tell me if this is not supported yet so i’ll stop trying.
        Tomer
        (0) 
        1. Ruben Baldassarri
          Hello Tomer,

          I’m having a similar problem with object visualization in UWL.
          I’ve filled the corresponding entries in node ‘Object visualization’ in transaction SWFVISU for my BOR object, and re-register the backend system, but when I try to display the object in UWL, it still tries to do it through WebGUI.

          Have you managed to solve your problem?
          If so, can you give me a clue on how to configure object visualization?

          Best regards,
          Ruben

          (0) 
  9. mohsena maknojia
    Hi Ginger,

    Can we use Web dynpro to design approval screen for a workflow that would be executed in CRM Web UI?
    Or is there any other way to design workflows for CRM 2007 Web UI? Please let me know your input as I  dont know how to proceed for my requirment. Thanks.

    (0) 
    1. Ginger Gatling Post author
      Hi,
      For CRM UI if it is just a decision task, you can use the decision and call something in the background to do the work.  If you really want to use the full CRM UI, then it’s a bit different because the CRM UI uses dynamic navigation to know what to call for the task.  Do a find on CRM WebClien UI framework on SDN or google for articles on how to use it- and use this link: https://www.sdn.sap.com/irj/scn/articles-crm-all.

      Basically, you have to build a CRM UI component, and use dynamic navigation in the business object, done in the IMG, to have the UI called with the task executes.  There is a new version of the workflow book coming out this summer that will have a chapter on this -but I don’t know the details of how to do it.   The workflow part is normally -you just have to have the CRM UI built, and use the IMG for the dynamic navigation. Hav eyou used the CRM UI before?
      Best
      Ginger

      (0) 
      1. Michael Arter
        Hi Ginger,
        Thank you very much for your blog – it has been very helpful.  We are currently designing a Travel Expense approval using a web dynpro as the approval task.  Rather than trying to setup the task as a synchronous process we have defined the approval task in the work as an asynchronous task with terminating events and then within the web dynpro raise the appropriate event to complete the workitem.  This seems to work fine and eliminates the need to have to try and complete the workitem within the web dynpro.  Just curious as to why this has been mentioned as an alternative to trying to ‘synchronise’ the web dynpro with a user decision task in the workflow?

        Michael Arter

        (0) 
        1. Ginger Gatling Post author
          Hi Michael
          Your approach is certainly valid  – using a terminating event to end the task.   The only reason why it was not used in the context of the user decision task is that user decisions are normally synchronous tasks.  However, if we had used the purchase requisition approval task as an example, we would have used terminating events since that task is already asynchronous.   We could have copied the user decision task  – made it asyncrhonous, then updated the workflow container with the decision key from the decision then used the WAPI to terminate the event.  The only consideration with terminating events is the volume – since it has another login for WF-BATCH  – but for something like approval a travel expense approval, that’s, fine – not like you’ll have thousands of them happening at the exact same moment in time.  Please do blog about your solution and what you’ve done – I’m certain it will help someone else who wants to use the terminating event! 
          Kind regards
          Ginger
          (0) 
  10. Nirmal Sivakumar G
    Nice blog…

    We have a case in our project where we need to pass additional parameters(in addition to WI_ID) from workflow dynamically as a parameter to UWL so that it can be accessed in Webdynpro java.

    Say if I need to pass my custom parameter APP_ID which is part of workflow container along with  WI_ID as dynamic parameter will it work?

    Is it possible to configure the
    DYNPARAM     WI_ID=${item.externalId}&APP_ID=${item.appId}

    Pls help.

    Best Regards,
    Nirmal Sivakumar G

    (0) 
    1. Ginger Gatling Post author
      hi Nirmal
      I think it **should** work.   I’ve switched groups and no longer covering this topic so I won’t be able to test it.  Would you please post this in the workflow forum and see the response you get?
      thanks
      Ginger
      (0) 

Leave a Reply