2008 Nov 08 9:41 AM
Hi,
I am using open SQL.
I have a table which has a field with max length of 10 characters. Now I want to fetch only those records whose value length is 5 characters.
Can I achieve this without using wildcard '_' ?
Is there a way by which I can find the length of the field value?
Thanks.
Hi,
I am using open SQL.
I have a table which has a field with max length of 10 characters. Now I want to fetch only those records whose value length is 5 characters.
Can I achieve this without using wildcard '_' ?
Is there a way by which I can find the length of the field value?
Thanks.
2008 Nov 10 4:18 AM
Hello,
Explain your problem little bit clearly.
If possible give one example.
2008 Nov 11 9:31 AM
Hello Santosh,
If a field lendth say MATNR is 18 characters and in MARA table I have material nos. as
10010001,
20010002,
30010003,
400100045.
Now in my SQL query, I would like to fetch only the first three material nos., ie, all material nos whose length is 8 digits.
Is there a way to derive it in SQL where condition (not using '_' wildcard).
Thanks.
2008 Nov 11 10:04 AM
WHERE MATNR LIKE '________' would work, why don't you want to use wildcards?
Thomas
Edit: actually it would not work if MATNR contains only digits, since these are stored with leading zeroes in the DB. Next one please.
2008 Nov 11 10:20 AM
Hi Thomas,
I agree that this will not work for MATNR. My requirement is not for MATNR.
The reason for me not to use '_' wildcard is that I want to do this for 1100, 2000, 3000 .... 7000 series of a particular field. Using '_' would mean that i will have to use '_' for all the series.
In native SQL I can use 'where LEN(VKBUR) = 3'.
Is there a similar way in open SQL?
Thanks.
2008 Nov 11 10:23 AM
Hi,
I think we can do like this.
Initially fetch all the data in to the internal table.
then we can delete the records whose length greater than 5 and less than 5.
Regards.
2008 Nov 11 10:36 AM
> In native SQL I can use 'where LEN(VKBUR) = 3'.
>
> Is there a similar way in open SQL?
I don't think so.
> I agree that this will not work for MATNR. My requirement is not for MATNR.
Right, you mentioned field length 10...my mistake.
> The reason for me not to use '_' wildcard is that I want to do this for 1100, 2000, 3000 .... 7000 series of a particular field. Using '_' would mean that i will have to use '_' for all the series.
Not completely getting this, so I'll withdraw now
Thomas
2008 Nov 11 11:32 AM
Hey,
why not use open sql and put +++++ in your select-options?
This will return all values consisting of 5 non-blank characters - which may have spaces enclosed.
IE SE16 for T000 with ++++++ in field MTEXT will select SAP AG but probably not any other client because usually the text is longer.
Regards,
Clemens.
2008 Nov 11 11:33 AM
This would be the same as LIKE '_____', but he doesn't like it...
2008 Nov 11 11:39 AM
Hi kumar,
possibly you can put it into a select-option range LOW = 1100 ...to HIGH = 9000.
Regards,
Clemens
2008 Nov 11 9:58 AM
Hi
Good
I dont think you can give the field range while selecting a particular field data from the table, so you will get complete filed value with the availble length. If you truncate some the digits outside the select statement.
Thanks
mrutyun^
2008 Dec 22 6:15 AM
All answers to this question are known. My question is not understood.
Thanks for your time and effort.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |