Practical Guide to SAP ABAP Excerpt


Espresso Tutorials

Fabian Bentz

121Excerpt from  Practical Guide to SAP ABAP Part 1: Conceptual Design, Development, Debugging by Thomas Stutenbäumer.

Foreign keys
To avoid incorrect user input, you can define foreign keys for determined fields. These foreign keys (also called check tables) describe the relation between two tables. The function of foreign keys is shown with the help of the table for contract accounts in the database table FKKVKP.

A foreign key is defined for the field BUSINESS PARTNER NUMBER (GPART), which describes the relationship between the table for the business partner (BUT000) and the table for contract accounts (FKKVKP). See Figure 2.13.

Only a record for a contract account can be inserted into table FKKVKP if the field BUSINESS PARTNER NUMBER contains a number that exists in TABLE BUT000 (Business Partner).

Figure2.13.jpg
Figure 2.13: Foreign key of a database table

The FOREIGN KEY FIELD TYPE often will not be specified. In this case, choose the CARDINALITY for the foreign key “1:CN.” This means there can be any number of contract accounts for a business partner.

Keep reading in Practical Guide to SAP ABAP Part 1: Conceptual Design, Development, Debugging by Thomas Stutenbäumer.

This book offers a comprehensive practical guide to SAP ABAP for ABAP professionals. Part I of this two-part series lays the groundwork with ABAP basics. Readers will learn fundamental methods and procedures for everyday ABAP use— for example, how to download files from SAP directories to workstations. Dive into the SAP Data Dictionary and how it works. Get detailed information on effective debugging techniques and how to use the SAP Debugger. Clarify when it is best to use standard SAP tables vs. Z-tables. Get expert developer tips and tricks including how to navigate ALV grid lists. Understand the documentation programs available to you and how to use them. Obtain useful reference lists of SAP transactions and SAP database tables. By using practical examples, tips, and screenshots, the author brings readers up to speed on the fundamentals of SAP ABAP.

– How to get the most out of SAP ABAP
– Guide for understanding and using the SAP Data Dictionary
– Beginner and advanced debugging techniques
– Expert ABAP development techniques

57Author Thomas Stutenbäumer has worked for more than 25 years as an IT professional for public utilities. After his study of mathematics at Westfälischen-Wilhelms-Universität in Münster, Germany he was responsible for the reorganization of the IT organization of a medium-sized public utility. He has worked for different professional organizations, published articles on the applications of new information technologies, and appeared as a speaker at utility industry events. For more than 10 years, he has developed ABAP programs and has modified standard SAP code since 2013 has been a senior consultant at the enterprise ConUti GmbH.