Skip to Content

How do I know I’m ready for this? 

This is number 7 in a series of blogs on ABAP OO for workflow, so you it would be a really good idea to make sure you have worked through the first 6 blogs. The examples we’ll use here continue on from those we used in the earlier blogs. Here’s the list of the earlier blogs:

Which is better ABAP OO or BOR?

Clearly ABAP OO is far superior to BOR – much quicker for development, much more flexible, much less specialized – but if you are still asking this question now might be good time to go back and read the first blog “Why Use ABAP OO with Workflow?” h4. Why would you need to use BOR and ABAP OO together?  The main reason for using BOR and ABAP OO together is to access provided SAP business objects for the content. Although newer workflows are now being written using ABAP OO for Workflow – such as Leave Request/Cancellation, and HR Admin Services forms – much of the existing content was originally written using BOR and has not yet been converted to ABAP OO. Whether BOR content is ever converted to ABAP OO depends on the priorities of the specific development area so you should *NOT* wait for old content to be converted.  A secondary reason is because even though you are mainly working in ABAP OO you still want to raise events using a technique that does not yet support ABAP OO for Workflow. E.g. Status management events do not provide an ABAP OO option as yet (SAP NetWeaver 7.00 – July 2007).

How do you access a BOR object from an ABAP OO class?

The best approach is to access the BOR object as an attribute of your ABAP OO class. For our ZCL_PLANT example we have been using in the previous blogs, there is an older equivalent BOR object BUS0008. To link the BOR object to our ZCL_PLANT class we need to:

  1. Create a constant with a prefilled type for the BOR object
  2. Create an attribute for our BOR object
  3. Fill the attribute value at runtime with the key of the BOR instance
  4. Reference the BOR object in our workflows/tasks A constant is just an attribute of a class with the level “Constant” (instead of “Instance” or “Static”).

The prefilled type can be created in a number of ways – you could use a type-pool or just use a direct entry type. A type-pool has the advantage of allowing you to collect all such prefilled types into one place, however for our example a direct entry type is adequate.image

To report this post you need to login first.

12 Comments

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

  1. Mike Pokraka
    Jocelyn,
    I’ve been using OO Classes for quite a while in workflows and could not agree more that it’s the way to go.
    I would like to say a public thanks for all your valuable input into all things Workflow and especially these blogs which have been an inpiration.
    Cheers,
    Mike
    (0) 
  2. Henk Verdaasdonk
    Jocelyn,
    Great article especially the BOR object as attribute of your OO class.

    How would you handle hard coded BOR events (by SAP), which should trigger your OO WF?

    Best regards,
    Henk.

    (0) 
  3. Ravi Dixit
    Hi Jocelyn

    I just went through the 7 blogs once again just to refresh my memory of OO/Workflow.

    It is a marvellous effort on your part to so lucidly and easily explain the unknowns, in fact I think you have gone a step ahead and actually given a beginner a neat little intro into the hitherto mystical world of SAP Workflow.

    This was the last one that I somehow missed when I moved from one client to another but, as they say, better late than never. I tried the BO as attribute of the class and may say it is absolutely fantastic!

    Keep up the great work!

    P.S.: Can we expect some more gems from you?

    (0) 
    1. Jocelyn Dart Post author
      Thanks Ravi for the encouragement – much appreciated! Yes I’m hoping to add some more tips in upcoming months on Workflow and the UWL.  Use of OO Exceptions and User Decision with Note are two I’m hoping to release next.  Keep an eye out!
      (0) 
  4. Hi Jocelyn,
    This is really great job and helping us a lot.Thanks a lot:)

    In my curreny project even I am trying to do same.
    There is a object type BUS7051 and I want to use this object in my own class. My workflow triggers with event ‘Created’ of BO BUS7051. I have defined class attribute and constant as you mentioned.
    But now I am confused, how to retrieve notification data from workflow and use the BO attributes and methods in my class…..
    Please help….

    Thanks in advance…
    Rashmi Jain

    (0) 
    1. Jocelyn Dart Post author
      Rashmi,
      Ok.. well this is a question perhaps better listed on the BPM forum, however here’s a quick summary.

      1. Your workflow is triggered on event BUS7051.CREATED

      2. The first step in your workflow should be to create an ABAP OO instance of your notification using the notification id from BUS7051.  If you want to have different ABAP OO classes for different types of notifications, then usually the notification type and scenario can be used to determine which class you instantiate and also which workflow you start (e.g. by adding a logical expression as a start condition of the workflow).

      3. You can then continue on with the rest of the workflow using your ABAP OO instance.

      As BUS7051 can represent many different types of notifications – including ISR, PCR and Adobe forms – it’s helpful here to have a parent ABAP OO class representing all attributes and methods that apply to any notification, and have specific child ABAP OO classes for each type of notification (which of course inherit all the generic attributes/methods from the parent class). 

      Hope that’s enough to get you started.

      If you aren’t familiar with some of the terms above I suggest you raise your questions in the SDN BPM forum.
      Regards,
      Jocelyn

      (0) 
      1. Thanks Jocelyn,
        This really helped me…. Now I can think ahead. 🙂
        Thanks again for your quick help……

        Regards,
        Rashmi Jain

        (0) 
      2. Elvis Hau
        Hi Jocelyn,

        I’m new in Workflow and can you please help me in how to add a BOR in my ABAP class for trigger the event. I need to trigger my abap class from BUS2034 created event. Can you give me a step by step to create the constant and the instance?

        Thanks for your atention,
        Elvis

        (0) 
  5. Paul Klimashkin
    Hello, Jocelyn Dart.
    Great blog!
    But I have one problem. I can’t press the “Direct Type Entry” button if my constant is Public. Therefore I can’t set initial value for BO_BUS0008.
    Whether there is an solution for this situation?
    (0) 
      1. Jocelyn Dart Post author
        Hi Paul,
        Unfortunately ABAP OO for workflow is only available from 6.20 onwards – e.g. ECC 5.0, ECC 6.0, etc. – as I mentioned in the introductory blog.  In 4.70 you still only have the option of using BOR objects. Although it doesn’t hurt to practice!  In later releases I haven’t had a problem creating public constants so I suspect that must be a 4.70 issue.
        Regards,
        Jocelyn
        (0) 
        1. Paul Klimashkin
          I found solution.
          Create own TYPE-POOL in SE11, where create constant:
          constants: BEGIN OF ztttt_c_bo_scase,
                      instid TYPE sibfboriid VALUE IS INITIAL,
                      typeid TYPE sibftypeid VALUE ‘SCASE’,
                      catid  TYPE sibfcatid VALUE ‘BO’,
                     END   OF ztttt_c_bo_scase.

          Next just insert this type-pool in type defenition of the class. And then insert ztttt_c_bo_scase as initial value for BOR attribute.

          (0) 

Leave a Reply