2007 Apr 16 4:48 AM
HI,
I have one import parameter as Sales_org (VBAK-VKORG).
I need to write a select statement to get the records from VAKPA table and the condition should be as
Frst four characters of VAKPA-KUNDE = Sales_org.
I have written the select statement as
select KUNDE
from VAKPA
into table i_VAKPA
where KUNDE+0(4) = Sales_org.
I am getting error as we cannot use offset in the select statement.
Can anyone let me know how to write this query.
Regards,
Ram
Hi,
Instead of KUNDE ...If it is okay..You can directly use the VKORG field in the table VAKPA..
select KUNDE
from VAKPA
into table i_VAKPA
where VKORG = Sales_org.
Thanks,
Naren
2007 Apr 16 4:51 AM
Hi Ram ,
You need to use the like statement in place of equal to .
Take the Sales_org into a variable and append % at the end of it.
Then use this varaible in the where clause.
Regards
Arun
2007 Apr 16 4:53 AM
Not clear Arun. Could you pls elaborate this with some example.
Regards,
Ram.
2007 Apr 16 4:57 AM
Hi Ram,
Decleare a variable which can accomodiate at 5 chars , let the variable be V_TEMP.
CONCATENATE Sales_org '%' into v_temp.
select KUNDE
from VAKPA
into table i_VAKPA
where KUNDE like v_temp.
Please try this and see if it helps.
Regards
Arun
2007 Apr 16 5:01 AM
Hi Arun,
My requirement is need to compare only the first 4 cahracters of field KUNDE = Sales_org.
Here the field KUNDE is of 10 character in length. like 'CH10234567'
and if my sales_org = CH10 then need to write select statement for this to satisfy the above condition.
select KUNDE
from VAKPA
into i_VAKPA
where KUNDE+0(4) = sales_org.
Regards,
Ram
2007 Apr 16 5:06 AM
Hi Ram ,
The statement will check only the first 4 char and will select all those records where the first 4 char of KUNDE is the input given by you.
Regards
Arun
2007 Apr 16 4:53 AM
Hi,
Instead of KUNDE ...If it is okay..You can directly use the VKORG field in the table VAKPA..
select KUNDE
from VAKPA
into table i_VAKPA
where VKORG = Sales_org.
Thanks,
Naren
2007 Apr 16 5:00 AM
Hi Ram Mohan,
Data v_text(6) type c
concatenate sales_org '%' into v_text.
select KUNDE
from VAKPA
into table i_VAKPA
where KUNDE like v_text.
I think this will solve the problem. Correct me if I am wrong.
Regards,
Ramesh S
*award points if reply is helpful
Message was edited by:
Ramesh Babu Srikakollu
2007 Apr 16 5:07 AM
Hi,
Try this
First offset Sales org in a Temporary table then pass it to the SELECT statement
Since
u cant use Offset in Select statement
Thanks
Shankar S
Close it when its Answered
2007 Apr 16 5:13 AM
HI RAM MOHAN,
TRY THIS...
DATA : BEGIN OF ITAB OCCURS 0,
KUNDE LIKE VAKPA-KUNDE,
END OF ITAB.
DATA : BEGIN OF ITAB1 OCCURS 0,
KUNDE LIKE VAKPA-KUNDE,
END OF ITAB1.
SELECT KUNDE FROM VAKPA INTO TABLE ITAB.
LOOP AT ITAB.
ITAB-KUNDE = ITAB-KUNDE+0(4).
MODIFY ITAB.
CLEAR ITAB.
ENDLOOP.
SELECT KUNDE FROM VAKPA INTO TABLE ITAB1 WHERE KUNDE EQ ITAB-KUNDE.
if it is helpful let me know.
Senthil kumar
2007 Apr 16 5:17 AM
hi
store the sales org. in a variable and try like this
data v_sorg like vakpa-vkorg.
v_sorg = <Sales org.>
select KUNDE
from VAKPA
into table i_VAKPA
where KUNDE LIKE '%V_SORG%'.
if helpful, reward
Sathish. R
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |