员工客商Z004
正常客商
客商重名校验机制
METHOD if_ex_bupa_addr_check~check.
DATA:
lv_id TYPE ztexit-id, "增强序列号
lv_status TYPE char1, "增强状态
lv_str TYPE string,
ls_but000 TYPE but000,
ls_return TYPE bapiret2.
* 客商名称存在性检查
lv_id = 'ZSD102'.
CALL FUNCTION 'ZABAP_CHECK_EXIT'
EXPORTING
id = lv_id
IMPORTING
e_status = lv_status.
IF lv_status <> 'S'.
RETURN.
ENDIF.
IF is_but000-bu_group = '04' OR is_but000-bu_group = 'Z005'.
RETURN.
ENDIF.
IF iv_activity <> '01' AND iv_activity <> '02'.
RETURN.
ENDIF.
IF is_but000-partner+0(1) <> '#'.
lv_str = ' PARTNER <> IS_BUT000-PARTNER '.
ENDIF.
IF is_but000-bu_group <> 'Z004'.
CONCATENATE lv_str ' AND NAME_ORG4 = IS_BUT000-NAME_ORG4 ' INTO lv_str.
SELECT SINGLE *
INTO ls_but000
FROM but000
WHERE name_org1 = is_but000-name_org1 "组织名称 1
AND name_org2 = is_but000-name_org2 "组织名称 2
AND name_org3 = is_but000-name_org3 "组织名称 3
AND (lv_str).
ELSE.
SELECT SINGLE *
INTO LS_BUT000
FROM BUT000
WHERE NAME_FIRST = IS_BUT000-NAME_FIRST "组织名称 1
AND NAME_LAST = IS_BUT000-NAME_LAST "组织名称 2
AND (LV_STR).
ENDIF.
IF sy-subrc = 0.
ls_return-type = 'E'.
ls_return-id = '00'.
ls_return-number = '001'.
ls_return-message_v1 = '名字与客商'.
ls_return-message_v2 = ls_but000-partner.
ls_return-message_v3 = '一致'.
APPEND ls_return TO et_return.
ENDIF.
ENDMETHOD.