‎2007 Oct 29 5:53 AM
Hi all.
i need to have a fm to check for syntax error when user key in some sql statement into my input field. What is the FM for checking syntax for sql statement? thks
‎2007 Oct 29 6:05 AM
Hi Gary,
Use RS_SYNTAX_CHECK
pass your code in I_SOURCE
Regards,
Atish
‎2007 Oct 29 6:16 AM
I got doubt in the FM part. I had declare the ' value' to store my sql statement. This sql statement had error. i need the 'RS_SYNTAX_CHECK' to make a check on my sql. I also expect a error message. How can i do it? Pls change my code if there any mistake. thankS!
data: value(30) type c.
value = 'Select * from student where'
CALL FUNCTION 'RS_SYNTAX_CHECK'
EXPORTING
I_GLOBAL_CHECK = ' '
I_GLOBAL_PROGRAM = ' '
I_PROGRAM =
I_WITH_DIALOG = ' '
IMPORTING
O_ERROR_INCLUDE =
O_ERROR_LINE =
O_ERROR_MESSAGE =
O_ERROR_OFFSET =
O_ERROR_SUBRC =
O_NAVIGATE =
CANCEL =
TABLES
I_SOURCE = <b>value</b>
.
‎2007 Oct 29 6:24 AM
Hi Gary,
I_SOURCE is a table.
You need to define a internal table in your code. In the same way you defined in your earlier program using TYPES...
Just have a field of type string and then append your SQL to that table and pass that table to this FM
regards,
Atish
‎2007 Oct 29 6:25 AM
Hello,
You need to pass the program name since this is mandatory!
Which also means that you cannot just pass a source code having just the query .
You'll have to put that query in a program . Convert that program source code into an internal table and pass that internal table here.
Hope this helps you.
Regards
Nishant
‎2007 Oct 29 6:27 AM
‎2007 Oct 29 6:34 AM
i try but i gt syntax error when activate. Below is my problem code
I got this syntax error: The field "TABLES" is unknown, but there is a field with the similar name "<TABLE>". "<TABLE>".
CONSTANTS: line_length TYPE i VALUE 255.
TYPES:
BEGIN OF t_texttable,
line(line_length) TYPE c,
END OF t_texttable.
DATA
i_texttable TYPE TABLE OF t_texttable.
data: value(30) type c.
Start-Of-Selection.
APPEND value TO i_texttable.
CALL FUNCTION 'RS_SYNTAX_CHECK'
EXPORTING
I_GLOBAL_CHECK = ' '
I_GLOBAL_PROGRAM = ' '
I_PROGRAM =
I_WITH_DIALOG = ' '
IMPORTING
O_ERROR_INCLUDE =
O_ERROR_LINE =
O_ERROR_MESSAGE =
O_ERROR_OFFSET =
O_ERROR_SUBRC =
O_NAVIGATE =
CANCEL =
TABLES
I_SOURCE = i_texttable
.
‎2007 Oct 29 6:44 AM
Hi Gary,
Change it to
CONSTANTS: line_length TYPE i VALUE 255.
TYPES:
BEGIN OF t_texttable,
line(line_length) TYPE c,
END OF t_texttable.
DATA
i_texttable TYPE TABLE OF t_texttable.
DATA wa_texttable TYPE t_texttable.
data: value(30) type c.
Start-Of-Selection.
MOVE value TO wa_texttable-line.
APPEND wa_texttable TO t_texttable.
CALL FUNCTION 'RS_SYNTAX_CHECK'
EXPORTING
I_GLOBAL_CHECK = ' '
I_GLOBAL_PROGRAM = ' '
I_PROGRAM =
I_WITH_DIALOG = ' '
IMPORTING
O_ERROR_INCLUDE =
O_ERROR_LINE =
O_ERROR_MESSAGE =
O_ERROR_OFFSET =
O_ERROR_SUBRC =
O_NAVIGATE =
CANCEL =
TABLES
I_SOURCE = i_texttable
Regards,
Atish
‎2007 Oct 29 6:49 AM
i cut and copy the code but i still hav syntax error:
The field "T_TEXTTABLE" is unknown, but there are the following fields
with similar names: "I_TEXTTABLE" and "WA_TEXTTABLE".
‎2007 Oct 29 6:51 AM
Hi
Sorry for that
just change
t_texttable to i_ texttable
Regards,
Atish
‎2007 Oct 29 6:57 AM
i gt another error again:
Field "TABLES" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement. "DATA" statement. "DATA" statement.
The word in bold is the error.
below is my code.
CONSTANTS: line_length TYPE i VALUE 255.
TYPES:
BEGIN OF t_texttable,
line(line_length) TYPE c,
END OF t_texttable.
DATA
i_texttable TYPE TABLE OF t_texttable.
DATA wa_texttable TYPE t_texttable.
data: value(50) type c.
START-OF-SELECTION.
MOVE value TO wa_texttable-line.
APPEND wa_texttable TO i_texttable.
CALL FUNCTION 'RS_SYNTAX_CHECK'
EXPORTING
I_GLOBAL_CHECK = ' '
I_GLOBAL_PROGRAM = ' '
I_PROGRAM =
I_WITH_DIALOG = ' '
IMPORTING
O_ERROR_INCLUDE =
O_ERROR_LINE =
O_ERROR_MESSAGE =
O_ERROR_OFFSET =
O_ERROR_SUBRC =
O_NAVIGATE =
CANCEL =
<b>TABLES</b>
I_SOURCE = i_texttable.
‎2007 Oct 29 7:01 AM
Hi Gary,
CALL FUNCTION 'RS_SYNTAX_CHECK'
EXPORTING
I_PROGRAM = sy-repid
I_WITH_DIALOG = ' '
IMPORTING
O_ERROR_INCLUDE =
O_ERROR_LINE =
O_ERROR_MESSAGE =
O_ERROR_OFFSET =
O_ERROR_SUBRC =
O_NAVIGATE =
CANCEL =
TABLES
I_SOURCE = i_texttable.
Regards,
Atish
‎2007 Oct 29 7:02 AM
Also Gary to get the errors record you need to fill get the importing parameters
IMPORTING
O_ERROR_INCLUDE =
O_ERROR_LINE =
O_ERROR_MESSAGE =
O_ERROR_OFFSET =
O_ERROR_SUBRC =
O_NAVIGATE =
CANCEL =
regards,
Atish
‎2007 Oct 29 7:12 AM
now i have no error text. i tested. There's no response or error check on my sql statement. How to perform the check which i can implement this FM in my program?
‎2007 Oct 29 7:14 AM
You need to get that using defining all the IMPORTING table.
Just do where used list on this FM and you can get an idea.
Regards,
Atish
‎2007 Oct 29 7:15 AM
gary please specify the program name for i_program the error will be removed.
give the program name in '' and in capital
‎2007 Oct 29 7:24 AM
do u hav ready code to demo? Cos i dont know hw to set the paramater
‎2007 Oct 29 6:09 AM
I think if you'll just pass the SQL statement which is having no data declaration, syntax check will give errors so pass the data declaration also of the variables that are being used.
Regards
Nishant