on 04-02-2013 10:03 PM
Hi folks,
I am creating an approval query to check if there is base document on AP Invoice, so it will bypass the approval but if there is no base document, then the approval should go to the approver. If I logon as the manager and then check on the AP Invoice form where there is base document and run the query, the result that I get is "FALSE" which is correct and if I create AP Invoice without base document, the result is "TRUE" which is also correct.
The problem occurs everytime the originator of the document try to add AP Invoice based on existing PO - getting an error message "Could not commit transaction error -1 (ADOC)". Could anyone please help me with this issue?
Please find below the approval query that I wrote :
DECLARE @TOTAL AS DECIMAL(38,2)
DECLARE @DOCTYPE AS NVARCHAR(1)
SET @TOTAL=CAST($[OPCH.DocTotal.Number] AS DECIMAL(38,2)) -CAST($[OPCH.VatSum.Number] AS DECIMAL(38,2))
SET @DOCTYPE=$[OPCH.DocType]
IF EXISTS (SELECT TOP 1 1 FROM OADM WHERE RTRIM($[$39.1.0])<>'' AND $[$39.23.Number]=-1 AND @DOCTYPE='S')
IF @TOTAL >0 AND @TOTAL <=500
SELECT 'TRUE'
ELSE
SELECT 'FALSE'
ELSE
IF EXISTS (SELECT TOP 1 1 FROM OADM WHERE RTRIM($[$38.1.0])<>'' AND $[$38.43.Number]=-1 AND @DOCTYPE='I')
IF @TOTAL >0 AND @TOTAL <=500
SELECT 'TRUE'
ELSE
SELECT 'FALSE'
ELSE
SELECT 'FALSE'
Thank you in advance
Hi Florence,
Did you checked with SAP notes?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Florence Tirtodjojo ..
Have you checked does you have any transcation notification for that...
Try This
DECLARE @TOTAL AS DECIMAL(38,2)
SET @TOTAL=CAST($[OPCH.DocTotal.Number] AS DECIMAL(38,2)) -CAST($[OPCH.VatSum.Number] AS DECIMAL(38,2))
IF $[$38.43.Number]<>-1
SELECT 'FALSE'
ELSE
IF $[$39.23.Number]<>-1
SELECT 'FALSE'
ELSE
IF @TOTAL >0 AND @TOTAL <=500
SELECT 'TRUE'
Regards
Kennedy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Try this Way Hope helpful
DECLARE @TOTAL AS DECIMAL(38,2)
DECLARE @TOTAL1 AS DECIMAL(38,2)
DECLARE @TOTAL2 AS DECIMAL(38,2)
SET @TOTAL=CAST($[OPCH.DocTotal.Number] AS DECIMAL(38,2)) -CAST($[OPCH.VatSum.Number] AS DECIMAL(38,2))
SET @TOTAL1= $[$38.43.Number]
SET @TOTAL2= $[$39.23.Number]
IF @TOTAL1<>-1
SELECT 'FALSE'
ELSE
IF @TOTAL2<>-1
SELECT 'FALSE'
ELSE
IF @TOTAL >0 AND @TOTAL <=500
SELECT 'TRUE'
Regards
Kennedy
Hi Kennedy,
Tried that one too, but it doesn't work. I'm started to think that the issue is not because of the approval query, but I am not sure with my assumption. Because if I logon as the manager, and run the query on active marketing document (AP invoice), I can see it's giving me the correct result. But when I copy from PO to AP Invoice as the originator, I'm getting the same error over and over again.
Thanks.
Hi Florence,
Any way to solve your problem, please refer SAP notes:
1465596 - Could not commit transaction ADOC
Hope helpful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Florence,
Where did you get RTRIM field?
Further, what is purpose of OADM table in above query?
Thanks & Regards,
Nagarajan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nagarajan,
Okay, please ignore that OADM table in the above query.
That RTRIM is actually an SQL function.
I changed the query into :
DECLARE @TOTAL AS DECIMAL(38,2)
SET @TOTAL=CAST($[OPCH.DocTotal.Number] AS DECIMAL(38,2)) -CAST($[OPCH.VatSum.Number] AS DECIMAL(38,2))
IF $[$38.43.Number\]<>-1
SELECT 'FALSE'
ELSE
IF $[$39.23.Number\]<>-1
SELECT 'FALSE'
ELSE
IF @TOTAL >0 AND @TOTAL <=500
SELECT 'TRUE'
But I am still getting the error message. Eventhough when I check as in Manager user, I can still see that the query above giving me the correct result.
User | Count |
---|---|
92 | |
11 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.