Methods inside object types WORKFLOW

Hi workflow gurus
I am trying to implement my own method in a subtyped object type, my requirement is that
if a particular condition is true then a particular outcome should be active.
For example
begin_method mymethod changing container.
select * from xxx where fff = ccc.
case  xxx-ggg.
when 'aaa'.
//I want the corresponding outcome to be active
when 'bbb'.
//I want the corresponding outcome to be active
endcase.
end_method.
these outcome should show up in my workflow step.
Can any of the gurus help me out on this.
Regards
Narendiran Rathinavelu

Hi,
I am giving you sample code with which your issue will be resolved. in case if you have any problem please ask.
  CALL FUNCTION 'Y_WF_PREQ_AUTO_PO_CHG_POSSIBLE'
EXPORTING                                                   P_BANFN   = OBJECT-KEY-PURCHASEREQUISITION   
  P_EKGRP   = OBJECT-KEY-PURCHASINGGROUP       
TABLES                                                      T_EBAN_REDUC  =   T_EBAN_REDUC                     
  T_EKPO_REDUC  = T_EKPO_REDUC                     
  T_COMPARISON  = T_COMPARISON                     
  T_DIFFERENCE  = T_DIFFERENCE                     
  T_MESSAGES_TEXT = T_MESSAGES                       
  T_ENDORSER    = T_ENDORSER                       
EXCEPTIONS                                                 PURCHASE_REQ_FIELD_EMPTY = 1                            
NO_PURCHASE_REQ_DATA_FOUND = 2                            
  NO_PURCHASE_ORDER_DATA_FOUND  = 3                            
  FUNCTION_PROBLEM              = 4                            
  CURRENCY_CONVERSION_FAILED    = 5                            
  NO_ENTRY_IN_T024              = 6                            
  NO_VALID_BUYER_FOUND          = 7                            
  QTY_UNIT_CONVERSION_FAILED    = 8
  NOT_ALL_ITEMS_APPROVED        = 9
  ALL_CHANGED_REQ_ITEMS_DELETED = 10
  SEVERAL_PO_ITEMS              = 11.
IF SY_SUBRC <> 0.                                                 
  CASE SY_SUBRC.                                              
    WHEN 1.                                                         
      EXIT_RETURN 9001 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4. 
    WHEN 2.                                                         
      EXIT_RETURN 9002 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4. 
    WHEN 3.                                                         
      EXIT_RETURN 9003 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4. 
    WHEN 4.                                                         
      EXIT_RETURN 9004 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4. 
    WHEN 5.                                                         
      EXIT_RETURN 9005 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4. 
    WHEN 6.                                                         
      EXIT_RETURN 9006 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4. 
    WHEN 7.                                                         
      EXIT_RETURN 9007 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4. 
    WHEN 8.                                                         
      EXIT_RETURN 9008 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4. 
    WHEN 9.                                                         
      EXIT_RETURN 9009 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4. 
Also at Object's Method level you have to define the exceptions which the method can throw.
now when you select the method in your task level, then exceptions defined at this method level will be shown at Task level.
Thanks,
sksingh

