- •Icons in Body Text
- •Introduction to the Dictionary
- •Overview of the functions
- •Data objects in the ABAP Dictionary
- •Data types
- •Exercise 1: Basic Data Types
- •Exercise 2: Simple and Nested Structures
- •Exercise 4: Deep Structures
- •Tables
- •Summary
- •Exercise 5: Tables in the ABAP Dictionary
- •Pooled and cluster tables
- •Performance During Table Access
- •Improved Performance through Access per Index
- •Improving the Performance through Table Buffering
- •Exercise 6: Performance Aspects with Table Access
- •Task 1:
- •Input Checks
- •Input check via the technical domains
- •Object Dependencies
- •Activation and Where-Used List
- •Changes to Tables
- •Database Changes to Transparent Tables
- •Enhancement of SAP Standard Tables
- •Exercise 9: Changes to Database Tables
- •Views and Maintenance Views
- •Restricted or Enhanced Views on Database Tables
- •Exercise 11: Views
- •Creating Maintenance Views
- •Exercise 12: Maintenance Views
- •Search Helps
- •Input helps
- •Exercise 13: Search Helps
- •Table ZEMPLOY##
- •Table ZDEPMENT##
- •Table ZEMPLOY##
- •Table ZEMPLOY##
- •Table ZDEPMENT##
- •Table ZDEPMENT##
- •Check table T000
- •Check table SCARR
- •Check table ZDEPMENT##
- •Check table SCURX
- •Check table STRAVELAG
- •Check table ZDEPMENT##
- •Check table T002
BC430 |
Lesson: Changes to Tables |
Exercise 9: Changes to Database Tables
Exercise Objectives
After completing this exercise, you will be able to:
•Make changes to existing objects
•Convert tables
•Enhance standard tables with append structures without modifying them
Business Example
After some organizational changes at the airlines, the original employee management design is no longer appropriate.
The design of table ZFLCREW## is no longer appropriate. The field for the role of the employee during the flight is too long.
Task 1:
Shorten one field in the ZFLCREW## table.
1.Reduce the field length to 15 characters.
Note: Create a new data element ZROLE## and replace the existing data element with the new one. When you define data element ZROLE##, do not use a domain. Instead, enter the data type and length directly when you define the data element. Now activate the table.
Go to change mode in the maintenance screen for table ZFLCREW##.
2.Display the activation log. The system reminds you that shortening the field makes it necessary to convert the table ZFLCREW##.
Task 2:
Employees with management or maintenance functions have their workplace at an airport. Record information about how to reach these employees in table ZEMPLOY##: a telephone number for reaching maintenance employees at the airport and an office location or where the administrative employees work.
1.Create an append structure for table ZEMPLOY## containing the following information:
Continued on next page
2006/Q2 |
© 2007 SAP AG. All rights reserved. |
161 |
Unit 6: Changes to Tables |
BC430 |
Field |
Data Element |
ZZAirport |
S_AIRPORT |
ZZOffice number |
S_BUREAUNO |
ZZTelephone number |
S_TELNO |
Note: The field names in an append structure must lie in the customer namespace for fields. The field names must therefore begin with ZZ or YY.
Task 3:
Create a suitable foreign key for the Airport field from the append structure.
1.Define the foreign key in the maintenance screen of the append structure.
Hint: The table for all airports is called SAIRPORT. For a complete definition of the foreign key, you also need to verify a field in the appended table (ZEMPLOY##).
From the maintenance screen for the table ZEMPLOY##, choose Goto → Append Structure.
2.Execute the program BC430_CHECK with transaction SE38. The program checks whether your solutions are correct.
162 |
© 2007 SAP AG. All rights reserved. |
2006/Q2 |
BC430 |
Lesson: Changes to Tables |
Solution 9: Changes to Database Tables
Task 1:
Shorten one field in the ZFLCREW## table.
1.Reduce the field length to 15 characters.
Note: Create a new data element ZROLE## and replace the existing data element with the new one. When you define data element ZROLE##, do not use a domain. Instead, enter the data type and length directly when you define the data element. Now activate the table.
Go to change mode in the maintenance screen for table ZFLCREW##.
a)Overwrite data element SEMP_ROLE in the Field type column with the name of your data element ZROLE##. Save your changes.
b)Select the name ZROLE##. In the next dialog box, confirm that you want to create the data element.
c)In the data element maintenance screen, enter a short description.
d)Select the Definition tab page. Choose Built-in data type. Enter CHAR in the Data type field, 15 in the Length field, and 0 in the Decimal places field.
e)On Field label tab page, maintain the text for the data element.
f)Activate the data element.
2.Display the activation log. The system reminds you that shortening the field makes it necessary to convert the table ZFLCREW##.
a)Go back to the table maintenance screen.
b)Navigate to the database utility with Utilities → Database Utility.
c)Choose Activate and adjust database. Confirm this at the confirmation prompt. The system now converts the table.
Task 2:
Employees with management or maintenance functions have their workplace at an airport. Record information about how to reach these employees in table ZEMPLOY##: a telephone number for reaching maintenance employees at the airport and an office location or where the administrative employees work.
1.Create an append structure for table ZEMPLOY## containing the following information:
Continued on next page
2006/Q2 |
© 2007 SAP AG. All rights reserved. |
163 |
Unit 6: Changes to Tables |
BC430 |
Field |
Data Element |
ZZAirport |
S_AIRPORT |
ZZOffice number |
S_BUREAUNO |
ZZTelephone number |
S_TELNO |
Note: The field names in an append structure must lie in the customer namespace for fields. The field names must therefore begin with ZZ or YY.
a)In display mode, go to the maintenance screen for table ZEMPLOY##.
b)Choose Goto → Append Structure.
c)In the next dialog box, enter the required name for the append structure. It must satisfy the usual naming conventions. Choose Continue.
d)The system displays the maintenance screen for the append structure. You maintain the append structure in the same way you would maintain a structure.
e)Enter a short text and insert the fields ZZAirport, ZZOffice number, and ZZTelephone number with the specified data elements.
f)Activate the append structure. Choose Goto → Activation Log to display the activation log.
g)Table ZEMPLOY## is automatically adjusted when you activate the append structure. The new fields are appended to the existing fields on the database.
Task 3:
Create a suitable foreign key for the Airport field from the append structure.
1.Define the foreign key in the maintenance screen of the append structure.
Hint: The table for all airports is called SAIRPORT. For a complete definition of the foreign key, you also need to verify a field in the appended table (ZEMPLOY##).
Continued on next page
164 |
© 2007 SAP AG. All rights reserved. |
2006/Q2 |
BC430 |
Lesson: Changes to Tables |
From the maintenance screen for the table ZEMPLOY##, choose Goto → Append Structure.
a)Place the cursor on the Airport field. Choose the key icon. Copy the system proposal.
b)The maintenance screen for the foreign key appears. The check table and the field assignments are already filled due to the system proposal. Enter a suitable short description.
Note: The foreign key cannot be fully specified using just the append structure since the key of check table SAIRPORT contains both a client field and an airport code, while the append structure has no client field. Make sure that when generating from the proposal, the client field is actually taken from the appended table.
c)Choose Non-key-fields / candidates as the type of foreign key fields (since the Airport field is not a key field in the table ZEMPLOY##) and C (since not every employee is assigned to an airport) to CN (since several employees can be assigned to the same airport) as the cardinality.
d)Choose Copy and then activate the append structure.
2.Execute the program BC430_CHECK with transaction SE38. The program checks whether your solutions are correct.
a)Execute the program BC430_CHECK with the transactionSE38.
2006/Q2 |
© 2007 SAP AG. All rights reserved. |
165 |
Unit 6: Changes to Tables |
BC430 |
166 |
© 2007 SAP AG. All rights reserved. |
2006/Q2 |
BC430 |
Lesson: Changes to Tables |
Exercise 10: Database Utility (SE14)
Dealing with Problems (Optional)
Exercise Objectives
After completing this exercise, you will be able to:
•Deal with errors when converting tables.
Business Example
When existing DB tables are converted, data may be lost or other problems may occur. In such cases, you should be able to reverse the conversion.
Task:
You should prevent data from getting lost when errors are made in the conversion.
1.Avoiding loss of data.
Caution: Before you proceed, you must copy the content of the employee and department tables into corresponding temporary tables.
2.Change the domain for the departments from length 4 to length 2 and activate the domain.
3.Activate the dependent objects (tables), too.
4.Display the log.
Note: Although only warnings are mentioned in the activation message, you will find error messages highlighted in red in the log and an instruction telling you that the tables have to be converted.
5.First convert the departments table using transaction SE14.
6.Now convert the employees table and check its contents.
7.If the conversion fails, try to reverse it again.
2006/Q2 |
© 2007 SAP AG. All rights reserved. |
167 |
Unit 6: Changes to Tables |
BC430 |
Solution 10: Database Utility (SE14)
Dealing with Problems (Optional)
Task:
You should prevent data from getting lost when errors are made in the conversion.
1.Avoiding loss of data.
Caution: Before you proceed, you must copy the content of the employee and department tables into corresponding temporary tables.
a)Copy the table for the employees and the table for the departments using SE11 or SE80.
b)Copy the content of the tables using an ABAP report (ABAP command
INSERT)
c)In addition, change the type definition for the table field of the department in both tables and use the data type CHAR 4 as a built-in type. In this way, the temporary tables become independent of the changes that will be made to the domain.
2.Change the domain for the departments from length 4 to length 2 and activate the domain.
a)Follow the same procedure as in the previous exercises.
3.Activate the dependent objects (tables), too.
a)Confirm the following dialog using the Next pushbutton.
.
4.Display the log.
Note: Although only warnings are mentioned in the activation message, you will find error messages highlighted in red in the log and an instruction telling you that the tables have to be converted.
Continued on next page
168 |
© 2007 SAP AG. All rights reserved. |
2006/Q2 |
BC430 |
Lesson: Changes to Tables |
5.First convert the departments table using transaction SE14.
a)Enter the table name in the initial screen of the database utilities.
b)Choose Edit.
c)Choose Activate and adjust database to start the conversion process.
Note: The conversion process ends without an error message. Despite this, you should take a closer look at the log and evaluate the messages.
6.Now convert the employees table and check its contents.
a)Enter the table name (SE14) in the initial screen of the database utilities.
b)Choose Edit.
c)Choose Activate and adjust database to start the conversion process.
Caution: The conversion process ends without an error message. Despite this, you should take a closer look at the log and evaluate the messages.
7.If the conversion fails, try to reverse it again.
a)There is probably a note in the conversion log that duplicates have appeared in the primary key.
Result
Discuss with the instructor the possibilities of returning the data to its original state.
2006/Q2 |
© 2007 SAP AG. All rights reserved. |
169 |
Unit 6: Changes to Tables |
BC430 |
Lesson Summary
You should now be able to:
•Make changes to tables
•Estimate the effect of these changes on the database
•Convert tables
•Continue terminated conversions
•Add customer fields to SAP standard tables by means of append structures without modifications
170 |
© 2007 SAP AG. All rights reserved. |
2006/Q2 |
BC430 |
Unit Summary |
Unit Summary
You should now be able to:
•Make changes to tables
•Estimate the effect of these changes on the database
•Convert tables
•Continue terminated conversions
•Add customer fields to SAP standard tables by means of append structures without modifications
2006/Q2 |
© 2007 SAP AG. All rights reserved. |
171 |
Unit Summary |
BC430 |
172 |
© 2007 SAP AG. All rights reserved. |
2006/Q2 |