Skip to main content

Hello.

On the shipment screen (url : ifsapf:frmShipment_Ext ), I would need to make an event when the user runs the deliver process to forbid the delivery when the total amount is less than a certain amount.

How can I make such an event? I don’t even see what might be the triggered table.

@romsar if you have shipments where you deliver multiple CO Lines from different Customer Orders this is what I would do:

  • create a CF in Shipment header → to sum up the amount of the shipment lines → look for unit price in CO Line and multiply by qty
  • create event on Inventory Transactions History where transaction_code = ‘OESHIP’
    • create custom attribute to get the total amount value from shipment header CF so that you can compare it in your event action with your threshold amount (minimum amount)

The disadvantage with this approach is that if you deliver a Shipment with 10 lines, there will be 10 inventory transactions of type OESHIP. Performance wise I don’t think this could be a problem.

 


Hi Romsar,

Try see which table gets updated when the "Deliver" process is executed. Identify the triggered table using debug console or Database Triggers that has this total amount that you are referring to (ex: like SHIPMENT_ORDER_LINE_TAB)

Create a New Custom Event:

  • Table Name: The table that triggers the event
  • Condition: Define the condition to check the total amount.for example 
  • NEW.TOTAL_AMOUNT < :Your_Minimum_Amount 
  • (Replace TOTAL_AMOUNT with the actual column name storing the total shipment amount.)


Add an Event Action:

  • Choose the Action Type as PL/SQL Block(Execute Online SQL).
  • Write the logic to validate the amount and prevent delivery like this in the Action Details.

BEGIN

   IF :NEW.TOTAL_AMOUNT < 100 THEN

      -- Raise an error to block delivery

      raise_application_error(-20000, 'Delivery cannot proceed: Total amount is below the minimum limit.');

   END IF;

END;

/Oshada

 


Hello.

With a workmate, we proceeded this way :

  • Table triggered : SHIPMENT_TAB
  • Fires on the ROWSTATE update

About the event action :

  • condition : OLD:ROWSTATE = Completed, NEW:ROSTATE = Closed

About calculating the total amount of the shipment, the calculous isn’t confirmed yet but I made this :

select round(sum(SHIPMENT_LINE.QTY_SHIPPED*CUSTOMER_ORDER_LINE.BASE_SALE_UNIT_PRICE), 2) INTO v_total_amount

from SHIPMENT_LINE

INNER JOIN CUSTOMER_ORDER_LINE on SHIPMENT_LINE.SOURCE_REF1=CUSTOMER_ORDER_LINE.ORDER_NO

            AND SHIPMENT_LINE.SOURCE_REF2=CUSTOMER_ORDER_LINE.LINE_NO

            AND SHIPMENT_LINE.SOURCE_REF3=CUSTOMER_ORDER_LINE.REL_NO

where SHIPMENT_ID='&NEW:SHIPMENT_ID'

AND CUSTOMER_ORDER_LINE.OBJSTATE!='Cancelled';

Does that sound fine?


Hello ​@Marcel.Ausan  ​

Why an event on inventory_transaction_hist_tab ?

The event that I’m trying to work on is not about the total amont for each delivery, but about the shipment total value.

Moreover, I can’t imagine to define an event on this table a same customer order line can be used on more than 1 shipment, so from a transaction, I can’t know the shipment origin.


hello?


@romsar sorry for the delay. For some reason I no longer get emails from IFS Community on new comments.

The reason I suggested to create the event in Inventory Transactions History is that there’s no status change at Shipment level when you deliver the shipment. The only way to catch the delivery transaction and stop it would be a trigger on inventory transactions history - transaction_code = OESHIP.

Normally the flow in your Shipment is like this:

….

Report Picking → Shipment status = Preliminary

Complete Handling → Shipment Status = Completed

Deliver → Shipment Status = Completed (doesn’t change)

Close Shipment → Shipment Status = Closed

 

So in your case if you created the event on status change from Completed to Closed, the Delivery transaction is done already!

Maybe you could create your event on status changing from Preliminary to Completed → thus block the Completion of the Shipment if the amount is low. If user can’t move the Shipment to Complete, they can’t Deliver also.


Hello ​@Marcel.Ausan 

it’s okay, no worries, I thought someone else would share a solution to my issue.

So, if I put an event on inventory transactions history for transaction_code = OESHIP., it would be a challenge to know the total amont of the whole delivery, as the number of records from inventory transactions history would be the same as the number of shipment lines, I will ask confrmation if we can use this option.

 

I was trying to make an event on SHIPMENT_TAB, triggering the STATE field but I’m afraid that it can’t be an idea. When the status is set to Deliver, I need to make sure that the next step is Deliver :

 

And the next step field is using an API 

 

I have tried on the event to call the API this way :

IFSAPP.Shipment_Flow_API.Get_Next_Step(&OLD:SHIPMENT_ID)

 

But that’s not possible


Reply