Tuesday, February 20, 2018

Step by Step :Using Receipt API ->Create Cash Receipt (Scenario 1)

Long time back , I had a post discussing AR Receipting , API's avaiability and integration with POS based system. This post is sort of tutorial outlines the specifications and the methodology for using the various Receipt APIs.
dgreybarrow Functional Importance of Receipt API's
Oracle receipt APIs provide an extension to existing functionality of creating and manipulating receipts through standard AR Receipts forms and lockboxes.
Most of the public receipt API caters to the following basic functionality via different API calls:
  1. Creating a cash receipt.
  2. Applying a cash receipt to a debit item.
  3. Creating a cash receipt and applying it to a debit item in one pass.
  4. On-account application.
  5. Unapplying the on-account application.
  6. Unapplying the receipt application to a particular transaction.
  7. Reversing the receipt.
  8. Activity application, such as Receipt Write-off.
  9. Creating a miscellaneous receipt.
  10. Other account application, such as Claim Investigation.
  11. Receipt-to-receipt application.
  12. Creating a cash receipt and an on-account application in one pass.
These API potentially used when you are using two major products like AR and Trade managment.
Which API's is not supported
  1. Creating a Batch Receipt
dgreybarrowWhy Receipts API are in demand
  • For Migration in Transformation/re-implemenation project , company want to bring old receipts to newer system. Except Lockbox, there is no other way other than API.
  • Integration :Some sectors like retail, healthcare , Telco need direct Integration with third party POS based system like (WINCOR etc)
  • Need for excel based upload interface : Majority of collection for companies are in third and fourth week of the month , and all entry should go into system thus need for excel based receipt upload cann't be denied. The business need for having receipt WEBADI is still not supported by Oracle.
dgreybarrow What is senarios
The senario which going to discuss here is "Create Cash Receipt "
In Reality a cash receipts may be created as identified (with a customer/Transaction) or as unidentified (without a customer).This routine is called to create cash receipts for the payment received in the form of a check or cash.
The key is
  • When you tag customer/transaction it is identified
  • Where there is no customer attached to receipt it is unidentified.
Moreover Receipt that you are going to create must have a Payment method , which have underline account details for identified and unidentified account.
dgreybarrowWhich API is being used
By using the following procedure Ar_receipt_api_pub.Create_cash you can create a single cash receipt, as in the case of manually created cash receipts.
dgreybarrow Step to use the API
You have to perform these steps in order to get API executed
Step 1 : Identification of some mandatory and key column of API
Once you identify the key and mandatory column , you have 50% done. What is recomended for you to check the API version in irep with your EBS version.
Here is the example.
Case 1 Receipt API Oracle Parameter
Step 2 : Idetify and the mandatory column and must do pre-requsite setup for receipt.
Your Payment method , underline bank, respective accounting details must be pre-requiste step up for creating a receipt in Oracle.
The mandatory requirement is Customer master with valid bill to and a valid transaction that must be open.
Step 3: You need to initialize the apps_initialize pacakge
For this you have to follow these steps:
Run the query 1
  1.  
  2. SELECT USER_ID FROM FND_USER
  3. WHERE USER_NAME='USER_NAME';
  4.  
Run the query 2
  1.  
  2. SELECT application_id FROM fnd_application
  3. WHERE application_short_name LIKE 'APPL_SHRT_NAME'; --'AR';
  4.  
Run the query 3
  1.  
  2. SELECT RESPONSIBILITY_ID
  3. FROM FND_RESPONSIBILITY
  4. WHERE APPLICATION_ID=222;
  5.  
Run the query 4
Run thisscript , this will set the apps environment.
Alternatively you can use fnd_global.apps_initialize(1290,51118,222) before calling API.
Step 4: run the
script in Toad or sql*plus and once the procedure executed correctly Oracle will issue a receipt id.
This is been tested in 11i . With little modification you can use in R12. Here is api code in text file.
dgreybarrow Finally Verification
Make sure you API executed correctly , once done you can check the receipt creation from Receipt workbench screen. What you have to do, just search the Receipt number and verify the details are correctly been populated or not.
Navigate to Receivables
Receipts : Receipts.
Query for Receipt Number 'HUB-TEST1'(As Example discussed above). The below screen shows the created cash receipt
Case 1 Receipt API Oracle
We will some other API usage in another post

Thursday, February 15, 2018

Use of PO_REQAPPROVAL_INIT1.START_WF_PROCESS API to Approve PO, BPA & PR


Use of PO_REQAPPROVAL_INIT1.START_WF_PROCESS API to Approve Purchase Orders, Blanket Purchase Agreements & Purchase Requisition ...
Some times, we are wondering what exactly Oracle is doing when we are clicking on the Approve button in the Purchase Order/Requisition Form. And How does Approve button call the Purchasing approval workflow.

  • When the Approve button is clicked, the approval modal window form for purchasing approvals iscalled (this is form POXDOAPP.fmb and its attached corresponding library file POXAPAPC.pll.). Both Enter Requisition and Enter Purchase Order forms call the the same approval form.
  • The library file POXAPAPC.pll has a procedure PO_WF_APPROVE_C.SetUpWorkFlow that calls the procedure PO_REQAPPROVAL_INIT1.Start_WF_Process in package file POXWPA1B.pls.
  • This server side procedure calls the workflow and initiates the workflow and processes the document through the workflow...

-- R12 - PO - SAMPLE SCRIPT TO APPROVE PURCHASE ORDER
DECLARE
v_item_key VARCHAR2(100);

Cursor c_po_details is

SELECT
pha.po_header_id,
pha.org_id,
pha.segment1,
pha.agent_id,
pdt.document_subtype,
pdt.document_type_code,
pha.authorization_status
FROM apps.po_headers_all pha, apps.po_document_types_all pdt
WHERE pha.type_lookup_code = pdt.document_subtype
AND pha.org_id = pdt.org_id
AND pdt.document_type_code = 'PO'
AND authorization_status in ('INCOMPLETE', 'REQUIRES REAPPROVAL')
AND segment1 = '11170000860'; -- Enter the Purchase Order Number
BEGIN
fnd_global.apps_initialize (user_id => 2083,
resp_id => 20707,
resp_appl_id => 201);
FOR p_rec IN c_po_details
LOOP

mo_global.init (p_rec.document_type_code);
mo_global.set_policy_context ('S', p_rec.org_id);

SELECT p_rec.po_header_id '-' to_char(po_wf_itemkey_s.NEXTVAL)
INTO v_item_key FROM dual;
dbms_output.put_line (' Calling po_reqapproval_init1.start_wf_process for po_id=>' p_rec.segment1);

po_reqapproval_init1.start_wf_process(
ItemType => 'POAPPRV'
, ItemKey => v_item_key
, WorkflowProcess => 'POAPPRV_TOP'
, ActionOriginatedFrom => 'PO_FORM'
, DocumentID => p_rec.po_header_id -- po_header_id
, DocumentNumber => p_rec.segment1 -- Purchase Order Number
, PreparerID => p_rec.agent_id -- Buyer/Preparer_id
, DocumentTypeCode => p_rec.document_type_code--'PO'
, DocumentSubtype => p_rec.document_subtype --'STANDARD'
, SubmitterAction => 'APPROVE'
, forwardToID => NULL
, forwardFromID => NULL
, DefaultApprovalPathID => NULL
, Note => NULL
, PrintFlag => 'N'
, FaxFlag => 'N'
, FaxNumber => NULL
, EmailFlag => 'N'
, EmailAddress => NULL
, CreateSourcingRule => 'N'
, ReleaseGenMethod => 'N'
, UpdateSourcingRule => 'N'
, MassUpdateReleases => 'N'
, RetroactivePriceChange => 'N'
, OrgAssignChange => 'N'
, CommunicatePriceChange => 'N'
, p_Background_Flag => 'N'
, p_Initiator => NULL
, p_xml_flag => NULL
, FpdsngFlag => 'N'
, p_source_type_code => NULL);
commit;

DBMS_OUTPUT.PUT_LINE ('The PO which is Approved Now =>' p_rec.segment1);
END LOOP;
END;

-- R12 - PO - SAMPLE SCRIPT TO APPROVE BLANKET PURCHASE AGREEMENT

DECLARE

v_item_key VARCHAR2(100);

Cursor c_po_details is
SELECT
pha.po_header_id,
pha.org_id,
pha.segment1,
pha.agent_id,
pdt.document_subtype,
pdt.document_type_code,
pha.authorization_status,
pha.approved_flag,
pha.wf_item_type,
pha.wf_item_key
FROM apps.po_headers_all pha, apps.po_document_types_all pdt
WHERE pha.type_lookup_code = pdt.document_subtype
AND pha.org_id = pdt.org_id
AND pdt.document_type_code = 'PA'
AND authorization_status in ('INCOMPLETE', 'REQUIRES REAPPROVAL')
AND segment1 = '11170000021'; -- Enter the BPA Number

BEGIN

fnd_global.apps_initialize (user_id => 2083,
resp_id => 20707,
resp_appl_id => 201);

FOR p_rec IN c_po_details

LOOP
mo_global.init ('PO');
mo_global.set_policy_context ('S', p_rec.org_id);

SELECT p_rec.po_header_id '-' to_char(po_wf_itemkey_s.NEXTVAL)
INTO v_item_key FROM dual;

dbms_output.put_line ('Calling po_reqapproval_init1.start_wf_process for po_id=>' p_rec.segment1);

po_reqapproval_init1.start_wf_process(
ItemType => 'POAPPRV'
, ItemKey => v_item_key
, WorkflowProcess => 'POAPPRV_TOP'
, ActionOriginatedFrom => 'PO_FORM'
, DocumentID => p_rec.po_header_id -- po_header_id
, DocumentNumber => p_rec.segment1 -- Purchase Order Number
, PreparerID => p_rec.agent_id -- Buer/Preparer_id
, DocumentTypeCode => p_rec.document_type_code--'PA'
, DocumentSubtype => p_rec.document_subtype --'BLANKET'
, SubmitterAction => 'APPROVE'
, forwardToID => NULL
, forwardFromID => NULL
, DefaultApprovalPathID => NULL
, Note => NULL
, PrintFlag => 'N'
, FaxFlag => 'N'
, FaxNumber => NULL
, EmailFlag => 'N'
, EmailAddress => NULL
, CreateSourcingRule => 'N'
, ReleaseGenMethod => 'N'
, UpdateSourcingRule => 'N'
, MassUpdateReleases => 'N'
, RetroactivePriceChange => 'N'
, OrgAssignChange => 'N'
, CommunicatePriceChange => 'N'
, p_Background_Flag => 'N'
, p_Initiator => NULL
, p_xml_flag => NULL
, FpdsngFlag => 'N'
, p_source_type_code => NULL);
commit;
dbms_output.put_line ('The BPA which is Approved Now =>' p_rec.segment1);

END LOOP;
END;

-- R12 - PO - SAMPLE SCRIPT TO APPROVE PURCHASE REQUISITION

DECLARE

v_item_key VARCHAR2(100);

Cursor c_req_details is

SELECT
prh.requisition_header_id,
prh.org_id,
prh.preparer_id,
prh.segment1,
pdt.document_subtype,
pdt.document_type_code,
prh.authorization_status
FROM apps.po_requisition_headers_all prh, apps.po_document_types_all pdt
WHERE prh.type_lookup_code = pdt.document_subtype
AND prh.org_id = pdt.org_id
AND pdt.document_type_code = 'REQUISITION'
AND NVL (authorization_status, 'INCOMPLETE') = 'INCOMPLETE'
AND segment1 = '21170000200'; -- Enter The Requisition Number
BEGIN

fnd_global.apps_initialize (user_id => 1805,
resp_id => 20707,
resp_appl_id => 201);

FOR p_rec IN c_req_details

LOOP

mo_global.init ('PO');
mo_global.set_policy_context ('S', p_rec.org_id);

SELECT p_rec.requisition_header_id '-' to_char(po_wf_itemkey_s.NEXTVAL)
INTO v_item_key FROM dual;

dbms_output.put_line (' Calling po_reqapproval_init1.start_wf_process for requisition =>' p_rec.segment1);

po_reqapproval_init1.start_wf_process(
ItemType => NULL
, ItemKey => v_item_key
, WorkflowProcess => 'POAPPRV_TOP'
, ActionOriginatedFrom => 'PO_FORM'
, DocumentID => p_rec.requisition_header_id -- requisition_header_id
, DocumentNumber => p_rec.segment1 -- Requisition Number
, PreparerID => p_rec.preparer_id
, DocumentTypeCode => p_rec.document_type_code-- REQUISITION
, DocumentSubtype => p_rec.document_subtype -- PURCHASE
, SubmitterAction => 'APPROVE'
, forwardToID => NULL
, forwardFromID => NULL
, DefaultApprovalPathID => NULL
, Note => NULL
, PrintFlag => 'N'
, FaxFlag => 'N'
, FaxNumber => NULL
, EmailFlag => 'N'
, EmailAddress => NULL
, CreateSourcingRule => 'N'
, ReleaseGenMethod => 'N'
, UpdateSourcingRule => 'N'
, MassUpdateReleases => 'N'
, RetroactivePriceChange => 'N'
, OrgAssignChange => 'N'
, CommunicatePriceChange => 'N'
, p_Background_Flag => 'N'
, p_Initiator => NULL
, p_xml_flag => NULL
, FpdsngFlag => 'N'
, p_source_type_code => NULL);

commit;

dbms_output.put_line ('The Requisition which is Approved =>' p_rec.segment1);
END LOOP;
END;

Wednesday, February 14, 2018

Find Oracle APPS User Password From Backend

Find Oracle APPS User Password From Backend

In three steps we can find any user name’s password in oracle apps

Step 1. Create below package
This package is used to decrypt the user's password.

