*数据类型相关定义
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.
相关文章
- 01-12Scrapy框架的使用、环境的安装、创建工程、scrapy的数据解析、scrapy的持久化存储、执行流程、
- 01-12[Hive]使用HDFS文件夹数据创建Hive表分区
- 01-12使用 csv 导入的方式在 SAP S/4HANA 里创建 employee 数据
- 01-12rest_framework django 简单使用(数据库创建数据, 覆盖数据, 其他的大同小异)
- 01-12使用TreeView树型菜单栏(递归调用数据库自动创建菜单)
- 01-12EF使用CodeFirst创建数据库和表
- 01-12如何强制python使用dumbdbm模块创建新数据库?
- 01-12物料主数据屏幕字段增强(使用增强及自定义表实现方式)
- 01-12SAP PP使用ECR去修改Recipe主数据,报错:Generation not supported for change object
- 01-12Marketing Cloud的Contact主数据创建