10-04-2008 5:40 AM
Can I use for all entries IN
with offset ?
SELECT KUNNR
FROM kna1
INTO TABLE gt_kna1
FOR ALL ENTRIES IN gt_soldto
WHERE name2+7(10) = gt_bstnk_storeno_kunnr-store_no
OR j_3astcu = gt_bstnk_storeno_kunnr-store_no.
Please guide me ... I need to select where kna1-name2 ( from 7th postion onwards ) contains the internal table value
then select kunnr field from kna1.
Thanks,
10-04-2008 6:01 AM
Really sorry
SELECT KUNNR
FROM kna1
INTO TABLE gt_kna1
FOR ALL ENTRIES IN gt_soldto
WHERE name2+7(10) = gt_soldto-store_no
OR j_3astcu = gt_soldto-store_no
Is my select stmt
10-04-2008 5:49 AM
Sam,
Your For All entries is gt_soldto internal table but the where conditions are w.r.t to something else.
K.Kiran.
10-04-2008 6:01 AM
Really sorry
SELECT KUNNR
FROM kna1
INTO TABLE gt_kna1
FOR ALL ENTRIES IN gt_soldto
WHERE name2+7(10) = gt_soldto-store_no
OR j_3astcu = gt_soldto-store_no
Is my select stmt
10-06-2008 9:44 PM
Hmmm....
Sorry - this isn't as simple as I first thought.
The solution I was thinking of involved patterns (Which is in the HELP for SELECT). But since you are using FOR ALL ENTRIES and not SELECT-OPTIONS or a range table, that doesn't help much.
You can still use a pattern, but it will involve looping through the internal table, and changing it to a pattern and using that in the SELECT.
An alternative is native SQL, but I think the first is better.
Sorry for my confusion Mea culpa
Rob
10-04-2008 6:19 AM
HI,
This code may help u...
FIELD-SYMBOLS: <fs> like line of gt_soldto.
LOOP AT gt_soldto assigning <fs>.
CONCATENATE '%' <fs>-store_no into <fs>-store_no.
ENDLOOP
SELECT KUNNR
FROM kna1
INTO TABLE gt_kna1
FOR ALL ENTRIES IN gt_soldto
WHERE name2 LIKE gt_soldto-store_no
OR j_3astcu = gt_soldto-store_no
.
Edited by: Sukriti Saha on Oct 4, 2008 7:20 AM
10-04-2008 8:03 AM
Hi
You can not offset the field name in the where condition(i.e left side of operator)
WHERE name2+7(10) = gt_bstnk-store_no.............> wrong
You can use offset right side of operator
like this way matnr = i_mara-matnr+0(18).
10-04-2008 8:27 AM
Use the following code -
In case cases you cannot use offset in select statement and hence use substr
SELECT KUNNR FROM kna1
INTO TABLE gt_kna1
FOR ALL ENTRIES IN gt_soldto
WHERE substr(name2,7,10) IN gt_bstnk_storeno_kunnr-store_no
OR j_3astcu = gt_bstnk_storeno_kunnr-store_no.
-Siddhi Daftary
10-04-2008 6:37 PM
Why not just press F1 on SELECT?? None of the other answers here are correct. Only one approaches correctness.
Rob
10-05-2008 4:11 AM
Yes Rob. (Yes There is no one in Performance tunning like you solve :-)....)
Yes None of the answer is correct. Your answer about correction is correct. THANK YOU!
I tried with F1 help ... it did not help much.
I saw in debugging some where ... the offset is allowed .
But I missed to copy that and to document for my reference recently. I hoped on SDN ....Still waiting for some as well as looking trying my self with F1 and all.
Did any body do this offset in SELECT.
10-05-2008 3:36 PM
After pressing F1 on SELECT, look at the portion on WHERE. (This isn't performance; it's syntax).
Rob
10-05-2008 7:09 PM
SAM,
ur internal table is FOR ALL ENTRIES IN is "gt_soldto" ...
the table in for all entries need to be compared with in the WHERE clause..
but you where not using the internal table "gt_soldto" in your where clause..
This leads to syntax error....
It has to lead to error .. COZ, There is no meaning in having a table in FOR ALL ENTRIES without using it in where clause.....
Make an additional comaprision between the fields of "KNA1" and "gt_soldto" .. that will resolve your prob...