Saturday, January 28, 2017

Oracle Receivables API for Cancelling Receipt

Oracle Receivables API for Cancelling Receipt
DECLARE
l_trx_hdr_id NUMBER;
l_trx_lines_id NUMBER;
l_line_number NUMBER :=1;
l_cust_account_id NUMBER;
l_btch_source NUMBER;
l_count NUMBER;
l_cust_trx_type_id NUMBER;
l_memo_lines NUMBER;
l_return_status VARCHAR2(1);
l_msg_count NUMBER;
l_msg_data VARCHAR2(2000);
l_mesg VARCHAR2(2000);
l_batch_id NUMBER;
l_cnt NUMBER := 0;
l_batch_source_rec ar_invoice_api_pub.batch_source_rec_type;
l_trx_header_tbl ar_invoice_api_pub.trx_header_tbl_type;
l_trx_lines_tbl ar_invoice_api_pub.trx_line_tbl_type;
l_trx_dist_tbl ar_invoice_api_pub.trx_dist_tbl_type;
l_trx_salescredits_tbl ar_invoice_api_pub.trx_salescredits_tbl_type;
l_customer_trx_id NUMBER;
l_chr_mesg VARCHAR2(2000);
p_cm_line_tbl AR_CREDIT_MEMO_API_PUB.Cm_Line_Tbl_Type_Cover%TYPE;

--Reciepts
e_excp EXCEPTION;

BEGIN
fnd_global.apps_initialize (user_id => 0,resp_id => 20678,resp_appl_id => 222);

mo_global.init('AR');

ar_receipt_api_pub.REVERSE(
p_api_version => 1.0
,p_init_msg_list => FND_API.G_FALSE
,p_commit => FND_API.G_FALSE
,p_validation_level => FND_API.G_VALID_LEVEL_FULL
,x_return_status => l_return_status
,x_msg_count => l_msg_count
,x_msg_data => l_msg_data
,p_cash_receipt_id => 6023
,p_receipt_number => NULL
,p_reversal_category_code => 'REV'
,p_reversal_category_name => NULL
,p_reversal_gl_date => TRUNC(SYSDATE)
,p_reversal_date => TRUNC(SYSDATE)
,p_reversal_reason_code => 'PAYMENT REVERSAL'
,p_reversal_reason_name => NULL
,p_reversal_comments => NULL
,p_called_from => NULL
,p_cancel_claims_flag => 'Y'
,p_org_id => 81
);
IF l_return_status<> FND_API.G_RET_STS_SUCCESS
THEN
dbms_output.put_line('... Msg Count: ' || l_msg_count);
l_chr_mesg := 'Error in Create Single Invoice';
IF l_msg_count = 1
THEN
dbms_output.put_line('... Msg Data: ' || l_msg_data);
l_chr_mesg := l_chr_mesg||l_msg_data;
ELSIF l_msg_count > 1
THEN
-- the messages on the stack are more than one so call them in a loop
-- and put the messages in a PL/SQL table.
l_count := 0;
LOOP
l_count := l_count +1 ;
l_mesg := fnd_msg_pub.get (fnd_msg_pub.g_next, fnd_api.g_false);
IF l_mesg IS NOT NULL
THEN
dbms_output.put_line('... Msg Data: ' || l_count || '. ' || l_mesg);
l_chr_mesg := l_chr_mesg||' '||l_mesg;
ELSE
RAISE e_excp;
END IF;
END LOOP;
END IF;
END IF;

dbms_output.put_line(l_return_status||l_msg_data);

COMMIT;
END;


No comments:

Post a Comment

How to improve blog performance

Improving the performance of a blog can involve a variety of strategies, including optimizing the website's technical infrastructure, im...