cancel
Showing results for 
Search instead for 
Did you mean: 

SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near "END"

former_member969480
Discoverer
0 Kudos

Buenas tardes

Soy novato en el uso de SAP y HANA, tengo que hacer un procedimiento almacenado el cual tiene la funcionalidad de ejecutar una consulta.

Al querer ejeciutar recibo el siguiente error:

SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near "END"

Me sería de mucha ayuda saber en que estoy fallando

Dejo el código:

CREATE PROCEDURE SP_CERTIFIQUED(
    IN F_Inicial timestamp,
    IN F_Final timestamp,
    Bodega NVARCHAR(10))
    
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER
READS SQL DATA AS

BEGIN
    SELECT
      T0."U_FacSerie" AS SERIE,
      T0."DocDate" AS FECHA_DOC,
      T0."DocTime" AS HORA_DOC,
      T0."U_FacSerie" AS SERIE,
      T0."U_FacNum" AS NUM_FAC,
      T0."U_SO1_01FOLIORETAIL1" AS R1_FOLIO,
      T0."DocNum" AS SAP_NUM,
      CAST(T0."U_CAE" AS VARCHAR(200)) AS CERTIFIQUED_NUMBER,
      T0."DocStatus" AS STATUS_DOC,
      T0."CardCode" AS COD_CLIENTE,
      T0."CardName" AS "NOMBRE CLIENTE",
      T0."U_FacNit" AS NIT_CLIENTE,
      T0."DocTotal" AS DOC_TOTAL,
      T1."SlpCode" AS COD_VEN,
      T1."SlpName" AS "NOMBRE VENDEDOR"
      
    FROM OINV T0
        INNER JOIN OSLP T1 ON T0."SlpCode" = T1."SlpCode" 
        INNER JOIN INV1 T2 ON T0."DocEntry" = T2."DocEntry"
    
    WHERE T2."WhsCode" = Bodega
    AND T0."DocDate" >= F_Inicial AND T0."DocDate" <= F_Final
    ORDER BY T0."DocNum" ASC
    
END;
former_member30
Community Manager
Community Manager
0 Kudos

Hi and welcome to the SAP Community!

Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend that you familiarize yourself with https://community.sap.com/resources/questions-and-answers (if you haven't already), as it provides tips for preparing questions that draw responses from our members.

Should you wish, you can revise your question by selecting Actions, then Edit (although once someone answers your question, you'll lose the ability to edit the question -- but if that happens, you can leave more details in a comment).

Finally, if you're hoping to connect with readers, please consider adding a picture to your profile. Here's how you do it: https://www.youtube.com/watch?v=F5JdUbyjfMA&list=PLpQebylHrdh5s3gwy-h6RtymfDpoz3vDS. By personalizing your profile with a photo of you, you encourage readers to respond.

Cheers,

Julia
SAP Community Moderator

Accepted Solutions (1)

Accepted Solutions (1)

Jörg_Brandeis
Contributor

Hi Bryan,

you should end each statement with a semicolon:

ORDER BY T0."DocNum" ASC;

This is the error near END

Regards,

Jörg

Answers (0)