Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

read table dbtable

Former Member
0 Kudos

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>.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Sam,

You can not use READ Statement on DBTABLE, you can only use on Internal tables.

Regards,

Satish

7 REPLIES 7

Former Member
0 Kudos

Sam,

You can not use READ Statement on DBTABLE, you can only use on Internal tables.

Regards,

Satish

Former Member
0 Kudos

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

0 Kudos

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?

0 Kudos

It is true, but not recommended. Use SELECTs instead.

Rob

0 Kudos

Can you please provide the link

0 Kudos

> 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>

0 Kudos

Yes. I haven't paid attention to that comments. Thanks for clearing.

Thanks all for your help.