Question

Disable Background processing for Shipment Invoice

  • 8 March 2021
  • 7 replies
  • 247 views

Userlevel 2
Badge +8

Hi,

Is there any method to disable the '’Create Shipment Invoice'’ function from running in the background? I have already checked Online processing for the shipment type and the customer order type. 

App9 UPD9

Thank you

Pamith


This topic has been closed for comments

7 replies

Userlevel 3
Badge +6

Hi

Go to the form Scheduled Database Tasks, search for the Task “Batch Create Shipment Invoices”,  right click to the Schedule and untick the ‘Active’ check box.

Regards

 

 

 

Userlevel 5
Badge +10

Hi Pamith,

Do you want this to run online so that you know the exact time the invoice is created? quite sure this functionality is executing as a background job due to performance-related issues. However, you can change the executing code and do a modification to run this particular job online, it would require customization though as if not all changes will be lost when a new delivery comes with changes to this particular API.

 

There is one more option though where you can trigger an email upon successfully completing the background job via Custom Events.

Userlevel 2
Badge +8

Hi

Go to the form Scheduled Database Tasks, search for the Task “Batch Create Shipment Invoices”,  right click to the Schedule and untick the ‘Active’ check box.

Regards

 

 

 

Hi, thank you for the reply, but this is not a scheduled job. Even in the database tasks, there is no place to disable it.

Userlevel 2
Badge +8

Hi Pamith,

Do you want this to run online so that you know the exact time the invoice is created? quite sure this functionality is executing as a background job due to performance-related issues. However, you can change the executing code and do a modification to run this particular job online, it would require customization though as if not all changes will be lost when a new delivery comes with changes to this particular API.

 

There is one more option though where you can trigger an email upon successfully completing the background job via Custom Events.

Hi Infaz, what i really want to do is to give a pop-up error when the shipment invoice is created. Since this goes to the background job the error is shown there - which doesn't serve the purpose. I am not inclined to do a code change though since its mostly a 'nice to have’ function which the customer requests.

thank you for the reply

Pamith

Userlevel 6
Badge +15

Hi @PamithK,

I have checked this from the code level and below are my findings,
1. I don't see any logical check for a basic data or any other setting to decide if the process executes foreground or in background.
2. It makes sense to process in background if you are selecting more than one line from the table and clicking the "Create Shipment Invoice" RMB.
3. But, there is an option given in the Invoice_Customer_Order_API.Make_Shipment_Invoice__ procedure to pass a specific shipment_id_ and make it process in foreground.

--   Create invoices for all the shipments passed in the attribute string by making a deferred call. If the
-- shipment_id is passed that means this comes from the shipment flow. In this case, if multiple invoices
-- are getting created, it will raise an error. If not will create a single shipment invoice.
PROCEDURE Make_Shipment_Invoice__ (
invoice_id_ OUT NUMBER,
attr_ IN OUT VARCHAR2,
shipment_id_ IN NUMBER )
IS
-- LOCAL VARIABLES
BEGIN
IF (shipment_id_ IS NOT NULL) THEN
-- LOGIC TO CREATE SHIPMENT INVOICE IN FOREGROUND
ELSE
-- LOGIC TO CREATE SHIPMENT INVOICE IN BACKGROUND
END IF;
END Make_Shipment_Invoice__;

4. However the problem is, even if you select one line from the table, it passes the hardcoded value NULL for shipment_id_ parameter from the front-end.

Conclusion,
This might have been done considering a specific functional flow (note the comments above the source code in point 3. above).

Cheers !
Dhananjaya.

Userlevel 3
Badge +6

Hi

Go to the form Scheduled Database Tasks, search for the Task “Batch Create Shipment Invoices”,  right click to the Schedule and untick the ‘Active’ check box.

Regards

 

 

 

Hi, thank you for the reply, but this is not a scheduled job. Even in the database tasks, there is no place to disable it.

Ah OK - then have you looked at the ‘Stop After’ check boxes in the Shipment Type?  

Userlevel 3
Badge +8

Hi Pamith,

Do you want this to run online so that you know the exact time the invoice is created? quite sure this functionality is executing as a background job due to performance-related issues. However, you can change the executing code and do a modification to run this particular job online, it would require customization though as if not all changes will be lost when a new delivery comes with changes to this particular API.

 

There is one more option though where you can trigger an email upon successfully completing the background job via Custom Events.

Hi Infaz, what i really want to do is to give a pop-up error when the shipment invoice is created. Since this goes to the background job the error is shown there - which doesn't serve the purpose. I am not inclined to do a code change though since its mostly a 'nice to have’ function which the customer requests.

thank you for the reply

Pamith

regarding “give a pop-up error when the shipment invoice is created.
There is one more option though where you can trigger an email upon successfully completing the background job via Custom Events.

A possible countermeasure is to enable an Event Action (email) on Event BACKGROUND_JOB_IS_PROCESSED. 
 
Configure conditions on PROCEDURE_NAME = (whatever) and STATE = Error

It is simple to hardcode the Action Details (E-Mail) ‘To:’ address … or try using &USER_MAIL_ADDRESS if you want to alert the submitter.

I have one with a subject of ‘&DESCRIPTION  abnormal end of job &JOB_ID    #DB_SID#’
The message may contain information like this:
EXECUTED DATE/TIME...:  &EXECUTED_DATETIME

JOB ID......................:  &JOB_ID
PROCEDURE...............:  &PROCEDURE_NAME
ARGUMENTS...............:  &ARGUMENTS
ERROR_TEXT..............:  
&ERROR_TEXT 

 

I have not tried Action Type ‘Streams Message’ but that seems an alternative to E-Mail.