Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Shivani11
Explorer

INTRODUCTION


Hello everyone! This blog post describes how to create an ABSTRACT CLASS in SE38.

This is the second part of ABSTRACT CLASS.

Part 1 includes the steps to create GLOBAL ABSTRACT CLASS. If you haven't checked out yet, Link is hereSAP GLOBAL ABSTRACT CLASS & OOPS PART:1

In this blog, we have mentioned the code along with result. Hope this will help the readers who are searching how to write abstract class in SE38.

STEPS TO CREATE LOCAL ABSTRACT CLASS


STEP1: Use tcode SE38. Enter the name of program then click on CREATE button.


STEP2: Write the description of the program or class. Keep TYPE as EXCUTABLE. Click on SAVE button.


STEP3: Save as local object or if we have any package then mention the name of package and click on SAVE button.

We are saving in local object.


STEP4: Write the code.
Parameters: p_kunnr type kunnr.

DATA: G_FNAME TYPE NAME1_GP,
G_SNAME TYPE NAME2_GP,
G_CITY TYPE NAME2_GP,
G_STREETNO TYPE STRAS_GP.

CLASS class1 DEFINITION ABSTRACT.
PUBLIC SECTION.
METHODS DISPLAY ABSTRACT IMPORTING IV_KUNNR TYPE KUNNR
EXPORTING EV_FNAME TYPE NAME1_GP
EV_SNAME TYPE NAME2_GP
EV_CITY TYPE ORT01_GP
EV_STREETNO TYPE STRAS_GP.
ENDCLASS.

CLASS CLASS2 DEFINITION INHERITING FROM CLASS1.
PUBLIC SECTION.
METHODS DISPLAY REDEFINITION.
ENDCLASS.

CLASS CLASS2 IMPLEMENTATION.
METHOD DISPLAY.
SELECT SINGLE NAME1 NAME2 ORT01 STRAS
FROM KNA1
INTO ( EV_FNAME , EV_SNAME , EV_CITY , EV_STREETNO )
WHERE KUNNR = P_KUNNR.
ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
DATA: OBJECT1 TYPE REF TO CLASS2.
CREATE OBJECT OBJECT1.
OBJECT1->DISPLAY( EXPORTING IV_KUNNR = P_KUNNR
IMPORTING EV_FNAME = G_FNAME
EV_SNAME = G_SNAME
EV_CITY = G_CITY
EV_STREETNO = G_STREETNO ).

WRITE:/ 'DETAILS ARE:',
/ 'FIRST NAME :', G_FNAME,
/ 'SECOND NAME :', G_SNAME,
/ 'CITY NAME :', G_CITY,
/ 'STREET NUMBER :', G_STREETNO.

RESULT



Hope this blog will help readers to create local Abstract Class in SAP ABAP OOPs with these 2 parts of the blog.

 
7 Comments
Labels in this area