ABAP 程序优化 20
将CKMLCR需要的数据一次性读取到内表里,再对该内表进行相关操作,减少数据表查询次数。LOOPATIMBEW1.SELECTSINGLEPVPRSINTOPVPRSFR...
将CKMLCR需要的数据一次性读取到内表里,再对该内表进行相关操作,减少数据表查询次数。
LOOP AT IMBEW1.
SELECT SINGLE PVPRS INTO PVPRS FROM CKMLCR WHERE KALNR = IMBEW1-KALNR
AND BDATJ = YEAR
AND POPER = MONTH
AND VPRSV = 'V'.
IF SY-SUBRC <> 0 AND SJDJ = 'X'.
MESSAGE I012 WITH '无实际单价,请选择管理单价'.
STOP.
ELSE.
ITABDJ-WERKS = IMBEW1-BWKEY.
ITABDJ-MATNR = IMBEW1-MATNR.
ITABDJ-PVPRS = PVPRS.
ENDIF.
APPEND ITABDJ.
CLEAR ITABDJ.
ENDLOOP. 展开
LOOP AT IMBEW1.
SELECT SINGLE PVPRS INTO PVPRS FROM CKMLCR WHERE KALNR = IMBEW1-KALNR
AND BDATJ = YEAR
AND POPER = MONTH
AND VPRSV = 'V'.
IF SY-SUBRC <> 0 AND SJDJ = 'X'.
MESSAGE I012 WITH '无实际单价,请选择管理单价'.
STOP.
ELSE.
ITABDJ-WERKS = IMBEW1-BWKEY.
ITABDJ-MATNR = IMBEW1-MATNR.
ITABDJ-PVPRS = PVPRS.
ENDIF.
APPEND ITABDJ.
CLEAR ITABDJ.
ENDLOOP. 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询