0% found this document useful (0 votes)
1K views3 pages

API To Inactive Customer Account

The document contains PL/SQL code that queries a database for customer account information, sets the context, initializes parameters for an API call, calls the API to update the customer account status to inactive, commits the transaction if successful or rolls back and displays error messages if not, and ends by noting completion of the API. It loops through the results of the initial query to process multiple customer accounts.

Uploaded by

Raza Hassan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views3 pages

API To Inactive Customer Account

The document contains PL/SQL code that queries a database for customer account information, sets the context, initializes parameters for an API call, calls the API to update the customer account status to inactive, commits the transaction if successful or rolls back and displays error messages if not, and ends by noting completion of the API. It loops through the results of the initial query to process multiple customer accounts.

Uploaded by

Raza Hassan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

EXEC DBMS_OUTPUT.

ENABLE (300000000000);
DECLARE
P_CUST_ACCOUNT_REC HZ_CUST_ACCOUNT_V2PUB.CUST_ACCOUNT_REC_TYPE;
P_OBJECT_VERSION_NUMBER NUMBER;
X_RETURN_STATUS VARCHAR2(2000);
X_MSG_COUNT NUMBER;
X_MSG_DATA VARCHAR2(2000);
LV_CONTEXT VARCHAR2(2);
CURSOR C1 IS

SELECT HCA.CUST_ACCOUNT_ID, HCA.OBJECT_VERSION_NUMBER, HCA.A


