Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

--- this script you can use to set the environment.

--- this is tested in 11i


--- you need to pass the details from query 1, 2 and 3
DECLARE

p_user_id NUMBER;
p_resp_id NUMBER;
p_resp_appl_id NUMBER;

BEGIN

p_user_id := 1011 -- pass the value of query 1


p_resp_id := 50556; -- pass the value of query 2
p_resp_appl_id := 222; -- pass the value of query 3

fnd_global.apps_initialize
(
user_id => p_user_id,
resp_id => p_resp_id,
resp_appl_id => p_resp_appl_id
);

END;

1) SELECT USER_ID FROM FND_USER


WHERE USER_NAME='USER_NAME';

2)SELECT application_id FROM fnd_application


WHERE application_short_name LIKE 'APPL_SHRT_NAME';
 

3)SELECT RESPONSIBILITY_ID
FROM FND_RESPONSIBILITY
WHERE APPLICATION_ID=222;
)

DECLARE

p_api_version NUMBER;
p_init_msg_list VARCHAR2(200);
p_commit VARCHAR2(200);
p_validation_level NUMBER;
x_return_status VARCHAR2(200);
x_msg_count NUMBER;
x_msg_data VARCHAR2(200);
p_cash_receipt_id ar_cash_receipts.cash_receipt_id%TYPE;
p_receipt_number ar_cash_receipts.receipt_number%TYPE;
p_amount_applied
ar_receivable_applications.amount_applied%TYPE;
p_applied_payment_schedule_id
ar_payment_schedules.payment_schedule_id%TYPE;
p_link_to_customer_trx_id ra_customer_trx.customer_trx_id
%TYPE;
p_receivables_trx_id
ar_receivable_applications.receivables_trx_id%TYPE;
p_apply_date ar_receivable_applications.apply_date
%TYPE;
p_apply_gl_date ar_receivable_applications.gl_date
%TYPE;
p_ussgl_transaction_code
ar_receivable_applications.ussgl_transaction_code%TYPE;
p_attribute_rec AR_RECEIPT_API_PUB.attribute_rec_type;
p_global_attribute_rec
AR_RECEIPT_API_PUB.global_attribute_rec_type;
p_comments ar_receivable_applications.comments
%TYPE;
p_application_ref_type
ar_receivable_applications.application_ref_type%TYPE;
p_application_ref_id
ar_receivable_applications.application_ref_id%TYPE;
p_application_ref_num
ar_receivable_applications.application_ref_num%TYPE;
p_secondary_application_ref_id
ar_receivable_applications.secondary_application_ref_id%TYPE;
p_payment_set_id
ar_receivable_applications.payment_set_id%TYPE;
p_receivable_application_id
ar_receivable_applications.receivable_application_id%TYPE;
p_customer_reference
ar_receivable_applications.customer_reference%TYPE;
p_val_writeoff_limits_flag VARCHAR2(200);
p_called_from VARCHAR2(200);
p_netted_receipt_flag VARCHAR2(200);
p_netted_cash_receipt_id ar_cash_receipts.cash_receipt_id%TYPE;
p_secondary_app_ref_type
ar_receivable_applications.secondary_application_ref_type%TYPE;
p_secondary_app_ref_num
ar_receivable_applications.secondary_application_ref_num%TYPE;

BEGIN

p_cash_receipt_id := 27673;
p_receipt_number := 'TEST-UOB-7';
p_amount_applied := 3;
p_applied_payment_schedule_id := -3;
p_receivables_trx_id := 1483;

fnd_global.apps_initialize( 1290,51118,222);

AR_RECEIPT_API_PUB.Activity_application(
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 => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
p_cash_receipt_id => p_cash_receipt_id,
p_receipt_number => p_receipt_number,
p_amount_applied => p_amount_applied,
p_applied_payment_schedule_id => p_applied_payment_schedule_id,
p_link_to_customer_trx_id => p_link_to_customer_trx_id,
p_receivables_trx_id => p_receivables_trx_id,
p_apply_date => p_apply_date,
p_apply_gl_date => p_apply_gl_date,
p_ussgl_transaction_code => p_ussgl_transaction_code,
p_attribute_rec => p_attribute_rec,
p_global_attribute_rec => p_global_attribute_rec,
p_comments => p_comments,
p_application_ref_type => p_application_ref_type,
p_application_ref_id => p_application_ref_id,
p_application_ref_num => p_application_ref_num,
p_secondary_application_ref_id => p_secondary_application_ref_id,
p_payment_set_id => p_payment_set_id,
p_receivable_application_id => p_receivable_application_id,
p_customer_reference => p_customer_reference,
p_val_writeoff_limits_flag => p_val_writeoff_limits_flag,
p_called_from => p_called_from,
p_netted_receipt_flag => p_netted_receipt_flag,
p_netted_cash_receipt_id => p_netted_cash_receipt_id,
p_secondary_app_ref_type => p_secondary_app_ref_type,
p_secondary_app_ref_num => p_secondary_app_ref_num
);

IF (x_return_status = 'S') THEN

COMMIT;

dbms_output.put_line('SUCCESS');
dbms_output.put_line('Return Status = '|| SUBSTR
(x_return_status,1,255));
dbms_output.put_line('Message Count = '||x_msg_count);
dbms_output.put_line('Message Data = '||x_msg_data);
dbms_output.put_line('p_receivable_application_id = '||
p_receivable_application_id);

ELSE

ROLLBACK;

dbms_output.put_line('Return Status = '|| SUBSTR


(x_return_status,1,255));
dbms_output.put_line('Message Count = '|| TO_CHAR(x_msg_count ));
dbms_output.put_line('Message Data = '|| SUBSTR (x_msg_data,1,255));
dbms_output.put_line(APPS.FND_MSG_PUB.Get ( p_msg_index =>
APPS.FND_MSG_PUB.G_LAST,
p_encoded => APPS.FND_API.G_FALSE));

IF x_msg_count >=0 THEN


FOR I IN 1..10 LOOP
dbms_output.put_line(I||'. '|| SUBSTR
(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));

END LOOP;
END IF;

END IF;

EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Exception :'||sqlerrm);

END;

What is senarios here

The senario which going to discuss here is "Reverse Receipt"

The senarios is very simple as cancel, you basically booked the transaction and then reverse it to
make net effect zero.

Typically senarios is when Customer is ready to pay, you created Receipt and submitted a
cheque in Bank and then bank inform there is issue with Cheque ,in that case you are simply
reversing the transaction and notify the customer.

Which API is being used

Call this routine Ar_receipt_api_pub.Reverse to reverse.

This is applicable to reversal of both cash as well Misc.

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.


First you need to create a cash Receipt .

The other Information for Onaccount mapping are here:

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.

The other mandatory column here is to pass the reason and code that must be from setup.
Input from these two screens are used to pass the value in the API's

Step 3: You need to initialize the apps_initialize pacakge

For this you have to follow these steps:

You might also like