1 FUNCTION zfm_pp_0010.
2 *"----------------------------------------------------------------------
3 *"*"本地接口:
4 *" EXPORTING
5 *" VALUE(EV_TYPE) TYPE CHAR1
6 *" VALUE(EV_MESSAGE) TYPE CHAR255
7 *" TABLES
8 *" TI_INPUT STRUCTURE ZSPP_0008 OPTIONAL
9 *"----------------------------------------------------------------------
10
11 DATA:lv_plnty TYPE plnty,
12 lv_plnnr TYPE plnnr,
13 lv_plnal TYPE plnal,
14 lv_matnr TYPE matnr,
15 lv_werks TYPE werks_d,
16 lt_return TYPE TABLE OF bapiret2,
17 ls_return TYPE bapiret2,
18 lt_operations TYPE TABLE OF cps_task_list_maint_opr,
19 ls_operations TYPE cps_task_list_maint_opr,
20 lt_operations_x TYPE TABLE OF cps_task_list_maint_opr_x,
21 ls_operations_x TYPE cps_task_list_maint_opr_x,
22 ls_task TYPE cps_task_list_maint_tsk,
23 ls_task_x TYPE cps_task_list_maint_tsk_x,
24 lv_task_maintain_mode TYPE cp_task_list_maint_mode,
25 lv_pointer TYPE cp_task_list_maint_pointer.
26
27 CLEAR lv_plnty .
28 CLEAR lv_plnnr .
29 CLEAR lv_plnal .
30 REFRESH lt_return .
31 CLEAR ls_return .
32 REFRESH lt_operations .
33 CLEAR ls_operations .
34 REFRESH lt_operations_x .
35 CLEAR ls_operations_x .
36 CLEAR lv_matnr .
37 CLEAR lv_werks .
38 CLEAR ls_task .
39 CLEAR ls_task_x .
40 CLEAR lv_task_maintain_mode .
41 CLEAR lv_pointer .
42
43 LOOP AT ti_input ASSIGNING FIELD-SYMBOL(<fs_input>) .
44
45 CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
46 EXPORTING
47 input = <fs_input>-matnr
48 IMPORTING
49 output = <fs_input>-matnr
50 EXCEPTIONS
51 length_error = 1
52 OTHERS = 2.
53
54 ENDLOOP .
55
56 LOOP AT ti_input ASSIGNING <fs_input> .
57
58 AT FIRST .
59
60 lv_matnr = <fs_input>-matnr .
61 lv_werks = <fs_input>-werks .
62 lv_plnnr = <fs_input>-plnnr .
63 * lv_plnty = <fs_input>-plnty .
64 lv_plnal = <fs_input>-plnal .
65 lv_plnty = 'N' .
66 lv_task_maintain_mode = 'M' .
67
68 SELECT SINGLE plnnr,
69 plnal
70 INTO (@lv_plnnr,@lv_plnal)
71 FROM mapl
72 WHERE matnr = @<fs_input>-matnr
73 AND werks = @<fs_input>-werks
74 AND plnal = @<fs_input>-plnal
75 AND plnty = 'N' .
76
77 ls_task-task_list_usage = <fs_input>-verwe .
78 ls_task_x-task_list_usage = 'X' .
79
80 ls_task-task_list_status = <fs_input>-statu .
81 ls_task_x-task_list_status = 'X' .
82
83 ls_task-lot_size_from = <fs_input>-losvn .
84 ls_task_x-lot_size_from = 'X' .
85
86 ls_task-lot_size_to = <fs_input>-losbs .
87 ls_task_x-lot_size_to = 'X' .
88
89 ls_task-description = <fs_input>-ktext .
90 ls_task_x-description = 'X' .
91
92 ENDAT .
93
94 CLEAR ls_operations .
95 CLEAR ls_operations_x .
96
97 IF <fs_input>-flag IS NOT INITIAL .
98
99 IF <fs_input>-flag = 'N' .
100 ls_operations-maintain_mode = 'C' .
101 ELSEIF <fs_input>-flag = 'C' .
102 ls_operations-maintain_mode = 'M' .
103 ELSEIF <fs_input>-flag = 'D' .
104 ls_operations-maintain_mode = 'D' .
105 ENDIF .
106
107 lv_pointer = lv_pointer + 1 .
108 ls_operations-sequence_no = '000000'. "序列
109
110 ls_operations-flag_bar_pointer = lv_pointer .
111
112 ls_operations-activity = <fs_input>-vornr .
113 ls_operations_x-activity = 'X' .
114
115 ls_operations-activity_old = <fs_input>-vornr .
116
117 ls_operations-operation_measure_unit = <fs_input>-meinh .
118 ls_operations_x-operation_measure_unit = 'X' .
119
120 ls_operations-work_cntr = <fs_input>-arbpl .
121 ls_operations_x-work_cntr = 'X' .
122
123 ls_operations-plant = <fs_input>-werks .
124 ls_operations_x-plant = 'X' .
125
126 ls_operations-nominator = '1' .
127 ls_operations_x-nominator = 'X' .
128
129 ls_operations-denominator = '1' .
130 ls_operations_x-denominator = 'X' .
131
132 ls_operations-control_key = <fs_input>-steus .
133 ls_operations_x-control_key = 'X' .
134
135 ls_operations-description = <fs_input>-ltxa1 .
136 ls_operations_x-description = 'X' .
137
138 ls_operations-base_quantity = <fs_input>-bmsch .
139 ls_operations_x-base_quantity = 'X' .
140
141 ls_operations-std_value_01 = <fs_input>-vgw01 .
142 ls_operations_x-std_value_01 = 'X' .
143
144 ls_operations-std_unit_01 = <fs_input>-vge01 .
145 ls_operations_x-std_unit_01 = 'X' .
146
147 ls_operations-std_value_02 = <fs_input>-vgw02 .
148 ls_operations_x-std_value_02 = 'X' .
149
150 ls_operations-std_unit_02 = <fs_input>-vge02 .
151 ls_operations_x-std_unit_02 = 'X' .
152
153 ls_operations-std_value_03 = <fs_input>-vgw03 .
154 ls_operations_x-std_value_03 = 'X' .
155
156 ls_operations-std_unit_03 = <fs_input>-vge03 .
157 ls_operations_x-std_unit_03 = 'X' .
158
159 ls_operations-std_value_04 = <fs_input>-vgw04 .
160 ls_operations_x-std_value_04 = 'X' .
161
162 ls_operations-std_unit_04 = <fs_input>-vge04 .
163 ls_operations_x-std_unit_04 = 'X' .
164
165 ls_operations-std_value_05 = <fs_input>-vgw05 .
166 ls_operations_x-std_value_05 = 'X' .
167
168 ls_operations-std_unit_05 = <fs_input>-vge05 .
169 ls_operations_x-std_unit_05 = 'X' .
170
171 ls_operations-std_value_06 = <fs_input>-vgw06 .
172 ls_operations_x-std_value_06 = 'X' .
173
174 ls_operations-std_unit_06 = <fs_input>-vge06 .
175 ls_operations_x-std_unit_06 = 'X' .
176
177 ls_operations-standard_queue_time = <fs_input>-zwnor .
178 ls_operations_x-standard_queue_time = 'X' .
179
180 ls_operations-min_queue_time_unit = <fs_input>-zeiwn .
181 ls_operations_x-min_queue_time_unit = 'X' .
182
183 ls_operations-userfields_keyword_id = <fs_input>-slwid .
184 ls_operations_x-userfields_keyword_id = 'X' .
185
186 ls_operations-userfield_ch20_00 = <fs_input>-usr00 .
187 ls_operations_x-userfield_ch20_00 = 'X' .
188
189 ls_operations-purch_org = <fs_input>-ekorg .
190 ls_operations_x-purch_org = 'X' .
191
192 ls_operations-matl_group = <fs_input>-matkl .
193 ls_operations_x-matl_group = 'X' .
194
195 ls_operations-cost_elem = <fs_input>-sakto .
196 ls_operations_x-cost_elem = 'X' .
197
198 ls_operations-purch_group = <fs_input>-ekgrp .
199 ls_operations_x-purch_group = 'X' .
200
201 APPEND ls_operations TO lt_operations .
202 APPEND ls_operations_x TO lt_operations_x .
203
204 ENDIF .
205
206 ENDLOOP .
207
208 CALL FUNCTION 'CPCC_S_TASK_LIST_MAINTAIN'
209 EXPORTING
210 * CHANGE_NO =
211 key_date = sy-datum
212 task_list_type = lv_plnty
213 task_list_group = lv_plnnr
214 group_counter = lv_plnal
215 material = lv_matnr
216 plant = lv_werks
217 task_maintain_mode = 'M'
218 task = ls_task
219 task_x = ls_task_x
220 * APPLICATION =
221 * BOM_USAGE =
222 * TESTRUN = ' '
223 * IMPORTING
224 * EV_PLNTY =
225 * EV_PLNNR =
226 * EV_PLNAL =
227 TABLES
228 * MATERIAL_TASK_ALLOCATIONS =
229 * MATERIAL_TASK_ALLOCATIONS_X =
230 * SEQUENCES =
231 * SEQUENCES_X =
232 operations = lt_operations
233 operations_x = lt_operations_x
234 * SUBOPERATIONS =
235 * SUBOPERATIONS_X =
236 * PRODUCTION_RESOURCES_TOOLS =
237 * PRODUCTION_RESOURCES_TOOLS_X =
238 * COMPONENT_ALLOCATIONS =
239 * COMPONENT_ALLOCATIONS_X =
240 * INSPECTION_CHARACTERISTICS =
241 * INSPECTION_CHARACTERISTICS_X =
242 * INSPECTION_VALUES =
243 * INSPECTION_VALUES_X =
244 * REFERENCED_OPERATIONS =
245 * TEXT =
246 * TEXT_ALLOCATIONS =
247 return = lt_return
248 * SEGMENT_TASK_MAINTAIN =
249 .
250
251 LOOP AT lt_return INTO ls_return WHERE type CA 'AXE'.
252 EXIT.
253 ENDLOOP.
254 IF sy-subrc NE 0.
255 CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
256 EXPORTING
257 wait = abap_true.
258 ev_type = 'S'.
259 ev_message = '修改成功'.
260 ELSE.
261 CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
262 SORT lt_return BY type message.
263 DELETE ADJACENT DUPLICATES FROM lt_return COMPARING type message.
264 LOOP AT lt_return INTO ls_return WHERE type CA 'AXE'.
265 ev_message = ls_return-message && ';' && ev_message .
266 ENDLOOP.
267 ev_type = 'E'.
268 ENDIF.
269
270 ENDFUNCTION.