ABAP-OO Workflow Rule Resolution
Florin Wach
florin.wach at gmx.net
Wed Sep 10 10:14:52 EDT 2008
Hi Wuggies,
I have just stumbled over an issue with the rule resolution by "function module" using ABAP-OO, as the container is not passed as a reference to IF_SWF_CNT_CONTAINER nor as a persistent XML-reference (as the check and receiver function modules do). So there's currently a small GAP.
The requirement was, to pass the persistent object reference (structure SIBFLPOR) and/or the object instance (TYPE REF TO ---type---) to the role-container (AC_CONTAINER).
The straightforward(?) solution was:
- Create a container element "LPOR" with struct-reference to type SIBFLPOR
- Create a public attribute MS_LPOR and assign this in the binding to the rule (Releasable->MS_LPOR --> LPOR)
A little bit of a suprise was, that the binding checks returns with an error, saying that that assignment is just incompatible. That was true in the way, that the instance-attribute MS_LPOR was treated as it was a TYPE-REF-TO definition. So the only eligible target type for the binding was a TYPE-REF-TO definition.
However. I have changed the container stuff and now having a new element RELEASALBE with a TYPE-REF-TO definition and within the dataflow I just pass the _wi_object_id itself. Now the binding checks is fine.
On runtime now, the following coding will /not/ work, to retrieve the object instance:
DATA: releasable TYPE REF TO Z_CL_RELEASABLE.
swc_get_element ac_container 'Releasable' releasable.
Because the "new" ABAP-OO elements are passed in a way, that the old BOR-container macros cannot work with.
On the other hand, the rule interface does not (!) provide the ac_container as an object referring to IF_SWF_CNT_CONTAINER (or something like this).
So this is, how it works:
Create a new import parameter (optional, pass-value) for future use:
ACTOR_CONTAINER_OO TYPE REF TO IF_SWF_CNT_CONTAINER Container: Implementing Class
"... further in coding
* The ABAP-OO container object is currently not designed by SAP. This
* part is not yet fully compatible to the new ABAP-OO-Workflow.
* Therefore we will help ourself here and create it backwards from
* the BOR-container.
* If the interface is correctly(!) used in the future, then we will
* also use, what the standard gives us.
IF actor_container_oo IS INITIAL.
CALL METHOD CL_SWF_CNT_CONTAINER=>IF_SWF_CNT_CONVERSION~CREATE_FROM_BOR_CONTAINER
EXPORTING
values = ac_container[]
RECEIVING
container = actor_container_oo.
ENDIF.
DATA: releasable_oo TYPE REF TO Z_CL_RELEASABLE.
swf_get_element actor_container_oo 'Releasable' lo_releasable.
"no it's fine :-)
IF NOT sy-subrc EQ 0.
"Handle exceptions here
ENDIF.
Take care,
Florin
More information about the SAP-WUG
mailing list