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:
- Getting started with ABAP OO for Workflow … using the IF_WORKFLOW interface
- [Using ABAP OO with Workflow Tasks | Using ABAP OO methods in Workflow Tasks]
- [Raising ABAP OO events for Workflow | Raising ABAP OO events for workflow]
- [Using ABAP OO attributes in Workflows and Tasks | Using ABAP OO attributes in workflows and tasks]
- [Using functional methods in Workflows and Tasks | Using functional methods in workflows and tasks]
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:
- Create a constant with a prefilled type for the BOR object
- Create an attribute for our BOR object
- Fill the attribute value at runtime with the key of the BOR instance
- 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.