Bapi客户主数据快捷修改
Posted SAP剑客
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Bapi客户主数据快捷修改相关的知识,希望对你有一定的参考价值。
比如需求要更新客户主档的某个字段,其实用函数“SD_CUSTOMER_MAINTAIN_ALL”非常方便,比如输入参数I_KNA1可以更新集团数据,I_KNB1可以更新公司代码数据,I_KNVV可以更新销售视图数据,首先查询,然后针对某个字段进行更新即可。
IF I_HEAD-ZTERM IS NOT INITIAL.
SELECT SINGLE *
FROM KNB1 INTO LS_KNB1
WHERE KUNNR = I_HEAD-KUNNR
AND BUKRS = I_HEAD-KKBER.
LS_KNB1-ZTERM = I_HEAD-ZTERM.
CALL FUNCTION 'SD_CUSTOMER_MAINTAIN_ALL'
EXPORTING
I_KNB1 = LS_KNB1
EXCEPTIONS
CLIENT_ERROR = 1
KNA1_INCOMPLETE = 2
KNB1_INCOMPLETE = 3
KNB5_INCOMPLETE = 4
KNVV_INCOMPLETE = 5
KUNNR_NOT_UNIQUE = 6
SALES_AREA_NOT_UNIQUE = 7
SALES_AREA_NOT_VALID = 8
INSERT_UPDATE_CONFLICT = 9
NUMBER_ASSIGNMENT_ERROR = 10
NUMBER_NOT_IN_RANGE = 11
NUMBER_RANGE_NOT_EXTERN = 12
NUMBER_RANGE_NOT_INTERN = 13
ACCOUNT_GROUP_NOT_VALID = 14
PARNR_INVALID = 15
BANK_ADDRESS_INVALID = 16
TAX_DATA_NOT_VALID = 17
NO_AUTHORITY = 18
COMPANY_CODE_NOT_UNIQUE = 19
DUNNING_DATA_NOT_VALID = 20
KNB1_REFERENCE_INVALID = 21
CAM_ERROR = 22
OTHERS = 23.
IF SY-SUBRC EQ 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
E_SUCC = 'S'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
E_SUCC = 'E'.
ENDIF.
ENDIF.
以上是关于Bapi客户主数据快捷修改的主要内容,如果未能解决你的问题,请参考以下文章