Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 2136

SBO_transaction notification SAP HANA document number same series

$
0
0

hi expert

can anyone help me to correct the store procedure to add to Sbo_transaction notification ?

i've the same series document number for A\r Invoices and A\r credit memo.

i want to block the user to add a Docdate < the the last Document date, for the same series.

Sap B1  fill in the store procedure, but it doesn't start the control.

 

-

begin

  

    declare INDocDate DATETIME;

    declare tempDate DATETIME;

    declare conta INT;

   

   

 

--- add in a temp table the data

 

    IF (:object_type = '13' or :object_type = '14' or :object_type = '203' or :object_type = '15') and :transaction_type = ('A') then

    --IF :object_type in ('13','14','203','15') and :transaction_type in ('A') then

        BEGIN

            CREATE TABLE TEMPTABLE ( "DocEntry" INT, "Series" INT,    "SeriesName" NVARCHAR(8) ,

                                     "DocNum" INT, "DocDate" DATETIME,    "ObjType" NVARCHAR(20));

           

            INSERT INTO TEMPTABLE ("DocEntry", "Series","SeriesName","DocNum","DocDate","ObjType")

            Select "DocEntry",a."Series",b."SeriesName","DocNum","DocDate","ObjType"

              From OINV a Inner Join NNM1 b On a."Series"=b."Series"

              Union

              Select "DocEntry",a."Series",b."SeriesName","DocNum","DocDate","ObjType"

              From ORIN a Inner Join NNM1 b On a."Series"=b."Series"

            union

            Select "DocEntry",a."Series",b."SeriesName","DocNum","DocDate","ObjType"

              From ODPI a Inner Join NNM1 b On a."Series"=b."Series"

            union

            Select "DocEntry",a."Series",b."SeriesName","DocNum","DocDate","ObjType"

              From ODLN a Inner Join NNM1 b On a."Series"=b."Series";

         

              Select  T0."DocDate"  into tempDate

 

            From TEMPTABLE T0 Inner Join TEMPTABLE T1

            On T0."SeriesName"=T1."SeriesName"

            Where T0."DocEntry"=:list_of_cols_val_tab_del

                     And T0."ObjType"=:object_type 

                     And T0."DocDate"<T1."DocDate";

           

            SELECT COUNT(*) INTO Conta from TEMPTABLE;

           

            IF :Conta > 0  THEN

                 

              declare INDocDate DATETIME;

                 

                  Select T1."DocDate" into INDocDate

                  From TEMPTABLE T0 Inner Join TEMPTABLE T1

                  On T0."SeriesName"=T1."SeriesName"

                  Where T0."DocEntry"=:list_of_cols_val_tab_del And T0."ObjType"=:object_type;

                   

                    error := -999;

                    error_message := 'DOCUMENT DATA < THEN THE LAST DOCUMENT INSERT FOR THE SAME SERIES ' ;

                

              

              END IF;

              Drop Table TEMPTABLE;

        END;

    END IF;

end;

   

 

 

select

 

       :error,

 

       :error_message

 

FROM dummy;

 

 

end;


Viewing all articles
Browse latest Browse all 2136

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>