Sunday, 4 November 2012
API to get Customer Credit Exposure Amount in Oracle Apps
DECLARE
V_HOLD_ID NUMBER DEFAULT 50;
L_CUST_TOTAL_EXPOSURE NUMBER;
P_CREDIT_CHECK_RULE_ID NUMBER;
V_MSG_DATA VARCHAR2 (4000);
L_RETURN_STATUS VARCHAR2 (30);
BEGIN
MO_GLOBAL.INIT ('ONT');
FND_GLOBAL.APPS_INITIALIZE (USER_ID => 1110,
RESP_ID => 50678,
RESP_APPL_ID => 7000
);
MO_GLOBAL.SET_POLICY_CONTEXT ('S', 83);
DBMS_OUTPUT.PUT_LINE ('Calling the API to get customr exposure amount');
OE_CREDIT_ENGINE_GRP.GET_CUSTOMER_EXPOSURE
(P_CUSTOMER_ID => 1590, ---- Customer Account ID
P_SITE_ID => NULL, ---- Customer Site ID
P_LIMIT_CURR_CODE => 'INR', ---- Currency Code
P_CREDIT_CHECK_RULE_ID => 1041, ---- Credit_Check_Rule_ID from table OE_CREDIT_CHECK_RULES
X_TOTAL_EXPOSURE => L_CUST_TOTAL_EXPOSURE,
X_RETURN_STATUS => L_RETURN_STATUS
);
IF L_RETURN_STATUS = FND_API.G_RET_STS_SUCCESS
THEN
DBMS_OUTPUT.PUT_LINE ('success:');
DBMS_OUTPUT.PUT_LINE ( 'l_total_exposure_amount - '
|| L_CUST_TOTAL_EXPOSURE
);
COMMIT;
ELSIF L_RETURN_STATUS IS NULL
THEN
DBMS_OUTPUT.PUT_LINE ('Status is null');
ELSE
DBMS_OUTPUT.PUT_LINE ('Failed: ' || V_MSG_DATA);
FOR I IN 1 .. OE_MSG_PUB.COUNT_MSG
LOOP
V_MSG_DATA := OE_MSG_PUB.GET (P_MSG_INDEX => I, P_ENCODED => 'F');
DBMS_OUTPUT.PUT_LINE (I || ') ' || V_MSG_DATA);
END LOOP;
ROLLBACK;
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE ('Error is ' || SQLCODE || '---' || SQLERRM);
END;
Query to get Year Calendar
SELECT LPAD (MONTH, 20 - (20 - LENGTH (MONTH)) / 2) MONTH, "Sun", "Mon",
"Tue", "Wed", "Thu", "Fri", "Sat"
FROM (SELECT TO_CHAR (dt, 'fmMonthfm YYYY') MONTH,
TO_CHAR (dt + 1, 'iw') week,
MAX (DECODE (TO_CHAR (dt, 'd'),
'1', LPAD (TO_CHAR (dt, 'fmdd'), 2)
)
) "Sun",
MAX (DECODE (TO_CHAR (dt, 'd'),
'2', LPAD (TO_CHAR (dt, 'fmdd'), 2)
)
) "Mon",
MAX (DECODE (TO_CHAR (dt, 'd'),
'3', LPAD (TO_CHAR (dt, 'fmdd'), 2)
)
) "Tue",
MAX (DECODE (TO_CHAR (dt, 'd'),
'4', LPAD (TO_CHAR (dt, 'fmdd'), 2)
)
) "Wed",
MAX (DECODE (TO_CHAR (dt, 'd'),
'5', LPAD (TO_CHAR (dt, 'fmdd'), 2)
)
) "Thu",
MAX (DECODE (TO_CHAR (dt, 'd'),
'6', LPAD (TO_CHAR (dt, 'fmdd'), 2)
)
) "Fri",
MAX (DECODE (TO_CHAR (dt, 'd'),
'7', LPAD (TO_CHAR (dt, 'fmdd'), 2)
)
) "Sat"
FROM (SELECT TRUNC (SYSDATE, 'y') - 1 + ROWNUM dt
FROM all_objects
WHERE ROWNUM <=
ADD_MONTHS (TRUNC (SYSDATE, 'y'), 12)
- TRUNC (SYSDATE, 'y'))
GROUP BY TO_CHAR (dt, 'fmMonthfm YYYY'), TO_CHAR (dt + 1, 'iw'))
ORDER BY TO_DATE (MONTH, 'Month YYYY'), TO_NUMBER (week)
Subscribe to:
Posts (Atom)