Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Workflow Customisation Error

user16854May 11 2012 — edited May 11 2012
Sorry - I have also posted a similar question to this in the PL/SQL form:
10332115
But wanted to ask here too because this is related to Workflow related too, so I'm not sure where the query best sits.

--------------------------------------

I am working on changing an existing customisation we have on our PO Approval Workflow.

When I send an old PO for approval, the WF is erroring.

I have added debug statements so I can see at which point the WF falls over.

As part of the workflow change, we set an attribute on the POAPPRV workflow called "X_CONTRACT_IN_PLACE"

When the PO is sent for approval again, we want to find the value of that attribute.

It is falling over here:
-- ####
  l_progress := '15 Got This Far';
  IF (l_po_wf_debug = 'Y') THEN
     PO_WF_DEBUG_PKG.insert_debug(p_item_type,p_item_key,l_progress);
  END IF;
-- ####

          -- get attribute value
          -- cannot use GetItemAttrText because if a PO 
          -- is sent for approval twice, it will generate 2 different item_keys
         SELECT DISTINCT wiav.text_value
                    INTO l_xccc_contract
                FROM apps.wf_item_attribute_values wiav
                   , apps.wf_item_attributes wia
                   , apps.wf_items wi
                   , po.po_headers_all pha
               WHERE wiav.item_type = wia.item_type
                 AND wi.item_type = wiav.item_type
                 AND wi.item_key = wiav.item_key
                 AND wiav.NAME = wia.NAME
                 AND wi.user_key = pha.segment1
                 AND wiav.text_value IS NOT NULL
                 AND wiav.item_type = 'POAPPRV'
                 AND wia.NAME = 'X_CONTRACT_IN_PLACE'
                 AND wi.user_key = TO_CHAR(l_this_doc_num);

-- ####
  l_progress := '16 Got This Far';
  IF (l_po_wf_debug = 'Y') THEN
     PO_WF_DEBUG_PKG.insert_debug(p_item_type,p_item_key,l_progress);
  END IF;
-- ####
I can tell it's getting stuck at this point because when I check the po_wf_debug table it shows the "15 Got This Far" statement, but not the next one.

If I run the SQL in TOAD, it e.g. returns NULL for one of the POs I'm testing, because it's an old PO and the Attribute was not set on it. However, when the same bit of code is reached in the workflow, it is breaking.
SELECT DISTINCT wiav.text_value
--                    INTO l_xccc_contract
                FROM apps.wf_item_attribute_values wiav
                   , apps.wf_item_attributes wia
                   , apps.wf_items wi
               WHERE wiav.item_type = wia.item_type
                 AND wi.item_type = wiav.item_type
                 AND wi.item_key = wiav.item_key
                 AND wiav.NAME = wia.NAME
                 AND wiav.text_value IS NOT NULL
                 AND wiav.item_type = 'POAPPRV'
                 AND wia.NAME = 'X_CONTRACT_IN_PLACE'
                 AND wi.user_key = '50085068';   
Any advice much appreciated, as I'm rather stuck!

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 8 2012
Added on May 11 2012
3 comments
947 views