CRM BP函数

CRM BP函数
REPORT ZCRM_BP_TEST.
"""""""""""""""""""""""""""""""""""""CREATE BP***********************************
DATA:GW_HEAD    TYPE BAPIBUS1006_HEAD,
     GW_DATA    TYPE BAPIBUS1006_CENTRAL,
     GW_PERSON  TYPE BAPIBUS1006_CENTRAL_PERSON,
     GW_ORGAN   TYPE BAPIBUS1006_CENTRAL_ORGAN,
     GW_GROUP   TYPE BAPIBUS1006_CENTRAL_GROUP,
     GW_ADDR    TYPE BAPIBUS1006_ADDRESS,
     GT_ADTEL   TYPE TABLE OF BAPIADTEL,
     GW_ADTEL   LIKE LINE OF GT_ADTEL,
     GT_ADSMTP  TYPE TABLE OF BAPIADSMTP,
     GW_ADSMTP  LIKE LINE OF GT_ADSMTP,
     GT_RETURN  TYPE TABLE OF BAPIRET2,
     GW_RETURN  LIKE LINE OF GT_RETURN,
     GV_PARTNER TYPE BU_PARTNER.

"person
GW_HEAD-PARTN_CAT = '1'.
GW_HEAD-PARTN_GRP = 'Z021'.

GW_PERSON-FIRSTNAME = 'FIRSTNAME'.
GW_PERSON-LASTNAME = 'LASTNAME'.
GW_PERSON-SEX = '1'." ''Unknown,1    Female,2 Male

GW_ADDR-STANDARDADDRESS = 'X'.
GW_ADDR-CITY = '滁州'.
GW_ADDR-DISTRICT = '定远'.
GW_ADDR-POSTL_COD1 = '233208'.
GW_ADDR-STREET = '严桥'.
GW_ADDR-STR_SUPPL1 = '官东'.
GW_ADDR-COUNTRY = 'CN'.
GW_ADDR-REGION = '110'.

GW_ADTEL-COUNTRY = 'CN'.
GW_ADTEL-STD_NO = 'X'.
GW_ADTEL-TELEPHONE = '18851442265'.
GW_ADTEL-R_3_USER = '3'."1 Landline Telephones,3 Mobile Telephone
APPEND GW_ADTEL TO GT_ADTEL.
GW_ADTEL-COUNTRY = 'CN'.
GW_ADTEL-STD_NO = 'X'.
GW_ADTEL-TELEPHONE = '4977243'.
GW_ADTEL-EXTENSION = '0550'.
GW_ADTEL-R_3_USER = '1'."1 Landline Telephones,3 Mobile Telephone
APPEND GW_ADTEL TO GT_ADTEL.

GW_ADSMTP-STD_NO = 'X'.
GW_ADSMTP-E_MAIL = 'WWWLIYUANANHUI@126.COM'.
APPEND GW_ADSMTP TO GT_ADSMTP.

