IF ls_th_sum_lab_ndt IS not INITIAL.
ls_th_sum_lab_ndt-ndt_flag = 'X'.
ls_th_sum_lab_ndt-zwc_cat = 'NDT'.
if there are more than 2 zwc_cat that equal to NDT change the other one to MH
APPEND ls_th_sum_lab_ndt TO gt_th_sum_lab_ndt.
ENDIF.
基本上我想做什么:
如果ls_th_sum_lab_ndt-zwc_cat=MH
将第二行设置为MH,则更新ls_th_sum_lab_ndt-zwc_cat="NDT" >2
先谢谢您!
答案 0 :(得分:0)
尝试一下:
DATA: lv_count type i,
lv_index type sy-tabix.
...
LOOP AT gt_th_sum_lab_ndt INTO ls_th_sum_lab_ndt WHERE zwc_cat = 'NDT'.
lv_count = lv_count + 1.
if lv_count >= 2.
lv_index = sy-tabix.
exit.
endif.
ENDLOOP.
CHECK lv_count >= 2.
READ TABLE gt_th_sum_lab_ndt INTO ls_th_sum_lab_ndt INDEX lv_index.
ls_th_sum_lab_ndt-zwc_cat = 'MH'.
MODIFY gt_th_sum_lab_ndt FROM ls_th_sum_lab_ndt INDEX lv_index.
希望有帮助。