Database Access


What are the ways you can do the tuning? What are the major steps will you use for these?

Tuning can be done in three ways -

  • disk i/o
  • SQL tuning
  • memory tuning

Before performing tuning, we should get the status of the database using oracle utility called statpack and tkprof.

What are the two methods of modifying Sap standard tables?
Mention what are the two methods of modifying SAP standard tables?

There are two methods for modifying SAP standard tables -

  • Append structures
  • Customizing includes

What is the difference between a 'Database index' and a 'Match code'?

'Database Index' contains fields from one table.
'Match Code' contain fields from several tables. Match code objects can build on cluster tables, transparent tables, and pooled tables.

What are the different databases Integrities?
Mention the various databases integrities?

The different types of database integrities are specified below -

  • Semantic Integrity
  • Relational Integrity
  • Primary Key Integrity
  • Value Set Integrity
  • Foreign Key Integrity
  • Operational Integrity

ABAP query is used for?

ABAP Query (also known as an SAP Query or Query) is a powerful tool used to generate simple reports without any coding.

Which transaction code is used to creating a query?

SQ01 is a transaction code used for SAP Query: Maintain queries in SAP.

What is match code? How it is different from database index?
Differentiate between database index and match code?

Match Code is a tool to help us to search for data records in the system. Match codes are an efficient and user-friendly search tool where key of a record is unknown.
Match code objects builds on cluster tables, transparent tables, and pooled tables.
Database index contains fields only from one table.

What is SAP memory and ABAP memory?

SAP memory is a global memory.
ABAP memory is local memory.

How is conversion of data types done between ABAP/4 & DB layer?

Database interface is responsible for the conversion between ABAP/4 data types and the database layer.

Difference between SY-TABIX and SY-INDEX? Where it is used? Can you check SY-SUBRC after performing?

SY-TABIX - Current line of an internal table. SY-TABIX is set by the statements below, however only for index tables. The field is either not set or is set to 0 for hashed tables.

  • APPEND sets SY-TABIX to the index of the last line of the table, that is, it contains the overall number of entries in the table.
  • COLLECT sets SY-TABIX to the index of the existing or inserted line in the table. If the table has the type HASHED TABLE, SY-TABIX is set to 0.
  • LOOP AT sets SY-TABIX to the index of the current line at the beginning of each loop loss. At the end of the loop, SY-TABIX is reset to the value that it had before entering the loop. It is set to 0 if the table has the type HASHED TABLE.
  • READ TABLE sets SY-TABIX to the index of the table line read. If you use a binary search, and the system does not find a line, SY-TABIX contains the total number of lines, or one more than the total number of lines. SY-INDEX is undefined if a linear search fails to return an entry.
  • SEARCH FOR sets SY-TABIX to the index of the table line in which the search string is found.

SY_INDEX - In a DO or WHILE loop, SY-INDEX contains the number of loop passes including the current pass.

What is the difference between get and get late?

GET -
Syntax - GET <nodename>.
GET event occurs(triggers) when the logical database has read a line from the node <nodename> and makes it available to the work area in the program declared using the statement NODES <nodename>.
GET LATE -
Syntax - GET <nodename> LATE
GET LATE event is triggered when all the data records for a node and all the data records of the sub-nodes under it in the hierarchy of the logical database have been read.

What are the System Fields you have worked with? Explain?

The following list specifies some of the system fields(30) -

  • SY-DBSYS - Central Database
  • SY-HOST - Server
  • SY-OPSYS - Operating System
  • SY-SAPRL - SAP Release
  • SY-SYSID - System Name
  • SY-LANGU - User Logon Language
  • SY-MANDT - Client
  • SY-UNAME - Logon Username
  • SY-DATLO - Local Date
  • SY-DATUM - Server Date
  • SY-TIMLO - Local Time
  • SY-UZEIT - Server Time
  • SY-DYNNR - Screen Number
  • SY-REPID - Current ABAP program
  • SY-TCODE - Transaction Code
  • SY-ULINE - Horizontal Line
  • SY-VLINE - Vertical Line
  • SY-INDEX - Number of current loop Pass
  • SY-TABIX - Current line of internal table
  • SY-DBCNT - Number of table entries processed
  • SY-SUBRC - Return Code
  • SY-UCOMM - Function Code
  • SY-LINCT - Page Length of list
  • SY-LINNO - Current Line
  • SY-PAGNO - Current Page Number
  • SY-LSIND - Index of List
  • SY-MSGID - Message Class
  • SY-MSGNO - Message Number
  • SY-MSGTY - Message Type
  • SY-SPONO - Spool number during printing

What is the transaction code for Table Maintenance?

SM30.

Explain what is the difference between Primary key and Unique key?

Primary Key – It can accept 0 value and cannot be NULL.
Unique Key – It can be NULL.

What are Joins and different types Joins?
Mention the types of joins?

There are four types of Joins -

  • Self-Join
  • Inner Join
  • Outer Join
  • Equi Join

How do you display a data in a Detail List?

By using two statements -

  • Top-of-page during line-selection
  • At line-selection

What are the System Table used in ABAP?

  • Sales Document: Item Data – VBAP
  • Sales Document: Partner – VBPA
  • Sales Document: Header Data – VBAK
  • Sales Document Flow – VBFA
  • Sales Document: Delivery Item Data - LIPS
  • Customer Master – KNA1
  • Material Data – MARA
  • Conditions (Transaction Data) – KONV

What is get cursor field?

