SAP B1 Approval Procedure
I'am trying to create a simple query for my Approval Procedure in SAP B1
,i want to execute approval procedure if OCRD.creditline is less than OCRD.Balance , my problem is everytime i create a sales order it will asking me for approval even creditline is greater than balance, i am sorry i am new of creating script/s, please see my script below for your assistance:
SELECT distinct 'true' FROM OCRD T0 INNER JOIN ORDR T1 ON T0.CardCode = T1.CardCode WHERE T0.[CreditLine] < T0.[Balance]
Dear Silent Knight,
If I setup Approval Procedure with below query on Sales Order Level, it works.
SELECT distinct 'true' FROM OCRD T0 INNER JOIN ORDR T1 ON T0.CardCode = T1.CardCode WHERE T0.[CreditLine] < T0.[Balance] and T0.CardCode=$[$4.0.0]
This query will not directly run in query generator as there is another way of checking the output.
Please make sure that you have done below settings for Originator and Sales Order document shown below.
1. Approval Stage
2. Approval Template-Originator Tab
3. Approval Template-Document Tab
4. Approval Template-Stages Tab
5. Approval Template-Terms Tab
Once you do all the settings and apply query to the template. Open Sales Order and select customer whose CreditLine<Balance and keep the Sales Order open and Go to Tools-->Queries-->User Queries--> and click on the approval query that you saved (Query shown in screen shot in my test case) and once it returns True in query output then it will go for approval.
Hope this will help you to identify where what goes wrong.