Upload
blackvard
View
646
Download
7
Embed Size (px)
Citation preview
Blackvard Management ConsultingSAP Persistence
Creating Source Code Automatically
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
Blackvard Management Consultants
www.blackvard.comCopyright © Blackvard Management Consulting – All rights reserved
Erin Lett is the Operations Manager for Blackvard Management Consulting. She holds a Bachelor’s Degree from Stetson University in Communications and has been working in the SAP, eLearning, and Software Development industries for the past 6 years.
For further information please visit:
www.blackvard.com
Copyright © Blackvard Management Consulting- All rights reserved www.blackvard.com
Your Host
Erin Lett
Blackvard Management Consultants
www.blackvard.comCopyright © Blackvard Management Consulting – All rights reserved
Short Bio:
Lukas M. Dietzsch is managing director at Blackvard Management Consulting, LLC. He is holding a Master’s degree in Information Technology and is an experienced IT solution architect and project lead.
His strong background in adapting to requirements and standards in different industries and on various platforms are valuable assets for Blackvard customers.
He is repeatedly commended by customers for driving efficient solutions for complex problems in globally distributed team environments and meeting tough deadlines.
For further information please visit:
www.blackvard.com
Lukas M. Dietzsch
Copyright © Blackvard Management Consulting- All rights reserved www.blackvard.com
Managing Director
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
Persistence Service Overview SAP Persistence Service Overview was previously covered in our
“Understanding Persistence” webinar. Overview Concepts Used In Persistence Transient vs. Persistent Data Data In Object-oriented Programming Persistence Service/Persistence Classes/Managed Objects
The “Understanding Persistence” webinar can be viewed via the following link: http://www.blackvard.com/understanding-persistence/
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
Agenda
What Will Be Covered:
1. Introduction
2. SAP Persistence Overview – Previous Webinar
3. Components of Persistence
1. Get A Flight Object
2. Create A Flight Object
4. Questions
5. About Us
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
Let’s begin by talking a little bit about the basic architecture of SAP Persistence. To better understand how to create source code automatically.
Components Of Persistence
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
Begin by using the SE24 transaction, in Class Builder, to create a new Class with the name ZCL_MY_FLIGHT.
Since it will be in the Persistent Class of the database table called SFLIGHT. Fill in all required fields and then select the Class Type
Persistent Class & click Save. Select where you wish to store the new class & click Save again.
Create Persistent Class
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
After saving the new class, verify your Persistent Class, by clicking the Interfaces tab.
It implements the interface IF_OS_STATE.
Interfaces
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
Under the Friends tab, it also displays as a friend of the abstract agent class, ZCB_MY_FLIGHT.
Friends
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
Now connect the Persistent Class to an ABAP Dictionary object. 2 ways for connecting & persistence mapping of a DDIC (depends on
Netweaver version): by clicking the Persistence button on top OR Navigate via “Goto > Persistence representant” to the mapping
Set Persistence Representation
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
Now assign a Table/View/Structure to the Class. Select the database table that consists of flights, called SFLIGHT. Click the Continue icon to confirm.
Assign Table
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
After assigning the table, Class Builder loads metadata into the lower Table/Fields section.
Double-click on any one of the fields to load it into the Maintain Area.
Maintain Properties of Attributes
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
Using the Maintain Area, you can now modify the ID, Description, Field Visibility, etc.
After completing the maintenance, simply press Enter to assign it to the Persistent Class as an attribute.
Add Attribute To Persistent Class
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
After pressing Enter, the field appears under the Class as an Attribute & loads the next field into the Maintain Area accordingly.
Select each column/field you want to add to your class. Double-click on the name, then click the black arrow icon to add it to the class.
Add Attribute To Persistent Class
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
If all fields are not required, the unused columns can remain in the lower area and be added later as needed.
After applying the workflow to each field, the following appears:
Add Attribute To Persistent Class
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
After Saving the Persistence Mapping, return to the Class Definition using SE80 or SE24.
Verify the Attributes & Methods.
New Attributes
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
Along with the new attributes, GET & SET methods are also generated. Class Builder will activate the Actor Classes, along with the Persistent
Class. Save your work! The Persistent Class is complete & can now be used.
New GET/SET Methods
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
Requesting data from database table
Adding new data to the database table
1st U
se c
ase
2nd U
secase
Sample Use Cases for SFLIGHT
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
In the core of the TRY-CATCH block, reference the Agent Class & Save it in the reference variable lo_flight_agent by querying the class attribute of the zca_my_flight called agent.
Get A Flight Object
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
Ask the agent to retrieve a persistent from the database using the “BA” business key.
Save the receiving reference of the flight instance in the reference variable, in the local object called “lo_flight”.
You now have an initialized instance of the zcl_my_flight & can call its GET- and SET methods, e.g. such as GET_CARRNAME().
Get A Flight Object
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
This process is very effective & reusable between various clients such as: ABAP classes, ABAP programs, Function Modules, etc.
Now verify the results:
Get A Flight Object
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
Create a flight object using the Persistent Class by referencing the Agent Class & Saving it in the variable lo_flight_agent.
Ask the agent to create a persistent in the database with the key parameters of:
i_CARRID, i_CONNID and i_FLDATE
(the key values of the database table SFLIGHT) Set a new price (set_price) Call the COMMIT statement. Save your work & Activate. Run the report.
Create A Flight Object
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
Here you can see the results of the coding in the first line: Our newly created entry appears in database table SFLIGHT (check by using transaction SE11 or SE16n).
Create A Flight Object
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
Have Additional Questions?
Want To get trained?
Please Set Up A Consultation.
Email: [email protected]
Require A Consultation?
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
Technical project lead and ABAP architect responsible for quality in technical scope and budget in a global roll-out of SAP Logistics applications (SAP LE / LO)
Conducting multiple SAP ABAP and SAP HANA® trainings for various US companies
Implementation of a standard SAP software solution for Spend Management within SAP AG & ARIBA (annual spend volume 3 Bill. EUR) which can be used in all SAP systems
Improved claims management using SAP FS-CM which is generating annual savings of 15 Mio € for a huge German public healthcare organization
Implemented a global solution for procurement processes at BMW AG using SAP SRM / B2B
Blueprinting and implementation of SAP software for banking credit cancelations for VOLKSWAGEN
Key Achievements of Blackvard Management Consulting in Previous Projects
What We’ve Accomplished
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com
An overview of current and previous customers:
Customers That Recommend Blackvard