Hi All,
I need a custom event in shipment screen.
When Status is ‘Preliminary’ and Next Step in Shipment Flow = ‘Complete’ and Site = ‘A01’ then I need to enable my event. (all fields are highlighted in red) image 1
The action is check if any value in ‘Adjusted Net weight’ field in line part is zero/blank. then when user performs rmb and choose ‘complete’ an error messsage must shown to user. that “Adjusted Net weight is zero/null” (RMB is shown in image 2)
image 1
image 2
So, I created an event and action. Details are given below.
Action Code:
DECLARE
CONTRACT_ VARCHAR2(20):= '&NEW:CONTRACT';
SHIPMENT_ID_ NUMBER := '&NEW:SHIPMENT_ID';
STATE_OLD_ VARCHAR2(4000) :='&OLD:ROWSTATE';
GET_NET_WEIGHT_ NUMBER;
CURSOR C_ IS SELECT SHIPMENT_ID, SHIPMENT_LINE_NO FROM IFSAPP.SHIPMENT_LINE
WHERE SHIPMENT_ID = SHIPMENT_ID_;
BEGIN
IF CONTRACT_ = 'A01' AND STATE_OLD_ = 'Preliminary' AND IFSAPP.Shipment_Flow_API.Get_Next_Step(SHIPMENT_ID_) = 'Complete' THEN
FOR R_ IN C_
LOOP
GET_NET_WEIGHT_ := IFSAPP.Shipment_Line_API.Get_Net_Weight(R_.SHIPMENT_ID, R_.SHIPMENT_LINE_NO, 'TRUE');
IF GET_NET_WEIGHT_ = 0 THEN
IFSAPP.ERROR_SYS.RECORD_GENERAL('Error', '');
ELSE NULL;
END IF;
END LOOP;
ELSE NULL;
END IF;
END;
But when I use this code in action window, and try to perform the RMB. expected error is not shown in the application and the status of the shipment is also not getting changed. But when I disable event, status of the shipment is getting changed.
I need to show the error message in application and also status should not get changed, it must only get changed when error is not shown, means Adjusted Net weight must be a nonzero/non null value.
Please help to resolve this, thanks in advance.
Parallel approaches to solving this requirement is also welcomed...
Thanks in advance.
IFS Apps 10
Best Regards,
Hari