vk13查询dump
内部错误:T IVAKE F IVAKE_INSERT I MV130F0I
VK067
通过查看底表是那个日期重复了
解决办法就是VK11,就是把这个日期给重新覆盖点,原来是20230506到20230606然后中间还有一条20230510到20230610
Vk11创建20230101到20231010,覆盖这段时间就可以了
这个是因为调用bapi的BAPI_PRICES_CONDITONS导致日期重复会报错
使用另一个bapi不报错RV_CONDITION_COPY
LOOP AT GT_REQ INTO GS_REQ.
GS_RES-MATNR = GS_REQ-MATNR.
LV_MATNR = GS_REQ-MATNR.
LV_MATNR = |{ LV_MATNR ALPHA = IN }|.
GS_REQ-MATNR = LV_MATNR.
SELECT COUNT(*) FROM MARA WHERE MATNR = @GS_REQ-MATNR INTO @DATA(LV_CNT) .
IF LV_CNT = 1."查询到数据
SELECT SINGLE *
INTO @DATA(LS_A901)
FROM A901
WHERE KAPPL = 'V' AND KSCHL = @GS_REQ-KSCHL
AND MATNR = @GS_REQ-MATNR
AND DATBI = @GS_REQ-DATBI
AND DATAB = @GS_REQ-DATAB.
IF SY-SUBRC = 0.
LV_MODE = 'B'.
ELSE.
LV_MODE = 'A'.
ENDIF.
CLEAR: LS_KEY_FIELDS.
" LS_KEY_FIELDS-VKORG = IS_INPUT-VKORG. " 销售组织
" LS_KEY_FIELDS-VTWEG = IS_INPUT-VTWEG. " 分销渠道
" LS_KEY_FIELDS-KUNNR = IS_INPUT-KUNNR. " 客户
LS_KEY_FIELDS-MATNR = GS_REQ-MATNR. " 物料号
CLEAR LS_COPY_RECORDS.
" condtion fields
LS_COPY_RECORDS-KOPOS = '01'. " 条件的序列号
LS_COPY_RECORDS-KSCHL = GS_REQ-KSCHL. " 条件类型
LS_COPY_RECORDS-KAPPL = 'V'. " 应用程序
LS_COPY_RECORDS-WAERS = GS_REQ-KONWA. " 货币码
LS_COPY_RECORDS-KMEIN = GS_REQ-KMEIN. " 单位
LS_COPY_RECORDS-KBETR = GS_REQ-KBETR. " 金额
LS_COPY_RECORDS-KPEIN = GS_REQ-KPEIN. " 条件定价单位
" ls_copy_records-stfkz = 'A'. " 等级类型
LS_COPY_RECORDS-KRECH = 'C'. " 条件的计算类型
APPEND LS_COPY_RECORDS TO LT_COPY_RECORDS.
CALL FUNCTION 'RV_CONDITION_RESET'.
CALL FUNCTION 'RV_CONDITION_COPY'
EXPORTING
APPLICATION = 'V'
CONDITION_TABLE = '901'
CONDITION_TYPE = GS_REQ-KSCHL
DATE_FROM = GS_REQ-DATAB
DATE_TO = GS_REQ-DATBI
KEY_FIELDS = LS_KEY_FIELDS
MAINTAIN_MODE = LV_MODE "A:创建 B:更新
OVERLAP_CONFIRMED = 'X'
USED_BY_IDOC = 'X'
KEEP_OLD_RECORDS = 'X'
* IMPORTING
* e_komk = ls_komk
* e_komp = ls_komp
* new_record = lv_record
TABLES
COPY_RECORDS = LT_COPY_RECORDS
* copy_staffel = lt_copy_staffel
EXCEPTIONS
ENQUEUE_ON_RECORD = 1
INVALID_APPLICATION = 2
INVALID_CONDITION_NUMBER = 3
INVALID_CONDITION_TYPE = 4
NO_AUTHORITY_EKORG = 5
NO_AUTHORITY_KSCHL = 6
NO_AUTHORITY_VKORG = 7
NO_SELECTION = 8
TABLE_NOT_VALID = 9
NO_MATERIAL_FOR_SETTLEMENT = 10
NO_UNIT_FOR_PERIOD_COND = 11
NO_UNIT_REFERENCE_MAGNITUDE = 12
INVALID_CONDITION_TABLE = 13
OTHERS = 14.
IF SY-SUBRC = 0.
" Commit and Get Condition NO.
CALL FUNCTION 'RV_CONDITION_SAVE'
TABLES
KNUMH_MAP = LT_KNUMH_COMP.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
CALL FUNCTION 'RV_CONDITION_RESET'.
READ TABLE LT_KNUMH_COMP INTO LS_KNUMH_COMP INDEX 1.
IF SY-SUBRC = 0 AND LS_KNUMH_COMP-KNUMH_NEW IS NOT INITIAL.
GS_RES-MSGTX = LS_KNUMH_COMP-KNUMH_NEW.
GS_RES-Msgty = 'S'.
ELSE.
IF LV_MODE EQ 'A'.
IF SY-MSGTY EQ ''.
GS_RES-MSGTX = '创建失败'.
ELSE.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
INTO GS_RES-MSGTX.
ENDIF.
GS_RES-Msgty = 'E'.
ELSE.
GS_RES-MSGTX = '修改成功'.
GS_RES-Msgty = 'S'.
ENDIF.
ENDIF.
ELSE.
IF SY-MSGTY EQ ''.
GS_RES-MSGTX = '失败'.
ELSE.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
INTO GS_RES-MSGTX.
ENDIF.
GS_RES-Msgty = 'E'.
ENDIF.
APPEND GS_RES TO Gt_RES.
ELSE.
GS_RES-Msgty = 'E'.
GS_RES-MSGTX = '该物料不存在请检查后再传输'.
APPEND GS_RES TO Gt_RES.
ENDIF.
CLEAR:GS_REQ.
ENDLOOP.
网友评论