12-04-2007 8:44 PM
Hello Experts,
I am "read table dbtable" in a program and iam getting an error that 'field does not eixts'. Can anybody please let me know what is the reason?
Thanks a lot for you help.
Code:
DB table <b>ZTABLE</b> has the following fields:
KUNNR
BSTNK
VBELN
POSNR
MATNR
MAKTX
ZZWKTNR2
PRSDT
ZNEWDT
ERNAM
ZPOSTDT
ZPOSTTIME
data: i_ztable like ztable occurs 0 with header line.
sort i_ztable by kunnr bstnk vbeln posnr matnr zzwktnr2.
if not i_ztable is initial.
* loop at i_ztable.
read table ztable with key
kunnr = i_ztable-kunnr
bstnk = i_ztable-bstnk
vbeln = i_ztable-chargeback
posnr = i_ztable-posnr
matnr = i_ztable-matnr
zzwktnr2 = i_ztable-zzwktnr2
binary search.
* endloop.
During syntax check it's giving error: <i>The field KUNNR is unknown</i>.
12-04-2007 8:53 PM
Sam,
You can not use READ Statement on DBTABLE, you can only use on Internal tables.
Regards,
Satish
12-04-2007 8:53 PM
Sam,
You can not use READ Statement on DBTABLE, you can only use on Internal tables.
Regards,
Satish
12-04-2007 8:56 PM
You can do like this
data: wa type ztable.
Select single * from ztable into wa where
kunnr = i_ztable-kunnr and
bstnk = i_ztable-bstnk and
vbeln = i_ztable-chargeback and
posnr = i_ztable-posnr and
matnr = i_ztable-matnr and
zzwktnr2 = i_ztable-zzwktnr2.
Regards,
Satish
12-04-2007 9:12 PM
Thanks Satish for the response. But when I looked in SAP HELP, it's mentioned in that you can use 'Read' Statement on Database Tables. Isn't it true?
12-04-2007 9:14 PM
12-04-2007 9:18 PM
12-04-2007 9:22 PM
> Thanks Satish for the response. But when I looked in
> SAP HELP, it's mentioned in that you can use 'Read'
> Statement on Database Tables. Isn't it true?
In the same help document, also says that it is obsolete and the following statement needs special attention.
<i>For dbtab, you must specify the name of a <b>database table that begins with "T" and is not longer than five characters</b>. The table work area must have been declared with statement TABLES for database table dbtab. If a database table is specified that does not begin with "T", then the first letter is implicitly replaced by "T".</i>
12-04-2007 9:46 PM
Yes. I haven't paid attention to that comments. Thanks for clearing.
Thanks all for your help.