Database Views:
Database views in SAP ABAP provide an application-specific perspective on data distributed across multiple tables.
Views are created by combining fields from one or more tables using inner join operations
Steps to Create Database View
Below are the steps used to create the database view in SAP ABAP:
Step-1: Open the data dictionary initial screen by navigating the menu path or entering the transaction code SE11 in the command field.
Click the radio button in front of View option, and give a name to the view then click the Create button given on the screen
Step-2: A pop-up window will appear with all the views, from where select the "Database view" and click on the Copy button.
Step-3: A view maintains screen appears that contains multiple tabs, where first provide the description in the field "Short description."
Select Table/Join Conditions Tab:
Once on the Data Dictionary initial screen, select the "Table/Join Conditions" tab. This tab allows you to define the tables and their relationships.
Enter Table Names:
Enter the names of the base tables you want to link. In this case, enter "ZA103_STD" and "ZA103_STD_ADR" as the table names.
Click on Relationships Button:
After entering the table names, click on the "Relationships" button. This action will allow you to define the join conditions between the selected tables ("ZA103_STD" and "ZA103_STD_ADR" ).
Step-4: Upon clicking the Relationships button, the Data Dictionary will display all tables that have a foreign key relationship with the base table "ZA103_STD" and click on copy.
Step-5: Once we will select the ZA103_STD_ADR table, all the join conditions field names will be filled automatically.
Step-6: Now, we will move to the next tab, which is View fields, to select the fields of both tables that we want to display.
Step-7: To choose the fields from each table, click on the "Table fields" button provided on the screen (refer to the image above). This action will open a new pop-up window displaying both table names "ZA103_STD" and "ZA103_STD_ADR" . Select one table at a time and then choose the desired fields from each table.
Step-8: After clicking the "Choose" button located at the bottom of the screen, all the fields of the selected table will be displayed, allowing us to select the necessary fields.
Once the fields are selected, proceed by clicking on the "Copy" button. Repeat the same process for selecting fields from the other table ZA103_STD_ADR.
Step-9:After choosing all the necessary fields from both tables, save the view as a local object. Next, activate the view either by pressing CTRL+F3 or by clicking on the "Activate" button.
Step-10: To display the selected records using the database view, access the Content option by pressing CTRL+SHIFT+F10 or by selecting it from the screen. Upon clicking the Content option, it will open the selection screen
Comentarios