Skip to Content
author's profile photo Former Member
Former Member

read table dbtable

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 08:53 PM

    Sam,

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

    Regards,

    Satish

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 08: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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.