Some inventory transactions does not Transfer

  • 14 April 2021
  • 4 replies
  • 263 views

Userlevel 7
Badge +18

Hi!

I have noticed in some instances that, when we execute Transfer Inventory Transactions job for a site, some transactions created during the same day does not get transferred.
I know this is not any issue but the system behavior due to some reasons, which I am not really clear of.

In the technical aspect I have heard this is caused due to truncating dates when the job is executed. 

And in the functional aspect, I think this has some reason with deciding the actual costs for the day before they are being transferred. 

Please help to clarify this.

Thanks!

 


This topic has been closed for comments

4 replies

Userlevel 3
Badge +4

Hi Vimukthi,

Yes, that's right. This happens because in 'Mpccom_Accounting_API.Transfer_To_Finance___' method, the applied_date is getting truncated. 

Please refer the below cursor which fetches the Accountings. You will notice that the 'date applied' returns a truncated value with the TRUNC() function - trunc(date_applied_).

 

CURSOR get_accountings (contract_     IN VARCHAR2,
                                                 date_applied_ IN DATE ) IS
         SELECT DISTINCT acc1.date_applied, acc1.accounting_id
         FROM   MPCCOM_ACCOUNTING_TAB acc1
         WHERE  acc1.date_applied  <= trunc(date_applied_)
         AND    acc1.contract       = contract_
         AND    acc1.booking_source = booking_source_
         AND    acc1.status_code    = '2'
         AND    NOT EXISTS (SELECT 1 FROM MPCCOM_ACCOUNTING_TAB acc2
                            WHERE acc2.accounting_id = acc1.accounting_id
                            AND   acc2.status_code = '99')
         ORDER BY acc1.date_applied, acc1.accounting_id;


         
Since we did not pass the format argument here, the TRUNC() function uses the default value that truncates the date to midnight.
So, whatever the transactions we do today will have to be transferred on the following day/midnight by running the 'Transfer inventory Transactions job'. Actually if we look at this in a functional perspective also I believe that should be the intended behaviour if we consider the nature of daily transactions.

 

Hope this helps.

Userlevel 7
Badge +18

Hi Vimukthi,

Yes, that's right. This happens because in 'Mpccom_Accounting_API.Transfer_To_Finance___' method, the applied_date is getting truncated. 

Please refer the below cursor which fetches the Accountings. You will notice that the 'date applied' returns a truncated value with the TRUNC() function - trunc(date_applied_).

 

CURSOR get_accountings (contract_     IN VARCHAR2,
                                                 date_applied_ IN DATE ) IS
         SELECT DISTINCT acc1.date_applied, acc1.accounting_id
         FROM   MPCCOM_ACCOUNTING_TAB acc1
         WHERE  acc1.date_applied  <= trunc(date_applied_)
         AND    acc1.contract       = contract_
         AND    acc1.booking_source = booking_source_
         AND    acc1.status_code    = '2'
         AND    NOT EXISTS (SELECT 1 FROM MPCCOM_ACCOUNTING_TAB acc2
                            WHERE acc2.accounting_id = acc1.accounting_id
                            AND   acc2.status_code = '99')
         ORDER BY acc1.date_applied, acc1.accounting_id;


         
Since we did not pass the format argument here, the TRUNC() function uses the default value that truncates the date to midnight.
So, whatever the transactions we do today will have to be transferred on the following day/midnight by running the 'Transfer inventory Transactions job'. Actually if we look at this in a functional perspective also I believe that should be the intended behaviour if we consider the nature of daily transactions.

Hope this helps.

Thanks Rajitha!

Userlevel 5
Badge +10

Hi Vimukthi,

The workaround is to input +1 day to the applied date field, this way it ensures all transactions are captured.

Userlevel 7
Badge +18

Hi Vimukthi,

The workaround is to input +1 day to the applied date field, this way it ensures all transactions are captured.

Thanks Infaz!