How to attach event to custome workflow object ?

Hi Guys,
Could someone help me on how to raise event while creating custom workflow object.We can attach event to object in transaction swe2 . I would like to know how to create that event. Could some send sample custom workflow object with events.
Many thanks in advance.
Cheers,
Garrick.

Here's an example  using Business object BUS2080  Service notification
I delegated ZBUS2080 to BUS2080 (service notification).  Added 2 Events REASSIGNED and MODIFIED.
Use transaction SWO1 for manipulating business objects.
The User performs an action on a service notification  (IW52) say PUT IN SERVICE AGAIN.
When the user puts the service notification in service again the event triggered will start a (user defined) workflow which makes a call to a method in the business object ZBUS2080 which launches a batch job.
This batch job creates our user event REASSIGNED which in turn calls a new workflow to be executed.
This workflow performs the action I want -- in this case to re-assign the service notification to a new person, send an email and escalate the deadlines
Code samples are shown below.
So here's how it works.
First you need to set up some entries with table SWE2. I've assumed you've already defined the events to the Business object(s) you want to use.
In SWE2 define entries for BUS2080 (or ZBUS2080) For Events INPROCESSAGAIN and (our event) REASSIGNED.
IN SWE2 define the receiver call as a FUNCTION MODULE
For the receiver function modules  for the SAP event (INPROCESSAGAIN) define the receiver module as SWW_WI_CREATE_VIA_EVENT
For the event REASSIGNED define the receiver module as SWW_WI_CREATE_VIA_EVENT_IBF.
I have no idea whatwhat the difference is between the two but the process works when it's done like this.
Ensure the linkage Activated box is clicked in both cases.
Put your workflow numbers in the RECEIVER TYPE in SWE2 table.
In the first workflow when the user puts the service notification in service ensure your workflow starts a batch job which raises another event
Note : You need to instantiate the object (I.e supply the key) to trigger the event correctly. The key is obtained from the WF and will be in the container anyway.
You can do this by adding this type of function module into the method of the business object you want to execute during the first workflow. The code here creates a batch job which submits the EVENT creating program.
function z_create_event_for_cs.
""Local interface:
*"  IMPORTING
*"     REFERENCE(OBJECT_KEY) LIKE  SWOTOBJID-OBJKEY
*"     REFERENCE(W_REASON) LIKE  HRPXXXX-DUMMY
*"     REFERENCE(W_ESCLEVEL) LIKE  HRPXXXX-DUMMY
Create Batch job to run ZZREASSIGNCS
which creates event REASSIGNED in Customer query workflow.
data: jobnr like tbtcjob-jobcount,
      jobname like tbtcjob-jobname,
      pgmname  like sy-repid,
      w_key like viqmel-qmnum,
      w_code type c,
      w_num  type c.
      w_num = w_esclevel.
      jobname = 'CREATEEVENT'.
    pgmname = 'ZZREASSIGNCS'.
call function 'JOB_OPEN'
  exporting
    jobname                = jobname
importing
   jobcount               =  jobnr
CHANGING
  RET                    =
  exceptions
   cant_create_job        = 1
   invalid_job_data       = 2
   jobname_missing        = 3
   others                 = 4
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
  input =  object_key
  importing
  output = w_key.
w_code = w_reason.
if w_code = ' '.
w_code = 'Z'.
endif.
submit zzreassigncs
with p_key = w_key
  with p_escl = w_code
  with p_escnum = w_num
  via job jobname number jobnr
  and return.
call function 'JOB_CLOSE'
  exporting
     jobcount                          = jobnr
     jobname                           = jobname
   strtimmed                         = 'X'
  exceptions
    cant_start_immediate              = 1
   invalid_startdate                 = 2
   jobname_missing                   = 3
   job_close_failed                  = 4
   job_nosteps                       = 5
   job_notex                         = 6
   lock_failed                       = 7
   invalid_target                    = 8
   others                            = 9
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endfunction.
For the actual program which creates the event  use something like this
program zzreassigncs.
This program creates an event REASSIGN
This triggers a "clone" of the initial customer query workflow
which is now marked as completed.
The deadline and escalation level from the original workflow
should be passed to the new workflow via the event container
Program is submitted from the original workflow
Ensure transaction SWE2 has the event REASSIGN for bus object BUS2080
defined or the WF won't start even if the event is raised correctly
As this program is run as a background / batch task
you need to obtain the relevant notification number and pass it
as a parameter.
When run from the WF the you can get the notification number obtained
from the workflow / task  container.
include <cntn01>.   "For WF macros.
parameters: p_key like swotobjid-objkey,  "Service notification number
            p_escl type c,
            p_escnum type c.
