Oracle applications - Surendranath Subramani: Standard hooks in Oracle Purchasing and Oracle payable module

Thursday, July 27, 2017

Standard hooks in Oracle Purchasing and Oracle payable module

Date: 27-Jul-2017
Instance Version: 12.1.3
Database: 11.2.0.4

Purpose:

Today we will see what is the purpose of standard hooks and how to use it and available hooks in purchasing and payable module.

What is hook: it use to enable the custom functionality or custom validation in the standard process without modifying the seeded objects.

Advantage: When you apply patch, hooks are not impacted so it is safe to apply patch. When you modify seeded objects, oracle will not support and seeded objects can be easy impacted due to patch.

With no delay we will see what are the hooks available.

PO Module:

Submit Purchase Order: 

PO_CUSTOM_SUBMISSION_CHECK_PVT


AP Module:

Invoice Validation

AP_CUSTOM_INV_VALIDATION_PKG

Internet Expense Report:

AP_WEB_EXPENSE_CUST_WF

This package is called in workflow (APEXP).


Example:

I will show you how to add custom logic while submitting purchase Order.




 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

PACKAGE PO_CUSTOM_SUBMISSION_CHECK_PVT ......

PROCEDURE do_pre_submission_check(
    p_api_version                    IN             NUMBER,
    p_document_id                    IN             NUMBER,
    p_action_requested               IN             VARCHAR2,
    p_document_type                  IN             VARCHAR2,
    p_document_subtype               IN             VARCHAR2,
    p_document_level                 IN             VARCHAR2,
    p_document_level_id              IN             NUMBER,
    p_requested_changes              IN             PO_CHANGES_REC_TYPE,
    p_check_asl                      IN             BOOLEAN,
    p_req_chg_initiator              IN             VARCHAR2,
    p_origin_doc_id                  IN             NUMBER,
    p_online_report_id               IN             NUMBER,
    p_user_id                        IN             NUMBER,
    p_login_id                       IN             NUMBER,
    p_sequence                       IN OUT NOCOPY  NUMBER,
    x_return_status                  OUT NOCOPY     VARCHAR2
  )
  IS
    l_api_name    CONSTANT varchar2(50)  := 'do_pre_submission_check';
    l_api_version CONSTANT NUMBER        := 1.0;
    d_mod         CONSTANT VARCHAR2(100) := d_do_pre_submission_check;
    d_position    NUMBER := 0;
    lv_return_status VARCHAR2(4000);

  BEGIN

    x_return_status := FND_API.G_RET_STS_SUCCESS;
    d_position := 100;
    
    -- Call custom validation
    
    BEGIN
    xx_po_process.validate_po(p_document_id,p_user_id,lv_return_status);
    IF (lv_return_status = 'S' OR lv_return_status IS NULL) THEN
        x_return_status := FND_API.G_RET_STS_SUCCESS;
    ELSE
        x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
        FND_MESSAGE.Set_Name('PO', lv_return_status);
        FND_MSG_PUB.Add;    
    END IF;   
    EXCEPTION WHEN OTHERS THEN
      NULL;
    END;    

  EXCEPTION
    WHEN OTHERS
    THEN
      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
      IF po_log.d_exc
      THEN
        PO_LOG.exc(d_mod, d_position, SQLCODE || ': ' || SQLERRM);
        PO_LOG.proc_end(d_mod, 'd_position', d_position);
        PO_LOG.proc_end(d_mod, 'x_return_status', x_return_status);
        PO_LOG.proc_end(d_mod);
      END IF;

  END do_pre_submission_check;


Thanks for visiting my blog! Your comments are much appreciated!


No comments:

Post a Comment