FW: ABAP OO Super/SubClass Event triggering

Mark Daley mark_daley at hotmail.com
Thu Jun 16 09:53:23 EDT 2011


Woops, embarrassing moment, I had a restriction on the event trace, wouldn't mind but it was me that put it on!!
 
So the event was triggering for my subclass all along. 
 
Jocelyn just got your mail, thankyou, I'll be implementing your recommendations in any case. 
 
One more thing....
 
Ideally I would like to define my events on the superclass, and then just trigger the events from the subclass, I've tried this and it works but.....
 
.... any receivers linked to that event still get triggered irrecpective of the class triggering the event. Is there anything I can do about this?
Eg
In trns SWETYPV ZSUPER.CREATE is linked to WF1
and ZSUB1.CREATE is linked to WF2.
 
If I trigger ZSUB1.CREATE both WF1 and WF2 are started, but I only want WF2 to start. Same happens when I trigger ZSUPER.CREATE.
 
Mark



From: mark_daley at hotmail.com
To: sap-wug at mit.edu
Subject: RE: ABAP OO Super/SubClass Event triggering
Date: Thu, 16 Jun 2011 10:51:12 +0000





Hi Mike/Jocelyn.
 
I think I'm doing what you've said Mike, but the event is not appearing in SWEL. 
 
Here's what I've tried in SWUE :
Object Type 'ZSUB1'
Event : CREATE
 
I put in object key etc and then click create event, message says 'Event Created - at least one receiver found'..... BUT no event in SWEL and doesn't hit breakpoint in ZSUPER.FIND_BY_LPOR or ZSUPER.LPOR
 
If I try ZSUPER with CREATE, I rightly get error saying event does not exist as the event is on ZSUB1 not ZSUPER.
 
Note I can trigger an event of the superclass fine eg ZSUPER.SUPERCREATE, breakpoint is hit and event is created in SWEL.
 
 
My code is like this...



method bi_persistent~find_by_lpor.
  data : l_matnr type matnr.

  l_matnr = lpor-instid.
  case lpor-typeid.
    

when 'ZSUPER'.
      try.
          create object result type ZSUPER
             exporting
               i_matnr = l_matnr.
        catch ....
      endtry. 
   
    when 'ZSUB1'.
      try.
          create object result type zZSUB1
             exporting
               i_matnr = l_matnr.
        catch ......
      endtry.
   
    when 'ZSUB2'.
      try.
          create object result type ZSUB2
             exporting
               i_matnr = l_matnr.
        catch .....
      endtry.
  endcase.
endmethod. 
 
 
  

method BI_PERSISTENT~LPOR.
result = me->m_por.
endmethod. 
 
I fill m_por in the constructor
 
ZSUPER.CONSTRUCTOR
...
...
  

 me->m_por-catid = 'CL'.
  me->m_por-typeid = 'ZSUPER'.
  me->m_por-instid = me->matnr. 
...
...
...
 
 
  
But none of this code seems to be executed as my breakpoint is NOT being hit!!
 
Mark



 
 
 
 
 
 
 
 
 
 
From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf Of Dart, Jocelyn
Sent: 16 June 2011 10:02
To: SAP Workflow Users' Group
Subject: RE: ABAP OO Super/SubClass Event triggering
 
Mark, 
Can you send through your code for the FIND_BY_LPOR and LPOR classes please?
They are usually only a few lines long. 
Should be easy to spot the problem.
Regards,
Jocelyn
 
From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf Of Mike Pokraka
Sent: 15 June 2011 17:39
To: SAP Workflow Users' Group
Subject: Re: ABAP OO Super/SubClass Event triggering
 
Hi Mark,
 
It's certainly possible, what precisely does "having problems" entail? If
you raise an event ZSUB.CREATED, that's exactly what you should see in
SWEL. If this is the case then your problem is elsewere.
 
You're probably on the right track looking at FIND_BY_LPOR, as that can be
tricky to get right. Bear in mind that FIND_BY_LPOR is static and thus
cannot be redefined, thus you will need to ensure that the correct class
(TYPEID) is retained in your LPOR structure for each instance.
 
Breakpoints are a bit fluffy at times, make sure your breakpoint debugs by
just using ZSUPER everywhere, then move the trigger back to ZSUB.
 
Hope that helps,
Mike
 
 
From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf Of Mark Daley
Sent: Thursday, 16 June 2011 12:44 AM
To: sap-wug at mit.edu
Subject: ABAP OO Super/SubClass Event triggering
 
Hi all,
 
I have an abap object class that is workflow enabled ie using IF_WORKFLOW interface.
 
I want to create several 'flavours' of this class (ZSUB1) using the original abap class (ZSUPER) as the superclass.
 
My understanding from what I've read in Workflow book and blogs, is that I need to reference the ZSUB1 instance in my workflow and I will have access to methods of the super class. 
 
This all seems fine, but I'm having problems trying to trigger an event of the subclass eg ZSUB.CREATE? Is it possible to do this?
 
I've tried to debug whats happening using SWUE by puting  a breakpoint in the FIND_BY_LPOR method of ZSUPER but it does not even get executed?
 
What am I missing?
 
 
Mark 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20110616/1037a5d5/attachment.htm


More information about the SAP-WUG mailing list