Thursday, January 28, 2010

Ar_receipt_api_pub.Apply

Applies a cash receipt to a particular installment of a debit item.
 The application can also be a cross currency application.
This api works only when you set the org_id using DBMS_APPLICATION.SET_CLIENT_INFO(&v_org_id)
But dont forget to set the session through FND_GLOBAL.APPS_INITIALISE because it will set the
necessary profile values defaulted to user

Another important thing to note is...
Incase if you want to apply against the invoice installment then we have to pass the parameter named
"P_INSTALLMENT" with the installment number
Remember Oralce provides another api named Ar_receipt_api_pub.Create_and_apply to create and apply simultaneously.
Let us have the detailed view of the mentioned api in another post


Script:
declare
l_return_status varchar2(1);
l_msg_count number;
l_msg_data varchar2(240);
l_count number;
l_msg_data_out varchar2(240);
l_mesg varchar2(240);
p_count number;
begin
ar_receipt_api_pub.Apply
( 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,
p_cash_receipt_id => '&cash_receipt_id',
p_customer_trx_id => '&customer_trx_id',
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data
);
dbms_output.put_line('Status ' || l_return_status);
dbms_output.put_line('Message count ' || l_msg_count);
if l_msg_count = 1 Then
dbms_output.put_line('l_msg_data '||l_msg_data);
elsif l_msg_count > 1 Then
loop
p_count := p_count+1;
l_msg_data := FND_MSG_PUB.Get(FND_MSG_PUB.G_NEXT,FND_API.G_FALSE);
if l_msg_data is NULL Then
exit;
end if;
dbms_output.put_line('Message' || p_count ||'.'||l_msg_data);
end loop;
end if;
end;

if the Status is 'E', check for the error message and debug log.

1 Responses to “Ar_receipt_api_pub.Apply”

Frutas Saludables said...
March 30, 2023 at 1:27 PM

Hi.
You say the application can also be a cross currency application.
but I´m trying to aply a receipt in COP Currency to an trsaction in USD currency and i'm getting the following error: Cross currency rate is null

Do I missing a parameter?

-- 2) Call the API
AR_RECEIPT_API_PUB.APPLY
( 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,
p_cash_receipt_id => l_cash_receipt_id , --Recipt In COP Currency
p_customer_trx_id => X_ID_FACTURA, -- invoive in USD Currency
x_return_status => l_return_status_F,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data);


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.