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: 

Why is my newly created database view empty?

Former Member
0 Kudos
583

Hi all,

I have just created a database view in SE11 between 2 tables, but when I test it, the veiw is empty. I found out that in the Maint. Status tab, there's a warning saying that "You can only read database views with more than one table". What is my problem here? Both my tables are having lots of data. Please help.

1 REPLY 1

Former Member
0 Kudos
130

Hi,

VIEWS:

-


  • View is a data dictionary object.

  • It exists logically inside the data dictionary.

  • It is used to fetch datas from more than one database table.

  • In views, we specify the tables and SAP will automatically generate a join condition code in the background.

Navigations to create a view:

-


SE11 -> Select 'VIEW' radiobutton -> Specify view name starting with Z or Y

-> Create -> Select as 'DATABASE VIEW' -> Click on Copy -> Enter short description

-> Specify name of the tables from which you want to fetch records

-> Click on Relationships pushbutton -> Opens an interface

-> Select the condition based on primary key relationship -> Click on Copy

-> A join condition is created -> Click on 'View Fields' tab button

-> Click on Table fields pushbutton -> Opens an interface with specified table names

-> Click on first table -> Click on Choose -> Select required fields -> Click on Copy

-> Do the same thing for choosing fields from second table -> Save -> Activate

-> Discard the warning message.

To implement the view created, use SE38 editor and write the following code:

TABLES ZMYVIEW1.

SELECT * FROM ZMYVIEW1.

WRITE 😕 ZMYVIEW1-MATNR, ZMYVIEW1-MTART, ZMYVIEW1-MBRSH, ZMYVIEW1-MEINS,

ZMYVIEW1-WERKS, ZMYVIEW1-LVORM, ZMYVIEW1-MMSTA.

ENDSELECT.

Save -> Activate -> Execute.

In the above code, TABLES statement is used to create a temporary table space area

to hold the records of view.

Regards,

Priya.