Wednesday, 13 August 2014

Basic Code

  SUBMIT_REQUEST
====================
DECLARE

 P_ID1   VARCHAR2(30);
 P_ID2   NUMBER;
 ln_request_id           NUMBER          := 0;
 LC_PERIOD_NAME     VARCHAR2(30);
 LN_APPLICATION_ID NUMBER;
 LN_LEDGER_ID  NUMBER;
 LC_LEDGER_SHORT_NAME VARCHAR2(30);

BEGIN

 P_ID1    := #DISPOSITION_ID1#;
 P_ID2    := #DISPOSITION_ID2#;

SELECT  GPS.ATTRIBUTE2
        ,GPS.ATTRIBUTE3
        ,GPS.ATTRIBUTE4
        ,GL.SHORT_NAME
INTO   LC_PERIOD_NAME    
           ,LN_APPLICATION_ID
           ,LN_LEDGER_ID
           ,LC_LEDGER_SHORT_NAME
FROM    LA_EXTENSION_VALUES  GPS
        ,GL_LEDGERS GL
WHERE   GPS.ATTRIBUTE4=GL.LEDGER_ID
AND     GPS.ATTRIBUTE2=P_ID1
AND     GPS.ATTRIBUTE3=101
AND     GPS.ATTRIBUTE4=P_ID2;

                    ln_request_id:=fnd_request.submit_request ('SQLGL',
                                                'GLOOAP',
                                                'Open Period',
                                                SYSDATE,
                                                FALSE, --TRUE,   --sub_request
                                                LC_LEDGER_SHORT_NAME,  --Ledger/Ledger Set
                                                1017,  --Access Set ID
                                                LN_LEDGER_ID,  --Ledger ID
                                                101,  --Chart Of Accounts ID
                                                LN_APPLICATION_ID,  --Application ID
                                                'P',  -- Execution Mode
                                                LC_PERIOD_NAME    -- Period Name
                                               );
                 COMMIT;

END;


===============================================================
select name from gl_ledgers
where ledger_id = gl_access_set_security_pkg.get_default_ledger_id
(FND_PROFILE.VALUE('GL_ACCESS_SET_ID'),'F');

===============================================================
DECLARE
   P_ID1                            number:=#DISPOSITION_ID1#;
   v_validate                       BOOLEAN := FALSE;
   v_attribute20                    VARCHAR2 (100) := NULL;
   v_valid_grades_changed_warning   BOOLEAN;

   CURSOR c1
   IS
      SELECT position_id, object_version_number, position_definition_id, name
      FROM per_all_positions
      WHERE position_id = P_ID1;
BEGIN
   FOR a IN c1
   LOOP
      hr_position_api.update_position (p_validate => v_validate,
                                       p_position_id => a.position_id,
                                       p_object_version_number => a.object_version_number,
                                       p_attribute20 => v_attribute20,
                                       p_position_definition_id => a.position_definition_id,
                                       p_name => a.name,
                                       p_valid_grades_changed_warning => v_valid_grades_changed_warning
      );
   END LOOP;
END;


==================================================================
/* Formatted on 8/13/2014 8:41:17 AM (QP5 v5.115.810.9015) */
DECLARE
   p_id1   NUMBER := #disposition_id1#;

   CURSOR c1
   IS
      SELECT ROWID,
             org_information_id,
             org_information_context,
             organization_id,
             org_information1,
             org_information10,
             org_information11,
             org_information12,
             org_information13,
             org_information14,
             org_information15,
             org_information16,
             org_information17,
             org_information18,
             org_information19,
             org_information2,
             org_information20,
             org_information3,
             org_information4,
             org_information5,
             org_information6,
             org_information7,
             org_information8,
             org_information9,
             attribute_category,
             attribute1,
             attribute2,
             attribute3,
             attribute4,
             attribute5,
             attribute6,
             attribute7,
             attribute8,
             attribute9,
             attribute10,
             attribute11,
             attribute12,
             attribute13,
             attribute14,
             attribute15,
             attribute16,
             attribute17,
             attribute18,
             attribute19,
             attribute20
      FROM hr_organization_information
      WHERE     organization_id = p_id1
            AND org_information1 = 'HR_ORG'
            AND org_information_context = 'CLASS';
BEGIN
   FOR a IN c1
   LOOP
      a.org_information2   := 'Y';
      hr_org_information_pkg.update_row (a.ROWID,
                                         a.org_information_id,
                                         a.org_information_context,
                                         a.organization_id,
                                         a.org_information1,
                                         a.org_information10,
                                         a.org_information11,
                                         a.org_information12,
                                         a.org_information13,
                                         a.org_information14,
                                         a.org_information15,
                                         a.org_information16,
                                         a.org_information17,
                                         a.org_information18,
                                         a.org_information19,
                                         a.org_information2,
                                         a.org_information20,
                                         a.org_information3,
                                         a.org_information4,
                                         a.org_information5,
                                         a.org_information6,
                                         a.org_information7,
                                         a.org_information8,
                                         a.org_information9,
                                         a.attribute_category,
                                         a.attribute1,
                                         a.attribute2,
                                         a.attribute3,
                                         a.attribute4,
                                         a.attribute5,
                                         a.attribute6,
                                         a.attribute7,
                                         a.attribute8,
                                         a.attribute9,
                                         a.attribute10,
                                         a.attribute11,
                                         a.attribute12,
                                         a.attribute13,
                                         a.attribute14,
                                         a.attribute15,
                                         a.attribute16,
                                         a.attribute17,
                                         a.attribute18,
                                         a.attribute19,
                                         a.attribute20
      );
   END LOOP;
