2008 Jul 30 7:56 PM
Hi All,
I have a problem in a select statement where I use a dynamic condition.It gives me a dump
SAPSQL_WHERE_PARENTHESES
CX_SY_DYNAMIC_OSQL_SYNTAX.
Please find the below code which I implemented.
*SELECT * FROM ZXR5*
WHERE (SOURCE).
The value of SOURCE is 'MATNR EQ '000000000000200066'.
When I checked the help, it is advised to use a CATCH exception which I did as below:
TRY.
*SELECT * FROM ZXR5*
WHERE (SOURCE).
CATCH cx_sy_dynamic_osql_error.
MESSAGE `Wrong WHERE condition!` TYPE 'I'.
ENDTRY.
Now, the select statement gives an exception and is not executing to fetch the values.
I need some input on the above issue. Any help on this would be greatly appreciated.
Regards,
Rajmohamed.M
Hi all,
Thanks for the reply.I found out the answer for the issue.
When you pass the dynamic condition, it is better to put in Paranthesis i.e instead of MATNR EQ 000000000200066 , you can put (MATNR EQ 000000000200066 ) which solved my problem.
Regards,
Raj
2008 Jul 30 7:59 PM
2008 Jul 30 8:10 PM
Hi,
The problem is with the Dynamic Condition and the SOURCE is a table not a structure. So sometimes the values will be like this
source-line[1] : MATNR = '000000000000200066' AND
source-line[2] : OBJKEY = '12345'.
For the above conditions also, it gives me a dump.
Regards,
Raj
2008 Jul 30 8:21 PM
Populate ur table in this way and check
source-line[1] : MATNR = '000000000000200066'
source-line[2] : AND
source-line[3] : OBJKEY = '12345'
Regards,
Joy.
2008 Jul 30 8:25 PM
source can define as string.
EPORT YDYN_C.
data: source type string.
data: it_flight type sflight_tab1.
data: p_carrid type sflight-carrid.
p_carrid = 'AA'. <=== in your case define a variable and assign the material value to it
source = 'CARRID EQ P_CARRID' .
select * from
sflight
into table it_flight
where (source).
if sy-subrc eq 0.
endif.Regards
Vijay Babu Dudla
2008 Jul 31 7:40 PM
Hi all,
Thanks for the reply.I found out the answer for the issue.
When you pass the dynamic condition, it is better to put in Paranthesis i.e instead of MATNR EQ 000000000200066 , you can put (MATNR EQ 000000000200066 ) which solved my problem.
Regards,
Raj
2008 Jul 31 8:02 PM
Please close your thread as being answered if you have solved the problem. Thanks.
2008 Jul 31 9:11 PM
Hi Mike,
I made the posting answered But how Can I close the post.
Regards,
Raj.
2008 Jul 31 9:36 PM
2008 Jul 31 9:52 PM
2008 Jul 30 8:05 PM
TRY.
SELECT * FROM ZXR5
INTO table <FS_TAB>
WHERE (SOURCE).
CATCH cx_sy_dynamic_osql_error.
"when there is error then it will give a message
MESSAGE `Wrong WHERE condition!` TYPE 'I'.
ENDTRY.
if the dynamic select fails then we need to catch the exception otherwise run time error will occur
2008 Jul 30 8:16 PM
Hi Vijay,
I tried the same and all the time, the select statement gives me an exception and wont proceed.
TRY.
SELECT * FROM ZXR5
INTO TABLE <L_ZXR5>
WHERE (SOURCE).
CATCH cx_sy_dynamic_osql_error.
MESSAGE `Wrong WHERE condition!` TYPE 'I'.
ENDTRY.
Regards,
Raj
2008 Jul 30 8:09 PM
Populate source table in this way:
concatenate 'MATNR EQ' ''000000000000200066'' into SOURCE
separated by space in character mode.
Regards,
Joy.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |