Ar API Unapply on Account Receipts Final
Comments
Content
DECLARE
pi_cash_receip_id ar_cash_receipts.cash_receipt_id%TYPE;
pi_receipt_number ar_cash_receipts.receipt_number%TYPE;
pi_receivable_application_id ar_receivable_applications.receivable_application_i
d%TYPE;
pi_reversal_gl_date ar_receivable_applications.reversal_gl_date%TYPE;
pi_user_id NUMBER;
lc_return_status VARCHAR2(240);
v_sucess_records NUMBER := 0;
ln_msg_count NUMBER;
lc_msg_data VARCHAR2(230);
x_msg_index_out NUMBER := 0;
v_error_records_n NUMBER :=0;
CURSOR c1 IS SELECT aCRA.cash_receipt_id cash_receipt_id,
aCRA.receipt_number receipt_number,ACRA.CREATED_BY user_id,
ARAA.RECEIVABLE_APPLICATION_ID RECEIVABLE_APPLICATION_ID,
ARAA.REVERSAL_GL_DATE REVERSAL_GL_DATE
FROM ar_receivable_applications_all ARAA,
ar_cash_receipts_all ACRA
WHERE ARAA.status='ACC'
AND DISPLAY='Y'
AND ACRA.CASH_RECEIPT_ID=ARAA.CASH_RECEIPT_ID
AND AMOUNT_APPLIED <> 0
--AND REVERSAL_GL_DATE IS NULL
AND ARAA.ORG_ID=110;
--AND ROWNUM <= 5;
BEGIN
FOR I IN c1 LOOP
lc_return_status := Fnd_Api.G_RET_STS_SUCCESS;
pi_reversal_gl_date:=i.REVERSAL_GL_DATE;
pi_receivable_application_id := i.RECEIVABLE_APPLICATION_ID;
pi_receipt_number := i.receipt_number;
pi_user_id := i.user_id;
pi_cash_receip_id := i.cash_receipt_id;
BEGIN
/*fnd_global.apps_initialize ( user_id =>pi_user_id,
--pi_user_id,
resp_id =>52871,
resp_appl_id =>222
);*/
dbms_application_info.set_client_info(110);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error While Doing Intialization');
END;
DBMS_OUTPUT.PUT_LINE('Entering API');
AR_RECEIPT_API_PUB.UNAPPLY_ON_ACCOUNT (
-- Standard API parameters.
p_api_version
=> 1.0,
p_init_msg_list
=> Fnd_Api.G_TRUE,
p_commit
=>FND_API.G_FALSE,
p_validation_level
=>FND_API.G_VALID_LEVEL_FULL,
x_return_status
=> lc_return_status,
x_msg_count
=> ln_msg_count,
x_msg_data
=> lc_msg_data,
-- *** Receipt Info. parameters *****
p_receipt_number
=> pi_receipt_number,
--pi_rec
eipt_number,
p_cash_receipt_id
=>pi_cash_receip_id,
--pi_cash
_receip_id,
p_receivable_application_id =>pi_receivable_application_id,
--pi_receivable_application_id,
p_reversal_gl_date
=>NULL
--pi_reversal
_gl_date
);
--DBMS_OTUPUT.PUT_LINE('End API');
IF UPPER (lc_return_status) = Fnd_Api.G_RET_STS_SUCCESS THEN
DBMS_OUTPUT.PUT_LINE('Un Apply on account Successful for Receipt Number:'||' '|
| pi_receipt_number);
Fnd_Msg_Pub.GET(p_msg_index => Fnd_Msg_Pub.G_FIRST,
p_data => lc_msg_data,
p_encoded => Fnd_Api.G_FALSE,
p_msg_index_out => x_msg_index_out);
DBMS_OUTPUT.PUT_LINE('Sucessful: ' || (lc_msg_data));
v_sucess_records
:= v_sucess_records+1;
ELSE
x_msg_index_out:=1;
DBMS_OUTPUT.PUT_LINE( 'Error occurred while performing Un Apply On Account for
Receipt Number: ' || pi_receipt_number);
Fnd_Msg_Pub.GET(p_msg_index => Fnd_Msg_Pub.G_FIRST,
p_data => lc_msg_data,
p_encoded => Fnd_Api.G_FALSE,
p_msg_index_out => x_msg_index_out);
v_error_records_n
:= v_error_records_n + 1;
DBMS_OUTPUT.PUT_LINE('Error: ' || (lc_msg_data));
END IF;
END LOOP;
DBMS_OUTPUT.PUT_LINE('No of Proceesed_records:'||' '||v_sucess_records);
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('There is No On Account Receipts');
WHEN OTHERS THEN
v_error_records_n
:= v_error_records_n + 1;
ROLLBACK;
END;
Sponsor Documents