Workitem in Method

Hi Experts,
How i can get the current Workitem Id and Workitem Text in my method.
I am able to get the Main Workflow id in my Method.
Through this Main Workflow id i can get the current Workitem Id using FM or through tables.
Is there any other way to get the Workitem Id ?
Using SWC_GET_ELEMENT statements in my method.
I am using swc_get_element container '_Workitem.WorkitemId' l_wi_id.
swc_get_element container '_Workitem.WorkitemShortText' l_wi_text.
But this is not working Please suggest.
Thanks in Advance....

Hi,
Use the interface "IF_WAPI_WORKITEM_CONTEXT" to get details of the workitem instead.
Hope this helps.
Best Regards,
Saujanya

Similar Messages

  • Methods of Workitem execute twice

    hello experts,
    in my workitem (activity  methods Tab), before work item execution there is a method to  display image, after the work item execution there is a method to close window.
    after our systerm imported new support packages,the methods execute twice. i can not find the reason and solution.
    i guess there is an inconsistent in systerm's time zone management, which is causing the time to execute display image and window close methods before workitem creation time.
    please give me your suggestions?
    Thanks in advance!

    What's worse is that it seems now your messages have started posting thrice
    Just a small note to remind you that version can be important, especially in this case where you have a problem related to packages. So you should include version information (release, support package level) in your description of the problem.
    Sorry I can't be of more help with respect to the problem itself.

  • How to replicate contents of a folder

    We have a folder(nt:folder) containing images. We would like to replicate all the images to the publish environment. I have tried the following implementation but it only replicates the folder  without the content. Is there any way to replicate the content at the same time without iterating through each node?
    Currently using CQ5.4
    Thank you.
            String agentId="someAgent";
            String folderPath="/content/dam/images/someFolder";
            ReplicationOptions opts = new ReplicationOptions();
            AgentIdFilter filter = new AgentIdFilter(agentId);
            opts.setFilter(filter);
            Replicator replicator = sling.getService(Replicator.class);
            replicator.replicate(mySession, ReplicationActionType.ACTIVATE, folderPath, opts);

    Hi,    
        You need to repicate notes recursively instead of just root path. Can you try something like this:
    public void recursiveReplication(Session session, String path, BufferedWriter out,
                WorkItem workItem) throws IOException,Exception{ 
            doReplicate(session, path,out,workItem);           // Calling method to replicate
            Resource res = resolver.getResource(path);
            Iterator<Resource> iter = resolver.listChildren(res);
            while (iter.hasNext()) {
                Resource tempResource=iter.next();
                String temp=tempResource.getPath();
                //checking for hierarchyNode
                Node node = tempResource.adaptTo(Node.class);
                      if (!node.isNodeType("nt:hierarchyNode")){
                          continue;
                      else
                         recursiveReplication(session, temp,out,workItem);
        }// end of recursiveReplication()mthd
        public void doReplicate(Session session, String path,BufferedWriter out,
                WorkItem workItem) throws IOException,Exception{
            try {          
                //Code related to the replicate...           
            } catch (ReplicationException e) {
        }// end of doReplicate()mthd
    Hope it helps..
    Thanks
    Siva

  • Workflow in process status when work is completed and returned to inbox

    Issue...
    Once upgraded to ECC 5.0, our Workflows are still in process status after completing the work item and returning to inbox. Takes several seconds to go to completed status.
    More detail...
    In a number of our work items in custom workflows we utilize methods that display a custom transaction for review & approval in the workflow process. From within the custom transaction we issue the terminating event for the work item by means of Function Module "SAP_WAPI_CREATE_EVENT" once the user approves or disapproves the work item.
    This worked all very well in Rel. 4.6c. By the time the users were routed back to their inbox the work item had disappeared.
    We recently upgraded to ECC 5.0 and experience the following problem. Once the user has left the work item and are back in their inbox, the work item is still on display. It eventually goes away once the users refresh their screen after a few seconds. This is very confusing to the users and some of them even wanting to start executing the same item again....
    I was wondering if anybody has any ideas on how the completion/termination of the work item could be changed so that it completes faster and is gone from the inbox immediately.
    In our research we did come across OSS note 831443, which explains as of release 6.20 that work items will be locked while executing a method and that the terminating event can only be delivered once it is unlocked. Taking this into consideration, we tried moving the terminating event to the end of the method within the business object program, but the work item never completed, even after refreshing the inbox.
    Thank you for any feedback.

    Hello Tom,
    I've had quite a similar problem with the terminating event in a dialog while the workitem is locked.
    I came across the same SAPNote 831443, but it doesn't seem to tell the whole story there. As I found out, the status change (from "in work" to "complete") is just skipped over, while the workflow continues with processing, leaving a last workitem "in work" hanging out to dry when the whole process has already finished.
    Basically the problem is, or was, that a popup dialog was shown to the user after the processed the transaction, which held the lock open. I have found no logs, saying that there was a problem with a locked workitem, anyhow.
    At last I have found out, that basically there shouldn't be much coding between the <b>COMMIT WORK</b> statement and the coding that just ends the method with <b>END METHOD</b>. This kind of procedure does definitly apply to the newer Versions, as I didn't have any problems like this before. Mayhaps and only a guess is, that the unlock-operation was previously registered with a perform like PERFORM unlock_workitem ON COMMIT. or something similar. This defenitly has changed under the new releases.
    In your specific case I would recommend to register the event processing in the update task and end the workitem's method as soon, as possible. For example:
    CALL FUNCTION 'SWE_EVENT_CREATE' IN UPDATE TASK   ...
    If this still does not help, you could further disjoin the transaction processing from the event creation by adding
    STARTING NEW TASK
    IN BACKGROUND MODE
    or whatever the correct syntax was here. This will schedule another tRFC on the database commit, which then is defenitly be picked up by another work process of the application server, just right -- hopefully -- after the object's method has completed.
    If you're feeling good with this answers, or it least it gave you new ideas to look upon, please assign points as appropriate.
    Best wishes,
    Florin

  • Reprocess - Workflow in process status

    Hi All,
    I am working with Workflow support,
    I don't know How to reprocess Workflow with the status is IN process.
    I know TC SWPR is a reprocess with error status.
    Thanks & regards
    Subramani.

    Hello Tom,
    I've had quite a similar problem with the terminating event in a dialog while the workitem is locked.
    I came across the same SAPNote 831443, but it doesn't seem to tell the whole story there. As I found out, the status change (from "in work" to "complete") is just skipped over, while the workflow continues with processing, leaving a last workitem "in work" hanging out to dry when the whole process has already finished.
    Basically the problem is, or was, that a popup dialog was shown to the user after the processed the transaction, which held the lock open. I have found no logs, saying that there was a problem with a locked workitem, anyhow.
    At last I have found out, that basically there shouldn't be much coding between the <b>COMMIT WORK</b> statement and the coding that just ends the method with <b>END METHOD</b>. This kind of procedure does definitly apply to the newer Versions, as I didn't have any problems like this before. Mayhaps and only a guess is, that the unlock-operation was previously registered with a perform like PERFORM unlock_workitem ON COMMIT. or something similar. This defenitly has changed under the new releases.
    In your specific case I would recommend to register the event processing in the update task and end the workitem's method as soon, as possible. For example:
    CALL FUNCTION 'SWE_EVENT_CREATE' IN UPDATE TASK   ...
    If this still does not help, you could further disjoin the transaction processing from the event creation by adding
    STARTING NEW TASK
    IN BACKGROUND MODE
    or whatever the correct syntax was here. This will schedule another tRFC on the database commit, which then is defenitly be picked up by another work process of the application server, just right -- hopefully -- after the object's method has completed.
    If you're feeling good with this answers, or it least it gave you new ideas to look upon, please assign points as appropriate.
    Best wishes,
    Florin

  • Decision step with method before workitem execution

    I have a decision step, which uses method before workitem execute uses BO Bus2094 - 'Display' method.
    When an agent receives a workitem, try to execute the workitem 'Getting an information message 'Error when starting submethod'.
    When i see the information of the error -
    "At least one submethod could not be processed.
    See the technical Workflow log to determine the error cause."
    When i check technical log of workitem, 2 steps are in error mode.
    1.  Dialog work item executed - Error when starting submethod
    2. EXECUTE_METHODS  - System error in asynchronous method start
    This is happening in Quality system, not in DEV system.
    Any inputs to resolve this.

    Hi,
    @Sivagami: I wonder, how a container element e.g. BUS2094 that was passed to a copy of the DECISION task is automatically executed just before the decision dialog? Good stuff, if it works like this, I'll try this at a later time.
    @Indira: Depending on the Release and such things I have expirienced several smaller bugs regarding the decision steps, especially when extending the data flow (from/to workitem), using the in-place-decision Workitem exit. So maybe you're already doing everything right, but just the inbox doesn't works as designed.
    To work around this problem, you could enter the object methods as a secondary method, which then will display the Sales document in a separate window,
    or you follow the proposal of Sivagami. If the Sales document doesn't seem to appear, you could enforce the display, by globally substitute the business object DECISION to one of your own, re-define the object's method Process that read the business object fromt the work item container and executes it's display method, which is basically the same result you'd like to have.
    Best wishes,
       Florin

  • Problem in modal method (decision workitem)

    Hi,
    I'm with a problem during the execution of a decision workitem. I've set a method to run before it (the modal execution) and, within it, called a transaction (in the case PA30) but it call the transaction two times.
    How can I make it execute only one time?
    Thanks in advance.
    -h

    When I searched the forum I found [this thread|Methods of Workitem execute twice;. Maybe it helps you also?
    Regards,
    Martin

  • Cancel WorkItem after execute a Method

    Hi all,
    Is there a way to cancel a workitem after executing a method?
    I put this method at the tab METHODS in the activity USER DECISION, but when the method is executed before the workitem, i need this closed.
    It´s because i am using a worklist at the PORTAL, and then what I need is to show the workitem at the UWL and then when the user click on the link to the WI, execute the METHOD (this method opens a webpage made with webdynpro).
    Best Regards,
    Ricardo

    I think you want to complete the workitem , once the workitem is executed from the UWL right?
    if this is the case as you said that you are using a Decision step which will open a webdynpro applicaiton once it is executed, then instead of using the methods tab, I suggest you to modify from the application side
    1. If the end user clicks on the Approve button or reject button UNder the actions of these button, call the standard SAP fm SAP_WAPI_DECISION_COMPLETE to which you have to pass the currently executed workitem ID and Decision for approve as 0001 and for reject 0002.
    this is more suitable and simple way of completing the worktem.

  • Open the workitem for display method

    Hi Guys,
    I have an issue with CRM BO BUS2000116.Actually we need to send an attachment to the workitem.so when the user executes the workitem.He/She will read the workitem text and the click on the attachment.The attachment should take into web ui page.
                But we are facing a peculiar issue.We have created a task with the display method(standard).So when the user executes the workitem its directly redirecting to the web ui page.but our requirement is to open the workitem.User will read the WI text and then he may click on the attachment.

    Hi- My understanding is, you need to show something to the user as workitem text and need to provide attachment. When clicking on the attachment, URL needs to open
    Have you tried to create a link in a method (before the approval task) using FM- "SAP_WAPI_ATTACHMENT_ADD" . If yes, then in the CRM worklist you will see this as an link under 'Attachments' (at bottom)
    You will be giving some workitem text in task description and this will be displayed at top.
    Let us know your output
    Vinoth

  • Change status of workitem in his method (ABAP OO)

    Hello!
    I have class Z_TTT with implementation IF_WORKFLOW. And I have method DISPLAY of this class.
    This method executing in task.
    How can I change status of this task inside method DISPLAY thus task not to be completed after executing.
    (In BOR I could use SAP_WAPI_SET_WORKITEM_STATUS (to ready) and then exit_cancelled.)
    How in ABAP OO?

    Thanks a million. Didn't know that    I'll edit my post, that it's more correct.
    In the method definition you declare the Exception class CX_BO_ACTION_CANCELLED to be thrown.
    In the method coding you use the following statement to raise the exception.
    RAISE EXCEPTION TYPE cx_bo_Action_Cancelled.

  • Orphaned Workitem - Workitem without agent -Recycle /treatment method.

    Hello All,
    Some times in my system there are some unwanted workitems without agent were created.How to treat them in general for all the Business objects like sc,po...I could see them in SWI2_admin .
    Is it problem of work flow?
    any experiece you encountered..As per process how to treat them.
    regards
    Muthu

    most of the times , problem is not with the workitem generation.
    it is generated correctly , but the agents for the workitem are not found...
    problem of agent not found is because of workflow only , some times if the task were to be classified as general and if it is not.
    then the system will generate workitem and agent will not be found.....

  • Cannot execute a customer BO Method from a workitem in webclient

    Hi everyone.
    I created a workflow in which i execute a Lead method (method developed by me) after a user decision is made.
    When i try it in winclient, it works perfectly, but in webclient, it doesn't do anything.
    Any clue????.
    Im working with CRM 5.2.
    Thanx in advance.
    Ricardo.

    Hi
    Looking at the error message I feel like there is something wrong in the task object and object method. You are using a class in the task make sure that class has the IF_WORKFLOW. Mak sure the task is enabled with synchronous task method check box.
    Regards
    Pavan

  • Rule with SELFITEM-SENDTASKDESCRITION task's workitem goes error

    Dear all,
               I have created a workflow with an activity step that uses business object SELFITEM and method SENDTASKDESCRIPTION  with rule AC00000168.
              On executing the WF, the workitem successfully goes to right agent.
              But, when the agent executes the workitem, it goes to error state.
              In the workflow log, I get the error message as "Exception occurred Error handling for work item 000000968991 eeom division 09.07.2010 - 11:28:52 " with exception 0,error type 1 and message 0.
              Following is binding details between workflow and task container.
    &MANAGER&      ->     &ADDRESSSTRINGS&
    &_ATTACH_OBJECTS&      ->     &ATTACHMENTS&
    &ATTENDANCEINSTANCE&     ->   &ATTENDANCE&
    &EXPRESS&     ->     &EXPRESS&
    &LANGUAGE& ->     &LANGUAGE&
    &LINEWIDTH&     ->     &LINEWIDTH&
    &TYPEID&     ->     &TYPEID&
    &SELFITEM&     ->     &_WI_OBJECT_ID&
            In the above binding parameter,MANAGER. is a workflow container of ABAP data dictionary type WFSYST-AGENT where the rule's agent is collected.
    Please suggest why the work item at agent inbox on execution goes error for which I will be grateful.
    Thanks and regards,
    S.Suresh

    Hello Rick !
            Thank you so much for your fruitful solution.
            Also, I am deeply sorry for delayed reply.
           I used the function module 'SWX_GET_MANAGER' in the custom method  as you suggested.
    BEGIN_METHOD FINDMANAGER CHANGING CONTAINER.
    DATA:
          EXTENDEDOBJECTID TYPE OBJEC-REALO,
          addresstype like soxna-type,
          RECIPIENTADDRESS TYPE SOXNA-FULLNAME.
    DATA:
          ac_container like swcont occurs 0 with
          addressstrings like soxna-fullname occu
      SWC_GET_ELEMENT CONTAINER 'ExtendedObjectID
    addresstype = 'G'.
    ac_container-element = 'OBJID'.
    ac_container-tab_index = '000001'.
    ac_container-elemlength = '008'.
    ac_container-type = 'N'.
    ac_container-value = EXTENDEDOBJECTID.
    append ac_container.
    ac_container-element = 'OTYPE'.
    ac_container-tab_index = '000001'.
    ac_container-elemlength = '002'.
    ac_container-type = 'C'.
    ac_container-value = 'P '.
    append ac_container.
      CALL FUNCTION 'SWX_GET_MANAGER'
        TABLES
          ACTOR_TAB = addressstrings
          AC_CONTAINER = ac_container
        EXCEPTIONS
          NOBODY_FOUND = 01
          OTHERS = 02.
      CASE SY-SUBRC.
       WHEN 0.            " OK
       WHEN 01.    " to be implemented
        WHEN OTHERS.       " to be implemented
      ENDCASE.
      loop at addressstrings.
      if addressstrings(2) = 'P '.
      delete addressstrings.
      endif.
      endloop.
    move addressstrings to recipientaddress.
      SWC_SET_ELEMENT CONTAINER 'RecipientAddress' RECIPIENTADDRESS.
    END_METHOD.
    Therafter, the values accumulated at RECIPIENTADDRESS is passed to the workflow container(SOXNA-FULLNAME) of SENDMAIL step.
    Also, I thank every one who contributed fruitful suggestions to solve my problem.
    Thanks and regards,
    S.Suresh

  • Urgent help req : work item id not getting passed in the method

    Hi ,
    I have created a subtype zcats of business object CATS and delegated it .
    I have created a new method Approve1 ( with attributes  SYNCRONUS & DIALOG )  in zcats which is similar in coding  to Approve method of CATS ( DIALOG) .
    I have include the method Approve1 of business object zcats in a standard task .
    The problem is that when the eorkflow gets triggered ,  the workitem id is not getting passed in the method APProve1 of zcats.
    Can someone please help me with this .
    Points would surely be awarded .

    BEGIN_METHOD APPROVE1 CHANGING CONTAINER.                 
      DATA: WORKITEMID_IMP LIKE OBJECT-KEY-ITEMID.              
      DATA: WI_CHCKWI LIKE SWWWIHEAD-WI_ID.                     
      DATA: WORKITEM TYPE SWC_OBJECT.                           
       <u> WORKITEMID_IMP = OBJECT-KEY-ITEMID</u>.                     
        SWC_GET_ELEMENT CONTAINER '_WORKITEM' WORKITEM.         
        SWC_GET_PROPERTY WORKITEM 'WorkitemReference' WI_CHCKWI.
        IF SY-SUBRC EQ 0 AND NOT WI_CHCKWI IS INITIAL.          
          WORKITEMID_IMP = WI_CHCKWI.                           
        ENDIF.                                                  
        CALL FUNCTION 'CATS_WF_APPROVAL'                        
          EXPORTING                                             
            WORKITEMID_IMP = WORKITEMID_IMP                     
          TABLES                                                
            CONT_IMP = CONTAINER.                               
      END_METHOD.                                               
    hi ,
    the above is the code in the method .
    At the first step of execution underlined above , the work item id is appearing blank .
    I think that the value is not passed to the container , but i am not sure og how to pass data to this conatiner

  • Reg : Advancing With Workitems

    Hi All,
    I am working in 4.6 with Purchase Requisition Workflow (Overall Release - BUS2105).
    The requirement is when the user rejects & saves the PR in ME54 I'm supposed to give a pop-up screen to enter rejection text.
    I tried various options like using SOFM-COMPOSE, calling text editor function modules via methods/reports/transaction codes etc.
    But everytime the user rejects the PR and saves it, he is taken to his inbox where that new workitem is present. Then he has to execute it seperately. I don't want the user to go back to his inbox to execute the workitem again. I want to advance with the workitems without going back to inbox.
    How can i achieve this?
    Thanks & Regards,
    Raj

    why dont you call the text editor FM in some of the userexits or badi before save.
    There check for the condition..if PR is rejected....then call the FM and get the rejection reason

Maybe you are looking for

  • Passing date over parameters

    Dear all, I have created a report which consists of 3 sub reports. All three sub reports uses different date fields from different tables (though the database is the same). The main report uses its own date field which is from another table. So, ther

  • Is there any kind of linkification extension for safari?

    Example being Instead of having to type this in: http://www.apple.com/webapps/utilities/speeddialwebclipgenerator.html Is there something in safari that can make it a link? .

  • How to recover system from new hdd T410

     Hello, please, help me to recover my system. I have a new HDD and trying to recover my system from "Lenovo_recovery" partition. Partition has been copped from old HDD. 1) I have chcked there are all files in "Lenovo_Recovery". 2) installed trial ver

  • Adobe Illustrator CS5 Jpeg to Vector

    I would like to change a jpeg to a vector and take out the background using CS5 Adobe Ilustrater on Windows 7 OS. Could someone help with instructions?

  • Export movie from Premiere for import into Encore

    I created an animation in 3D Studio MAX and rendered it to sequential stills for compositing in Premiere Pro 1.5. I want to export it out so it's ready for inport into Encore 2.0. I understand that Encore compresses it to MPEG-2 format while it is bu