Current Agent Value in Program Exit Workflow

Hi Gurus,
we are using program exit to send mail to outlook on user decsion step and it is working fine for Sequential approval but when we have to send mail for parallel approval(have used block for parallel approval) we are not able to fetch current agent.
- Have store agent in workflow container 'Agent' and used it in Block in workflow for implementing parallel appoaval.
- Created class implementing inetrface IF_SWF_IFS_WORKITEM_EXIT and put it under program exit of user decsion in workflow
- Now in this class I have created method at work item created to trigger email for which i require runtime work item id and agent for it.
- We are getting workitem id at runtime and based on it picking up approval agent from workflow container and send mail to it.
- this workfs fine for sequential one as there is only one approver at a time but in parallel where all approver are maintained in one multiline container, it is sending mail to first person maintained in multiline container.
Please find steps below what i have tried:-
- i tried with  FM RH_USERS_OF_WI_READ to get current agent for particular work item id  but it is throwing dump no value found at   runtime but stangely gives value if we run standalone for same work item id.
- Then,  I tried putting wait upto to see if it helps, but then also above fm is unable to fetch agent.
- Tried by putting select on   SWWUSERWI table but that also is not giving current agent
Question is:
Why we are not able to get value of current agent through above FM or select from userwi table? How do we get current agent value at the time of work item creation event is triggered which further hits our custom method.
Please help...
Regards
Ajit C

Hi Ajit,
Here you go.
You must be having a multiline container (probably of type WFSYST-AGENT) in your workflow which holds all the user ids to whom work item must be going parellely. e.g if the multiline container name is AGENT.
The current agent from that multiline container is referred by &AGENT[_AGENT_line_]&. This you must hast have put in your user decision step/activity as an agent also.
Now in your user decision step/activity, create one single line container element of type WFSYST-AGENT e.g. current_agent. in workflow to task binding, bind &AGENT[_AGENT_line_]& to CURRENT_AGENT. This way you will have current agent in that task container.
Finally use function module SAP_WAPI_READ_CONTAINER using WORKITEM id to read the value of CURRENT_AGENT in your program exit.
Regards,
Ibrahim

