使用BAPI_BUPA_CREATE_FROM_DATA创建BP主数据
2021/5/21 10:25:25
本文主要是介绍使用BAPI_BUPA_CREATE_FROM_DATA创建BP主数据,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
*数据类型相关定义
DATA:
LV_PARTNERGROUP TYPE BAPIBUS1006_HEAD-PARTN_GRP, "分组
LS_CENTRALDATA TYPE BAPIBUS1006_CENTRAL, "搜索词
LS_CENTRALDATAORGANIZATION TYPE BAPIBUS1006_CENTRAL_ORGAN, "名称信息
LS_ADDRESSDATA TYPE BAPIBUS1006_ADDRESS. "地址
DATA:
LT_TELEFONDATA TYPE STANDARD TABLE OF BAPIADTEL, "电话号码,移动电话
LS_TELEFONDATA TYPE BAPIADTEL,
LT_FAXDATA TYPE STANDARD TABLE OF BAPIADFAX, "传真2
LS_FAXDATA TYPE BAPIADFAX,
LT_E_MAILDATA TYPE STANDARD TABLE OF BAPIADSMTP, "电子邮件地址2
LS_E_MAILDATA TYPE BAPIADSMTP,
LT_RETURN TYPE STANDARD TABLE OF BAPIRET2, "返回信息
LS_RETURN TYPE BAPIRET2.
*&--分组
"分组
LV_PARTNERGROUP = IS_KNA1-BPGROUP.
*&--搜索词
"搜索项1
LS_CENTRALDATA-SEARCHTERM1 = IS_KNA1-SORT1.
"搜索项2
LS_CENTRALDATA-SEARCHTERM2 = IS_KNA1-SORT2.
"称谓
LS_CENTRALDATA-TITLE_KEY = IS_KNA1-TITLE.
*&--名称信息
"名称1
LS_CENTRALDATAORGANIZATION-NAME1 = IS_KNA1-NAME.
"名称2
LS_CENTRALDATAORGANIZATION-NAME2 = IS_KNA1-NAME1.
"名称3
LS_CENTRALDATAORGANIZATION-NAME3 = IS_KNA1-NAME2.
*&--标准地址
" 邮政编码
LS_ADDRESSDATA-POSTL_COD1 = IS_KNA1-POST_CODE1.
" 城市
LS_ADDRESSDATA-CITY = IS_KNA1-CITY1.
" 国家
LS_ADDRESSDATA-COUNTRY = IS_KNA1-COUNTRY.
" 省份/地区
LS_ADDRESSDATA-REGION = IS_KNA1-REGION.
" 街道1
LS_ADDRESSDATA-STREET = IS_KNA1-STREET.
"语言代码
LS_ADDRESSDATA-LANGU = IS_KNA1-SPRAS.
*&--通信
"电话号码
LS_TELEFONDATA-COUNTRY = IS_KNA1-COUNTRY.
LS_TELEFONDATA-STD_NO = 'X'.
LS_TELEFONDATA-HOME_FLAG = 'X'.
LS_TELEFONDATA-R_3_USER = '1'.
LS_TELEFONDATA-TELEPHONE = IS_KNA1-TEL_NUMBER.
APPEND LS_TELEFONDATA TO LT_TELEFONDATA.
"移动电话
LS_TELEFONDATA-COUNTRY = IS_KNA1-COUNTRY.
LS_TELEFONDATA-R_3_USER = '3'.
LS_TELEFONDATA-TELEPHONE = IS_KNA1-MOB_NUMBER.
APPEND LS_TELEFONDATA TO LT_TELEFONDATA.
"传真
LS_FAXDATA-FAX = IS_KNA1-FAX_NUMBER.
APPEND LS_FAXDATA TO LT_FAXDATA.
"电子邮件地址
LS_E_MAILDATA-E_MAIL = IS_KNA1-SMTP_ADDR.
APPEND LS_E_MAILDATA TO LT_E_MAILDATA.
*创建BP基本数据
CALL FUNCTION 'BAPI_BUPA_CREATE_FROM_DATA'
EXPORTING
BUSINESSPARTNEREXTERN = E_PARTNER
PARTNERCATEGORY = '2' "02:组织
PARTNERGROUP = LV_PARTNERGROUP
CENTRALDATA = LS_CENTRALDATA
CENTRALDATAORGANIZATION = LS_CENTRALDATAORGANIZATION
ADDRESSDATA = LS_ADDRESSDATA
IMPORTING
BUSINESSPARTNER = E_PARTNER
TABLES
TELEFONDATA = LT_TELEFONDATA
FAXDATA = LT_FAXDATA
E_MAILDATA = LT_E_MAILDATA
RETURN = LT_RETURN.
CLEAR LS_RETURN.
LOOP AT LT_RETURN INTO LS_RETURN WHERE TYPE = 'E' OR TYPE = 'A'.
EXIT.
ENDLOOP.
IF SY-SUBRC = 0.
EV_MSGTYP = 'E'.
EV_MSGTXT = TEXT-E43 && LS_RETURN-MESSAGE.
SAVE_PARA_DATA : '0' "0 : Inbound 1: outbound
EV_MSGTYP "'S'
EV_MSGTXT "'发送数据到ESB(SAP->ESB)'
''
'' "Batch
IS_KNA1-NAME "凭证号码
''.
EXIT.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
RETURN.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ENDIF.
这篇关于使用BAPI_BUPA_CREATE_FROM_DATA创建BP主数据的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-23增量更新怎么做?-icode9专业技术文章分享
- 2024-11-23压缩包加密方案有哪些?-icode9专业技术文章分享
- 2024-11-23用shell怎么写一个开机时自动同步远程仓库的代码?-icode9专业技术文章分享
- 2024-11-23webman可以同步自己的仓库吗?-icode9专业技术文章分享
- 2024-11-23在 Webman 中怎么判断是否有某命令进程正在运行?-icode9专业技术文章分享
- 2024-11-23如何重置new Swiper?-icode9专业技术文章分享
- 2024-11-23oss直传有什么好处?-icode9专业技术文章分享
- 2024-11-23如何将oss直传封装成一个组件在其他页面调用时都可以使用?-icode9专业技术文章分享
- 2024-11-23怎么使用laravel 11在代码里获取路由列表?-icode9专业技术文章分享
- 2024-11-22怎么实现ansible playbook 备份代码中命名包含时间戳功能?-icode9专业技术文章分享