SAP ABAP Private Class
TABLES: pa0002.
PARAMETERS: pernr TYPE pa0002-pernr.
DATA: BEGIN OF struct,
pernr TYPE pa0002-pernr,
vorna TYPE pa0002-vorna,
nachn TYPE pa0002-nachn,
END OF struct.
DATA: itab LIKE TABLE OF struct ,
wa LIKE struct.
*----------------------------------------------------------------------*
* CLASS class1 DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS class1 DEFINITION CREATE PRIVATE.
PUBLIC SECTION.
METHODS : method1.
CLASS-METHODS : method2.
ENDCLASS. "c1 DEFINITION
*----------------------------------------------------------------------*
* CLASS c1 IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS class1 IMPLEMENTATION.
METHOD method1.
SELECT * FROM pa0002 INTO CORRESPONDING FIELDS OF TABLE itab WHERE pernr EQ pernr.
LOOP AT itab INTO wa.
WRITE: / 'personnel number:', wa-pernr, 'First name:', wa-vorna,'Last name', wa-nachn.
ENDLOOP.
ENDMETHOD. "m1
METHOD method2.
DATA : object TYPE REF TO class1.
CREATE OBJECT : object.
CALL METHOD : object->method1.
ENDMETHOD. "m2
ENDCLASS. "c1 IMPLEMENTATION
START-OF-SELECTION.
CALL METHOD : class1=>method2.
Serkan AKKAVAK
Computer Engineer BSc
SAP Department Deputy Manager
Contact : serkurumsal@yandex.com
0 Comments