-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSAPABAP024-2
More file actions
290 lines (199 loc) · 8.39 KB
/
Copy pathSAPABAP024-2
File metadata and controls
290 lines (199 loc) · 8.39 KB
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
*&---------------------------------------------------------------------*
*& Report ZBK_P024
*&---------------------------------------------------------------------*
*&OO ALV-> SCREEN & CONTAINER & FULL SCREEN
*&OO ALV-> FIELDCATALOG & LAYOUT
*&OO ALV-> FIELDCATALOG & MERGE
*&---------------------------------------------------------------------*
REPORT zbk_p024.
INCLUDE ZBK_P024_top.
INCLUDE ZBK_P024_pbo.
INCLUDE ZBK_P024_pai.
INCLUDE ZBK_P024_frm.
START-OF-SELECTION.
PERFORM get_data.
PERFORM set_fcat.
PERFORM set_layout.
CALL SCREEN 0100.
*&---------------------------------------------------------------------*
*& Include ZBK_P024_TOP
*&---------------------------------------------------------------------*
DATA: go_alv TYPE REF TO cl_gui_alv_grid,
go_cont TYPE REF TO cl_gui_custom_container.
DATA: gt_ekko TYPE TABLE OF ekko,
gt_fcat TYPE lvc_t_fcat,
gs_fcat TYPE lvc_s_fcat,
gs_layout TYPE lvc_s_layo.
*&---------------------------------------------------------------------*
*& Include ZBK_P024_PBO
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS '0100'.
SET TITLEBAR '0100'.
PERFORM display_alv.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Include ZBK_P024_PAI
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN '&BACK'.
SET SCREEN 0.
ENDCASE.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Include ZBK_P024_FRM
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form display_alv
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM display_alv .
* CREATE OBJECT go_cont
* EXPORTING
* container_name = 'CC_ALV'.
*
* CREATE OBJECT go_alv
* EXPORTING
* i_parent = go_cont.
CREATE OBJECT go_alv
EXPORTING
i_parent = cl_gui_container=>screen0.
CALL METHOD go_alv->set_table_for_first_display
EXPORTING
* i_buffer_active = " Buffering Active
* i_bypassing_buffer = " Switch Off Buffer
* i_consistency_check = " Starting Consistency Check for Interface Error Recognition
* i_structure_name = " Internal Output Table Structure Name
* is_variant = " Layout
* i_save = " Save Layout
* i_default = 'X' " Default Display Variant
is_layout = gs_layout " Layout
* is_print = " Print Control
* it_special_groups = " Field Groups
* it_toolbar_excluding = " Excluded Toolbar Standard Functions
* it_hyperlink = " Hyperlinks
* it_alv_graphics = " Table of Structure DTC_S_TC
* it_except_qinfo = " Table for Exception Quickinfo
* ir_salv_adapter = " Internal Usage only !!! - obsolete
CHANGING
it_outtab = gt_ekko " Output Table
it_fieldcatalog = gt_fcat " Field Catalog
* it_sort = " Sort Criteria
* it_filter = " Filter Criteria
* EXCEPTIONS
* invalid_parameter_combination = 1 " Wrong Parameter
* program_error = 2 " Program Errors
* too_many_lines = 3 " Too many Rows in Ready for Input Grid
* others = 4
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form get_data
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM get_data .
SELECT * FROM ekko
INTO TABLE gt_ekko.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form set_fcat
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM set_fcat .
CLEAR: gs_fcat.
* gs_fcat-fieldname = 'CARRID'.
* gs_fcat-scrtext_s = 'A. Code'.
* gs_fcat-scrtext_m = 'Airline Code'.
* gs_fcat-scrtext_l = 'Airline Code'.
* gs_fcat-col_pos = 1. "Kolonun hangi sırada olacağını belirler
* gs_fcat-col_opt = abap_true. "Kolonunu içindeki en uzun karaktere sahip veriye göre genişletir.
* gs_fcat-key = abap_true. "Kolonun 'KEY' olduğunu belirtir, arka planını değiştirir, kaydırma yapsanda sabit kalır.
* APPEND gs_fcat TO gt_fcat.
*
* gs_fcat-fieldname = 'CARRNAME'.
* gs_fcat-scrtext_s = 'A. name'.
* gs_fcat-scrtext_m = 'Airline name'.
* gs_fcat-scrtext_l = 'Airline name'.
* gs_fcat-col_pos = 2.
* gs_fcat-col_opt = abap_true.
* gs_fcat-edit = abap_true. "Kolonu düzenleyebilir hale geliriz. Ancak tabloya yansıması için yeterli bir kod değildir.
* APPEND gs_fcat TO gt_fcat.
*
* gs_fcat-fieldname = 'CURRCODE'.
* gs_fcat-scrtext_s = 'LOCAL CURR'.
* gs_fcat-scrtext_m = 'Local currency of A.'.
* gs_fcat-scrtext_l = 'Local currency of airline'.
* gs_fcat-col_pos = 3.
* gs_fcat-col_opt = abap_true.
* gs_fcat-hotspot = abap_true. "Kolonu tıklanabilir hale getirir.
* APPEND gs_fcat TO gt_fcat.
*
* gs_fcat-fieldname = 'URL'.
* gs_fcat-scrtext_s = 'A. URL'.
* gs_fcat-scrtext_m = 'Airline URL'.
* gs_fcat-scrtext_l = 'Airline URL'.
* gs_fcat-col_pos = 4.
* gs_fcat-col_opt = abap_true.
* gs_fcat-no_out = abap_true. "Kolonu fieldcatolog yazsam bile gizler.
* APPEND gs_fcat TO gt_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'EKKO'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
* EXCEPTIONS
* INCONSISTENT_INTERFACE = 1
* PROGRAM_ERROR = 2
* OTHERS = 3
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form set_layout
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM set_layout .
CLEAR: gs_layout.
"LAYOUT için yazdığımız tüm kodlar tüm alv'yi etkiler.
gs_layout-cwidth_opt = abap_true. "Tüm kolanları optimize eder.
*gs_layout-edit = abap_true. "Tüm kolonları yazılabilir hale getirir.
*gs_layout-no_toolbar = abap_true. "Toolbar'ı kapatır.
gs_layout-zebra = abap_true. "Görsel değişiklik yapar.
ENDFORM.