"创建BP
*CALL FUNCTION 'BUPA_CREATE_FROM_DATA'
*  EXPORTING
**   IV_PARTNER     =
**   IV_PARTNER_GUID                      =
*    IV_CATEGORY    = GW_HEAD-PARTN_CAT "BU_TYPE 1 = Person,2 = Organization ,3= Group
*    IV_GROUP       = GW_HEAD-PARTN_GRP
*    IS_DATA        = GW_DATA
*    IS_DATA_PERSON = GW_PERSON
**   IS_DATA_ORGAN  =
**   IS_DATA_GROUP  =
*    IS_ADDRESS     = GW_ADDR
**   IV_TESTRUN     = ' '
**   IV_DUPLICATE_MESSAGE_TYPE            =
**   IV_ACCEPT_ERROR                      = ' '
**   IV_X_SAVE      = 'X'
**   IV_CONSIDER_CONSNUMBER_FOR_INS       = ' '
**   IV_CHECK_ADDRESS                     = 'X'
*  IMPORTING
*    EV_PARTNER     = GV_PARTNER
**   EV_PARTNER_GUID                      =
**   EV_ADDRNUMBER  =
**   EV_ADDRGUID    =
*  TABLES
*    IT_ADTEL       = GT_ADTEL
**   IT_ADFAX       =
**   IT_ADTTX       =
**   IT_ADTLX       =
*    IT_ADSMTP      = GT_ADSMTP
**   IT_ADRML       =
**   IT_ADX400      =
**   IT_ADRFC       =
**   IT_ADPRT       =
**   IT_ADSSF       =
**   IT_ADURI       =
**   IT_ADPAG       =
**   IT_ADREM       =
**   IT_ADCOMREM    =
**   IT_ADCOMUSE    =
**   IT_ADTEL_ADDR_IND                    =
**   IT_ADFAX_ADDR_IND                    =
**   IT_ADTTX_ADDR_IND                    =
**   IT_ADTLX_ADDR_IND                    =
**   IT_ADSMTP_ADDR_IND                   =
**   IT_ADRML_ADDR_IND                    =
**   IT_ADX400_ADDR_IND                   =
**   IT_ADRFC_ADDR_IND                    =
**   IT_ADPRT_ADDR_IND                    =
**   IT_ADSSF_ADDR_IND                    =
**   IT_ADURI_ADDR_IND                    =
**   IT_ADPAG_ADDR_IND                    =
**   IT_ADCOMREM_ADDR_IND                 =
**   IT_ADCOMUSE_ADDR_IND                 =
*    ET_RETURN      = GT_RETURN
**   ET_ADDR_DUPLICATES                   =
*  .
*READ TABLE GT_RETURN INTO GW_RETURN WITH KEY TYPE = 'E'.
*IF SY-SUBRC = 0.
*  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
*  WRITE GW_RETURN-MESSAGE.
*ELSE.
*  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*    EXPORTING
*      WAIT = 'X'.
*  WRITE GV_PARTNER.
*ENDIF.
"***************************ASSIGN ROLE TO BP
REFRESH:GT_RETURN.
GV_PARTNER = '0150001213'.
*CALL FUNCTION 'BUPA_ROLE_ADD_2'
*  EXPORTING
*    IV_PARTNER     = GV_PARTNER
**   IV_PARTNER_GUID       =
**   IV_PARTNERROLECATEGORY       =
**   IV_X_ALL_PARTNERROLES =
*    IV_PARTNERROLE = 'CRM000'
**   IV_DIFFTYPEVALUE      =
**   IV_VALIDFROM   =
**   IV_VALIDTO     = '99991231'
**   IV_X_SAVE      = 'X'
**   IV_CREATE_CP   =
*  TABLES
*    ET_RETURN      = GT_RETURN.
*READ TABLE GT_RETURN INTO GW_RETURN WITH KEY TYPE = 'E'.
*IF SY-SUBRC = 0.
*  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
*  WRITE GW_RETURN-MESSAGE.
*ELSE.
*  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*    EXPORTING
*      WAIT = 'X'.
*  WRITE GV_PARTNER.
*ENDIF.
"""""""""""""""""""""""""""""""ADD ID
*DATA:GW_IDENTIFICATION  TYPE BAPIBUS1006_IDENTIFICATION.
*GW_IDENTIFICATION-IDINSTITUTE = '定远县*局'.
*GW_IDENTIFICATION-IDENTRYDATE = '20160101'.
*GW_IDENTIFICATION-IDVALIDFROMDATE = '20160101'.
*GW_IDENTIFICATION-IDVALIDTODATE = '20260101'.
*GW_IDENTIFICATION-COUNTRY = 'CN'.
*GW_IDENTIFICATION-REGION = '110'.
*CALL FUNCTION 'BUPA_IDENTIFICATION_ADD'
*  EXPORTING
*    IV_PARTNER              = GV_PARTNER
**   IV_PARTNER_GUID         =
**   IV_IDENTIFICATIONCATEGORY = 'FS0001' "ID
*    IV_IDENTIFICATIONNUMBER = '3411251991XXXXXXXX'
*    IS_IDENTIFICATION       = GW_IDENTIFICATION
**   IV_X_SAVE               = 'X'
*    IV_IDENTIFICATIONTYPE   = 'FS0001'
*  TABLES
*    ET_RETURN               = GT_RETURN.
*READ TABLE GT_RETURN INTO GW_RETURN WITH KEY TYPE = 'E'.
*IF SY-SUBRC = 0.
*  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
*  WRITE GW_RETURN-MESSAGE.
*ELSE.
*  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*    EXPORTING
*      WAIT = 'X'.
*  WRITE GV_PARTNER.
*ENDIF.

DATA:GT_DAT   TYPE TABLE OF BUS_TB071_KEY,
     GW_DAT   LIKE LINE OF GT_DAT,
     GV_GUID  TYPE BU_PARTNER_GUID,
     GV_ERROR TYPE CHAR01.
SELECT SINGLE PARTNER_GUID INTO GV_GUID FROM BUT000 WHERE PARTNER = GV_PARTNER.
GW_DAT-TAX_CTY = 'CN'.
*GW_DAT-TAX_REG = '110'.
GW_DAT-TAX_TYPE = 'MWST'.
GW_DAT-TAX_GROUP = 'FULL'.
APPEND GW_DAT TO GT_DAT.
CALL FUNCTION 'BUTX_FRG0010_CREATE'
  EXPORTING
    IV_PARTNER_GUID = GV_GUID
*   IV_X_SAVE       = 'X'
  IMPORTING
    ET_RETURN       = GT_RETURN
    EV_ERROR        = GV_ERROR
  TABLES
    IT_DATA         = GT_DAT.
READ TABLE GT_RETURN INTO GW_RETURN WITH KEY TYPE = 'E'.
IF SY-SUBRC = 0.
  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
  WRITE GW_RETURN-MESSAGE.
ELSE.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      WAIT = 'X'.
  WRITE GV_PARTNER.
ENDIF.
View Code

修改地址相关信息:

<style></style>

BAPI_BUPA_ADDRESS_CHANGE

BUBA_4包

上一篇:centos和windows添加路由命令记录


下一篇:2019.3.12