abap计数相似的行值

  • 本文关键字:相似 abap abap
  • 更新时间 :
  • 英文 :

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="NDT" >2将第二行设置为MH ,则更新ls_th_sum_lab_ndt-zwc_cat=MH

提前感谢!

试试这个:

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.

希望能有所帮助。

相关内容

  • 没有找到相关文章

最新更新