END;

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

declare
xx number;
begin

/* Formatted on 8/13/2014 8:42:23 AM (QP5 v5.115.810.9015) */
UPDATE xxogs_ap_sup
SET new_terms_id   =
       (SELECT terms_id
        FROM ap_suppliers
        WHERE vendor_id = #disposition_id1#
              AND enabled_flag = #disposition_id2#),
    val_flag   = 'T'
WHERE     vendor_id = #disposition_id1#
      AND enabled_flag = #disposition_id2#
      AND val_flag IS NULL;
     
commit;


/* Formatted on 8/13/2014 8:42:40 AM (QP5 v5.115.810.9015) */

UPDATE xxogs_ap_sup
SET new_terms_id = NULL, val_flag = NULL
WHERE     vendor_id = #disposition_id1#
      AND enabled_flag = #disposition_id2#
      AND val_flag = 'T'
      AND terms_id = NVL (new_terms_id, terms_id);
     
commit;

end;


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

DECLARE
   p_id1        NUMBER;
   p_id2        NUMBER;
   r_order_id   NUMBER;
   r_resp_id    NUMBER;
   opmsg        VARCHAR2 (2000);
   errbuf       VARCHAR2 (2000);
   retcode      VARCHAR2 (2000);
BEGIN
   p_id1 := #DISPOSITION_ID1#;
   p_id2 :=#DISPOSITION_ID2#;

   BEGIN
      SELECT order_type_id
        INTO r_order_id
        FROM oe_order_headers_all
       WHERE header_id = p_id1;
   EXCEPTION
      WHEN NO_DATA_FOUND
      THEN
         INSERT INTO grc_om_test
              VALUES (p_id1, p_id2, 'No Transaction Type Found');
   END;

   BEGIN
      SELECT a.responsibility_id
        INTO r_resp_id
        FROM fnd_login_responsibilities a, fnd_logins b
       WHERE a.login_id = b.login_id
         AND b.user_id = (SELECT created_by
                            FROM oe_order_headers_all
                           WHERE header_id = p_id1)
         AND b.login_type = 'FORM'
         AND a.resp_appl_id = 660
         AND a.start_time IN (SELECT MAX (start_time)
                                FROM fnd_login_responsibilities
                               WHERE resp_appl_id = 660);
   EXCEPTION
      WHEN NO_DATA_FOUND
      THEN
         INSERT INTO grc_om_test
              VALUES (p_id1, p_id2, 'No Resp Found');
   END;

   INSERT INTO grc_om_test
        VALUES (p_id1, p_id2, r_order_id);
   INSERT INTO grc_om_test
        VALUES (p_id1, p_id2, r_resp_id);  
   IF r_order_id=4181 and r_resp_id=52300 THEN
    INSERT INTO grc_om_test
         VALUES (p_id1, p_id2, 'PCG START');

   sales_order_proc (p_id1, p_id2, opmsg, errbuf, retcode);

   INSERT INTO grc_om_test
        VALUES (p_id1, p_id2, opmsg);

   COMMIT;

   INSERT INTO grc_om_test
        VALUES (p_id1, p_id2, 'PCG END');
   END IF;    

   COMMIT;
END;




Pending and Running   

DECLARE

P_ID1   number:=#DISPOSITION_ID1#;
P_ID2   number:=#DISPOSITION_ID2#;

BEGIN

UPDATE
fnd_concurrent_requests
SET phase_code = 'P',
status_code = 'I'
WHERE
REQUEST_ID = P_ID1
AND CONCURRENT_PROGRAM_ID = P_ID2;

COMMIT;

END;

Complete Cancel

DECLARE

 P_ID1   number:=#DISPOSITION_ID1#;
 P_ID2   number:=#DISPOSITION_ID2#;

BEGIN

UPDATE fnd_concurrent_requests
SET PHASE_CODE='C'
,STATUS_CODE='D'
Where REQUEST_ID = P_ID1
 and CONCURRENT_PROGRAM_ID = P_ID2;

COMMIT;

END;

1 comment:

  1. Regards
    Sridevi Koduru (Senior Oracle Apps Trainer Oracleappstechnical.com)
    LinkedIn profile - https://in.linkedin.com/in/sridevi-koduru-9b876a8b
    Please Contact for One to One Online Training on Oracle Apps Technical, Financials, SCM, Oracle Manufacturing, BI Publisher, OAF, ADF, SQL, PL/SQL, D2K at sridevikoduru@oracleappstechnical.com | +91 - 9581017828.

    ReplyDelete