Skip to main content

I was trying to run a custom menu in which  po date calculation api is calculating dates upon which I expect the modufy fucntion to modify calculated dates in the PO lines.

 

The issue here is that I got this message even though I did not mess with anything standard can somebody please let me know what I might be doing wrong and how can I fix it ?

 

 

My guess would be that you are not passing in a date value into the method you are calling. Have you managed to run through the code in SQL developer successfully? 


Yes it was successful in SQL developer for single record


What parameters are you passing in to the custom menu? Have you put any of them in quotation marks turning them into characters?


 

 

Believe you need to know what date is being fetched. E.g. use debug console to see what the RMB is doing. Alternatively, raise an application message with the value;

DECLARE

BEGIN
error_sys.appl_general('PurchaseOrder',&WANTED_RECEIPT_DATE);
END;

 

Reload config and execute RMB:

 

 

 

Best guess is you are using quotes between the field. Which is giving back an binding error message (which is not a date ;-));

DECLARE

BEGIN
error_sys.appl_general('PurchaseOrder','&WANTED_RECEIPT_DATE');
END;

 

 

 

 


The problem which i think I am having is I am trying to call Pur_Ord_Date_Calculation_API.Calculate_Order_Line_Dates();

when and I have to pass the values from the PO line that I have selected into this so that when I calculate it inside loop it applies that date taken from one line and apply it to all the other PO lines.

Can you please help me understand how to pass the values from one line and apply it to all of them ? If that works than this whole issue will be fixed.


Can you share your code? Not sure what you are trying.


Can you share your code? Not sure what you are trying.

DECLARE


info_      varchar2(4000);
attr_      varchar2(4000); 
date_entered_      date;
start_date_ date;


CURSOR c1 IS
SELECT *  
FROM PURCHASE_ORDER_LINE_PART_CFV
WHERE  CF$_ID_DOCUMENT = &CF$_ID_DOCUMENT;

