2014 Apr 29 2:19 PM
Hello
i have a doubt about a select statement , i have a ZTABLE with a key field char length 11 and a record in the table with the key '00012345678'
i have a field in the selection screen of length 20 which i use for capture the value for find the data in the ZTABLE work fine so far but
if fill the field with the value '00012345678000' ( add 3 more zero at the end ) the record is still find in the DB and my question is this OK ? is this the normal behavior ? or is because is a CHAR type field ?
Thanks
2014 Apr 29 2:46 PM
thanks for the reply ,
i know how to solved the issue my question was more if this is the correct behavior of SQL or is just a abap case ?(that the where truncate the value in case of CHAR data type.(
Hello
i have a doubt about a select statement , i have a ZTABLE with a key field char length 11 and a record in the table with the key '00012345678'
i have a field in the selection screen of length 20 which i use for capture the value for find the data in the ZTABLE work fine so far but
if fill the field with the value '00012345678000' ( add 3 more zero at the end ) the record is still find in the DB and my question is this OK ? is this the normal behavior ? or is because is a CHAR type field ?
Thanks
2014 Apr 29 2:36 PM
Hi Edgar,
No. On screen you should define the same field lentgh which is defined in table.
Are you transferring screen data to local variable(type same as table data element) and further using it in Select query for comparision?
Regards,
Sudeesh Soni
2014 Apr 29 2:42 PM
Hi Edgar,
Kindly take the same type i.e your ZTABLE-field in your selection screen. Can i know of which type you have taken the field type for the screen field and in the program.
I think your issue will be solved.
Thanks & Regards,
S.Rajendranath Raparthi
2014 Apr 29 2:45 PM
Hi EA,
No, it should not find because the value differs. you are comapring 00012345678 with 00012345678000 and still you are getting result.. It should not return any value..
2014 Apr 29 2:48 PM
but i am getting value, is like the where is truncate the value of the field char 20 and only getting the first 11 position
2014 Apr 29 2:46 PM
thanks for the reply ,
i know how to solved the issue my question was more if this is the correct behavior of SQL or is just a abap case ?(that the where truncate the value in case of CHAR data type.(
2014 Apr 29 2:54 PM
Your question is very good Edgar. but i never faced such issue. you are comparing 11 field length with 14 . i will have to check this. Will let you know.
2014 Apr 29 4:20 PM
2014 Apr 29 4:40 PM
Hi,
PARAMETER: aaa type c LENGTH 20.
data: bbb TYPE c LENGTH 11.
bbb = aaa.
Here bbb always contains First 11 characters of aaa. If it is an integer then it is the reverse case always contain last digits until it fit the field.
characters: assignment happens from left to right if the container is not enough size.
digits: assignment happens from right to left if the container is not enough size.
Regards,
Aswath.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |