forked from moreus/ABAPDesignPattern
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zdp_facade.abap
70 lines (59 loc) · 1.52 KB
/
zdp_facade.abap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
*&---------------------------------------------------------------------*
*& Report ZDP_FACADE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zdp_facade.
CLASS lcl_data DEFINITION.
PUBLIC SECTION.
METHODS: constructor.
ENDCLASS.
INTERFACE lif_write.
METHODS: write_data.
ENDINTERFACE.
CLASS lcl_write_alv DEFINITION.
PUBLIC SECTION.
INTERFACES: lif_write.
ENDCLASS.
CLASS lcl_write_log DEFINITION.
PUBLIC SECTION.
INTERFACES: lif_write.
ENDCLASS.
CLASS lcl_facade DEFINITION.
PUBLIC SECTION.
METHODS: process_report IMPORTING iv_write_type TYPE char1.
ENDCLASS.
CLASS lcl_data IMPLEMENTATION.
METHOD constructor.
WRITE: / 'Getting Data'.
ENDMETHOD.
ENDCLASS.
CLASS lcl_write_alv IMPLEMENTATION.
METHOD lif_write~write_data.
WRITE: / 'Writing data in ALV'.
ENDMETHOD.
ENDCLASS.
CLASS lcl_write_log IMPLEMENTATION.
METHOD lif_write~write_data.
WRITE: / 'Wring data in Log'.
ENDMETHOD.
ENDCLASS.
CLASS lcl_facade IMPLEMENTATION.
METHOD process_report.
DATA: lo_data TYPE REF TO lcl_data.
CREATE OBJECT lo_data.
DATA: lo_write TYPE REF TO lif_write.
IF iv_write_type = 'A'.
CREATE OBJECT lo_write TYPE lcl_write_alv.
ELSE.
CREATE OBJECT lo_write TYPE lcl_write_log.
ENDIF.
lo_write->write_data( ).
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA: lo_facade TYPE REF TO lcl_facade.
CREATE OBJECT lo_facade.
lo_facade->process_report( iv_write_type = 'A' ).