constants: c_event    like swetypecou-event   value 'REASSIGNED',
           c_attrib   like swotra-attribute   value 'USRSTATUS',
           c_object   like swetypecou-objtype value 'BUS2080'.
data:     w_object like swotobjid,
          w_stat     like  tj30t-txt04.
data: rc like sy-subrc.
data: begin of event_cont occurs 0.
      include structure swr_cont.
data: end of event_cont.
data: begin of return.
  include structure swotreturn.
data end of return.
if running from WF rather than a batch job
swc_container container.
swc_get_element container  'Znumber' p_key.
w_object-objkey = p_key.
w_object-objtype = 'BUS2080'.
call function 'SWO_PROPERTY_GET'
exporting
    object                = w_object
    attribute             = c_attrib
  changing
    value                 =  return.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
w_stat = return(4).
event_cont-element = 'Status'.
event_cont-value = w_stat.
append  event_cont.
event_cont-element = 'Escalated'.
event_cont-value = p_escl.
append event_cont.
event_cont-element = 'Escalation'.
event_cont-value = p_escnum.
append event_cont.
Note WAPI calls only valid from rel 6.1 using Webflow engine
(part of standard WF since rel 6.1)
CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'
  EXPORTING
    OBJECT_TYPE           =   w_object-objtype
    OBJECT_KEY            =   w_object-objkey
    EVENT                 =   'REASSIGNED'
  IMPORTING
   RETURN_CODE           =  rc
  EVENT_ID              =
TABLES
   INPUT_CONTAINER       =  event_cont.
if rc <> 0.   "Houston ---We have a problem !! '
  write: text-002 color col_negative.
  exit.
endif.
even though no database / table is updated here by the event
we still need the commit work to initiate the event correctly
commit work.
You CAN use Objects (OO ABAP) but if you are fairly new to this sort of stuff just stick with standard BOR (Business objects) to parctice on until you've got the hang of the process.
It's actually a lot simpler than most people realize --which is why WF consultants get paid decently !!!!.
Cheers
Jimbo

