cancel
Showing results for 
Search instead for 
Did you mean: 

Could not commit transaction : Error -1 detected during transaction (ADOC) on Approval Query

0 Kudos

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

Accepted Solutions (0)

Answers (4)

Answers (4)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi Florence,

Did you checked with SAP notes?

0 Kudos

Hi Nagarajan,

That I already checked before I posted this issue on this forum. Nothing is checked over there, This approval runs based on that query only.

Thank you.

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

Did you check 1345316 - Could not commit transaction error while creating
documents ?

0 Kudos

Hi,

Just check on that Note and the setting on the system, that Permit More than One Document Type per Series option is unchecked.

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi Florence,

Approval query will work on header level lik ORDR, ODLN.... it will not work on row level like RDR1, DLN1... this is standard system behaviour.

KennedyT21
Active Contributor
0 Kudos

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

0 Kudos

Hi Kennedy,

I have tried that one too, but it didn't work...

Sorry and I appreciate your help.

KennedyT21
Active Contributor
0 Kudos

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

0 Kudos

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.

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi Florence,

Any way to solve your problem, please refer SAP notes:

1465596 - Could not commit transaction ADOC

Hope helpful.

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi Florence,

Where did you get RTRIM field?

Further, what is purpose of OADM table in above query?

Thanks & Regards,

Nagarajan

0 Kudos

Hi Naga Rajan,

The RTRIM field is to check if the item code is blank or not.

The purpose for that OADM table is just as a flag if the condition is fulfilled then it will return as true.


Thank you.

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi Florence,

Still i didn't understand the OADM table in above query.

Please let me know how did you get RTRIM field or from which table.

Thanks & Regards,

Nagarajan

0 Kudos

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.