12
返回列表 发新帖
楼主: kacey

求PO workflow API

[复制链接]
论坛徽章:
2
咸鸭蛋
日期:2012-11-29 15:57:332013年新春福章
日期:2013-02-25 14:51:24
11#
发表于 2010-12-20 22:15 | 只看该作者
PO审批不仅仅是把状态从INCOMPLETE 的狀態變成APPROVED这么简单,后台做了若干操作

LZ的需求是:自动提交PO,让它审批,很简单,打开PO form,找PO审批那个按钮的触发器里的代码,有一行提交审批工作流的代码就是

如果要求自动提交还要自动审批,要就符合原采购审批工作流的自审批流程,要就改这个工作流,让它能自动审批。

使用道具 举报

回复
论坛徽章:
2
咸鸭蛋
日期:2012-11-29 15:57:332013年新春福章
日期:2013-02-25 14:51:24
12#
发表于 2010-12-21 09:20 | 只看该作者
好事做到底,送佛送到西

================================================


PACKAGE BODY PO_WF_APPROVE_C IS

-- Private procedures/functions that supports the wf_approve_doc procedure.

procedure setupworkflow ( ActionOriginatedFrom    varchar2,
                          DocumentID                  number,
                          DocumentNumber          varchar2,
                          PreparerID              number,
                          DocumentTypeCode        varchar2,
                          DocumentSubtype         varchar2,
                          RequestorAction         varchar2,
                          forwardToID             number default NULL,
                          forwardFromID           number,
                          DefaultApprovalPathID   number,
                          DocumentStatus          varchar2,
                          DocumentNote                  varchar2 );

/*===========================================================================

  PROCEDURE NAME:        wf_approve_doc()

===========================================================================*/

PROCEDURE wf_approve_doc IS

        ActionOriginatedFrom   varchar2(30);
        PreparerID             Number;
        DocumentTypeCode       varchar2(30);  
        DocumentSubtype        varchar2(60);
        DocumentStatus         varchar2(60);
        RequestorAction        varchar2(60);
        forwardToID            number;
        forwardFromID          number;
        DefaultApprovalPathID  number;
       
        --< Note expansion project FPJ Start>
        --DocumentNote               VARCHAR2(480) := '';
        DocumentNote        WF_ITEM_ATTRIBUTE_VALUES.text_value%TYPE := NULL; --VARCHAR2(4000)
        --< Note expansion project FPJ End>

        X_system_message_level varchar2(4);
        x_po_auth_status       VARCHAR2(25) := '';
        x_po_header_id         NUMBER;
        x_req_status               VARCHAR2(25) := '';
        x_req_status_dsp       VARCHAR2(25) := '';
        x_error_rc               VARCHAR2(25) := '';
        x_doc_header_id               number;
        l_approval_mode               VARCHAR2(30);

        -- FPI CBC Start
        l_unencum_doc_exists   BOOLEAN := FALSE;
        l_doc_type_code        VARCHAR2(30);
        l_document_id          NUMBER;
        -- FPI CBC End

BEGIN

        -- FPI CBC Start
        -- Check if there are any lines which are yet to be encumbered
        l_doc_type_code := Name_In('poxdoapp_globals.document_type_code');
        IF l_doc_type_code = 'REQUISITION'
        THEN
            l_document_id := Name_In('PO_REQ_HDR.Requisition_Header_Id');
        ELSIF l_doc_type_code IN ('PA', 'PO')
        THEN
            l_document_id := Name_In('po_headers.po_header_id');
        ELSIF l_doc_type_code = 'RELEASE'
        THEN
            l_document_id := Name_In('po_releases.po_release_id');
        END IF;

        l_unencum_doc_exists :=  PO_Poapproval_Init1.Reserve_Unreserve_Check
                                    (action            => 'UNRESERVE',
                                     doc_header_id     => l_document_id,
                                     doc_type_code     => l_doc_type_code,
                                     doc_status        => NULL,
                                     doc_cancel_flag   => NULL);
        -- FPI CBC End



        -- SUBMIT TO WORK FLOW.   Iali - 06-21-97
        -- Submit the document for approval to the workflow, passing it the
        -- appropriate arguments.
        -- Note that there are different workflows/Start Processes for PO, Change Order,
        -- and Requisition. We call the appropriate one depending upon the document type.

        -- Setting up common parameters for the call to WF.

        ActionOriginatedFrom  := 'PO_FORM';
        DocumentTypeCode      := name_in('poxdoapp_globals.document_type_code');
        DocumentSubtype       := name_in('poxdoapp_globals.document_subtype');
        DocumentStatus        := name_in('poxdoapp_globals.approval_status_code');
        RequestorAction              := 'APPROVE';
        forwardToID           := to_number(name_in('po_approve.forward_to_id'));
        forwardFromID         := to_number(name_in('po_approve.forward_from_id'));
        DefaultApprovalPathID := to_number(name_in('po_approve.approval_path_id'));
       
        --< Note expansion project FPJ Start >
        -- When calling approval workflow, truncate note to 480 for document types
        -- other than REQUISITION because only the Req Approval Workflow is being
        -- supported in 11.5.10 for this project.
        IF NAME_IN('POXDOAPP_GLOBALS.document_type_code') = 'REQUISITION' THEN
           DocumentNote        := name_in('PO_APPROVE.note');
        ELSE
           DocumentNote        := substr(name_in('PO_APPROVE.note'), 1, 480);
        END IF;
        --< Note expansion project FPJ End >

        -- Display the busy cursor before submitting document to WF.
        SET_APPLICATION_PROPERTY (CURSOR_STYLE, 'BUSY');
       
        /* BUG 729568. Moved this copy statement to before WF call so that */
        /* print_flag is set correctly so that workflow can print the doc. */
        /* Before it was always set to 'N' so the doc never printed since  */
        /* the copy was afterwards. (FRKHAN 09/17/98) */
        copy(NAME_IN('po_approve.print_check'), 'poxdoapp_globals.print_flag');

        IF name_in('poxdoapp_globals.document_type_code') = 'REQUISITION' THEN

                -- Setup REQUISITION approval request to WF.