Similar Messages

  • How to get event when any library object added to indesign doc?

    I want to do some operation when any library object is added to doc. So please tell me how to get event when any library object is added to the doc. better provide some code snippet.

    Daves61,
    I need to clarify what kind of event you're interested in.
    1. When you click once on page/spead widget in the Pages panel and only widget becomes selected. The layout window remains unchanged. OR
    2. When you doubleclick on page/spread widget the selected master spread appears in the layout window.
    In the first case you work with Pages panel.
    Have a look to file PageTransitionsPanelObserver.cpp from SDK. 
    PageTransitionsPanelObserver::LazyUpdate()
    In the second case you work with Layout window.

  • How do I add my Custom Workflow Activity to FIM 2010 R2 SP1 installed on Windows 2012 server?

    Hellos.
    I have tried and failed to add my custom.dll into the Windows Server 2012  GAC.
    We have a version of FIM 2010 R2 Sp1 running on Windows Server 2008 R2 and that was no problem. There seemed to be a gacutil.exe present on the system which added my assembly.
    I cannot find gacutil.exe on the Windows 2012 Server.
    I have downloaded and installed Windows SDK for Windows 8. However, when I try the gacutil.exe /i <myCustom.dll> nothing seems to happen.
    Are there any guidelines how to add custom workflow activities to FIM when installed on a Windows Server 2012 system?
    TIA
    *HH

    Well yes. It is fine when FIM is hosted on Windows Server 2008 R2.My difficulty is that I am using FIM 2010 R2 Sp1 and Windows Server 2012. No GACutility executable.
    However, the problem has been resolved. Powershell can be used to modify the assemblies.
    I opened a RunAs Administrator PS session. My assembly is in folder c:\Temp
    Using Windows Explorer I browsed the folder c:\windows\assembly and noted the System.EnterpriseServices entries: version (2.0.0.0) and public key token (b03f5f7f11d50a3a)
    (My version is 2.0.0.0 because when installing FIM and SharePoint 2013 the instructions I used suggested setting .Net version to be 2.0)
    These powershell commands got me going...
    PS C:\temp> [System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
    GAC    Version        Location
    True   v4.0.30319     C:\Windows\Microsoft.Net\assembly\GAC_64\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50...
    PS C:\temp> $publish = New-Object System.EnterpriseServices.Internal.Publish
    PS C:\temp> $publish.GacInstall("c:\temp\RunPowershellLibrary.dll")
    PS C:\temp>
    PS C:\temp>
    PS C:\temp> iisreset
    Amazingly I can see the assembly RunPowershellLibrary in my Windows 2012 GAC. :-)
    Also, what is more cheering is that the custom activity actually works with FIM 2010 R2 Sp1.

  • How to create event for BOR BUS2009 Object ?

    How to create a new event for BOR BUS2009 Object ?

    Hi,
    Please create a subtype for BOR BUS2009, say Z_BUS2009 and include your custom characteristic entities like Events, Methods, Key fields etc and finally do delegation. After delegation, all your custom changes reflects in BOR BUS2009.
    Regards,
    Prasanth

  • How we can find the customized workflow in Oracle Apps 11.5.10.2

    Hi all,
    I am new to Oracle Workflow and I want to know, How many customized workflow is running in my oracle apps 11.5.10.2.
    Thanks & Regards
    Rakesh Kumar

    An another possibility is to do the opposite to what I just wrote. Upload the true definition to the database an compare with the one you are not sure about via SQL:
    1. Backup the WFT file where the standard/seeded workflow is provided
    2. Edit it and change the name of the ITEM_TYPE. For instance, change it from OEOL to OEOL_TMP (cannot exceed 8 characters)
    3. Upload it to the database with WFLOAD
    4. Compare the design tables for the two if them (WF_ITEM_TYPES, WF_ACTIVITIES, WF_MESSAGES, WF_PROCESS_ACTIVITIES, WF_ITEM_ATTRIBUTES, etc). If the table provides a VERSION column then the query would need to use a WHERE END_DATE is null (so that you get only the active/current version of the object). A select... MINUM select would do the job.
    I would do this in test though, to avoid a mistake can cause any issues.
    Regards,
    Alejandro
    Edited by: Alejandro Sosa on Feb 4, 2013 7:07 AM

  • How to attach a smartform in BOR object

    Hi,
    I want to know how to attach a z smartform to BOR object? I tried to search out here but not able to have the result.
    Kindly provide the guidelines for it....
    Regards,
    Rickky

    Hi,
    In the BOR object, create a method say display_SF. Now in the ABAP properties for that method give "OTHER" option.
    Now in the BOR object, you can find the program which is used. Inside that program, You need to write the code to fetch the required data (ONLY BASIC REQUIRED DATA WILL BE ENOUGH) and call the smartform by passing all the print parameters and all the required data for that smartform.
    Now inside the smartform, with imported required data, you can write all the logic and data fetch etc for the printouts.
    The following sysntax can be used to fetch the required data into the method and can use to pass the same while calling the smartform.
    SWC_GET_ELEMENT CONTAINER 'Plant' PLANT.
    Regards,
    Harish

  • How to find the right customizing adapter object for a R3 table?

    I customized a document type ZCRM in the R/3. Now i want to do the synch load for document types using R3AS to see if it goes to the CRM system.
    When i check TR VOV8 in R/3 customizing,  i see that table TVAK is used in R/3  to store my document type ZCRM
    Then i try to find out, to which customizing adapter object table TVAK belongs. It is described in course TCRM20 Unit 9: I check table SMOFTABLES in the CRM system using TR SE16 and search in the column R3TABNAME for tablename TVAK. But it isn´t there...
    What am i doing wrong? How can i transfer my document type?
    Thank you

    Thanks - you are right - document types/transaction types and item categories cannot be transfered at all
    I just transfered customizing adapter object DNL_CUST_PRICE because R/3 table T052 (payment terms) is included in this adapter object. I customized payment term ZCRM in R/3. A check shows a green light. Now i want to check in which table in CRM my payment terms landed?
    Table T052 does not seem to exist in CRM.
    A detail insight in adapter object DNL_CUST_PRICE  by transaction R3AC3 to check the target table in CRM shows an empty column 'Mapping structure target site'. Where could i look?
    Thank you

  • How to attach file in a workflow

    Dear all,
    I want to attach a  file with workflow mail.
    can anybody tell me about this...
    regards ,
    Piyush jain
    Edited by: piyush jain on Mar 16, 2009 12:12 PM

    Hi Piyush,
    After bringing your final alv data in the final internal table,
    go through this link , i also had an same requirement to send data after converting to excel file and
    send it as an attachment to mail id outside Sap,
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/to%252bsend%252b2%252bint%252btables%252bdata%252bas%252btwo%252battachments%252bto%252bmail%252bid%252boutside%252bsap%252bsystem
    Check here the parameters which i have passed in that function module.
    Hope it helps
    Regrds
    Mansi

  • How to dispatch events from custom AS3 classes to MXML

    Hello,
    I introduce some custom classes inside my SCRIPT tag in MXML.
    These classes should dispatch custom Events (or any events for that
    matter) and the listeners should be defined inside the SCRIPT tag.
    In the custom class I have:
    quote:
    dispatchEvent(new Event("customEvent"));
    And inside the script tag:
    quote:
    addEventListener("customEvent", testListener);
    quote:
    public function testListener(evt:Event):void{
    Alert("Event fired successfully.");
    However, this event is not handled in the listener (the alert
    is not shown). What could be wrong?

    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" creationComplete="init();">
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    private function init():void
    addEventListener("customEvent", testListener);
    dispatchEvent(new Event("customEvent"));
    private function testListener(evt:Event):void{
    Alert.show("Event fired successfully.");
    Do like this
    Alert is the Class Object. This is not the Function.

  • How to respond Events defined within workflow

    I have a workflow in which I have defined and event (that star thing). the event says
    that if the root of the xml is "ERoot" then this event should be triggered.
    I have an xml with 'ERoot' as the root. I think i have to post this xml into a jms
    queue inorder to wake up my event.
    to which jms queue/topic should I post this xml?
    is it com.bea.wli.bpm.EventQueue? or is it some other TOPIC?
    thanks,
    Naveen

    u need to create the events step by step in the workflow.
    first event would be the condition which should be checked so that it gets triggered when the condition is satisfied.
    second would be the the triggering in which u will get this triggered. u need to create a class in which the adobe form's code will be present like the FM it generates etc.in this class u will to write some methods for eg: if u create method say send_mail in this class u will code all the logic for sending the adobe form as a mail and u assign this in the workflow. So now, in the workflow all the methods that u assign will get triggered.

  • How to attach a file from a URL?

    Hi experts,
    I need to attach a file which is already in the repository, and I only know its URL.
    I think I have to use BBP_PD_BID_UPDATE but it doesn't attach anything, or I'm mising some information.I have the GUID of the object and the URL. If I could have the file properties as mime or file size... I think it should be easier.
    Anyone knows how to get this info? or how to attach the file to the object?
    kind regards

    Btw, you may read below links for more details
    SyBooks Online
    Sybase Unwired Platform ( SMP ) – Custom Attachment Icon in HWC Application
    SUP HWC Attachment Viewer not displaying attachment

  • Custom Workflow - Reports

    Hi,
    How do we define a custom workflow to generate a report? The report is to get all the users and there attributes from LDAP. I do understand a form also has to be associated with the WF. I have no clue how to head start with custom reporting,
    Please update me or also if possible provide some sample custom workflow , forms , rule for custom workflow reports.
    Thanks

    Hello All,
    Did anyone got this working?
    I have a requirement wherein i have to get the report results back into a wf and use it for further tasks.
    Can someone help or provide inputs regarding Process View. Or how to call a report from a wf?
    Thanks in advance.

  • HELP IN Creating customized Oracle Object from Java

    How can I create a customized oracle object that has these 3 fields with data persistance:
    NAME : VARCHAR2
    INSER_DATE : DATE
    OBJ:user-defined collection(oracle.sql.array)
    using JAVA. Later, that oracle object is enqueue in Oracle avanced Queue.
    I've been looking in this site for the answer but had no luck.
    I am using Java 1.2 and Oracle 8.1.6.
    Any help will be appreciated as I needed so badly. Thanks.
    Robby
    [email protected]

    Hi
    I assume your attempting to generate a Java class with the approriate getters and setters. If so the JPulisher utility is what your after. You can access it from either JDeveloper or the command line... Its documented in the Oracle Java manuals (jdbc etc.)...
    A piece of advice... especially if you using AQ and ADT's or oracle's jms implementation against AQ, make sure you use the Oracle 8.1.7 jdbc drivers, even if your accessing an 8.1.6 DBMS. The performance difference is significant
    Dom

  • How to organize translation of customer developments

    Hello everybody,
    I am having a hard time finding documentation on how to organize translation of customer development objects. I've had a look at the articles in service.sap.com\globalization and also at the SAP Online documentation, but I am having trouble getting the overall picture.
    We have a 3-tier system landscape with installed languages english, german, italian and 2 clients in every system, one primarily used by german users, one for primarily italian users. In both clients, there are development activities, so we have ojects with original language german and others italian. Is it useful to create an extra client which is solely reserved for translation? What are the alternatives and what consequences do they have on the translation process?
    Anybody any experience on this topic? Where else could I find documentation on this topic?
    Thank you for your help, regard, Kathrin!

    Hi Kathrin,
    I've never seen these transactions before (SLWA/SLWB).  Every time you turn over a stone SAP presents another whole new raft of functionality that you didn't know about.
    From my experience (rolled out one European solution, in the process of doing another) however, I'm not sure that use of these is really required.  Maybe there is benefit but it seems a little excessive to me (after only a quick view).
    By before migration, I mean before moving to the next tier in your landscape (from DEV to QA).  So, one of the quality checks on all objects before they are allowed to leave the DEV system is checking to ensure that they are translated to all languages (by a native speaker for each language to check for accuracy). 
    Hope that helps.
    Brad

  • How to ignore the password policy in a custom workflow?

    Hi,
    We have a custom workflow which is called via SPML to provide 'Administrator Change Password' functionality in a portal.
    Our password policy sets the String Quality rules and Number of Previous Passwords that Cannot be Reused. But we like to bypass the password policy when the password administrators (who have a admin role with a capability - 'Change Password Administrator'). At least, restriction ' Number of Previous Passwords that Cannot be Reused' need to be ignored (But password need to be added to the history... cannot disable adding passwords to history).
    Please advice me how it could be achieved?
    The workflow steps:
    1. Checkout 'ChangeUserPassword' view for the user as an administrator
    2. Set the new password in the view, set true to view.savePasswordHistory
    3. Set password on the resources
    4.Checkin the view
    Thanks
    Siva

    Thanks eTech.
    My main goal is to skip the password history check (new password can't be a last used 10 passwords) when admin change password workflow is launched. As you suggested , I created a special password policy exactly as our regular password policy excluding "Number of Previous Passwords that Cannot be Reused" setting.
    Then before change the password of a user as admin, special policy is attached , password changed, and user's password policy is reverted back to regular one. The issue is, as the special policy does not enforce the password history check, the whole password history of the user is wiped out from the user object when the password is changed by admin change password workflow. We don't want this to happen.
    Please guide me whether is anyway to achieve just ignoring the password history without any other impact on user.
    Is adding passwords to user object's password history list is triggered by "Number of Previous Passwords that Cannot be Reused" setting of the password policy??
    Thanks
    Siva

Maybe you are looking for