‎2011 Aug 17 12:25 PM
Hi All,
Is it possible to do a select query with using offset option for column name . I have tried a code but it dint pass the syntax check.
I am eager to know because I have seen this thread with similiar requirement but that dint work for me.
Has it got something to do with SAP version.
Best Regards,
Dep
‎2011 Aug 17 12:52 PM
No you cannot atleast in open SQL. You have a lot of workarounds of using either patterns with the select statement or processing after the select statement by looping.
With native SQL, you may give a try. I don't think it is very reliable
Vikranth
‎2011 Aug 17 12:52 PM
No you cannot atleast in open SQL. You have a lot of workarounds of using either patterns with the select statement or processing after the select statement by looping.
With native SQL, you may give a try. I don't think it is very reliable
Vikranth
‎2011 Aug 17 1:04 PM
Hi Vikranth,
Select with patterns I have seen examples where it has been used in WHERE condition.
But, when it comes to columns is where my concern is.
Example from the LINK I mentioned :
Select FIELD1+0(10) into L_FIELD1 where FIELD2 = L_FIELD2+2(10).BR
Dep
‎2011 Aug 17 2:34 PM
‎2011 Aug 17 3:07 PM
Hi Rob,
Can I achieve below using patterns:
Select Ebeln+0(4)
ebelp
into table itab
from ekpo
up to 10 rows.BR
Dep
‎2011 Aug 17 3:30 PM
Hi,
Select Ebeln+0(4)
ebelp
into table itab
from ekpo
up to 10 rows.
if you really only want to achieve that, then use SELECT ebeln ebelp ... and define itab with EBELN field of 4 characters only , it will copy only the 4 first characters.
Sandra
‎2011 Aug 18 10:13 AM
Hi Sandra ,
I would also like to how could we acheive:
Select Ebeln+2(4)
ebelp
into table itab
from ekpo
up to 10 rows.I am sorry I have asked it late and moderators kindly do take approriate action if needed for marking my question as solved and changing it again.
And I wish there were more 10 pointers ))
BR
Dep
‎2011 Aug 18 10:30 AM
Hi Dep,
AFAIK this is not possible using Open SQL.
Actually Sandra's solution works because the values get "truncated" when they are transferred from the DB layer to the target internal table. (Since the length of the internal table field is lesser).
BR,
Suhas
PS: As a matter-of-fact at the back of my mind i knew this question was coming
Edited by: Suhas Saha on Aug 18, 2011 3:02 PM
‎2011 Aug 18 12:54 PM
How complicated does this need to get?
Select your data with a char4 field named, but empty...then loop at your internal table and compute the char4 field = ebeln+2(4)!
‎2011 Aug 18 1:16 PM
‎2011 Aug 18 10:20 AM
Hi.
try offset and put them in another internal table or if it is a single table put into variables. After that go for fetch from standard tables,
I have faced the problem whine fetching documents with reference fields,
Rgds
Siva