/* Bug 1100247 - Amitabh
** Desc: When a Requisition created by User A is opened by User B
**      via the Requisition Summary form (in Incomplete Status)
**      and the access level is Public, the User B could approve
**      the requisition using rights of User A as the Workflow
**      startup process 'SetUpWorkFlow' used to pass the preparer_id
**      as the person approving it. The call has been modified to
**      pass the po_startup_values.employee_id as the approver.This
**      will ensure that the rights of person approving the Req are
**      used and the action history is updated correctly.
**
** Modifying the parameter to be passed to SetUpWorkFlow
** from po_req_hdr.preparer_id to po_startup_values.employee_id
**
** Dependencies: POXWPA1B.pls v110.46
*/

                SetUpWorkFlow ( ActionOriginatedFrom,
                                    to_number(name_in('po_req_hdr.Requisition_Header_Id')),
                                            name_in('po_req_hdr.segment1'),
                                to_number(name_in('po_startup_values.employee_id')),
                                DocumentTypeCode,
                                       DocumentSubtype,
                                RequestorAction,
                                forwardToID,
                                forwardFromID,
                                DefaultApprovalPathID,
                                DocumentStatus,
                                DocumentNote);

        ELSIF name_in('poxdoapp_globals.document_type_code') IN ('PO', 'PA') THEN

                  -- Setup PO / CHANGE ORDER approval request to WF.

                SetUpWorkFlow( ActionOriginatedFrom,
                                   to_number(name_in('po_headers.po_header_id')),
                                   name_in('po_headers.segment1'),
                               to_number(name_in('po_startup_values.employee_id')),
                               DocumentTypeCode,
                                      DocumentSubtype,
                               RequestorAction,
                                 forwardToID,
                               forwardFromID,
                               DefaultApprovalPathID,
                               DocumentStatus,
                               DocumentNote);

        ELSIF name_in('poxdoapp_globals.document_type_code') = 'RELEASE' THEN

                  -- Setup RELEASE approval request to WF.

                SetUpWorkFlow( ActionOriginatedFrom,
                                   to_number(name_in('po_releases.po_release_id')),
                                   name_in('poxdoapp_globals.release_po_doc_num'),
                               to_number(name_in('po_startup_values.employee_id')),
                               DocumentTypeCode,
                                      DocumentSubtype,
                               RequestorAction,
                                 forwardToID,
                               forwardFromID,
                               DefaultApprovalPathID,
                               DocumentStatus,
                               DocumentNote);

        ELSE
                fnd_message.debug ('INVALID DOCUMENT TYPE TO wf_approve_doc');
                raise form_trigger_failure;

        END IF;               

        -- POST WF SUBMIT PROCESSING.

        -- Doing a server side commit:
        po_reqs_sv2.WF_notifications_commit;

        -- Reset cursor after return from call to WF.
        SET_APPLICATION_PROPERTY (CURSOR_STYLE, 'DEFAULT');
       
        -- <FPJ Enter PO Forms Enhancements START>
        -- FND_MESSAGE.SET_NAME('PO', 'PO_WF_APP_DOC_SUBMITTED');
        -- FND_MESSAGE.SHOW;
        -- <FPJ Enter PO Forms Enhancements END>

        x_doc_header_id := TO_NUMBER(NAME_IN('poxdoapp_globals.object_id'));

        -- If the print checkbox is checked, send concurrent request to print document.
           -- Display the watch cursor while the concurrent request is being sent.
        -- Removed concurrent request to print doc since WF should print it.
        -- FRKHAN 09/17/98

            copy('COMMIT', 'poxdoapp_globals.return_code');

       
          /* Get the profile PO_WORKFLOW_APPROVAL_MODE to determine if the workflow is being
           run in BACKGROUND or ON-LINE mode
           If approval mode is background then simply clear the document. Else requery the
           document, except for requisitions.
        */

          fnd_profile.get('PO_WORKFLOW_APPROVAL_MODE', l_approval_mode);

          IF l_approval_mode is NULL THEN
                     l_approval_mode := 'BACKGROUND';
          END IF;


        IF (NAME_IN('poxdoapp_globals.calling_form_code') = 'ENTRY' AND
                NAME_IN('poxdoapp_globals.document_type_code') = 'REQUISITION') THEN

                -- Close approval window, navigate back to the parent form
                -- and clear the record.

                    hide_window('po_approve');            
                app_special.enable('MODAL', PROPERTY_ON);
                go_item(NAME_IN('poxdoapp_globals.return_field'));
               
                /* FPI CBC -- Start */
                IF IGC_CBC_PO_GRP.Cbc_Po_Enabled_Flag = 'Y'
                AND  (l_unencum_doc_exists
                OR    Name_In('PO_APPROVE.RESERVE') = 'RESERVE' )
                THEN
                     po_approve_c9.igc_view_results;
                END IF;
                /* FPI CBC -- End */


      /* Bug 2157214 fixed. copied NULL to the below parameter values */
      /* Before the fix, after approving a requisition , these values are not
         made NULL because of which querying was not possible immediately after
         'OK' button is pressed in the Approval window */
                         copy (NULL, 'PARAMETER.search_criteria_from');
                        copy (NULL, 'PARAMETER.g_query_find');
                            copy (NULL, 'PARAMETER.p_requisition_header_id');       
                DO_KEY('CLEAR_RECORD');

        ELSIF (NAME_IN('poxdoapp_globals.calling_form_code') = 'ENTRY' AND
                name_in('poxdoapp_globals.document_type_code') IN ('PO', 'PA')) THEN

             IF l_approval_mode = 'BACKGROUND' THEN

                    hide_window('po_approve');
                app_special.enable('MODAL', PROPERTY_ON);
                go_item(NAME_IN('poxdoapp_globals.return_field'));

                 copy (NULL, 'PARAMETER.search_criteria_from');
                   copy (NULL, 'PARAMETER.po_header_id');         
                DO_KEY('CLEAR_RECORD');   
                                    
                -- Note: After clear record, FORM will fetch the next record
                --       to refill the block.  If the next record is empty,
                --       set the record to NEW.

                IF name_in('PO_HEADERS.ROW_ID') is NULL THEN
                     set_record_property (to_number(name_in('SYSTEM.CURSOR_RECORD')),
                                     'PO_HEADERS', STATUS, NEW_STATUS);
                END IF;

           ELSE

                -- If it is PO document, get the authorization status of the
                -- po document.                   
                -- If the PO has been:
                --  o approved & not forwarded then requery the record because
                --    the approval process has changed the record.
                --  o forwarded then clear the record and do not allow user
                --    to view it.

                  x_po_header_id :=  TO_NUMBER(NAME_IN('poxdoapp_globals.object_id'));
              
                SELECT poh.authorization_status
                  INTO x_po_auth_status
                  FROM po_headers_all poh
                 WHERE poh.po_header_id = x_po_header_id;

                    hide_window('po_approve');
                app_special.enable('MODAL', PROPERTY_ON);
                go_item(NAME_IN('poxdoapp_globals.return_field'));

                IF x_po_auth_status in ('IN PROCESS','PRE-APPROVED')
                THEN                       
                 /*  FPI CBC -- Start */
                  -- Display the CBC View Results window before
                  -- clearing the record.
                  IF IGC_CBC_PO_GRP.Cbc_Po_Enabled_Flag = 'Y'
                  AND  (l_unencum_doc_exists
                  OR    Name_In('PO_APPROVE.RESERVE') = 'RESERVE' )
                  THEN
                       po_approve_c9.igc_view_results;
                  END IF;
                  /*  FPI CBC -- End */

                   copy (NULL, 'PARAMETER.search_criteria_from');
                     copy (NULL, 'PARAMETER.po_header_id');         
                  DO_KEY('CLEAR_RECORD');   
                                    
                  -- Note: After clear record, FORM will fetch the next record
                  --       to refill the block.  If the next record is empty,
                  --       set the record to NEW.

                  IF name_in('PO_HEADERS.ROW_ID') is NULL THEN
                     set_record_property (to_number(name_in('SYSTEM.CURSOR_RECORD')),
                                     'PO_HEADERS', STATUS, NEW_STATUS);
                  END IF;

                ELSE
                        /*  FPI CBC -- Start */
                        IF IGC_CBC_PO_GRP.Cbc_Po_Enabled_Flag = 'Y'
                        AND  (l_unencum_doc_exists
                        OR    Name_In('PO_APPROVE.RESERVE') = 'RESERVE' )
                        THEN
                              po_approve_c9.igc_view_results;
                        END IF;
                        /*  FPI CBC -- End */
                           execute_query;

                               -- NULL out the query parameters after executing the query.
                            copy (NULL, 'PARAMETER.search_criteria_from');
                        IF NAME_IN('poxdoapp_globals.document_type_code') = 'REQUISITION' THEN
                                copy (NULL, 'PARAMETER.g_query_find');
                                    copy (NULL, 'PARAMETER.p_requisition_header_id');       
                        ELSIF NAME_IN('poxdoapp_globals.document_type_code') = 'RELEASE' THEN
                                    copy (NULL, 'PARAMETER.po_release_id');
                        ELSE
                                    copy (NULL, 'PARAMETER.po_header_id');
                        END IF;       

                END IF;
           END IF;

        ELSIF (NAME_IN('poxdoapp_globals.calling_form_code') = 'ENTRY' AND
                name_in('poxdoapp_globals.document_type_code') = 'RELEASE') THEN
   
                -- post WF processing for releases should be same as for PO

             IF l_approval_mode = 'BACKGROUND' THEN

                    hide_window('po_approve');
                app_special.enable('MODAL', PROPERTY_ON);
                go_item(NAME_IN('poxdoapp_globals.return_field'));

                 copy (NULL, 'PARAMETER.search_criteria_from');
                   copy (NULL, 'PARAMETER.po_release_id');         
                DO_KEY('CLEAR_RECORD');   
                                    
                -- Note: After clear record, FORM will fetch the next record
                --       to refill the block.  If the next record is empty,
                --       set the record to NEW.

                IF name_in('PO_RELEASES.ROW_ID') is NULL THEN
                     set_record_property (to_number(name_in('SYSTEM.CURSOR_RECORD')),
                                     'PO_RELEASES', STATUS, NEW_STATUS);
                END IF;

           ELSE

                  x_doc_header_id :=  TO_NUMBER(NAME_IN('poxdoapp_globals.object_id'));
              
                SELECT por.authorization_status
                  INTO x_po_auth_status
                  FROM po_releases_all por
                 WHERE por.po_release_id = x_doc_header_id;
               
                    hide_window('po_approve');
                app_special.enable('MODAL', PROPERTY_ON);
                go_item(NAME_IN('poxdoapp_globals.return_field'));

                IF x_po_auth_status in ('IN PROCESS','PRE-APPROVED') THEN                       
                  /*  FPI CBC -- Start */
                  -- Display the CBC view results window before
                  -- clearing the record.
                  IF IGC_CBC_PO_GRP.Cbc_Po_Enabled_Flag = 'Y'
                  AND  (l_unencum_doc_exists
                  OR    Name_In('PO_APPROVE.RESERVE') = 'RESERVE' )
                  THEN
                      po_approve_c9.igc_view_results;
                  END IF;
                  /* FPI CBC -- End */

                   copy (NULL, 'PARAMETER.search_criteria_from');
                     copy (NULL, 'PARAMETER.po_release_id');         
                  DO_KEY('CLEAR_RECORD');   
                                    
                  -- Note: After clear record, FORM will fetch the next record
                  --       to refill the block.  If the next record is empty,
                  --       set the record to NEW.

                  IF name_in('PO_RELEASES.ROW_ID') is NULL THEN
                     set_record_property (to_number(name_in('SYSTEM.CURSOR_RECORD')),
                                     'PO_RELEASES', STATUS, NEW_STATUS);
                  END IF;

                ELSE
                  /*  FPI CBC -- Start */
                  IF IGC_CBC_PO_GRP.Cbc_Po_Enabled_Flag = 'Y'
                  AND  (l_unencum_doc_exists
                  OR    Name_In('PO_APPROVE.RESERVE') = 'RESERVE' )
                  THEN
                      po_approve_c9.igc_view_results;
                  END IF;
                  /* FPI CBC -- End */

                  execute_query;

                      -- NULL out the query parameters after executing the query.
                      copy (NULL, 'PARAMETER.search_criteria_from');
                  IF NAME_IN('poxdoapp_globals.document_type_code') = 'REQUISITION' THEN
                        copy (NULL, 'PARAMETER.g_query_find');
                            copy (NULL, 'PARAMETER.p_requisition_header_id');       
                  ELSIF NAME_IN('poxdoapp_globals.document_type_code') = 'RELEASE' THEN
                            copy (NULL, 'PARAMETER.po_release_id');
                  ELSE
                            copy (NULL, 'PARAMETER.po_header_id');
                  END IF;       

                END IF;
           END IF;
        ELSE
                -- Close approval window, navigate back to the parent form
                -- and execute query.

                    hide_window('po_approve');
                app_special.enable('MODAL', PROPERTY_ON);
                go_item(NAME_IN('poxdoapp_globals.return_field'));

                     IF l_approval_mode = 'BACKGROUND' THEN
                  DO_KEY('CLEAR_RECORD');
       
                  IF NAME_IN('poxdoapp_globals.document_type_code') = 'RELEASE' THEN
                        IF name_in('PO_HEADERS.ROW_ID') is NULL THEN
                                     set_record_property (to_number(name_in('SYSTEM.CURSOR_RECORD')),
                                                             'PO_RELEASES', STATUS, NEW_STATUS);
                        END IF;
                  ELSIF name_in('poxdoapp_globals.document_type_code') IN ('PO', 'PA') THEN
                        IF name_in('PO_HEADERS.ROW_ID') is NULL THEN
                                     set_record_property (to_number(name_in('SYSTEM.CURSOR_RECORD')),
                                                             'PO_HEADERS', STATUS, NEW_STATUS);
                        END IF;

                  END IF;       
               
                ELSE
                        /*  FPI CBC -- Start */
                       IF IGC_CBC_PO_GRP.Cbc_Po_Enabled_Flag = 'Y'
                       AND  (l_unencum_doc_exists
                       OR    Name_In('PO_APPROVE.RESERVE') = 'RESERVE' )
                       THEN
                            po_approve_c9.igc_view_results;
                       END IF;
                       /* FPI CBC -- End */


                        execute_query;       
                END IF;

                    -- NULL out the query parameters after executing the query.
                    copy (NULL, 'PARAMETER.search_criteria_from');
                IF NAME_IN('poxdoapp_globals.document_type_code') = 'REQUISITION' THEN
                        copy (NULL, 'PARAMETER.g_query_find');
                            copy (NULL, 'PARAMETER.p_requisition_header_id');       
                ELSIF NAME_IN('poxdoapp_globals.document_type_code') = 'RELEASE' THEN
                            copy (NULL, 'PARAMETER.po_release_id');
                ELSE
                            copy (NULL, 'PARAMETER.po_header_id');
                END IF;       
        END IF;

EXCEPTION
    WHEN OTHERS THEN
            SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'DEFAULT');
        PO_MESSAGE_C.SHOW;
        RAISE;

END;  -- wf_approve_doc()


/* ************************************************************************ *

        PRIVATE PROCEDURES / FUNCTIONS.

   ************************************************************************ */

/*
        This procedure sets up the arguments for the call to the Workflow StarUp Process
        depending upon the docuement type.
*/

PROCEDURE SetUpWorkFlow ( ActionOriginatedFrom   IN varchar2,
                          DocumentID                 IN number,
                          DocumentNumber         IN varchar2,
                          PreparerID             IN number,
                          DocumentTypeCode       IN varchar2,
                          DocumentSubtype        IN varchar2,
                          RequestorAction        IN varchar2,
                          forwardToID            IN number default NULL,
                          forwardFromID          IN number,
                          DefaultApprovalPathID  IN number,
                          DocumentStatus         IN varchar2,
                          DocumentNote           IN varchar2)
IS

        l_seq                  varchar2(10);
        ItemType               varchar2(8) := null;
        ItemKey                       varchar2(240) := null;
        WorkflowProcess               varchar2(80) := null;
        print_check               varchar2(3);

        fax_check               varchar2(3);
        fax_number               varchar2(30);
        email_check               varchar2(30);
        emailaddress               varchar2(2000);
        xml_or_edi                        varchar2(10);
       
-- FPH Autocreate sourcing Rule Start
        rel_gen_mthd           varchar2(30);
        create_sourcing_rule   varchar2(30);
        update_sourcing_rule   varchar2(30);
-- FPH Autocreate sourcing Rule End

        l_massupdate_release    VARCHAR2(1) := 'N'; -- RETROACTIVE FPI
        l_org_assign_change     VARCHAR2(1) := 'N'; -- GA FPI

        -- <FPJ Redesign Approval Window START>
        l_change_summary        PO_HEADERS_ALL.change_summary%TYPE;
        -- <FPJ Redesign Approval Window END>
        
        -- <FPJ Retroactive START>
        l_communicate_updates        VARCHAR2(1) := 'N';
        l_retro_price_change         VARCHAR2(1) := 'N';
        -- <FPJ Retroactive START>
BEGIN


/* Bug# 1691814: kagarwal
** Desc: Changed PO_DOCUMENT_TYPES_V to PO_DOCUMENT_TYPES to improve
** the perfomance of the SQL.
*/
        /* RETROACTIVE FPI START.
         * Deleted the code which derived item_type, itemkey and workflow
         * process since they are now done in start_wf_process.
        */


        print_check := NAME_IN('poxdoapp_globals.print_flag');

-- Autocreate sourcing Rule Start
        create_sourcing_rule := name_in('po_approve.create_sourcing_rule');
        update_sourcing_rule := name_in('po_approve.update_sourcing_rule');
        /* RETROACTIVE FPI START */
        l_massupdate_release := name_in('po_approve.massupdate_releases');
        /* RETROACTIVE FPI END */
        
        /*
        Fix for 2328967 by davidng
        The parameter po_approve.rel_gen_mtd_cd is no longer used.
        Instead, po_approve.release_generation_method is used.
        */

        rel_gen_mthd := name_in('po_approve.release_generation_method');

        -- rel_gen_mthd := name_in('po_approve.rel_gen_mthd_cd');
        -- Note that we are passing the code and not the displayed field.
        /* End fix by davidng */       

