METHOD refresh_tags DATA lv_e_btd_intid TYPE ain pub_btd_intid DATA lt

  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
METHOD refresh_tags .
DATA lv_e_btd_intid TYPE /ain/pub_btd_intid.
DATA lt_tags TYPE zsc_tags_tab.
DATA lt_tags_distinct TYPE zsc_tags_tab.
DATA lt_tags_temp TYPE zsc_tags_tab.
DATA ls_tags LIKE LINE OF lt_tags.
DATA lo_nd_table_rfid TYPE REF TO if_wd_context_node.
DATA ls_table_rfid TYPE wd_this->element_table_rfid.
DATA lt_table_rfid TYPE wd_this->elements_table_rfid.
DATA ls_table_charg TYPE wd_this->element_table_charg.
DATA lt_table_charg TYPE wd_this->elements_table_charg.
DATA lt_table_size TYPE wd_this->elements_table_size.
DATA ls_table_size TYPE wd_this->element_table_size.
DATA lt_table_ex TYPE wd_this->elements_table.
DATA lt_table_ex_result TYPE wd_this->elements_table.
DATA ls_table_ex TYPE wd_this->element_table.
DATA lt_table TYPE TABLE OF zsc_rfid_ds_om_ssf.
DATA ls_table TYPE zsc_rfid_ds_om_ssf.
FIELD-SYMBOLS <fs_table> TYPE zsc_rfid_ds_om_ssf."wd_this->element_table.
FIELD-SYMBOLS <fs_table_charg> TYPE wd_this->element_table_charg.
FIELD-SYMBOLS <fs_table_size> TYPE wd_this->element_table_size.
FIELD-SYMBOLS <fs_table_ex> LIKE ls_table_ex.
FIELD-SYMBOLS <fs_table_rfid> LIKE ls_table_rfid.
DATA lo_nd_input TYPE REF TO if_wd_context_node.
DATA lo_el_input TYPE REF TO if_wd_context_element.
DATA ls_input TYPE wd_this->element_input.
DATA lt_pobj_id TYPE /ain/pub_pobj_id_tab.
DATA ls_pobj_id TYPE /ain/pub_pobj_id_str.
DATA ls_pobj_othattr TYPE /ain/pub_pobj_othattr_str.
DATA ls_prod_obj TYPE /ain/ui_prod_obj_str.
DATA lt_mm TYPE ztt_rfid_mm_struct.
DATA ls_mm LIKE LINE OF lt_mm.
DATA lv_e TYPE ebeln.
DATA lv_matnr TYPE matnr.
lo_nd_input = wd_context->get_child_node( name = wd_this->wdctx_input ).
lo_el_input = lo_nd_input->get_element( ).
lo_el_input->get_static_attributes( IMPORTING static_attributes = ls_input ).
* LO_ND_INPUT = WD_CONTEXT->GET_CHILD_NODE( name = wd_this->WDCTX_TABLE_CHARG ).
* LO_ND_INPUT->GET_STATIC_ATTRIBUTES_TABLE( IMPORTING TABLE = LT_TABLE_CHARG ).
* LO_ND_INPUT = WD_CONTEXT->GET_CHILD_NODE( name = wd_this->WDCTX_TABLE_SIZE ).
* LO_ND_INPUT->GET_STATIC_ATTRIBUTES_TABLE( IMPORTING TABLE = LT_TABLE_SIZE ).
IF update IS INITIAL.
CALL FUNCTION '/AIN/PUB_BO_BUFFER_REFRESH'.
lv_e_btd_intid = wd_assist->gv_assigned_doc. " wd_this->get_assigned_doc( ).
zcl_aii_utils=>get_rfids_by_btd_intid( EXPORTING iv_btd_intid = lv_e_btd_intid IMPORTING et_tags = lt_tags et_pobj_othattrs = wd_this->gt_pobj_othattrs et_pobj_id = lt_pobj_id ).
*
* LOOP AT LT_TABLE_CHARG ASSIGNING <FS_TABLE_CHARG>.
* <FS_TABLE_CHARG>-RFID_KOLVO = 0.
* <FS_TABLE_CHARG>-POD_KOLVO = 0.
* clear <FS_TABLE_CHARG>-DOC46.
* ENDLOOP.
* LOOP AT LT_TABLE_SIZE ASSIGNING <FS_TABLE_SIZE>.
* <FS_TABLE_size>-RFID_KOLVO = 0.
* <FS_TABLE_size>-POD_KOLVO = 0.
* <FS_TABLE_SIZE>-EBELP = 0.
* CLEAR <FS_TABLE_SIZE>-VBELN.
* CLEAR <FS_TABLE_SIZE>-DOC46.
* ENDLOOP.
LOOP AT lt_tags INTO ls_tags .
SELECT SINGLE matnr_descr FROM zsc_rfid_mat INTO ls_table_rfid-matxt WHERE sap_matnr = ls_tags-matnr.
MOVE-CORRESPONDING ls_tags TO ls_table_rfid.
READ TABLE lt_pobj_id WITH KEY pobj_extid = ls_tags-rfid INTO ls_pobj_id.
IF sy-subrc = 0.
READ TABLE wd_this->gt_pobj_othattrs WITH KEY pobj_intid = ls_pobj_id-pobj_intid attribute_name = wd_this->mv_oth_charg_pm INTO ls_pobj_othattr.
IF sy-subrc = 0.
ls_table_rfid-charg = ls_pobj_othattr-attribute_value.
ELSE.
CLEAR ls_table_rfid-charg.
ENDIF.
READ TABLE wd_this->gt_pobj_othattrs WITH KEY pobj_intid = ls_pobj_id-pobj_intid attribute_name = wd_this->mv_oth_postavka INTO ls_pobj_othattr.
IF sy-subrc = 0.
ls_table_rfid-vbeln = ls_pobj_othattr-attribute_value.
ENDIF.
READ TABLE wd_this->gt_pobj_othattrs WITH KEY pobj_intid = ls_pobj_id-pobj_intid attribute_name = wd_this->mv_oth_posnr INTO ls_pobj_othattr.
IF sy-subrc = 0.
ls_table_rfid-posnr = ls_pobj_othattr-attribute_value.
ENDIF.
READ TABLE wd_this->gt_pobj_othattrs WITH KEY pobj_intid = ls_pobj_id-pobj_intid attribute_name = wd_this->mv_oth_46 INTO ls_pobj_othattr.
IF sy-subrc = 0.
ls_table_rfid-doc46 = ls_pobj_othattr-attribute_value.
ENDIF.
READ TABLE wd_this->gt_pobj_othattrs WITH KEY pobj_intid = ls_pobj_id-pobj_intid attribute_name = wd_this->mv_oth_pos INTO ls_pobj_othattr.
IF sy-subrc = 0.
ls_table_rfid-ebelp = ls_pobj_othattr-attribute_value.
ENDIF.
ls_table_rfid-uom = wd_assist->get_prod_uom( ls_table_rfid-matnr ).
* CALL FUNCTION '/AIN/UI_OBJ_DETAIL'
* EXPORTING
* iv_obj_guid = LS_POBJ_ID-POBJ_INTID
** iv_archived = iv_archived
* IMPORTING
** es_loc_obj = ls_loc_obj
* es_prod_obj = ls_prod_obj
** TABLES
** et_obj_hist = lt_obj_hist
* EXCEPTIONS
* data_not_found = 1
* input_data_missing = 2
* OTHERS = 3.
* IF sy-subrc = 0.
* LS_TABLE_RFID-UOM = LS_PROD_OBJ-BASE_UOM.
* ENDIF.
ENDIF.
ls_table_rfid-matnr = ls_tags-matnr.
ls_table_rfid-height = ls_tags-height.
ls_table_rfid-lgort = ls_input-lgort.
ls_table_rfid-werks = ls_input-werks.
ls_table_rfid-sizes = ls_tags-size.
* ls_table_rfid-uom = 'ST'.
ls_table_rfid-rfid_kolvo = 1.
MOVE-CORRESPONDING ls_table_rfid TO ls_table_charg.
ls_table_charg-pod_kolvo = 1.
MOVE-CORRESPONDING ls_table_rfid TO ls_table_size.
* CLEAR: LS_TABLE_SIZE-DOC46." LS_TABLE_SIZE-VBELN.
ls_table_size-pod_kolvo = 1.
"Закладка. Тут, возможно происходит задвоение.
COLLECT ls_table_charg INTO lt_table_charg.
COLLECT ls_table_rfid INTO lt_table_rfid.
COLLECT ls_table_size INTO lt_table_size.
MOVE-CORRESPONDING ls_table_charg TO ls_table.
ls_table-ebeln = ls_table_rfid-doc46.
ls_table-ebelp = ls_table_rfid-ebelp.
* ls_table-meins = 'ST'.
ls_table-naim = ls_table_charg-matxt.
ls_table-vbeln = ls_table_rfid-vbeln.
ls_table-meins = ls_table_rfid-uom.
COLLECT ls_table INTO lt_table.
ENDLOOP.
ELSE.
lo_nd_input = wd_context->get_child_node( name = wd_this->wdctx_table ).
lo_nd_input->get_static_attributes_table( IMPORTING table = lt_table_ex ).
lo_nd_input = wd_context->get_child_node( name = wd_this->wdctx_table_rfid ).
lo_nd_input->get_static_attributes_table( IMPORTING table = lt_table_rfid ).
"Try to fix error with duplicated amount in rfid alv
DELETE ADJACENT DUPLICATES FROM lt_table_rfid.
LOOP AT lt_table_rfid INTO ls_table_rfid .
MOVE-CORRESPONDING ls_table_rfid TO ls_table_charg.
ls_table_charg-pod_kolvo = 1.
MOVE-CORRESPONDING ls_table_rfid TO ls_table_size.
ls_table_size-pod_kolvo = 1.
COLLECT ls_table_charg INTO lt_table_charg.
* COLLECT ls_table_rfid INTO lt_table_rfid.
COLLECT ls_table_size INTO lt_table_size.
MOVE-CORRESPONDING ls_table_charg TO ls_table.
ls_table-ebeln = ls_table_rfid-doc46.
ls_table-ebelp = ls_table_rfid-ebelp.
* ls_table-meins = 'ST'.
ls_table-naim = ls_table_charg-matxt.
ls_table-vbeln = ls_table_rfid-vbeln.
ls_table-meins = ls_table_rfid-uom.
COLLECT ls_table INTO lt_table.
ENDLOOP.
LOOP AT lt_table_charg ASSIGNING <fs_table_charg>.
<fs_table_charg>-num = sy-tabix.
ENDLOOP.
LOOP AT lt_table_size ASSIGNING <fs_table_size>.
<fs_table_size>-num = sy-tabix.
ENDLOOP.
LOOP AT lt_table_rfid ASSIGNING <fs_table_rfid>.
<fs_table_rfid>-num = sy-tabix.
ENDLOOP.
* get open amount of distributed 46*
LOOP AT lt_table INTO ls_table.
ls_table-num = sy-tabix.
LOOP AT lt_table_ex ASSIGNING <fs_table_ex> WHERE matnr = ls_table-matnr. "here must be only 1 row per matnr
MOVE-CORRESPONDING ls_table TO <fs_table_ex>.
lt_mm = <fs_table_ex>-sp_tab.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = <fs_table_ex>-matnr
IMPORTING
output = lv_matnr.
READ TABLE lt_mm WITH KEY matnr = lv_matnr ebeln = <fs_table_ex>-ebeln INTO ls_mm.
IF sy-subrc EQ 0.
* change record in main alv
<fs_table_ex>-open_kolvo = ls_mm-menge.
<fs_table_ex>-ebelp = ls_mm-ebelp.
ENDIF.
APPEND <fs_table_ex> TO lt_table_ex_result.
ENDLOOP.
ENDLOOP.
ENDIF.
* LOOP AT lt_table ASSIGNING <fs_table>.
* <fs_table>-num = sy-tabix.
* data ls_mmord TYPE ZSC_RFID_MM_STRUCT.
* wd_this->GET_MM_ORDER( EXPORTING IV_EBELN = LS_INPUT-EBELN MAT = <fS_TABLE>-MATNR RECEIVING ES_RES = LS_MMORD ).
* IF LS_MMORD is NOT INITIAL.
* wd_this->GV_OPEN_AMOUNT = LS_MMORD-MENGE.
* <FS_TABLE>-OPEN_KOLVO = LS_MMORD-MENGE.
* LS_INPUT-EBELNP = LS_MMORD-EBELP.
* ENDIF.
* ENDLOOP.
* UPDATE_MAIN( ). "update MENGE and EBELP for current ebeln
lo_nd_table_rfid = wd_context->get_child_node( name = wd_this->wdctx_table_rfid ).
lo_nd_table_rfid->bind_table( new_items = lt_table_rfid ).
lo_nd_table_rfid = wd_context->get_child_node( name = wd_this->wdctx_table ).
IF update IS INITIAL.
lo_nd_table_rfid->bind_table( new_items = lt_table ).
DATA lo_nd_table_charg TYPE REF TO if_wd_context_node.
lo_nd_table_charg = wd_context->get_child_node( name = wd_this->wdctx_table_charg ).
lo_nd_table_charg->bind_table( new_items = lt_table_charg set_initial_elements = abap_true ).
*
lo_nd_table_rfid = wd_context->get_child_node( name = wd_this->wdctx_table_size ).
lo_nd_table_rfid->bind_table( new_items = lt_table_size ).
ELSE.
lo_nd_table_rfid->bind_table( new_items = lt_table_ex_result ).
ENDIF.
ENDMETHOD.