Saturday, October 3, 2009

Order Line is Invoiced or not

OM: Order Line is Invoiced or not:-
----------------------------------------

One sales/OM order may have many lines. Invoice can be done for some specfic line as well.
If we want to know whether the specfic line is invoiced or not. Then use the following API.

DECLARE
l_ord_stats VARCHAR2(100);
v VARCHAR2(100);
p_line_id NUMBER :='Your Line ID Number'
p_flow_status VARCHAR2(100):='AWAITING_SHIPPING';
X VARCHAR2(100);
x_result_date DATE;
BEGIN
oe_line_status_pub.get_invoiced_status(p_line_id, x, x_result_date); --if x returns null means not invoiced, if invoiced it wil retutn date also (x=’Y) –this is procedure
SELECT OE_LINE_STATUS_PUB.get_line_status(p_line_id,P_flow_status) INTO l_ord_stats FROM dual; --we need to pass the line and flow status we wil status –this is a function
dbms_output.put_line( 'v XX is' ||X ||x_result_date);
END;

Example:-

DECLARE
l_ord_stats VARCHAR2(100);
v VARCHAR2(100);
p_line_id NUMBER :=3569080;
p_flow_status VARCHAR2(100):='AWAITING_SHIPPING';
X VARCHAR2(100);
x_result_date DATE;
BEGIN
oe_line_status_pub.get_invoiced_status(p_line_id, x, x_result_date); --if x returns null means not invoiced, if invoiced it wil retutn date also (x=’Y) –this is procedure
SELECT OE_LINE_STATUS_PUB.get_line_status(p_line_id,P_flow_status) INTO l_ord_stats FROM dual; --we need to pass the line and flow status we wil status –this is a function
dbms_output.put_line( 'v XX is' ||X ||x_result_date);
END;