Monday, January 31, 2011

AR_RECEIPT_API_PUB.Unapply_on_account ( Script to unapply on account a Receipt in R12)

                                                                                                                          

Below script will be useful to unapply on account a receipt using the API AR_RECEIPT_API_PUB.Unapply_on_account
This script is tested in R12.1.1 instance 

SCRIPT:
set serveroutput on;
DECLARE
v_return_status      VARCHAR2(1);
v_msg_count          NUMBER;
v_msg_data           VARCHAR2(240);
v_count              NUMBER;
v_receipt_number     VARCHAR2(240) := 'SHAREORACLEAPPS';
v_reversal_gl_date   DATE          := SYSDATE;
v_org_id             NUMBER        := 93;
p_count              NUMBER;

v_context            VARCHAR2(100);

FUNCTION set_context( i_user_name    IN  VARCHAR2
                     ,i_resp_name    IN  VARCHAR2
                     ,i_org_id       IN  NUMBER)
RETURN VARCHAR2
IS
BEGIN
NULL;
-- Inorder to reduce the content of the post I moved the implementation part of this function to another post and it is available here   
END set_context;

BEGIN

--1. Set applications context if not already set.
v_context := set_context('&user_id','&responsibility',&org_id);
IF v_context = 'F'
    THEN
        DBMS_OUTPUT.PUT_LINE('Error while setting the context');       
END IF;


MO_GLOBAL.init('AR');

AR_RECEIPT_API_PUB.Unapply_on_account
           ( p_api_version       => 1.0,
             p_init_msg_list     => FND_API.G_TRUE,
             p_commit            => FND_API.G_TRUE,
             p_validation_level  => FND_API.G_VALID_LEVEL_FULL,
             x_return_status     => v_return_status,
             x_msg_count         => v_msg_count,
             x_msg_data          => v_msg_data,
             p_receipt_number    => v_receipt_number,
             p_reversal_gl_date  => v_reversal_gl_date,
                   p_org_id            => v_org_id
               );
IF v_return_status = 'S' THEN
   DBMS_OUTPUT.put_line('Receipt Unapply on account is Sucessful :');
ELSE
   DBMS_OUTPUT.put_line('Message count ' || v_msg_count);
   IF v_msg_count = 1 THEN
      DBMS_OUTPUT.put_line('v_msg_data '||v_msg_data);
   ELSIF v_msg_count > 1 THEN
   LOOP
      p_count := p_count+1;
      v_msg_data := FND_MSG_PUB.Get(FND_MSG_PUB.G_NEXT,FND_API.G_FALSE);
      IF v_msg_data IS NULL THEN
      EXIT;
      END IF;
      DBMS_OUTPUT.put_line('Message' || p_count ||'---'||v_msg_data);
      END LOOP;
      END IF;
END IF;
END;
/

0 Responses to “AR_RECEIPT_API_PUB.Unapply_on_account ( Script to unapply on account a Receipt in R12)”

Post a Comment

Disclaimer

The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.