API Create and Apply for Receipt Account Receivable

Haloooo…akhirnya bisa posting blog lagi setelah sekian lamaa, rasanya malas banget tapi dipaksain buat buka blog. Kali ini saya mau memposting cara buat API Receipt di AR.

CREATE OR REPLACE PROCEDURE APPS.xxx_AR_RECEIPT_CREATION_API(
ERRBUF   OUT VARCHAR2,
RETCODE  OUT VARCHAR2,
P_STATUS IN  VARCHAR2) –parameter
IS
l_return_status       VARCHAR2(1);
l_msg_count           NUMBER;
l_msg_data            VARCHAR2(240);
l_cash_receipt_id     NUMBER;
p_count               NUMBER := 0;
l_recept_method_name  VARCHAR2(100);
BEGIN
mo_global.init(‘AR’);
mo_global.set_policy_context(‘S’,141); –(S (single),org_id) (‘M'(Multiple))
fnd_global.apps_initialize(1130,51052,222,0); –(user_id(saya),responsibility_id(ar super user),application_id)
for item in (SELECT
RECEIPT_NUMBER,
RECEIVED_DATE,
AMOUNT,
–REMARKS,
SOURCE,
STATUS
FROM   xx_RECEIPT_STG MRS
WHERE   MRS.RECEIPT_NUMBER NOT IN
(SELECT   A.RECEIPT_NUMBER
FROM   AR_CASH_RECEIPTS_ALL A
WHERE   A.RECEIPT_NUMBER = MRS.RECEIPT_NUMBER)
AND MRS.STATUS= P_STATUS)

loop
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,ITEM.RECEIPT_NUMBER);
AR_RECEIPT_API_PUB.create_and_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,
x_return_status          => l_return_status,
x_msg_count              => l_msg_count,
x_msg_data               => l_msg_data,
P_CURRENCY_CODE          => ‘IDR’,                — Corrency code
p_amount                 => item.AMOUNT,          — total amount
p_receipt_number         => item.RECEIPT_NUMBER,  — no receipt
p_receipt_date           => item.RECEIVED_DATE,   — tgl recipt
p_gl_date                => item.RECEIVED_DATE,   — tgl gl_date
p_customer_number        => 2014922,              — customer_num
p_receipt_method_name    => item.source,          — Receipt Method
p_trx_number             => item.RECEIPT_NUMBER,  —No invoice yang mau direceipt
p_cr_id                  => l_cash_receipt_id );

—————————–OUTPUT REPORT————————————-
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,’Status ‘ || l_return_status);
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,’Message count ‘ || l_msg_count);
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,’Cash Receipt ID ‘ || l_cash_receipt_id );
if l_msg_count = 1 Then
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,’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;
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,’Message ‘ || p_count ||’. ‘||l_msg_data);
end loop;
end if;
end loop;
END;
/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s