Skip to main content
Question

Remove pairs of invoices that have both debit and credit note (S/H from "BSEG"."SHKZG").

  • July 15, 2022
  • 1 reply
  • 3 views

Hi,

 

As an analyst, I want to exclude from the analysis pairs of invoices that have resulted in a credit note / (canceled invoices)

 

imageCan you help with PQL query?

 

Thanks,

Guilherme

1 reply

  • Level 8
  • July 18, 2022

You can go trough the Data with LAG(..) and order through Postin D.., when you have different status in "BSEG"."SHKZG" you can set it to 1. If you have only S or only H you set it to 0.

 

You can set this as a component Filter and make Invoice != (FIlter with LAG() + CASE WHEN (...)).. so you will get only the invoices which have only S or only H.

 

That should give you an idea how to solve it.