GET CURSOR statement transfers the name of the screen element on which the cursor is positioned during a user action into the variable <field>.
GET CURSOR FIELD <field> [OFFSET <offset>] [LINE <line>] [VALUE <value>] LENGTH <length>].

What is database utility?

Database utility is an interface between the ABAP/4 Dictionary and the underlying the SAP system.

What are the basic functions of Database utility?

The basic functions of database utility are -

  • Create database objects
  • Delete database objects
  • Adjust database objects to changed ABAP/4 dictionary definition

Logical databases are created by transaction?

Transaction SE36.

What are the main events of which are used for Logical Database?
Explain what are the events used for Logical Database?

The main events used for Logical Database are as specified below -

  • GET - The programs used for Logical Database are executed with the help of GET event. It mainly takes place when a line from the node was read by the logical database. GET statements determine the depth of the logical database.
  • PUT - The program flow is directed by the PUT event.

Explain what Is A Logical Database?
What do you mean by a Logical database?
What are logical databases?

A logical database is a special ABAP/4 program that combines the contents of certain database tables. Logical database is mostly involved in retrieving data for the concerned application programs. Logical database has the data created by linking more than one table of the database in the special ABAP program. Logical database is specially created during the program running and used to read data from the database tables by linking them.
LDB offers an easy-to-use selection-screens. We can modify the pre-generated selection-screen based on our requirements. It offers reasonable data selections and functions to check whether user input is complete, correct, and plausible. It contains central authorization checks for database accesses. Enhancements such as improved performance immediately apply to all report programs that uses the logical database.

What are the advantages/disadvantages of logical databases?

Advantages -

  • No need of programming for retrieval, meaning for data selection.
  • Easy to use standard user interface, have check completeness of user input.

Disadvantages -

  • Fast in case of lesser no. of tables however if the table is in the lowest level of hierarchy, all upper level tables should be read so performance is slower.

What are the disadvantages of logical databases?

If we do not specify a logical database in the program attributes, the GET events never occur.
There is no ENDGET command, so the code block associated with an event ends with the next event statement such as another GET or an END-OF-SELECTION.

If we are using logical databases, how will you modify the Selection-screen Elements?

Select-options: dname for deptt-dname.

What is the difference between unique key and primary key?

The unique key accepts null values; however, the primary key does not accept null values. Primary key can accept zero value but not null.

Do you know about several database integrities?
List the various database integrities.

There are several database integrities and some of them are - primary key integrity, operational integrity, relational integrity, and semantic integrity.

Can you create callable component of program code in a single ABAP/4 program?

Yes, we can either create include program in the database or define Macros.

What is the function of the append statement in SAP ABAP?

When the internal table ends, a record needs to be added at the certain specified work area. The function of the append statement is to add the record.

Can data be put directly into the database?

No. The data can put into the database only after the data has been entered via transaction.

What are indexes in SAP tables?

Indexes are specified as a copy of a database table reduced to specific fields. This data exists in sorted form. This sorting form improve fast access to the field of the tables. In the order that other fields are also read, a pointer to the associated record of the actual table are included in the index. The indexes are activated along with the table and are created automatically with it in the database.

Difference between transparent tables and pooled tables?

Transparent tables in the dictionary has a one-to-one relation with the table in database. Its structure corresponds to single database field. Table in the database has the same name as in the dictionary. Transparent table holds application data.
Pooled tables in the dictionary has a many-to-one relation with the table in database. Table in the database has the different name as in the dictionary. Pooled table are stored in table pool at the database level.

What is an ABAP/4 Query in SAP?

ABAP/4 Query is a powerful tool to generate simple reports without any coding. ABAP/4 Query can generate the following 3 simple reports -

  • Basic List - It is the simple reports.
  • Statistics - Reports with statistical functions like Average, Percentages.
  • Ranked Lists - For analytical reports.

For creating a ABAP/4 Query, programmer has to create user group and a functional group. Functional group can be created using with or without logical database table. Finally, assign user group to functional group. Finally, create a query on the functional group generated.

Select up to 1 row and select single difference?

Select single fetches first matching record. If more than one matching record are there, then only the first matching record will be considered and other records will not be considered. Whereas, select up to 1 row will fetch all the matching records from the database.

What is the difference between VIEW and a TABLE in SAP?

A table physically stores data. A view does not store any data on its own. It can contain data from multiple tables and it just accesses/reads data from those tables.

What are two methods of modifying SAP standard tables?

  • Append Structures.
  • Customizing Includes.

How to avoid Transport Request in Table maintenance Generator?

select 'No, or user, recording routine' while creating TMG.

How data is stored in cluster table?

Cluster table stores the data as name value pair. A cluster table contains data from multiple DDIC tables.

How can I copy a standard table to make my own z_table?

Go to transaction SE11. Press "Copy" button to copy table. Enter the name of the standard table and in the target table enter Z_table name and press enter.

I have a z_table, I wants to add one more field to the table without disturbing previous data, what should I do?

While adjusting database table in SE14, select 'Save Data' radio button.

Can we have the same append structure in more than one Database Table?

No, we cannot have same append structure in more than one database table.

What is the role of NAST table in SAP?

After the final selection of the output is performed and the application document is saved, entries are created in the NAST table with application ID, Application document number, output type, output medium, output timing and Status code.

What is the role of TNAPR table in SAP?

Stores all the forms, driver programs and all NACE settings.

What are different database tables in SAP ABAP?

3

How to find the return code of a SQL stmt in ABAP programs?

Open SQL has 2 system fields with return codes -

  • SY-SUBRC
  • SY-DBCNT