Similar Messages

  • Exception '1250' is not defined for method 'CREATE' object type 'MESSAGE'

    Dear experts,
    I set up the document distribution (SWU3, backgroundjob SMTP, activated the workflows, flagged the linkages, etc). Now, I have still a error:
    Exception '1250' is not defined for method 'CREATE' object type 'MESSAGE'
    Does anyone know what the cause of exception 1250 could be?
    Thanks in advance and kind regards,
    Samuel

    hi,
    SAP ITS is SAP Internet Transaction Server which provides connection between SAP ERP system and html client.
    Check with bassis, i think TCP/IP or work station application not configured yet. i guess?
    Benakaraja
    ??P

  • Exception '1003' is not defined for method 'SENDTASKDESCRIPTION' object type 'SELFITEM'

    Hi All,
    Please help me in this. I am trying to send a mail when user rejected the item in his inbox. I am getting error like
    Exception '1003' is not defined for method 'SENDTASKDESCRIPTION' object type 'SELFITEM'. I tried so  many ways like no attachments,send express ,siganture,encryption all disabled but still the same error from user outbox who ever rejects it.
    Regards,
    Madhu.

    Hi Madhu,
    This exception is raised means you have checked the Signature check-box  and encrypt check box.
    Now you have unchecked that the issue should be solved , but if it is still giving the same exception synchronize your run time buffer using the t-code SWU_OBUF .
    Let me know if the issue is still there.
    Regards
    Bikas

  • Assigning Filter Object Type for Internal Order

    Hi All,
    I have a requirement to send a INTERNAL_ORDER IDOC to another system on creation or on change of an order. I have created the model view and added the BAPI InternalOrder.SaveReplica in the distribution model (BD64) and the next step was for me to add a filter. I tried creating a filter group but then I get the message "Select node:Content-dependent parameter filtering". I have done a similar configuration for PROJECT idoc before and I was able to solve this by configuring in BD95 - Defining the filter object type and then BD81 - Assigning the filter object type to the parameter. However now when I try and implement the same steps for the Internal Order IDOC, I am having trouble assigning a filter object type to a parameter. I want to filter by company code and so far I was able to define the filter object type (BUKRS) in BD95 and then when I go on to try and assign this to the BAPI Parameter in BD81 , only 1 parameter appears (objectstatus) when I drop down for the parameter options.
    The row entry that I am trying to add is:
    Obj. Type
    Method
    Filter object type
    Parameter
    Field Name
    BUS2075
    SAVEREPLICA
    BUKRS
    MASTERDATA
    COMP_CODE
    But only OBJECTSTATUS appears in the Parameter block as an option when I press F4.
    Further more when I try save the entry as above, I get an error. Error Message: "Entry MASTERDATA does not exist in (check entry)"
    Can I please get some guidance on how to filter the internal order by company code or more importantly advise on which step I may have skipped in order have “MASTERDATA” appear as an option for Parameter field in BD81.
    Thank you.

    Hi,
    I need to pass object key or object type to a function module 'SAP_WAPI_WORKITEMS_TO_OBJECT'. This function module returns the worklist details(workflow inbox). In worklist details i need to use the field for workitem id.
    Regards,
    Gautham

  • How to debug method of object of worklfow in background

    Hi guys,
    Is it possible to debug method of object of workflow which is set in background?
    Thanks!

    Hi
    Refer to link below
    Re: Debug workflow task
    Hope it will help you.
    Regards
    Natasha Garg

  • Hi How do we create Methods inside the Business objects of Z

    Hi Abapers,
                        How do we create Methods inside the Business objects (z objects) and how *** an import parameter or export parameter  to be defined for the new Methods.
    Regards
    Bhaskar Rao.M

    Hi Bhaskar,
    that ´s not difficult.
    Open your Bus.Obj. in SWO1 with CHANGE/EDIT
    Click on the "Methods" header line and then use the button for "Create".
    If you want to add the method on basis of a function module, choose next in the next pop up. Then the system will offer you the ex/import parameter from the function module. So this is a really simple way.
    If you don´t have a FM, it is a little bit more difficult.
    Choose No on the quetion about a FM, fill in the next pop up  methode name (no blanks allowed).
    Dialogue is for user related method (call screen...) synchronous for methods which have to give back a result directly in to the workflow.
    After completing the screen the method will be displayed as new method at the end of method list. Now add parameters (first click on the method name, then choose parameter button, same functionality to add program to the method).
    Programm:
    Code snip:
    BEGIN_METHOD ZWFCHECKMIRO CHANGING CONTAINER.
    DATA:
          ZBELNR TYPE RBKP-BELNR,
          ZGJAHR TYPE RBKP-GJAHR,
          RESULT TYPE HRP1001-ISTAT,
          BELNR TYPE BKPF-BELNR,
          GJAHR TYPE BKPF-GJAHR,
          BUKRS TYPE BKPF-BUKRS.
    to import parameter
      SWC_GET_ELEMENT CONTAINER 'Zbelnr' ZBELNR.
      SWC_GET_ELEMENT CONTAINER 'Zgjahr' ZGJAHR.
    *(or SWC_GET_TABLE)
    here add the functionality of your method!
    to export parameter
    SWC_SET_ELEMENT CONTAINER 'Result' RESULT.
      SWC_SET_ELEMENT CONTAINER 'Belnr' BELNR.
    *(or SWC_SET_TABLE)
    !!! Important: naming convention!!! Use same writing of parameter names in
    PARAM area (button PARAMETER) and here in code.
    To use your method, change it to implemented after adding your code.
    -> Edit -> Change release status -> object type component -> into implemented
    (Sorry , have a german screen here, possibly terms are a little bit different.
    Hope this helps a little bit.!
    regards
    Dirk

  • Workflow with Object Type LFA1

    Dear Workflow Gurus,
    My business scenario is as follows:
    1. User will create the Vendor Master
    2. Workflow will be triggered to the Manager so that he can check it (Display only)
    Basically, I created a workflow with the following:
    Start Event - BO LFA1 CREATED
    Task - BO LFA1 DISPLAY
    I have tested my workflow at SWDD and SWUE. It is working fine and I get the notification in my SBWP. I can then double click/execute the item in my SBWP Inbox and it will take me to XK03 (Working Perfectly). However, in a real time scenario, when I create a Vendor Master via either FK01, MK01 or XK01, I dont get any notification in my SBWP. Im puzzled as the test at SWDD and SWUE was a success.
    Im wondering whether Im using the correct Object Type and Method for my START EVENT - BO LFA1 CREATED. Please take note that everything is Active, has been binded and I have assigned (Import checkbox) LFA1 in my Workflow Container
    Please advise.

    Hi,
    It looks no event is created from FK01, MK01 or XK01.
    Please activate the workflow event trace and check the event.
    Regards,
    Masa

  • How to access Business object type attribute from a method/function modul ?

    Hello,
    i have created a business object type object along with attributes and methods. Now inside the method i want to access the attributes. inside the method i am writing:
    data a type XXX.
    a = me->attribute
    this is creating a compilation error.
    Now the method is defined as a function module in some package, so can anyone inform me how to access object attributes from the function module ?
    pointes are awarded
    Regards

    Hello,
    thanks for your answer, but this too did not work, "=>" is for static attributes and the attributes i have are not static. Moreover, i tried it but it gave the same error :
    the abap error was when i was checking the code is :
    the type me=>documenttype is unknown
    as you know in SWO1 i created an object and when i create a method you link it to a function module and this is where you have the implementation of the method, so from this method how can i access the attributes on the main object that i created in SWO1
    regards

  • Workflow - Create a new buisness object type for an new infotype.

    Hi all,
    I have an issue with creating a new buisness object type, which is related to a
    supertype, for an new infotype.
    I am new to workflow and business object. I don't have much knowledge in these area. I need to resolve this problem ASAP.
    Could someone please provide me a step-by-step guide on how to create a new business object type, which is related to an existing supertype, for an newly created infotype?
    If would be very much appreciated if someone could assist me in resolving this issue.
    Thank You.

    Business objects are maintained in SWO1 creating a subtype is done with the button: Create subtype (F9)
    If you don't have knowledge of workflow or abap objects, it is perhaps better to tell your employer that and find someone who has.
    If your problem is simply only creating a subtype then go with the instructions I already gave you, if however more things need to be done, like extending the subtype with (virtual)attributes, methods, events, delegating the subtype and implementing the methods in newly created tasks and subsequently workflows I really advise to find someone who can do this, or attend a SAP course on this subject.
    Kind regards, Rob Dielemans

  • Method 'PROCESS' is not defined for object type 'BUS2081'

    Hi All,
    I am using a workflow for incoming invoice approval using WS20001004. I prepared one version for this. The standard business methos bus2081 i delegated to zbus2081. Here i placed one decision step for reject or approve. In the same task in inbox i can see the document i can see as attachment. Now the issue is after seeing the attachment when i click on task in  my inbox it status is changed to red and i can  not process it further.In log i can see the error like Method 'PROCESS' is not defined for object type 'BUS2081'. This method i do not have in standard or in delegated one. I was struck here. Pleas help in this.
    Regards,
    Madhu.

    Hi,
    "Here i placed one decision step for reject or approve." if your workitem is based on standard user decision step type of workflow, then the business object in underlying task should be 'DECISION' and method should be 'PROCESS'. I think in the task you have put your custom business object instead of business object 'DECISION'. This could be the reason you are facing error.
    Regards,
    Ibrahim

  • Declare object type inside the package

    Hi,
    How can I declare an object type inside the package?
    CREATE TYPE TempObj AS OBJECT (
    user_id number,
    text varchar2(4000),
    date_created DATE
    This will not work if placed inside this:
    CREATE OR REPLACE PACKAGE SAMPLE_PKG IS
    ---declaration goes here.
    END SAMPLE_PKG;
    I tried using the type RECORD and it worked. But I am just curious how to declare an Object. Or maybe RECORD is the replacement of Object? is this correct?
    thanks,
    Baldwin

    The inside of a PL/SQL package should contain PL/SQL statements.
    CREATE TYPE is not a PL/SQL statement. You can't create a table in package either.
    If data protection is the reason that you would rather create the type inside the package, then consider using a record type as you suggested, or hiding the SQL type in a more protected schema.
    Message was edited by:
    jonjac

  • Member function and member procedure inside an object type in Oracle.

    Hi All,
    Please do have a look at these codes and help me understand. I have no idea about this member function and member procedure. How do they work? Please explain me about this.
    Regards,
    BS2012
    create type foo_type as object (
      foo number,
      member procedure proc(p in number),
      member function  func(p in number) return number
    create type body foo_type as
      member procedure proc(p in number) is begin
        foo := p*2;
      end proc;
      member function func(p in number) return number is begin
        return foo/p;
      end func;
    end;
    /

    Methods are just like functions or procedures in a package, except they're not in a package, their part of an object type.
    The object has attributes (which are the variables declared in it).
    To use such an object you would do things like this...
    SQL> set serverout on
    SQL>
    SQL> declare
      2    v_foo foo_type;
      3    v_val number;
      4  begin
      5    v_foo := foo_type(20); -- instantiate the object and initialize the object attributes
      6    v_foo.proc(20); -- call the object method (proc)
      7    v_val := v_foo.func(4); -- call the object method (func)
      8    dbms_output.put_line(v_val);
      9  end;
    10  /
    10
    PL/SQL procedure successfully completed.The Type definition you've declared creates the object class, but not actually an object itself.
    To actually have an object you need to declare a variable of that object class type, and then instantiate it. When you instantiate the object you need to initialize all the attributes (generally you can pass null if required for each of them to initialize them).
    Once you have your object instantiated, you can call the methods within that object as demonstrated above, a bit like calling functions and procedures in a package, except they are methods within the object type itself, and therefore called directly by referencing them from the variable.
    The documentation goes into a lot more detail of objects if you look it up.

  • Passing Ref Cursor as parameter to object type method

    I am encountering a problem passing a parameter of type REF CURSOR to methods of a set of object types I am developing.
    Here is an example of what I am trying to do:
    create or replace package p1 as
    type c_Cursor is ref cursor;
    end p1;
    create or replace type t_Object as object
    not instantiable method m1(p_Cursor in p1.c_Cursor) return varchar2
    ) not instantiable not final;
    create or replace type t_Subtype under t_Object as
    overriding method m1(p_Cursor in p1.c_Cursor)
    return varchar2
    The problem is that the PL/SQL compiler gives the error message PLS-00201 "p1.c_Cursor" not defined.
    According to my PL/SQL book (SF's Oracle PL/SQL Programming) the only way to use a ref cursor as a parameter to functions/procedures is to wrap them in a package. Indeed I have developed a test procedure in a different package that uses p1.c_Cursor as a parameter and it works fine.
    Oracle's documemtation suggests that object security (roles etc) can cause this error but as all the objects are being created in the same schema I don't see how this should be a problem.
    If anyone can suggest how to get around this problem I will be very grateful.
    BTW, if there are any mistakes in my sample code it's because I am writing it from memory as I don't have Internet access at work.
    Thanks,
    Charles.

    Thanks for your reply. I am still baffled as to why it doesn't work but, as you correctly point out, SYS_REFCURSOR works just fine. I figured that out earlier today and now the problem is solved.
    Charles.

  • Where to include custo object types in workflow events?

    Hi All,
    One of my friend is working on HR related Workflow. He has a question about where to include the custom change document infotypes in workflow events.
    To make it clear, he says there are three transactions swehr1, swehr2 and swehr3. Now, if he wants to include a custom object (Z object) which transaction should he use?
    Please reply ASAP.
    Regards
    Swapna.

    Yes, you use swehr1 to link the infotype to the object type. Then use swehr3 to create the event linkage to your function module or object type event.
    I just did this with an e-recruiting project and it worked fine.  For example:
    swehr1 entry:
    NB  Requisition     5131  Persons Responsible    ZERC_REQUI     Job Requisition
    swehr3 entry:
    NB  Requisition     5131  Persons Responsible   INS     0     ZERC_REQUI             Z_ON_MEMBER_ADD
    This accomplishes the following: when a record is inserted for infotype 5131, the function module Z_ON_MEMBER_ADD runs. That function module decides if or which event should be raised. Alternatively I could have entered an event for the ZERC_REQUI object type, but then the event will always be raised on a 5131 record insertion, and for my application I didn't want that.
    I hope this example is helpful.
    ~Margaret

  • Object type for Proxy for sending Notifcation Workflow

    Hi
    Object type for Proxy for sending Notifcation Workflow.
    Early reply is highely appriciable.
    Thanks,
    Naidu.

    Could you make your post more cryptic? There were still some things I could understand.
    Perhaps you should take a look at the forum guidelines and especially at the part on asking a question. you can find the forum guidelines through the sticky thread at the top of this forum or through the Community Guidelines which you can find on the left side of your screen.
    Regards,
    Martin

Maybe you are looking for