Similar Messages

  • Current filter values in Customer Exit variables

    Hi!
    I have a pretty hard question here that I would be impressed if someone has an answer to:
    The scenario is:
    I have a customer exit variable that should de dependent on the current filter setting in the query. Is it possible from within the customer exit code get information about the current filter(s)?
    I know that I can access other variables values, but in this case I would like to know which values that has been filtered on within BEx (after the popup screen).
    Regards
    Marty

    You asked for:
    1. In the field I_S_RKB1D-COMPUID (or GENUNIID I'm not quite sure) you get the internal query name.
    2. Look in RSZELTXREF with SELTUID = I_S_RKB1D-COMPUID.
    3. The filter values have LATYP = FIX (if they are in the filter box).
    4. Search table RSZRANGE with ELTUID = RSZELTXREF-TELTUID.
    5. Don't wonder if this doesn't work anymore after an upgrade
    Best regards
    Dirk

  • How to pass value standard program to Workflow after than to call Transaction

    Hi Experts..
        While We are Cancel any PO in Me29n, it will Pass values(Like reason for cancel With PO No) and Send a mail (User name whose reject the cancel against Release of PO No) in workflow inbox(workplace) After than getting a mail any particular User, they will See the Message of  Purchase  order against  Canceled. After then they will double click on that message it will trigger ME29N Tcode with the particular PO.
            Using with Badi in Me29N we have to Passed  Values and sent a Mail in work place but When  Double click on Message I Dont Know HOw to Call ME29N in work place....
         Cancel Po in Me29N-->WORK PLACE --> Double click on message,will call ME29N
       So, please help me how to i can Rectified this.
    Regards,
    kumar

    hi Kumar
    BUS2012 is a business object, see it in tcode SWO1.
    You can try blow code:
    INCLUDE <CNTN01>.
    DATA: OBJ TYPE SWC_OBJECT.
    DATA: PO_ITEMS TYPE TABLE OF BAPIEKPOC.
    DATA: PURCHASEORDER     TYPE     BAPIEKKO-PO_NUMBER VALUE '4500000004'.
    SWC_CONTAINER CONTAINER.
    SWC_CREATE_OBJECT OBJ 'BUS2012' ''.
    SWC_CREATE_CONTAINER CONTAINER.
    SWC_SET_ELEMENT CONTAINER 'NotificationType' 'S1'.
    SWC_SET_ELEMENT CONTAINER 'PurchaseOrder' PURCHASEORDER.
    SWC_CALL_METHOD OBJ 'Display' CONTAINER.  " call method 'Display' show ME29N.
    Infact, you can achieve all your requirment in workflow, don`t need implement BADI.
    The trigger event is event 'rejection_start' in BUS2012. Create a user decision(which will show in workplace) and create a task bounding the 'Display' method of BUS2012.
    There are so many detail content in scn or wiki. thanks.
    hope can help you.
    Regards,
    Archer

  • Doubt in Workflows using Programming Exits on OO ABAP

    I have a doubt on workflows:-
    Let me brief you about my requirement:
    I am trying to update some Master data using ABAP Methods through Programming Exits in a Workflow.
    I managed to find an OO method that can fetch the workflow container values directly into the structure.
    While testing the workflow:-
    The OO ABAP method executes and successfully updates the master tables.
    However, a calling method (that triggers this method indirectly), raises an exception called SWF_RUN_WIM_EXEC_INTERRUPTED.  
    The exception is caught within the caller method and the workflow errors saying that “the method ABC… cannot be executed.”
    The caller method is:-
    CL_SWF_RUN_WORKFLOW_START
    The exception is raised on execution of the following statement:-
    CALL METHOD me->start_workitem( lh_wi_handle ).
    One reason for this is that the workflow is still not completed and still in “READY” state.
    Alternative method
    Once the Master data is updated successfully,
    I tried to use the FM SAP_WAPI_WORKITEM_COMPLETE to end the work item or tried another FM to suspend the workflow.
    Now it gives an error saying that these FMs are restricted from use during run-time execution.
    Query
    Do you have an idea why the exception is raised and how to track/prevent the same?
    Can you suggest any other alternative?  Your valuable advice is urgently needed.
    Thanks a million in advance,
    Best Regards,
    Vinod

    Check the code
          CLASS zcl_event_handler IMPLEMENTATION
    CLASS zcl_event_handler IMPLEMENTATION.
    Top-of-page event
      METHOD top_of_page.
        PERFORM event_top_of_page
                USING z_dyndoc_id.
      ENDMETHOD.   "METHOD top_of_page
    Change Status Button
      METHOD handle_toolbar.
        IF NOT pa_prodr IS INITIAL.
          DATA: lz_toolbar  TYPE stb_button.
          CLEAR lz_toolbar.
          MOVE    'CHANGE_STATUS'  TO lz_toolbar-function.
          MOVE    text-001         TO lz_toolbar-text.
          APPEND  lz_toolbar       TO e_object->mt_toolbar.
        ENDIF.          "IF NOT pa_prodr IS INITIAL
      ENDMETHOD.   "METHOD handle_toolbar
    Handle User Command
      METHOD handle_user_command.
        CASE e_ucomm.
          WHEN 'CHANGE_STATUS'.
            LOOP AT    it_output
                 INTO  wa_output.
              IF wa_output-chk_box EQ kc_x.
                z_flag = 1.
                EXIT.
              ENDIF.          "IF wa_output-chk_box EQ kc_x
            ENDLOOP.      "LOOP AT it_output INTO  wa_output
            IF z_flag EQ 1.
              PERFORM display_selected_data.
            ELSE.
              MESSAGE i001(zzrefn01)
                      WITH text-023.
            ENDIF.       "IF z_flag EQ 1
        ENDCASE.      "CASE e_ucomm
      ENDMETHOD.   "METHOD handle_user_command
    ENDCLASS.   "zcl_event_handler IMPLEMENTATION

  • Has anyone implemented Program exits in Workflow?

    hi all,
    i know we can capture workflow container values in the program exits.
    but i need to manipulate/change the container values and pass the new container values back to the task from the class.
    so how should i implement the binding and the class.
    thanks,
    Subba

    for this you will have to create a dummy method of a class and use the macros from <cntn01> to modify the contents. Probably you know this.
    Note that only the variables created in workflow , that are not default can be set as export parameters.
    get the required parameters as import parameters and export parameters of the method you create. Create a task out of that and insert it in the workflow definition.
    Write logic inside the method such that... only if required, modify the contents else pass the same to export.. so that net effect is nil.
    This is one method of creating program exits.
    another method is what you are asking
    add the class, shd have the interface IF_SWF_IFS_WORKITEM_EXIT  in its definition.
    Define its methods.
    By default the task container will be available for the class to operate on. they will be public. so you can reference them in your method.
    regards,
    Sandeep Josyula
    *Mark helpful answers

  • Import workflow container element to program exits

    Hi Friends
    Can you please let me know if we can import container elements from workflow to program exits in step?
    Regards
    Rajeev

    Hi Rajeev,
    Yes you can import container elements from the workitem (not the workflow) to the program exit. You need an element which references the container (if_swf_ifs_parameter_container). You probably have an attribute in you class which is a reference to IF_WAPI_WORKITEM_CONTEXT called M_CTX. This has a method called get_wi_container which will give you the workitem container. Now you not only have the option to read elements with method get in your container class, but there is also a method set which will allow you to fill or change values in the container.
    Regards,
    Martin

  • How to debug a program exit in a Workflow ?

    Hi experts,
                      How to debug a program exit in a workflow when the workflow is triggered ?
    thanks in advance
    regards
    Ashwin

    In 4.6c I did this by creating a function module and a table (zsm50_debug). In the table are just two fields: User name (key), and a flag (yes/no).
    The function module:
    FUNCTION zsm50_debug.
    *"*"Local interface:
    *"  IMPORTING
    *"     REFERENCE(Z_DEBUG_USER) LIKE  SY-UNAME
      DATA: z_exit,
            z_debug.
      CLEAR: z_debug.
      DATA: starttime   TYPE t,
            currenttime TYPE t,
            time_passed TYPE i.
      starttime = sy-uzeit.
    * Check if debugging is switched on
      SELECT SINGLE debug FROM  zsm50_debug
                          INTO  z_debug
                          WHERE uname = z_debug_user.
    * Debugging is switched on:
      IF z_debug = 'X'.
    *   Not an endless loop, but it will continue after approx. 1 minute...
    *   Plenty of time to go to SM50 to debug the program and continue!
        DO.
    *     Change the value of z_exit to 'X' to exit the loop an stay in
    *     debug mode.
          IF z_exit = 'X'.
            EXIT.
          ENDIF.
    *     To prevent an endless loop (if the user forgot that debugging was
    *     switched on in ZSM50_DEBUG, time is measured to allow the program
    *     to continue after 2 minutes
          GET TIME FIELD currenttime.
          time_passed = currenttime - starttime.
          IF time_passed > 120.
            WRITE: / '!!!==========================================!!!'.
            WRITE: / '!!!DEBUGGING STILL SWITCHED ON IN ZSM50_DEBUG!!!'.
            WRITE: / '!!!    Program was delayed by two minutes    !!!'.
            WRITE: / '!!!==========================================!!!'.
            EXIT.
          ENDIF.
        ENDDO.
      ENDIF.
    ENDFUNCTION.
    This FM reads the table and checks if the flag is switched on. If so, it loops for two minutes. After that, it continues regardless. If not flagged, it continues immediately.
    This way, you can debug any program that is running in the background.
    In every method I program I add this FM right in the beginning. With authorization for SM50, I can then debug the program (in production it may be difficult to get the correct server, if there are more).

  • How to get the current month value for a customer exit variable?

    How to get the current month value for a customer exit variable? 
    And also if we have an InfoObject with date value (including date, month, year), then how to derive the month value from this date type of Char.?
    Thanks!

    Hi Kevin,
    Check here........
    Re: Customer Exist for "From Current Date To Month End"
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/25d98cf6-0d01-0010-0e9b-edcd4597335a
    Cal month
    Regards,
    Vijay.

  • Whether Workflow Program Exit works in ABAP WebDynpro

    Hi,
    I have the custom  workflow in which in each task i have given a program exit to update the status into my custom tables.
    Now i'm in doing the change in workflow, that it should call the abap webdynpro screen, where the user decisions has to be made.
    I'm getting the Workitem id from the UWL and then it lauches the Web Dynpro to choose either Approve, Reject or Change etc along with some other travel expense information.
    Now once i complete the web dynpro by calling the method 'SAP_WAPI_WORKITEM_COMPLETE', the particular work item is completed.
    I want to ask whether before this FM is called,whether the Program Exit which i have written in the Class method and which is called in the Workflow, whether it triggers or not?
    Regards,

    It is calling the workflow program exit before the SAP_WAPI_WORKITEM_COMPLETE function module.
    So closing the thread.

  • Retrieve workflow container data in programming exit

    I am trying to use a programming exit in Workflow in order to amend the task container for the receipients field of a "Send Email" step. The reason why we are not determining the receipients in the usual way is because we hold the receipients (amongst other data) in a separate Z* table - this needs to stay this way.
    I created a class and copied method CHANGE_CONT_ELEMENT to base my altered code on. The method is triggered fine when testing the workflow. Here is what it now looks like:
    method CHANGE_CONT_ELEMENT .
      DATA: container TYPE REF TO if_swf_cnt_container,
            if_swf_cnt_container,
            cont TYPE REF TO IF_SWF_IFS_PARAMETER_CONTAINER,
            name TYPE swfdname,
            lh_wihandle TYPE REF TO if_swf_run_wim_internal,
            l_exception TYPE REF TO cx_swf_cnt_container,
            l_wiid TYPE sww_wiid,
            w_container type ref to IF_SWF_IFS_PARAMETER_CONTAINER,
            w_names type SWFDNAMTAB,
            wa_names type line of SWFDNAMTAB,
            w_value(30).
      w_container = me->m_ctx->GET_WI_CONTAINER( ).
      w_names = w_container->LIST_NAMES( ).
    data: w_name type SWFDNAME.
    w_name = 'TEST-NUMBER'.
    TRY.
      loop at w_names into wa_names.
        CALL METHOD w_container->get
         EXPORTING
          name       = wa_names.
      endloop.
    CATCH CX_SWF_CNT_ELEM_NOT_FOUND .
    CATCH CX_SWF_CNT_ELEM_TYPE_CONFLICT .
    CATCH CX_SWF_CNT_UNIT_TYPE_CONFLICT .
    CATCH CX_SWF_CNT_CONTAINER .
    ENDTRY.
    ENDMETHOD.
    Now w_names retrieves the names of the fields fine (including my "TEST" entry which I declared in the Workflow Builder), but the GET method causes a "CX_SWF_CNT_ELEM_NOT_FOUND" exception.
    Is this the correct way to retrieve data out of a Workflow container within a WF programming exit? What am I doing wrong?
    Kind regards,
    Michael Koch

    Hi Michael, Paolo & Other experts,
    I am trying to understand when, why and how to use a 'programming exit' in a SAP workflow.
    (1) Did you figure out the solution to your problem?
    (2) Is there any material / tutorial on use of a  'programming exit' in a workflow?
    Thanks
    Abaper

  • Why customer exit variable to grab the current month value doesn't work?

    In CMOD, input the following code to grab the current month value from the system date:
    Grab the month value with System Date
    WHEN 'CURMONTH'.
        CLEAR l_s_range.
        l_s_range-low = SY-DATUM+4(2).
        l_s_range-sign = 'I'.
        l_s_range-opt = 'EQ'.
        APPEND l_s_range TO e_t_range.
    In Query Designer, create a formula variable CURMONTH processed by customer exit and the dimension under the Currency/Unit tab is "Number".  Put the formular variable in the column as a KF.  When running the query, the column with the formular variable shows values of "2,0000000" other than just "2" I want for the current month.  If  the dimension under the Currency/Unit tab is "date", the column with the formular variable shows values of "00/00/0000".  Any idea?  How to grab the correct current month value which is 2 from the system date.
    Thanks!

    Oh ok , try the below options, As such I dont see any errors in our code .
    Not sure if you have ABAPER's in your team, just check with them once on the FM we are trying to see .
    Next , do you hvae 0CALDAY available in your report ? If so try to restrict that field with variable "0DAT" and write the same code you have written for your formula variable , but instead change the variable name to "0DAT" and try if this gets the month . let me know if I'm not clear .

  • How do the Program exits in Workflow  work?

    hi all,
    there is a Program Exit available in Workflow tasks...and it says
    You can execute additional methods that you have programmed when predefined events occur. Add the ABAP classes that contain these methods. The ABAP classes added must support the IF_SWF_IFS_WORKITEM_EXIT interface.
    now i want to use this program exits in my workflow...so that this program exit(which is basically a class) will take input from Workflow container and gives back processed data <b>back to workflow</b>.
    so how to go about with these Program exits.
    thanks,
    subba

    hi
    good
    go throgh this links
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/82d03e23-0a01-0010-b482-dccfe1c877c4
    http://help.sap.com/saphelp_nw04/helpdata/en/1a/6b023c3f6aaf08e10000000a11402f/content.htm
    thanks
    mrutyun^

  • Program exited with status value:101

    Hi,
    Please somebody help me.
    I'm developing an application, in which I implemented maps, UIImagePicker, and used Sqlite3 for database.
    My application gets terminated when I run it on iphone(no problem on simulator) with the following message:
    Program exited with status value:101.
    This happens randomly mostly after opening map 8-9 times or after accessing database for about 40-50 times.
    I observed the memory allocation and leaks, there is no leak and when application terminate the net memory allocation is between 2.5Mb - 6Mb.

    Use the activity monitor instrument (or memory monitor) on the device to find out the real sizes and the amount of memory available.
    101 is usually memory problem.

  • UIWebView cause "Program exited with status value:101"

    My application uses both imagepickercontroller and UIWebView as subviews. it crashes frequently, I guessed the reason was related to imagepickercontroller at first, but after doing more testing , I found it is UIWebView cause crash and exit silently problem with message in console "Program exited with status value:101". I tried to write a simple test app which contains only a window and an UIWebView as subview to load pages with javascripts like maps.google.com, it exit silently always after opening such pages after a while. I also tested UICatalog on iPhone, get the same result. any ideas on this issues??

    Error 101 means iPhone runs out of Memory and ends your application.
    Set a breakpoint to the "applicationDidReceiveMemoryWarning" function or however it is called exactly.
    Also if you check object allocations and leaks with instruments you should be able to see a big memory footprint of your application.

  • Program Exit for Travel Expense approval workflow

    Dear Experts,
    When a travel expense request is raised from the portal, the requester can attach certain documents like Files, notes to the same  for the approver to see.
    But when the approver sees the request in his UWL, he is not able to see the documents that the requester attached while creating the request.
    I used a Program Exit for the same to happen, which creates a custom Event of a Custom BO, which in turn is attached to a standard task, that calls a method of an ABAP Class, that in turn attaches the document for that particular Employee and trip number.
    But I am not able to View the document in the UWL.
    Am I missing anything?
    Please help..
    Note: I reffered the following document (which was very helpful):
    http://scn.sap.com/docs/DOC-29492

    Try changing the behavior of the uwl when calling a SAP GUI from the default ITS to WIN GUI since you can't display documents on ITS:
    Content Administration->Portal Content->Portal Users->Standard Portal Users->Universal Worklist->UWL - Launch SAP Transaction
    Under Property Category choose Content - Transaction. Set the property SAP GUI Type to SAP GUI for Windows.

Maybe you are looking for