Persistence Class
- Persistence Class is one of the four classes in Object Oriented Programming in ABAP.
- The purpose of persistence class is to perform database operations like insert, update, delete.
- The persistence class name must start with CL.
- While creating the persistence class, 2 helper class creates automatically. Those helper classes are CA and CB.
- CA is called as actor class or agent class.
- CB is called base class.
Creating Persistence Classes :-
-
Step 1 :- Go to SE24 and give a suitable name to the class.
-
Step 2 :- Click on create button.
-
Step 3 :- Click on save and Provide Package and transaction requests
-
Step 4 :- We will get automatic one interface and one friend class as we can see below.
Requirement :-
- How to create getter and setter method for a particular table using Persistence Class.
Solution :-
-
Step 1 :- Click on go to. → Persistence Representation
- It will ask for table name.
-
Step 2 :- Provide the table name.
- Press enter.
-
Step 3 :- Click on the above field name one by one and click upper arrow button.
-
Step 4 :- Click on save. and as soon as you will go back you will see many methods will have created automatically.
- SAP automatically generated getter and setter method for the fields of table.
- For primary field SAP will generate getter method only.
- and for non primary field it will generate both getter and setter methods.
Comments
Post a Comment