Tuesday, July 30, 2019

Setting the Password for PDF File sent through XML Publisher

Setting the Password for PDF File sent through XML Publisher

Open the rtf for which you want to set password and do the following things

1) Open the .rtf
2) Go to File - > Properties 
Create a new custom property 
a) Name : xdo-pdf-open-password
Type : text 
Value : Either Hard Code the value / or get the value for xml data 
b) Name : xdo-pdf-security
Type : text
Value : true

Note : property name should always start with xdo-

Monday, July 29, 2019

Get TimeZone profile value from EBS


--Get TimeZone profile value from EBS

 select '(GMT ' ||rtrim(tz_offset(ftv.timezone_code),chr(0))
|| ') ' || ftv.name time_zone from fnd_profile_option_values fpov ,FND_TIMEZONES_VL ftv
where 1=1 and fpov.profile_option_value=ftv.upgrade_tz_id
and fpov.Profile_Option_Id='3772' and fpov.LEVEL_ID='10001';

Get Only Time Stamp From Date


Select to_char(:P_DATE,'HH24:MI AM') from dual

Select to_char(sysdate,'HH24:MI AM') from dual

Select to_char(:P_DATE,'HH24:MI:SS AM') from dual

Select to_char(sysdate,'HH24:MI:SS AM') from dual

Sunday, July 28, 2019

AME IMP Queries

AME IMP Queries

/* AME API to fetch all approvers for transaction */
DECLARE
   l_next_approver   ame_util.approverrecord;
   approversout      ame_util.approverstable;
BEGIN
   ame_api.getallapprovers
                       (800,                                -- APPLICATION_ID
                        5,                                  -- TRANSACTION_ID
                        'MANPOWER_REQUISITION_TRANSACTION', -- TRANSACTION_TYPE
                        approversout
                       );

   FOR i IN approversout.FIRST .. approversout.LAST
   LOOP
      DBMS_OUTPUT.put_line (i | '-' || approversout (i).person_id);
      DBMS_OUTPUT.put_line (i || '-' || approversout (i).authority);
   END LOOP;
END;


/* AME API to fetch next approver if available */
DECLARE
   l_next_approver   ame_util.approverrecord;
BEGIN
   ame_api.getnextapprover
                        (800,                                  -- APPLICATION_ID
                         1,                                    -- TRANSACTION_ID
                         'MANPOWER_REQUISITION_TRANSACTION',   -- TRANSACTION_TYPE
                         l_next_approver                       -- OUT PARAMETER
                        );
   DBMS_OUTPUT.put_line (l_next_approver.person_id);
END;



/* AME API to delete current approver from Approver hierarchy */
DECLARE
   l_next_approver   ame_util.approverrecord;
BEGIN
   l_next_approver.person_id := 1473;
   ame_api.deleteapprover
                       (800,                                 -- APPLICATIONI_ID
                        1,                                   --TRANSACTIONI_ID
                        l_next_approver,
                        'MANPOWER_REQUISITION_TRANSACTION'   --TRANSACTION_TYPE
                       );
   DBMS_OUTPUT.put_line (l_next_approver.person_id);
END;

/* Calling WorkFlow from Back End */

DECLARE
   itemkey                NUMBER         := 4;
   itemtype               VARCHAR2 (150) := 'XXMPRFWF';
   created_by_user_name   VARCHAR2 (150) := NULL;
BEGIN
  
   
   wf_engine.createprocess (itemtype, itemkey, 'MANPOWER REQUISITION_PROCE');
  

   SELECT user_name
     INTO created_by_user_name
     FROM fnd_user
    WHERE user_id = 1162;

   DBMS_OUTPUT.put_line (' created_by_user_name ' || created_by_user_name);
   wf_engine.setitemattrtext (itemtype      => itemtype,
                              itemkey       => itemkey,
                              aname         => 'REQUESTOR_UNAME',
                              avalue        => created_by_user_name
                             );
   wf_engine.setitemattrtext (itemtype      => itemtype,
                              itemkey       => itemkey,
                              aname         => 'CREATED_BY_USER_NAME',
                              avalue        => created_by_user_name
                             );
   wf_engine.setitemattrtext (itemtype      => itemtype,
                              itemkey       => itemkey,
                              aname         => 'AME_TRANSACTION_TYPE',
                              avalue        => 'MANPOWER_REQUISITION_TRANSACTION' -AME TRANSACTION NAME
                              );                         
   wf_engine.setitemattrnumber (itemtype      => itemtype,
                                itemkey       => itemkey,
                                aname         => 'AME_TRANSACTION_ID',
                                avalue        => itemkey
                               );
   wf_engine.startprocess (itemtype, itemkey);
   DBMS_OUTPUT.put_line (' Started Successfuly...!!!');
   COMMIT;
END;


/* Query to Get AME Details which contains Rule Name, Condition and Approver Group */
SELECT ar.rule_id,
         art.description rule_name,
         ar.start_date,
         ar.end_date,
         ame_utility_pkg.get_condition_description (acu.condition_id) condition,
         aty.name action_type,
         ame_utility_pkg.get_action_description (ameactionusageeo.action_id)
            AS approver_group
    FROM ame_rules ar,
         ame_rules_tl art,
         ame_condition_usages acu,
         ame_action_usages ameactionusageeo,
         ame_actions_vl act,
         ame_action_types_vl aty,
         (SELECT *
            FROM ame_action_type_usages
           WHERE rule_type <> 2
                 AND TRUNC(SYSDATE) BETWEEN start_date
                                 AND NVL (end_date - (/ 86400), SYSDATE)) atu
   WHERE ar.rule_id = art.rule_id AND art.language = 'US'
         AND TRUNC (SYSDATE) BETWEEN ar.start_date
                                 AND NVL (
                                        ar.end_date,
                                        TO_DATE ('31-DEC-4712', 'DD-MON-YYYY'))
         --AND UPPER (art.description) LIKE '%MPRF%'
         AND acu.rule_id = ar.rule_id
         AND TRUNC (SYSDATE) BETWEEN acu.start_date
                                 AND NVL (
                                        acu.end_date,
                                        TO_DATE ('31-DEC-4712', 'DD-MON-YYYY'))