Value Accelerator Event - Structure question

1 week ago 1

Dear Community, I americium reaching retired to you due to the fact that I americium trying to recognize however 1 of the events that I person successful a Value Accelerator.

This lawsuit is accidental to materialize the Supplier invoice owed date. 

Here is the codification associated : 

SELECT
c_caseid,
c_time,
c_eventname,
"Number of Invoice Line Items",
"Accounting Document Primary Key"
FROM (

SELECT
CONCAT(bseg_bkpf.mandt, bseg_bkpf.bukrs, bseg_bkpf.gjahr, bseg_bkpf.belnr) AS c_caseid,
CASE -- ever adding 23:59:59 arsenic time
WHEN COALESCE(zbd3t, 0) > 0 THEN DATE_ADD('day', CAST(zbd3t AS INT) ,from_unixtime(zfbdt/1000 + 86399))
WHEN COALESCE(zbd3t, 0) = 0 AND COALESCE(zbd2t, 0) > 0 THEN DATE_ADD('day', CAST(zbd2t AS INT) ,from_unixtime(zfbdt/1000 + 86399))
WHEN COALESCE(zbd3t, 0) = 0 AND COALESCE(zbd2t, 0) = 0 AND COALESCE(zbd1t, 0) > 0 THEN DATE_ADD('day', CAST(zbd1t AS INT) ,from_unixtime(zfbdt/1000 + 86399))
ELSE from_unixtime(zfbdt / 1000 + 86399)
END AS c_time,
'Due Date passed' AS c_eventname,
COUNT(bseg_bkpf.buzei) OVER (PARTITION BY bseg_bkpf.belnr) AS "Number of Invoice Line Items",
bseg_bkpf.bkpf_c_key AS "Accounting Document Primary Key"
FROM bseg_bkpf
WHERE zfbdt IS NOT NULL
AND (bseg_bkpf.tcode != 'MR8M' OR bseg_bkpf.tcode IS NULL)
AND bschl IN (
-- Invoices
'31', -- Vendor Invoices
'22', -- Reverse Invoice
'21', -- Credit Memos
'32' -- Reverse Credit Memo
)
)

WHERE c_eventname IS NOT NULL
AND c_caseid IS NOT NULL
AND c_time IS NOT NULL

What I americium not definite to recognize is that it seems we are adding a timestamp to the owed day but I don't get wherefore arsenic if the invoice is owed contiguous : past it is casual to find conscionable utilizing the day if the invoice is overdue oregon not. 

Any thought ???

Thank you

Sanddie

Read Entire Article