-
Notifications
You must be signed in to change notification settings - Fork 0
/
oo alv data changed.abap
147 lines (124 loc) · 4.35 KB
/
oo alv data changed.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
ZGK_OOALV_SCREEN_TOP:
#####################
*&---------------------------------------------------------------------*
*& Include ZGK_OOALV_SCREEN_TOP
*&---------------------------------------------------------------------*
data: go_grid type ref to cl_gui_alv_grid,
go_cust type ref to cl_gui_custom_container.
data: gt_scarr type table of scarr,
gs_scarr type scarr,
gt_fcat type lvc_t_fcat,
gs_layout type lvc_s_layo.
FIELD-SYMBOLS: <gfs_fcat> TYPE LVC_S_FCAT.
CLASS cl_event_receiver DEFINITION DEFERRED.
DATA go_event_receiver TYPE REF TO cl_event_receiver.
ZGK_OOALV_SCREEN_CLS:
#####################
methods handle_data_changed "DATA_CHANGED""hucrede herhangi bir veri degisimini kontrol eder
for event data_changed of cl_gui_alv_grid
importing
er_data_changed
e_onf4
e_onf4_before
e_onf4_after
e_ucomm.
/////////////////////////////////////
method handle_data_changed.
data: ls_modi type lvc_s_modi,
lv_mess type char200.
loop at er_data_changed->mt_good_cells into ls_modi.
read table gt_scarr into gs_scarr index ls_modi-row_id.
if sy-subrc eq 0.
concatenate ls_modi-fieldname
'eski değer'
gs_scarr-carrname
',yeni değer'
ls_modi-value
into lv_mess
separated by space.
MESSAGE lv_mess TYPE 'I'.
endif.
endloop.
endmethod.
ZGK_OOALV_SCREEN_FRM:
#######################
*&---------------------------------------------------------------------*
*& Include ZGK_OOALV_SCREEN_FRM
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form display_alv.
if go_grid is initial.
create object go_cust
exporting
container_name = 'CC_ALV'.
CREATE OBJECT go_grid
exporting
i_parent = go_cust.
CREATE OBJECT go_event_receiver.
set HANDLER go_event_receiver->handle_data_changed FOR go_grid. "assign ediyoruz..
call method go_grid->set_table_for_first_display
exporting
is_layout = gs_layout
changing
it_outtab = gt_scarr
it_fieldcatalog = gt_fcat.
CALL METHOD go_grid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
else.
call method go_grid->refresh_table_display.
endif.
endform.
*&---------------------------------------------------------------------*
*& Form GET_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form get_data .
select * from scarr
into corresponding fields of table gt_scarr.
endform.
*&---------------------------------------------------------------------*
*& Form GS_LAYOUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form set_layout .
clear: gs_layout.
gs_layout-cwidth_opt = abap_true.
gs_layout-zebra = abap_true.
gs_layout-stylefname = 'STYLE'.
endform.
*&---------------------------------------------------------------------*
*& Form SET_FCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form set_fcat .
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'SCARR'
changing
ct_fieldcat = gt_fcat.
LOOP AT gt_fcat ASSIGNING <gfs_fcat>.
IF <gfs_fcat>-fieldname eq 'CARRNAME'.
<gfs_fcat>-edit = abap_true. "//Edit modu açık..
ENDIF.
ENDLOOP.
endform.