-- Autocreate sourcing Rule End

        -- <FPJ Redesign Approval Window START>
        l_change_summary := name_in('po_approve.change_summary');
        /* Update Change Summary */
        if (l_change_summary is not null) then
          if ((DocumentTypeCode='PO' and DocumentSubtype='STANDARD') or
              (DocumentTypeCode='PA' and DocumentSubtype='BLANKET')) then
            update po_headers_all
            set    change_summary = l_change_summary
            where  po_header_id = DocumentID;
          elsif (DocumentTypeCode='RELEASE' and DocumentSubtype='BLANKET') then
            update po_releases_all
            set    change_summary = l_change_summary
            where  po_release_id = DocumentID;
          end if;
        end if;
        -- <FPJ Redesign Approval Window END>

        /* XML Delivery Project, FPG+ */
        if((DocumentTypeCode='RELEASE' and DocumentSubtype='BLANKET')
                or(DocumentTypeCode='PO' and DocumentSubtype='STANDARD')) then
               
                xml_or_edi := name_in('PO_APPROVE.XML_OR_EDI');

                if(xml_or_edi = 'XML') then
                        if(DocumentTypeCode='RELEASE' and DocumentSubtype='BLANKET') then
                               
                                update po_releases_all
                                set xml_flag = 'Y' where po_release_id = DocumentID;
                        
                        update po_releases_all
                        set edi_processed_flag = 'N' where po_release_id = DocumentID;               
                    else
                           
                                update po_headers_all
                                set xml_flag = 'Y' where po_header_id = DocumentID;
                        
                        update po_headers_all
                        set edi_processed_flag = 'N' where po_header_id = DocumentID;               
                    end if;
                else
                        if(DocumentTypeCode='RELEASE' and DocumentSubtype='BLANKET') then               
               
                update po_releases_all
                set xml_flag = 'N' where po_release_id = DocumentID;
            else
               
                update po_headers_all
                set xml_flag = 'N' where po_header_id = DocumentID;
            end if;
                end if;
        end if;
        /* XML Delivery Project, FPG+ END*/

        --Bug 2756732 Start
        fax_check  := NAME_IN('po_approve.fax_check');
        fax_number := NAME_IN('po_approve.fax_number');

        If (fax_check = 'Y' AND fax_number is NULL ) then
           FND_MESSAGE.SET_NAME('PO','PO_FAX_NUMBER_REQUIRED');
           FND_MESSAGE.ERROR;
           RAISE form_trigger_failure;
        end if;
        --Bug 2756732 End

        email_check := NAME_IN('po_approve.email_check');
        If (email_check = 'Y' ) then
                If (name_in('po_approve.email_address') is null) then
                        FND_MESSAGE.SET_NAME('PO','PO_EMAIL_ADDRESS_REQUIRED');
                        FND_MESSAGE.ERROR;
                        RAISE form_trigger_failure;
                else
                        emailaddress :=  NAME_IN('po_approve.email_address');
                end if;
        end if;

        IF ( (create_sourcing_rule = 'Y' or update_sourcing_rule = 'Y') AND (nvl(length(ltrim(rtrim(rel_gen_mthd))), 0) = 0) )  then
        FND_MESSAGE.SET_NAME('PO', 'PO_APP_ENTER_RGM_MTHD');
        FND_MESSAGE.ERROR;
                RAISE form_trigger_failure;
    END IF;
        
        /* GA FPI Start : Pass the parameter which indicates whether a change has been
         * made in the GA org assignments for a PO */

         IF name_in('system.current_form') = 'POXPOEPO' THEN
           l_org_assign_change := name_in('PARAMETER.ORG_ASSIGN_CHANGE');  
         END IF;

        /* GA FPI End */
        
        -- <FPJ Retroactive START>
        l_communicate_updates := name_in('PO_APPROVE.COMMUNICATE_UPDATES');
        IF name_in('system.current_form') IN ('POXPOEPO', 'POXPOERL') THEN
          l_retro_price_change := name_in('D_GLOBALS.RETROACTIVE_CHANGE_FLAG');
          copy('N','d_globals.retroactive_change_flag');
          -- <Bug 3325520 START>
          IF ((DocumentTypeCode = 'RELEASE' AND DocumentSubtype = 'BLANKET') OR
              (DocumentTypeCode = 'PO' AND DocumentSubtype = 'STANDARD'))
          THEN
            l_communicate_updates := 'Y';
          END IF; /*IF ((DocumentTypeCode = 'RELEASE' AND DocumentSubtype = 'BLANKET') OR*/
          -- <Bug 3325520 END>

        ELSE
          l_retro_price_change := 'N';        
        END IF;
        -- <FPJ Retroactive START>

        PO_REQAPPROVAL_INIT1.Start_WF_Process ( ItemType => ItemType,
                                                       ItemKey => ItemKey,
                                                WorkflowProcess => WorkflowProcess,
                                                 ActionOriginatedFrom => ActionOriginatedFrom,
                                                  DocumentID => DocumentID,
                                                  DocumentNumber => DocumentNumber,
                                                  PreparerID => PreparerID,
                                                  DocumentTypeCode => DocumentTypeCode,
                                                  DocumentSubtype => DocumentSubtype,
                                                  SubmitterAction => RequestorAction,
                                                  forwardToID => forwardToID,
                                                  forwardFromID => forwardFromID,
                                                  DefaultApprovalPathID => DefaultApprovalPathID,
                                                Note => DocumentNote,
                                                printFlag => print_check,
                                                FaxFlag => fax_check,
                                                FaxNumber => fax_number,
                                                EmailFlag => email_check,
                                                EmailAddress => emailaddress,
                                                CreateSourcingRule => Create_Sourcing_Rule,
                                                UpdateSourcingRule => Update_Sourcing_Rule,
                                                ReleaseGenMethod => Rel_Gen_Mthd,
                                                MassUpdateReleases => l_massupdate_release, -- RETROACTIVE FPI CHANGE
                                                -- <FPJ Retroactive>
                                                RetroactivePriceChange => l_retro_price_change ,
                                                OrgAssignChange  => l_org_assign_change,  -- GA FPI
                                                CommunicatePriceChange => l_communicate_updates);

        EXCEPTION
              when form_trigger_failure then
                 po_message_c.Show;
                 RAISE form_trigger_failure;
              when others then
                 po_message_s.sql_error('WF_Error','000',sqlcode);
                 raise;

        END;  -- PROCEDURE SetUpWorkFlow

END;  -- PO_WF_APPROVE_C Package.

使用道具 举报

回复
论坛徽章:
0
13#
发表于 2011-7-18 17:56 | 只看该作者
能不能调过WF直接更新状态

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表