Application Development and Automation 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 only

reading tables

Former Member
0 Likes
718

Hi ,

I want to read the database table VBEP. for that i wrote following lines.

READ TABLE vbep WITH KEY vbeln = vbap-vbeln

posnr = vbap-posnr

etenr = '0001'.

But it showing error that '" vbeln is not present ". Please tell me how to read db table.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
682

Hi

U cant use READ stmt for database table read.Its for internal tables only.

Use SELECT stmt for database table read.

Ex:

select * from vbap into corresponding fields of table itab where...

select * from vbep into into corresponding fields of table itab1 where...

loop at itab1.

READ TABLE itab WITH KEY vbeln = itab1-vbeln

posnr = vbap-posnr

etenr = '0001'.

if sy-subrc = 0.

code here.

endif.

endloop.

Regs

Manas

6 REPLIES 6
Read only

Former Member
0 Likes
683

Hi

U cant use READ stmt for database table read.Its for internal tables only.

Use SELECT stmt for database table read.

Ex:

select * from vbap into corresponding fields of table itab where...

select * from vbep into into corresponding fields of table itab1 where...

loop at itab1.

READ TABLE itab WITH KEY vbeln = itab1-vbeln

posnr = vbap-posnr

etenr = '0001'.

if sy-subrc = 0.

code here.

endif.

endloop.

Regs

Manas

Read only

Former Member
0 Likes
682

Hi,

You can't read DB table. You need to select

Select single * from VBEP

into wa_vbep

where vbeln = vbap-vbeln

posnr = vbap-posnr

etenr = '0001'.

Reward points if this Helps.

Manish

Read only

Former Member
0 Likes
682

You cannot use READ table for database table

select all the data to internal table and use read

Read only

Former Member
0 Likes
682

Hey,

if u r trying to read from a database table, its completely wrong..!

U need to select records from the table into an internal table & then read.

Read only

Former Member
0 Likes
682

Hello,

Reading the Database table is Obsolete now.

Instead use select to read the data from VBEP.

DO like this.

Select * from VBAP into itab where ....

If not itab[] is intiial.

select * from VBEP into table Itab1 for all entries in itab

where vbeln = itab-vbeln

posnr = itab-posnr

etenr = '0001'.

If useful reward.

Vasanth

endif.

Read only

Former Member
0 Likes
682

Hi shweta

the READ statement is used at internal table level only.

Plz use SELECT * / SELECT DISTINCT / SELECT <field1> ...<FIELDn> ..

statement to read data from the Dbase tables.

Regards

Pankaj