09-02-2006 5:32 PM
hi to all
how to write an select statement without an into class
can we write like this
select single land1 from kna1
where kunnr = kna1-kunnr.
thanks in advance.
kiran
09-02-2006 5:41 PM
09-02-2006 5:44 PM
hi
use the below code.
<b>tables kna1.
parameters p_kunnr like kna1-kunnr.
select single * from kna1 where kunnr = p_kunnr.</b>
Cheers,
Abdul Hakim
Mark all useful answers...
09-02-2006 6:07 PM
Hi,
It is possible to write a SELECT without INTO clause.
1) If you want to fecth single record...
SELECT * FROM KAN1 WHERE KUNNR = KNA1-KUNNR.
X_KNA1-KUNNR = KNA1-KUNNR.
X_KNA1-NAME1 = KNA1-NAME1.
2) If you want to fecth multiple records...
SELECT * FROM KNA1 WHERE KUNNR IN S_KUNNR. "(S_KUNNR is select option)
ITAB-KUNNR = KNA1-KUNNR.
ITAB-NAME1 = KNA1-NAME1.
APPEND ITAN. CLEAR ITAB.
ENDSELECT.
Thanks,
Ramakrishna
09-02-2006 7:22 PM
You can't write:
select single land1 from kna1
where kunnr = kna1-kunnr.
But you can write either:
TABLES: kna1.
select single * from kna1
where kunnr = kna1-kunnr.
or:
tables: kna1.
data: country like kna1-land1.
select single land1 from kna1
into country
where kunnr = kna1-kunnr.
Rob
04-21-2007 11:25 AM
hi friend ,
i m beginer in abap and want to write my first program with select statement . if possible ,please guide me.
04-21-2007 1:31 PM
Hi Kiran,
when selecting anything, you want a result. This result is passed to the field given with INTO. If you don't write INTO, you have an implicit INTO. Examples are already given with TABLES statement:
SELECT * FROM KNA1
is interpreted as SELECT {all field names of KNA1} INTO KNA1 FROM KNA1.
SELECT COUNT( * ) FROM KNA1 WHERE ...
will put the number of records matching the WHERE clause into system field SY_DBCNT.
It is just the simplified way of writing ommitting the implicit INTO SY-DBCNT clause.
Conclusion:
You can not write
select single land1 from kna1
where kunnr = kna1-kunnr.
even if you have a structure field with the name KNA1. This field can be defined with the (outdated) TABLES: KNA1 statement because the field land1 is different from the (implicit) target areas KNA1.
Regards,
Clemens
Regards,
Clemens
04-21-2007 1:37 PM
hi
I agree all above, and know that if we use " * from" , then it will crate buffer and store the selected data in the buffer tempararily.
regards
sreeni