Building an ABAP Class for Sales Order Details Display: A Step-by-Step Guide
Creating Usual ABAP Class to display Sales Order Details :-
-
Step 1 :- Go to transaction code SE24.
-
Step 2 :- Click on create button.
-
Step 3 :- Since, We want to create a class, therefore select the Class radio button and press enter.
-
Step 4 :- Above screen will appear, where we are required to pass the details.
- Pass the Description.
- Select Usual ABAP Class as class type.
- For now select the class type as Final
-
Step 5 :- Press Enter → Provide the Package → Press enter → Provide the transport request → Press enter.
-
Step 6 :- Above screen will appear, where we can see all the features of a class.
let’s take a requirement and we will achieve that requirement with the help of Usual ABAP Class.
Requirement :-
- Take input as Sales Document number.
- Display the details of that Sales Document Number as output.
Solution :-
-
Step 1 :- Go to methods tab of the above created class.
Level :-
- Instance :- Can be accessed only by objects
- Static :- Can be accessed by Class name as well as its objects.
- for now select level as instance.
Visibility :-
- Public :- Can be accessed with in the class, within sub class , Outside the class.
- Private :- Can only be accessed with in the class.
- Protected :- Can be accessed with in the class, with in sub classes, not outside the class
- Select visibility as Public
- Provide the description.
-
Step 2 :- Click on Parameters .
Types of Parameters :-
a) Importing :- Input
b) Exporting :- Output
c) Changing :- Input/Output
d) Returning :- A method can have any number of exporting and changing parameters, but returning is always one
-
Step 3 :- We are taking Sales Document number as input and few fields as output.
-
Step 4 :- Click on the exceptions tab to provide a exception.
-
Step 5 :- Click on source code to write the necessary logic.
-
Step 6 :- Activate the class.
Executing the Class :-
-
Step 1 :- Press F8 to execute the class.
-
Step 2 :- Give a suitable Sales Document number and press F8.
- We can see the details in the above diagram.
Comments
Post a Comment