BEGIN
     
     --pdDate_  := &PLANNED_DELIVERY_DATE;

     IF &CF$_ID_DOCUMENT IS NULL OR &STATE = 'Closed' OR &STATE = 'Cancelled' THEN 
      
      error_sys.appl_general ('PurchaseOrderLinePart','Dates Cannot be updated as the Document ID is NULL and/or Purchase Order staus is Closed/Cancelled.');
     
     ELSE

      FOR rec_ IN c1 LOOP
        
        client_sys.Clear_Attr (attr_); 
        date_entered_ := IFSAPP.Purchase_Order_Line_Part_API.Get_Date_Entered(rec_.Order_no , rec_.Line_no , rec_.Release_no );
        Pur_Ord_Date_Calculation_API.Calculate_Order_Line_Dates(#WHAT IS THE SYNTAX FOR PASSING PARAMETERS HERE#);
        client_sys.Add_To_Attr('PLANNED_DELIVERY_DATE', rec_.planned_receipt_date , attr_ );
        client_sys.Add_To_Attr('PLANNED_RECEIPT_DATE', rec_.planned_arrival_date , attr_ );
        client_sys.Add_To_Attr('PLANNED_ARRIVAL_DATE', rec_.planned_delivery_date , attr_ );
        client_sys.Add_To_Attr('PROMISED_DELIVERY_DATE', rec_.promised_delivery_date , attr_ );
        client_sys.Add_To_Attr('WANTED_DELIVERY_DATE', rec_.wanted_delivery_date  , attr_ );
        ifsapp.purchase_order_line_part_api.Modify__(info_ , rec_.objid  ,rec_.objversion,  attr_ ,'DO');
        
        COMMIT;    
      END LOOP;
     END IF;
END;


Aah now it makes more sense :wink: .

 

The error you are getting, is because the actual date type you are throwing into the procedure is not correct. The date type which you can give into the procedure are stated in the procedure itself.

 

Right now you are passing something which is not supported. Hence the procedure is returning the; ‘Unknown date type’. 

 

If you try to give in the correct date type, i think it will start to work.


Aah now it makes more sense :wink: .

 

The error you are getting, is because the actual date type you are throwing into the procedure is not correct. The date type which you can give into the procedure are stated in the procedure itself.

 

Right now you are passing something which is not supported. Hence the procedure is returning the; ‘Unknown date type’. 

 

If you try to give in the correct date type, i think it will start to work.

Can you please help me understand what will be the date type here and do I need to define it below decalre for all 5 of these variables ?


Aah now it makes more sense :wink: .

 

The error you are getting, is because the actual date type you are throwing into the procedure is not correct. The date type which you can give into the procedure are stated in the procedure itself.

 

Right now you are passing something which is not supported. Hence the procedure is returning the; ‘Unknown date type’. 

 

If you try to give in the correct date type, i think it will start to work.

Where to pass this correct date type ? I am also not sure by looking at this that what is the correct date type ? can you help me understand ?


Based on what you pass into the procedure, it will calculate the dates according on that date type. Those calculated dates come back from the procedure and can be used to update your dates. E.g. below example. Added some new variables which will be filled by the procedure. 

DECLARE
info_ varchar2(4000);
attr_ varchar2(4000);
date_entered_ date;
start_date_ date;
-- Start Addition
planned_receipt_date_out_ DATE := SYSDATE;
planned_arrival_date_out_ DATE := SYSDATE;
planned_delivery_date_out_ DATE := SYSDATE;
promised_delivery_date_out_ DATE := SYSDATE;
wanted_delivery_date_out_ DATE := SYSDATE;
route_id_out_ VARCHAR2(4000) := '1';
-- End Addition

CURSOR c1 IS
SELECT *
FROM ifsapp.PURCHASE_ORDER_LINE_PART_CFV
WHERE CF$_ID_DOCUMENT = &CF$_ID_DOCUMENT;

BEGIN

pdDate_ := &PLANNED_DELIVERY_DATE;

IF &CF$_ID_DOCUMENT IS NULL OR &STATE = 'Closed' OR &STATE = 'Cancelled' THEN

ifsapp.error_sys.appl_general ('PurchaseOrderLinePart','Dates Cannot be updated as the Document ID is NULL and/or Purchase Order staus is Closed/Cancelled.');

ELSE

FOR rec_ IN c1 LOOP

ifsapp.client_sys.Clear_Attr (attr_);
date_entered_ := IFSAPP.Purchase_Order_Line_Part_API.Get_Date_Entered(rec_.Order_no , rec_.Line_no , rec_.Release_no );
ifsapp.Pur_Ord_Date_Calculation_API.Calculate_Order_Line_Dates(
planned_receipt_date_ => planned_receipt_date_out_, --Out parameter
planned_arrival_date_ => planned_arrival_date_out_, --Out parameter
planned_delivery_date_ => planned_delivery_date_out_, --Out parameter
promised_delivery_date_ => promised_delivery_date_out_, --Out parameter
wanted_delivery_date_ => wanted_delivery_date_out_, --Out parameter
route_id_ => rec_.route_id, --Out parameter
start_date_ => SYSDATE,
date_type_ => 'WANTED_DELIVERY_DATE',
contract_ => ifsapp.purchase_Order_api.get_contract(Rec_.order_no),
part_no_ => rec_.part_no,
vendor_no_ => rec_.vendor_no,
addr_no_ => ifsapp.purchase_order_api.get_addr_no(rec_.order_no),
ship_via_code_ => rec_.ship_via_code,
demand_code_ => rec_.demand_code,
internal_control_time_ => rec_.internal_control_time,
date_entered_ => date_entered_,
ext_transport_calendar_id_ => '1');
--Now use the calculated dates you just got to update.
ifsapp.client_sys.Add_To_Attr('PLANNED_DELIVERY_DATE', planned_delivery_date_out_ , attr_ );
ifsapp.client_sys.Add_To_Attr('PLANNED_RECEIPT_DATE', planned_receipt_date_out_ , attr_ );
ifsapp.client_sys.Add_To_Attr('PLANNED_ARRIVAL_DATE', planned_arrival_date_out_ , attr_ );
ifsapp.client_sys.Add_To_Attr('PROMISED_DELIVERY_DATE', promised_delivery_date_out_ , attr_ );
ifsapp.client_sys.Add_To_Attr('WANTED_DELIVERY_DATE', wanted_delivery_date_out_ , attr_ );
ifsapp.purchase_order_line_part_api.Modify__(info_ , rec_.objid ,rec_.objversion, attr_ ,'DO');

COMMIT;
END LOOP;
END IF;
END;

If you pass the right values into the procedure you will see it will provide you with correct (calculated) dates. You can change the date_type to any of the other date types which have been provided in the previous screenshot and see the difference 😉.

 

Hope this make sit more clear.

 

Regards,

Mitchel

 

 


Reply