CCOUNT_NAME
FROM HZ_PARTIES HP, HZ_CUST_ACCOUNTS HCA
WHERE 1 = 1
AND HP.PARTY_ID = HCA.PARTY_ID
AND HP.PARTY_NAME = 'HAJI GUL MUHAMMAD & SONS';
BEGIN
FOR X IN C1
LOOP
LV_CONTEXT := TGC_F_SET_CONTEXT('AFF','Receivables Manager Bike','89')
;
DBMS_OUTPUT.PUT_LINE ('89 '||LV_CONTEXT );
IF LV_CONTEXT = 'F' THEN
DBMS_OUTPUT.PUT_LINE('Error while setting the context');
APPS.FND_FILE.PUT_LINE(APPS.FND_FILE.LOG,'Error while setting the contex
t');
END IF;

-------------- INITIALIZING THE MANDATORY API PARAMETERS------------


----------
P_CUST_ACCOUNT_REC.CUST_ACCOUNT_ID := X.CUST_ACCOUNT_ID;
P_CUST_ACCOUNT_REC.STATUS := 'I';
P_CUST_ACCOUNT_REC.ACCOUNT_NAME :=X.ACCOUNT_NAME;
P_OBJECT_VERSION_NUMBER := X.OBJECT_VERSION_NUMBER;
DBMS_OUTPUT.PUT_LINE('Calling the API hz_cust_account_v2pub.update_cust_
account');
HZ_CUST_ACCOUNT_V2PUB.UPDATE_CUST_ACCOUNT
(
P_INIT_MSG_LIST => FND_API.G_TRUE,
P_CUST_ACCOUNT_REC => P_CUST_ACCOUNT_REC,
P_OBJECT_VERSION_NUMBER => P_OBJECT_VERSION_NUMBER,
X_RETURN_STATUS => X_RETURN_STATUS,
X_MSG_COUNT => X_MSG_COUNT,
X_MSG_DATA => X_MSG_DATA
);
IF X_RETURN_STATUS = FND_API.G_RET_STS_SUCCESS THEN
COMMIT;
DBMS_OUTPUT.PUT_LINE('Customer Account has been Success
fully inactive ');
DBMS_OUTPUT.PUT_LINE('Output information ....');
DBMS_OUTPUT.PUT_LINE('Object Version Number ='||P_OBJECT
_VERSION_NUMBER);
ELSE
DBMS_OUTPUT.PUT_LINE ('Updation of Customer Account got
failed:'||X_MSG_DATA);
ROLLBACK;
FOR I IN 1 .. X_MSG_COUNT
LOOP
X_MSG_DATA := FND_MSG_PUB.GET( P_MSG_INDEX => I, P_ENC
ODED => 'F');
DBMS_OUTPUT.PUT_LINE( I|| ') '|| X_MSG_DATA);
END LOOP;
END IF;
DBMS_OUTPUT.PUT_LINE('Completion of API');
END LOOP;
END;
/
--------------------------------------------------------------------------------
--------------------------------------

EXEC DBMS_OUTPUT.ENABLE (300000000000);


DECLARE
P_CUST_ACCOUNT_REC HZ_CUST_ACCOUNT_V2PUB.CUST_ACCOUNT_REC_TYPE;
P_OBJECT_VERSION_NUMBER NUMBER;
X_RETURN_STATUS VARCHAR2(2000);
X_MSG_COUNT NUMBER;
X_MSG_DATA VARCHAR2(2000);
LV_CONTEXT VARCHAR2(2);
CURSOR C1 IS

SELECT HCA.CUST_ACCOUNT_ID, HCA.OBJECT_VERSION_NUMBER, HCA.A


CCOUNT_NAME
FROM HZ_PARTIES HP, HZ_CUST_ACCOUNTS HCA
WHERE 1 = 1
AND HP.PARTY_ID = HCA.PARTY_ID
AND HP.PARTY_NAME = 'HAJI GUL MUHAMMAD & SONS';
BEGIN
FOR X IN C1
LOOP
LV_CONTEXT := TGC_F_SET_CONTEXT('AFF','Receivables Manager Bike','89')
;
DBMS_OUTPUT.PUT_LINE ('89 '||LV_CONTEXT );
IF LV_CONTEXT = 'F' THEN
DBMS_OUTPUT.PUT_LINE('Error while setting the context');
APPS.FND_FILE.PUT_LINE(APPS.FND_FILE.LOG,'Error while setting the contex
t');
END IF;
-------------- INITIALIZING THE MANDATORY API PARAMETERS------------
----------
P_CUST_ACCOUNT_REC.CUST_ACCOUNT_ID := X.CUST_ACCOUNT_ID;
P_CUST_ACCOUNT_REC.STATUS := 'I';
P_CUST_ACCOUNT_REC.ACCOUNT_NAME :=X.ACCOUNT_NAME;
P_OBJECT_VERSION_NUMBER := X.OBJECT_VERSION_NUMBER;
-- DBMS_OUTPUT.PUT_LINE('Calling the API hz_cust_account_v2pub.update_cus
t_account');
DBMS_OUTPUT.PUT_LINE('***************************/\MAY THE FORCE BE WITH
YOU/\**************************************');
HZ_CUST_ACCOUNT_V2PUB.UPDATE_CUST_ACCOUNT
(
P_INIT_MSG_LIST => FND_API.G_TRUE,
P_CUST_ACCOUNT_REC => P_CUST_ACCOUNT_REC,
P_OBJECT_VERSION_NUMBER => P_OBJECT_VERSION_NUMBER,
X_RETURN_STATUS => X_RETURN_STATUS,
X_MSG_COUNT => X_MSG_COUNT,
X_MSG_DATA => X_MSG_DATA
);
IF X_RETURN_STATUS = FND_API.G_RET_STS_SUCCESS THEN
COMMIT;
DBMS_OUTPUT.PUT_LINE('Customer Account has been Success
fully inactive ');
DBMS_OUTPUT.PUT_LINE('Output information ....');
DBMS_OUTPUT.PUT_LINE('Object Version Number ='||P_OBJECT
_VERSION_NUMBER);
ELSE
DBMS_OUTPUT.PUT_LINE ('Updation of Customer Account got
failed:'||X_MSG_DATA);
ROLLBACK;
FOR I IN 1 .. X_MSG_COUNT
LOOP
X_MSG_DATA := FND_MSG_PUB.GET( P_MSG_INDEX => I, P_ENC
ODED => 'F');
DBMS_OUTPUT.PUT_LINE( I|| ') '|| X_MSG_DATA);
END LOOP;
END IF;
DBMS_OUTPUT.PUT_LINE('Completion of API');
END LOOP;
END;
/

You might also like