Skip to Content
avatar image
Former Member

Approval Procedure Credit Limit with Net days

Hello, I've been trying to make an approval procedure with a query that if a customer has an invoice docstatus open and the docduedate is more than today; it goes to an approval procedure.

Can someone please help me? This is the code I've been using, and the orders gets accepted without being approved:

SELECT distinct 'true' FROM OINV T0 INNER JOIN OCRD T1 ON T0.[CardCode] = T1.[CardCode] INNER JOIN ORDR T2 ON T1.[CardCode] = T2.[CardCode] WHERE T0.[DocDueDate] > GETDATE() AND T0.[Docstatus]= 'o'

Thanks!!!

Add comment
10|10000 characters needed characters exceeded

  • I meant to open the approval, remove the authorization query, add again and update. I know that it is silly but I don`t know if SAP keeps the query inside the approval or run from the query manager.

    What is the SAP version? And I am assuming you are creating the order with the user that you assign the authorization

  • Former Member Danilo Kasparian

    Ok thanks Danilo,

    Yes, I'm creating the sales order with any user that appears on the first screenshot.

    I have version SBO 9.2 (9.20.170) PL 07

  • Former Member Danilo Kasparian

    Already tried, started all over again, and nothing, can't make it work.

  • Get RSS Feed

2 Answers

  • Sep 13, 2017 at 03:04 PM

    Hi,

    Try to change the query to

    IF ((SELECT COUNT('A') FROM OINV T0 WHERE DateDiff(DD, GetDate(), T0.DocDueDate) > 0 AND T0.CardCode = $[$4.0.0]) > 0)
    select 'true'
    else
    select 'false'
    
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      I did it, but still didn't work. I don't know if I'm doing anything wrong. But the orders go right through.

  • Sep 14, 2017 at 12:53 PM

    Hi,

    Change the table OINV to ORDR in your approval and then try.

    Regards,

    Nagarajan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      THANKS NAGARAJAN K,

      I TRIED IT A FEW MINUTES AGO BUT STILL DOESN'T WORK.

      THANKS A LOT FOR YOUR TIME.