You are on page 1of 19

Building Custom Tables

l Create Header Table


l Create Line Item Table
l Create Maintainable Views for Header & Items
l SE54 - Extended Table Maintenance for Views
l Program & Activate Event User Exits
– Data validations
l SE54 - Create View Cluster
l SM34 - Maintain View Cluster
– SF8 View Cluster name is ZSDBLINE_VC

21
FSS Technical Peer Group Meeting 11/13/2002

Finally we’ve gotten to the fun part of the presentation, creating custom
relational tables, with maintenance views that include data validation without
having to create and maintain all the dialog programming that usually goes
along with custom applications!

Unfortunately, I spent so much time researching and creating the first half of
this presentation, I had very little time to devote to this second half. So bare
with me as I wing it.

I did the underlying work on these tables a couple of months ago for the
Lincoln project and did not have time to carefully document each key stroke as
I fumbled my way through this new arena. Therefore, this presentation is a
road map but not a step by step recipe.

I would like to thank John Hosken for introducing this powerful tool to the
MIT and Lincoln Lab programmers at one of David Rosenberg’s lunch time
seminars.

21
Create Header Table
Search help can be Custom field type
Client attached to Field or allows custom
Field type documentation

22
FSS Technical Peer Group Meeting 11/13/2002

SE11
Database Table - Create
There must be no breaks in the Primary Key and it must appear at the
beginning of the table with Client as the first field. In this example duplicate
prime_contracts will not be allowed.
Creating custom field types allowed me to associate custom search help and
custom documentation with the fields. Actually, I only needed the custom field
types for the custom documentation. Search help could have been assigned to
the fields by double clicking the field name and then clicking on the soft
button, “Search Help for Field.” See http://fuller.mit.edu/tech/Search Helps.ppt
for the search help hierarchy used by SAP.

22
Custom Search Help
Defined in
Data type
Function Module Will display
contract # and
customer PO

Defined in
Search help

23
FSS Technical Peer Group Meeting 11/13/2002

SE11
Data type & Search help

Or double click on field name and then click the soft button, “Search Help for
Field.”

23
Custom Field Documentation
Defined in
Data type

24
FSS Technical Peer Group Meeting 11/13/2002

SE11
Data type

24
Create Line Item Table
Foreign Key

Foreign Key’s
Check Table

25
FSS Technical Peer Group Meeting 11/13/2002

SE11
Database Table - Create
Foreign key and check table are defined by selecting the field and clicking on
the “key” icon next to “New rows” button.

25
Create Maintainable View
Not the default!

26
FSS Technical Peer Group Meeting 11/13/2002

SE11
View - Create
Maintenance view is NOT the default. Make sure you select this view type!
After entering the short text description for this view, enter the line item table
as the first table under “Tables”.
Then click the button “Relationships” which is at the bottom of this column
(not shown on this slide)

All the “check tables” that appear in ZSDBLINE will be presented. Choose the
header table.

The Header table will be added to the list of “Tables” and the “Join
conditions” will be defaulted in as they appear above.
I also created a maintainable view for the header table. The only table involved
with that view was the header table.

26
Maintenance
View Fields Attribute (MF)

Header fields - S
will be read only on
line items
27
FSS Technical Peer Group Meeting 11/13/2002

These are the view fields


with the possible values for the maintenance attribute.

H will be hidden and populated via a user exit


S are the header fields that appear in read-only format above the line items in
the view cluster.

27
Extended Table Maintenance
SE54 - Generated Objects
Maintainable View

SE54
Generated Objects - Create
Be sure to give it an authorization group. There should be two authorization
groups associated with custom tables in a particular application area. One
authorization group will be for “read-only” access and the other for
“maintenance”. Make sure to use the one for “maintenance.”
The function group should be the function group that the table was created
under. It will be the function group where the user exit validations will appear.
I also generated a table maintenance object for the header view I created.

28
Create an Include via SE38

29
FSS Technical Peer Group Meeting 11/13/2002

SE38
Create an include
All the validation subroutines for your view should be in this include.
I also created an include for validations of the header view.

29
Modify Function Pool
SAPLfunction_group

Uncomment

30
FSS Technical Peer Group Meeting 11/13/2002

Modify the function pool in which you created your views and their extended
table maintenance screens by removing the comment from the user-defined
include files of interest.

30
Modify Lfunction_groupFXX
SE80 - Function group

31
FSS Technical Peer Group Meeting 11/13/2002

Add the includes you created to the SAP generated include, which you just
uncommented in the slide before.

31
Events
SE54 -> Environment -> Events

CHECK_TOTAL and VALIDATE_ZSDBLINE_V are two subroutines in the


Include program, shown in the last slides.
Event codes I used were “After saving the data in the database” and “Creating
a new entry”

I also created an event for the header view. It was an 05 event code.

32
Create View Cluster
SE54 -> Edit viewcluster

Enter the name you want for your view cluster and click on “Create/change”

33
Object structure

34
FSS Technical Peer Group Meeting 11/13/2002

I created this view cluster via trial and error. I had nothing to reference. It
works, which is about all I can say!

34
Generated Field Dependences
Header - ZSDBHEAD_V

35
FSS Technical Peer Group Meeting 11/13/2002

This was automatically generated when I clicked on the “Field-dependence”


generate button from the previous screen.

35
Generated Field Dependences
Header - ZSDBLINE_V

36
FSS Technical Peer Group Meeting 11/13/2002

Again this was automatically generated by selecting the line item object
structure and clicking the “Field-dependence” button.

36
View Cluster - Line Items SM34

Header

Line Items

37
FSS Technical Peer Group Meeting 11/13/2002

A quick demo of the results.

37
Summary
l Know your program “driver”
– Find the “One” in the application data model
l Filter the data early in the program
l Know the indexes available in an area
– If you can’t use the primary index there are
usually other indexes
l Use the SAP supplied tools when possible

38
FSS Technical Peer Group Meeting 11/13/2002

38
Where to Get More Information
l BC430 ABAP Dictionary
– Tomorrow in Waltham (11/14 - 11/15)
– January 9 - 10, 2003 Waltham
l My personal favorite, the book
– Object-Oriented Systems Analysis - Modeling
the World of Data by Sally Shlaer & Stephen
Mello
l Available, used on www.amazon.com

39
FSS Technical Peer Group Meeting 11/13/2002

39

You might also like