CREATE OR REPLACE PACKAGE get_user_pwd
AS
   FUNCTION decrypt (KEY IN VARCHAR2, VALUE IN VARCHAR2)
      RETURN VARCHAR2;
END get_user_pwd;
/


CREATE OR REPLACE PACKAGE BODY get_user_pwd
AS
   FUNCTION decrypt (KEY IN VARCHAR2, VALUE IN VARCHAR2)
      RETURN VARCHAR2
   AS
      LANGUAGE JAVA
      NAME 'oracle.apps.fnd.security.WebSessionManagerProc.decrypt
(java.lang.String,java.lang.String) return java.lang.String';
END get_user_pwd;
/

Step 2. Query to get password for apps user
SELECT (SELECT get_user_pwd.decrypt
                  (UPPER ((SELECT UPPER (fnd_profile.VALUE ('Guest_User_Pwd'))
                             FROM DUAL)
                         ),
                   usertable.encrypted_foundation_password
                  )
          FROM DUAL) AS apps_password
  FROM fnd_user usertable
 WHERE usertable.user_name LIKE
          UPPER ((SELECT SUBSTR (fnd_profile.VALUE ('Guest_User_Pwd'),
                                 1,
                                   INSTR (fnd_profile.VALUE ('Guest_User_Pwd'),
                                          '/'
                                         )
                                 - 1
                                )
                    FROM DUAL)
                );
above query works only in 11i since Oracle removed ‘Guest User Password’ profile option from Release 12 so please use below query for R12

/***********************************************************************************/
/*          QUERY TO GET APPS USER PASSWORD FOR BACK END  IN R12  */
/***********************************************************************************/
ALTER SESSION SET current_schema = apps;

SELECT (SELECT get_user_pwd.decrypt
                    (fnd_web_sec.get_guest_username_pwd,
                     usertable.encrypted_foundation_password
                    )
          FROM DUAL) AS apps_password
  FROM fnd_user usertable
 WHERE usertable.user_name LIKE
          (SELECT SUBSTR (fnd_web_sec.get_guest_username_pwd,
                          1,
                          INSTR (fnd_web_sec.get_guest_username_pwd, '/') - 1
                         )
             FROM DUAL);

Step 3. Query to get password for application user
SELECT usertable.user_name,
       (SELECT get_user_pwd.decrypt
                  (UPPER
                      ((SELECT (SELECT get_user_pwd.decrypt
                                          (UPPER
                                              ((SELECT UPPER
                                                          (fnd_profile.VALUE
                                                              ('Guest_User_Pwd'
                                                              )
                                                          )
                                                  FROM DUAL)
                                              ),
                                           usertable.encrypted_foundation_password
                                          )
                                  FROM DUAL) AS apps_password
                          FROM fnd_user usertable
                         WHERE usertable.user_name LIKE
                                  UPPER
                                     ((SELECT SUBSTR
                                                 (fnd_profile.VALUE
                                                             ('Guest_User_Pwd'),
                                                  1,
                                                    INSTR
                                                       (fnd_profile.VALUE
                                                             ('Guest_User_Pwd'),
                                                        '/'
                                                       )
                                                  - 1
                                                 )
                                         FROM DUAL)
                                     ))
                      ),
                   usertable.encrypted_user_password
                  )
          FROM DUAL) AS encrypted_user_password
  FROM fnd_user usertable
 WHERE usertable.user_name LIKE UPPER ('&Username');

above query works only in 11i since Oracle removed ‘Guest User Password’ profile option from Release 12 so please use below query for R12

/***********************************************************************************/
/*          QUERY TO GET APPS USER PASSWORD FOR BACK END  IN R12  */
/***********************************************************************************/
ALTER SESSION SET current_schema = apps;

SELECT usr.user_name, usr.description,
       get_user_pwd.decrypt
          ((SELECT (SELECT get_user_pwd.decrypt
                              (fnd_web_sec.get_guest_username_pwd,
                               usertable.encrypted_foundation_password
                              )
                      FROM DUAL) AS apps_password
              FROM fnd_user usertable
             WHERE usertable.user_name =
                      (SELECT SUBSTR
                                  (fnd_web_sec.get_guest_username_pwd,
                                   1,
                                     INSTR
                                          (fnd_web_sec.get_guest_username_pwd,
                                           '/'
                                          )
                                   - 1
                                  )
                         FROM DUAL)),
           usr.encrypted_user_password
          ) PASSWORD
  FROM fnd_user usr
 WHERE usr.user_name = '&User_Name';

Oracle Fusion - Cost Lines and Expenditure Item link in Projects

SELECT   ccd.transaction_id,ex.expenditure_item_id,cacat.serial_number FROM fusion.CST_INV_TRANSACTIONS cit,   fusion.cst_cost_distribution_...