IF_SWF_IFS_BIND_TRANSFORM - transforming from BOR to ABAP object

Kjetil Kilhavn list.sap-wug at vettug.no
Wed Feb 5 05:17:18 EST 2014


Tirsdag 4. februar 2014 14.46.28 skrev Mike Pokraka:
> Hi Kjetil,
> 
> I haven't encountered this because I usually take the easy route :-)

I am shocked! ;-)
Actually it turns out it is my own fault, since I used the event queue. When I disabled that I could debug 
from synchronous event creation in SWUE.

> Instantiate an OO equivalent early on in the WF via container operation, and
> use that whenever it's needed.

With the conversion I can choose to only have an object reference to the class, so the work items will not 
show up in the workflow overview from ME53N.

Once I got into the debugger I could figure it out by some debugging and some (read: a lot of) trial and 
error. This works: (field symbol type SIBFLPORB).

CHECK source_element IS BOUND AND
      target_element IS BOUND.
CHECK source_element->query( properties = swfcn_p_is_table ) IS INITIAL AND
      target_element->query( properties = swfcn_p_is_table ) IS INITIAL.

TRY.
  source_element->get_value_ref( IMPORTING 
                                   value_ref        = ls_source_element
                                   is_object        = l_source_is_object
                                   exception_return = lx_source_exception ).
  CHECK lx_source_exception IS INITIAL.
  CHECK l_source_is_object = 'X'.

  target_element->get_value_ref( IMPORTING 
                                   value_ref        = ls_target_element
                                   is_object        = l_target_is_object
                                   exception_return = lx_target_exception ).
  CHECK lx_target_exception IS INITIAL.
  CHECK l_target_is_object = 'X'.

  ASSIGN lr_source_element->* TO <ls_source_object>.
  ASSIGN lr_target_element->* TO <ls_target_object>.
  <ls_target_object>-instid = <ls_source_object>-instid.
  target_element->set_value( EXPORTING 
                               value            = <ls_target_object>
                             IMPORTING 
                               exception_return = lx_target_exception ).

  CATCH cx_swf_cnt_elem_access_denied.
  CATCH cx_swf_cnt_elem_def_invalid.
  CATCH cx_swf_cnt_container.
ENDTRY.

The code is not generic, but this allows me to use ZMMPUR_REQUISITION_ITEM instead of BUS2009 if I 
want to. I suppse this could be made generic by looking up object types in tables to find out what was 
supported. That is one of those excercises left to the reader.


> Regards,
> Mike
> 
> On 4 Feb 2014, at 13:06, Kjetil Kilhavn <list.sap-wug at vettug.no> wrote:
> 
> I decided to venture into the unchartered (for me) lands of mixed
> implementations, so I have a task which is triggered by a BUS2009 event but
> needs a ABAP object as well.
> 
> This is a simple solution (SelfItem::SendTaskDescription), so I really want
> this to just be a single task. “No problem” - that can be done using a
> transformation, all that is needed is an implementation of
> IF_SWF_IFS_BIND_TRANSFORM.
> 
> Sounds easy, and is not too bad up to and including implementation of the
> Check method where I can query the type of the source and target elements to
> ensure only the supported object types are passed. This method can be
> tested in the binding editor.
> 
> However, implementing the Transform method seems to be a tad bit worse.
> SAP have been kind enough to implement a couple of examples with addition
> and subtraction of numbers, and I have previously implemented the interface
> to transform a decision (SWYFORM-RETURN0) to a text representation of that
> decision. Easy peasy - but that was values, not objects!
> 
> Now, with objects it seems it is not so easy - and I am unable to figure out
> a way to test the transform method.
> 
> Even if the mighty google fail to be of assistance. Surely someone on this
> e- mail list must have encountered this problem before me.

-- 
Kjetil Kilhavn / Vettug AS (http://www.vettug.no)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20140205/df0f4e14/attachment.htm


More information about the SAP-WUG mailing list