SAP_WAPI_WORKITEMS_TO_OBJECTS

Hi Guys,
Please let me know somewhat details for this function module. I know this function module is used to get the workitems details related to the workflow. Let me know the proper paramaeters to be passes
Thanks

Importing Parameters
1. OBJECT_POR     TYPE     SIBFLPORB  : If you want to know the workitem which are pertaining to a particular instcnae of the BOR and if you have the instnace of the BOR then you can pass that instance to this parameter.
2.OBJTYPE     LIKE     SWOTOBJID-OBJTYPE : If you want to know what are workitems generated pertaining to a praticular Business object like BU1001006 or BUS2021 then pass that BOR name to this parameter which inturn returs all workitem belong to the BOR which is specified.
3. OBJKEY     LIKE     SWOTOBJID-OBJKEY : If you have the BOR key then you can even pass that value to this parameter which return the workitem related to object key.

Similar Messages

  • What is the reson for Fun SAP_WAPI_WORKITEMS_TO_OBJECT returns no value

    Hi All
    call function 'SAP_WAPI_WORKITEMS_TO_OBJECT'
        EXPORTING
          objtype                  = 'ZAR'
          objkey                   = v_objkey
          top_level_items          = c_set
          selection_status_variant = 0001
          text                     = c_set
          language                 = sy-langu
        TABLES
          worklist                 = i_worklist
          message_lines            = i_message_lines.
    I am using Function SAP_WAPI_WORKITEMS_TO_OBJECT  by passing object type and object key and looking for top level items . I get values for i_worklist[] all the time but for one AR i dont see a value in i_worklist[] .
    I know that Functional ppl had messed up with the workflow status in IMA2N transaction by changing the status....
    I want to know what is the reason for not getting any value in i_worklist[] for some ARS and works fine for other ARS.
    I can see the work id in workflow header table but i dont get workid when i use this function .
    Could you all tell me whats the reason for not getting ,i appreciate all your help
    Thanks

    With parameter selection_status_variant = 0001, you will only get a list of active instances.
    The parameter can have the following values:
    0000     All Instances
    0001     Active Instances (Running, Ready, Committed,...)
    0002     Finished Instances (Completed, Cancelled)
    0003     Active Instances (All)
    Cheers,
    Ramki Maley.

  • SAP_WAPI_WORKITEMS_TO_OBJECT

    The program is using
    SAP_WAPI_WORKITEMS_TO_OBJECT is getting the workflow item it_worklist_lc-wi_cd date as some other date ...
    But the workflow is showing like this
    < XXXXX>:                                      
    Date  : 10/03/2008                               
    Time  : 15:53:03 Action  : Approver assignment   
    Status                                                                               
    < XXXXX>: Please see corresponding e-mail      
    Date : 09.10.2008                                
    Time : 16:47:14 Action : Forward Request         
    Status                                                                               
    <XXXX>: sent that address               
    Date: 10/09/2008                                 
    Time: 17:49:09 Action: Rejection                 
    Status                     
                          I want the date as 10/09/08..but it is showing wrongly

    Hi, did you solve the problem...I am also facing the same issue

  • BUS2012 releaser RELEASE - BAPI_PO_RELEASE, saving releaser

    Hi all,
    I know, this kind of topic was already processed a couple of times, however I did not find a suitable solution for our problem.
    Customer wants to be able to save (and report later) releasers of the PO. There is a new processed being implemented, which uses the (slightly modified) BUS2012 object and it's RELEASE method to release the step of the PO in the workflow. Now this calls BAPI BAPI_PO_RELEASE, but it's interface does not incorporate the RELEASER.
    We can't use change documents for this purpose, as, from workflow-orientated releases there will only be WF-BATCH users releasing everything. We would be able to find the place, where CDHEAD and CDPOS are filled, but however this could be not only one place and the added value would be very low, as customer wants a transparent reporting on who and when did which release. For this purpose we enhanced the EKKO table with 16 fields (combinations of uname + date), which will serve the purpose of saving releaser / date of release for every step.
    We can get the actual agent of the workflow, but I do not know how to pass him / her to the BAPI. Of course we can redefine the RELEASE method (and we also will have to), but whatever I put to a e.g. Z_BAPI_PO_RELEASE, will need to be accessed somewhere deeper (maybe in FM ME_REL_SET, maybe in  ME_PURCHASE_DOCUMENT_DATA_SAVE)...
    I believe this was already solved by somebody and we do have something like a best-practise to work with it. Can anybody guide me? Of course, the whole process should be ready to accept releases also from ME29N, should also be implemented for the cancellation of the release and for rejection. But this first step would be a good kick for me.
    Thanks in advance.

    I can give you one option:
    define a new 'release' method, still calling the BAPI_PO_RELEASE but define it as dialog not background
    place the task calling the new method directly after the decision task , transfer the WI_actual_agent of the decision task as the executing agent of the new task. 
    This way the BAPI_PO_RELEASE will be executed with the RELEASER user and not WF-BACTH.
    however, this solution has a few limitations:
    this will work only in SAP GUI
    the user will need to have authorizations to release the PO.
    But, I have created many reports simply reading the workflow logs, this is not more complected then the change documents logs. you can use function modules:
    SAP_WAPI_READ_CONTAINER
    SAP_WAPI_DECISION_READ
    SAP_WAPI_WORKITEMS_TO_OBJECT
    And the logs themselves can be much clearer to the user then the change documents release status has changed from XXX to XXXX logs.

  • Report for outstanding workflows and the agents responsible

    I need a report that shows all leave request workflows , with userid who created them and approver (agent), and approver's org unit and personnel number.
    is there a standard SAP report that can show that? or I need to develop one?
    I was looking at the SWI2_FREQ, this report shows the leave request workflows and userid who created them, but it does not report on the agent.
    Regards,
    Tiberiu

    Hi
    I think by making use of SAP_WAPI_WORKITEMS_TO_OBJECTS you can get all the workitems who created the leave wokritems.
    Regards
    Pavan

  • Workflow status report

    Hi
    i wanted to develop a report which shows the current status of the  workflow .
    for example i have created a PO No  10001 and workflow 9001 has been triggered
    kindly tell me
    the table name
    how i related those two
    and then workflow and there task
    Regards
    Ammad

    >
    Raj  Karunanidhi wrote:
    > You can check SWW_CONTOB table to get the WI_ID based on PO number and Business object.
    > Once you get the workitem ID, you can get the status of workitem/PO from SWWWIHEAD table.
    NO, NO, NO!!!!
    Please do NOT access tables directly unless you know what you're doing because these change - that one is one example of a table that has changed over the versions. SAP_WAPI_WORKITEMS_TO_OBJECT will give you the same info in a manner that is supported by SAP.
    Next, before developing a report, are you aware of the standard functions? Most sites I've worked on users are happy to look at the log from within the PO using the object services button. Alternatively there's tx SWI6 - the only ugly thing is that you'll need to teach folk to put in BUS2012, but that can also be worked around.

  • Forwarded successfully the workitem for BO-BUS2000220(complaint) in the worklist of other user: Problem in "Sent date"  not reflecting correctly in SAP CRM 7.0 Web UI

    I am working with SAP CRM 7.0. We have a workflow in the system which is triggered at the creation of complaint(BO:BUS2000220) and then assign the complaint workitem
    in the woklist of specified agent. I have created a report and scheduled it daily to forward the complaint into the worklist of user B from worklist of user A after 7 days
    from creation date of complaint. But the problem is that the forwarded complaint is showing in the worklist of user B with sent date(the creation date of complaint, not the
    forwarded date).
    Relevant code:
    IF gw_complain-PROCESS_TYPE = 'ZCMS' AND age_complaint = 8.
              CALL FUNCTION 'SAP_WAPI_WORKITEMS_TO_OBJECT'
               EXPORTING
    objtype         = 'BUS2000120'
    objkey          = obj_guid_key
    top_level_items = ' '
    SELECTION_STATUS_VARIANT       = 0001
               IMPORTING
    return_code     = return_code
               TABLES
    worklist        = it_worklist[].
    READ TABLE it_worklist INTO wa_worklist WITH KEY wi_type = 'W'.
    CALL FUNCTION 'SAP_WAPI_FORWARD_WORKITEM'
                EXPORTING
    workitem_id    = wa_worklist-wi_id
                  USER_ID        = wa_worklist_esc-ESC_USER
    LANGUAGE       = SY-LANGU
    DO_COMMIT      = 'X'
    CURRENT_USER   = wa_worklist_esc-CURRENT_USER
                IMPORTING
    RETURN_CODE    = lv_return_code
                TABLES
    MESSAGE_LINES  = lv_mesg
    * MESSAGE_STRUCT =
    * USER_IDS       =
    ENDIF.
    Can someone help me how to change the sent date to actual forwarded date of complaint.

    Hi Kavita,
    There is a standard column in UWL with name 'Sent Date'. Other functionalities in UWL for example deadline monitoring (Due date column) are based on this sent date. This shows an employee what was the date workitem was created (sent date) and when it will get escalated (due date). Displaying forwarding date in Sent date will not give clear picture to employee as the deadline will be calculated based on sent date only not based on forwarding date. this was just an example.
    even though if your client is insisting, i dont think it can be done without any enhancement in UWL web dynpro com sort of thing. you can check with your portal consultant too.
    Regards,
    Ibrahim

  • How to find the user who approved the workitem.

    Hi experts,
    I have created a parking/posting workflow.
    When the user Approves, parked document is posted and BKPF table is updated with WF-BATCH as user name.
    Now I need to find the actual user who approved the workitem for posting.
    My plan is:
    1. Find the workitem id using the BOR, company code, document no, year, task no.
    2. Find the user who processed the above obtained worktem id.
    Please let me know the tables for the above points 1 and 2.
    Or let me know if there is any other way to find the actual user.
    Regards,
    Karthik

    Hi,
    To get the workitem ID with respect to a specific business object instance make use of the FM SAP_WAPI_WORKITEMS_TO_OBJECT
    To know who processed the determined workitem either you can make use of the FM SAP_WAPI_GET_WORKITEM_DETAIL or directly read the table SWWWIHEAD and you can find the actual agent WI_AAGENT this is the field which says who has executed the workitem.
    Regards
    Pavan

  • Report based on particular workflow

    Hi all.
    We made a custom workflow for t code fv60. It has got various levels of approvals and conditions. Now the requirement is to develop a report based on this workflow - similar to swi1. but our purpose of the report is to show various parked and published FI documents and the various users in whose inboxes these document mails are kept in varios approvaql stages. E. G. If today a document is parked by user abc and is approved at first level by user def and now that document is in user ghi's inbox  as a workitem , waiting his approval, the report should show all the users and the statuses of document at each stage.
    Is it possible?.
    if so please give some sample code or example on how to build the report.
    Thanks
    Ribhu

    Hi,
    Yes, it is possible but it will be specific to your workflow only and as Kjetil says making a very general report like this for any workflow will be tough !!
    However i can suggest the following so that you can start continuing on this
    1. First find out the Workflow Template number used and also list all the major user decision steps Task Numbers ( say approval1 - Task1, approval2 - Task2, approval3 - Task 3) used. Lets call it as {Task List}
    2. Given the from date and to date and type of document ( KR/KG etc..) get all the FI Documents parked/created on these dates.
    3. For each FI Invoice No call SAP_WAPI_WORKITEMS_TO_OBJECT  with proper object type ( should be either FIPP or BKPF) , object key ( company code + doc no + fiscal year), fill in the Task Filter with your Task List}
       a. The Table parameter WORKLIST will contain information about the workitems related to your user decision items, loop through them and if completed find the actual agent else find the list of recipients using SAP_WAPI_WORKITEM_RECIPIENTS, you can show this as inprocess.
    4. Infact once you get the WORKLIST you can do whatever you want.
    If you have more than one possible workflows associated with same Invoice , then you have to filter your WORKLIST again based on correct workflow template number using WI_CHCKWI field.
    Good Luck !!
    Regards
    Krishna Mohan

  • IDOC related to workflow task

    Is there any table or report which gives IDOC nos related to workflow task?

    Sreedevi, it depends what you want (where you start from), so please be more specific in your question next time (or if this doesn't answer your question).
    If you have a work item number and want to know the IDoc number you can use function module SAP_WAPI_OBJECTS_IN_WORKITEM to get a list of all object references. Then you have to process it from there. You can make a flexible solution which is compatible with future added IDoc types by checking the object type of each object returned and traversing the inheritance hierarchy until you get to object type IDOC. Then you know it is an IDoc, and you can find the IDoc number as the key of the object. Or you can hardcode supported object types using a CASE or IF statement. The flexible solution would be much more fun to program in my opinion.
    If you have an IDoc number and want to find work items you have to go the other way. That means starting with object type IDOC, finding all the inherited object types and for each of these using function module SAP_WAPI_WORKITEMS_TO_OBJECT. Again, another possibility is to hardcode the list of object types you want to check.
    The table Rose told you about, HRS1201, contains no IDoc numbers, but it contains all the tasks with the methods they use. So actually you can use that to find all the object types you need to check (whether they are inherited from IDOC), since all work items will refer to a task definition.

  • How to get the workitem at runtime

    Hi
    I have a web dynpro application from where a workflow will be started based on an event. I want to retrieve the workitem ID. How to retrive it?
    As per the Forums answers, I am currently using SAP_WAPI_WORKITEMS_TO_OBJECT function module to get the workitem ID
    Please help me
    Thanks
    Gopal

    Hi,
    You can refer the below thread.
    [Re: Completion of workitem for webdynpro abap application;
    links:
    [Re: Completion of workitem for webdynpro abap application;
    Regards,
    Priya

  • How to know the status of workflow?

    Hi all,
    When i create a Sales order in VA01 my workflow should get triggered.
    When the workflow status is 'In progress' the user should not be allowed to change the sales order that was created.
    How to do this and in which table can i get the status of a particular workflow.
    Regards,
    Gautham P

    Don't check any tables. The tables have changed between versions.
    Use two of the function modules from the workflow API instead.
    1) SAP_WAPI_WORKITEMS_TO_OBJECT to find the work items in which the object (your sales order BOR object) is used.
    2) SAP_WAPI_GET_WORKITEM_DETAIL to find work item status and more.

  • How to find ObjectKey for the workflow, or Task for a ObjectKey

    Hi,
    I am developing a custom workflow for a customer request,
    I need to apply a condition like, If there is a open workflow request for this customer, then it should not start another workflow.
    how do I do that ?
    I tried to look into SWi6, it gives results till I keep the Object key Blank, if I use this with the object key then it gives no result.
    I have also tried function module SAP_WAPI_WORKITEMS_TO_OBJECT, but still no success.
    I have developed my own Business object for this with key fields.
    thanks
    Siddharth

    Hi,
    You can check in the table SWW_WI2OBJ, whether for the key and business object, there is workflow exist or not.
    Get the last workitem based on the timestamp and pass that work item in SWWWIHEAD and get the top work item.
    Now check whether the status is COMPLETED or INPROCESS or READY, based on which you can trigger or not.
    Regards,
    JMB

  • Delete Work Item from PO Releaser's Inbox during Workflow

    Hi All
    How can I delete the previous Work Item that was created in the PO Releaser's Inbox if a PO was changed which re-triggered the PO Release workflow but this time to a different PO Releaser.
    The workflow is working correctly, i.e. creating the new release item in the new releaser'd Inbox but not deleting the old Work Item for the previous releaser.
    Any idea on how I can accomplish this?
    Kind Regards
    Utian Goliath

    PLease refer the below stuff................create a task and put the code inside the method.This task should be fisrt step in your workflow.
    User sets doc to Complete from FBV2 , Complete event triggered and workflow triggered.
    Workitem goes to approver .
    Now , the user immediately changes doc from FBV2 , sets it to Complete again and workflow triggered
    workitem goes to the same approver for the same document.
    SAP_WAPI_WORKITEM_TO_OBJECT - Worklist table will giv all parent id's for the object key concatenation of
    com code , doc no and fiscal year.
    SWP_WORKFLOW_INSTANCE_DELETE - Pass the parent id and will delete the entire instance but not
    parent workitem id.
    SAP_WAPI_WORKITEM_DELETE - Pass parent id everything will be deleted .( Check_final_state = blank ).
    No trace found in SWI14 and SWI2_FREQ.
    To remove the previous workitem , create a method in the begining of the workflow , use F.M.
    SAP_WAPI_WORKITEM_TO_OBJECT to get the workflow id's and then
    SWP_WORKFLOW_INSTANCE_DELETE or SAP_WAPI_WORKITEM_DELETE to delete the previous instance.
    data : lt_worklist type table of SWR_WIHDR,
           lw_worklist type SWR_WIHDR,
           lv_objkey type SWOTOBJID-OBJKEY,
           lv_return type sy-subrc,
           lv_id type SWP_HEADER-WF_ID.
    concatenate object-key-sourcecompanycode object-key-documentn
    object-key-fiscalyear into lv_objkey.
    CALL FUNCTION 'SAP_WAPI_WORKITEMS_TO_OBJECT'
    EXPORTING
      OBJECT_POR                     =
       OBJTYPE                        = 'FIPP'
       OBJKEY                          = lv_objkey
      TOP_LEVEL_ITEMS                = 'X'
      SELECTION_STATUS_VARIANT       = 0001
      TIME                           =
      TEXT                           = 'X'
      OUTPUT_ONLY_TOP_LEVEL          = ' '
      LANGUAGE                       = SY-LANGU
      DETERMINE_TASK_FILTER          = 'X'
      REMOVED_OBJECTS                = ' '
    IMPORTING
       RETURN_CODE                    = lv_return
      TABLES
      TASK_FILTER                    =
        WORKLIST                       = lt_worklist
      MESSAGE_LINES                  =
      MESSAGE_STRUCT                 =
       if lt_worklist is not initial.
    loop at lt_worklist into lw_worklist.
      object-instance = 'X'.
    move lw_worklist-wi_id to lv_id.
    CALL FUNCTION 'SWP_WORKFLOW_INSTANCE_DELETE'
      EXPORTING
        WF_ID                         = lv_id
        DO_COMMIT                     = 'X'
    EXCEPTIONS
      WORKFLOW_DOES_NOT_EXIST       = 1
      OTHERS                        = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDLOOP.
    ENDIF.
    Second way is to create a fork , and use wait for event step in it with the same event that is triggering the WFL
    In the same branch take a process control to end workflow instance.
    In the second branch carry out normal processing.
    Necessary branch = 1.
    So incase the user triggers the event again, a new instance will be created ,
    and in the previous instance , the first branch will follow ending the
    previous instance and the workitems of other branch will be logically deleted.

  • Controlling multiple workitem in purchase Requisition

    Guys,
              I need some suggestions regarding the controlling of multiple workitem for Purchase requisition. Our client have a PR release wf and when a PR is saved a workitem is sent to approvers inbox. Within a timeframe say (15 sec) any changes to PR will trigger the same wf and creates one more workitem. I want to restrict the creation of workitem if it falls within the time frame. Good suggestions are greatly appreciated with points.
    Thanks in Advance,
    Isaac

    I think you can use Function module SAP_WAPI_WORKITEMS_TO_OBJECT to retrieve the workitem that has been triggered for the same PR and the you can read the table SWWWIHEAD providing the workitem Id and then check the Creation time and compare.
    Use this coding in a virtual attribute and use it to define the Start Condition using Tcode SWB_COND
    Thanks
    Arghadip

Maybe you are looking for