Hi all,
I have create a business partner using the function module BAPI_BUPA_CREATE_FROM_DATA . But i am unable to update the customer data in it. I found few FM's in this regard but could not update the required fields with it. I have tried using :
1) BUPA_CENTRAL_MAINT_PERIOD
2) BUPA_CENTRAL_CI_CHANGE
3) BUPA_CENTRAL_MAINT_FROM
But it could not update the customer fields. I will attach the code i have written.Please suggest me with correct code wherever necessary.
ls_org-NAME1 = 'xxx'.
ls_org-name2 = 'XXX'.
ls_org-name3 = 'XXXXX'.
ls_org-name4 = 'YYYYY'.
ls_central-TITLE_KEY = '0003'.
ls_central-searchterm1 = 'XXX'. " last name
ls_central-searchterm2 = 'yyy'. " first name
ls_central-partnertype = iv_type. " partner type
ls_central-partnerlanguage = sy-langu. " language
ls_central-PARTNERTYPE ='0001'.
ls_central-AUTHORIZATIONGROUP = '0001'.
ls_central-partnerexternal = iv_mitid. " MITID external number
ls_person-firstname = 'xxx'. " first name
ls_person-lastname = 'yyy'. " last name
ls_person-middlename = l_name2. " middle name
ls_person-correspondlanguage = sy-langu. " language
ls_person-fullname = l_full. " full name
ls_address-STREET = 'lane1'.
ls_address-STR_SUPPL1 = 'lane'.
ls_address-STR_SUPPL2 = 'fruitpark'.
ls_address-CITY = 'frankfort'.
ls_address-region = 'NJ'.
ls_address-country = 'US'. " US
ls_address-TIME_ZONE = 'AST'. "US
ls_address-POSTL_COD1 = '94000'.
*ls_address-POSTL_COD2 = '500081'.
*ls_address-POSTL_COD3 = '500081'.
ls_address-langu = sy-langu. " language
ls_address-extaddressnumber = iv_mitid. " language
*append ls_address to lt_address.
ls_email-std_no = gc_true. " default email for person
ls_email-e_mail = 'asi@cc.com'. " default email for person
ls_email-EMAIL_SRCH = 'asi@infy.com'. " other e-mail for search
APPEND ls_email TO lt_email.
*
ls_telephone-TELEPHONE = '9985132452'.
ls_fax-FAX = '124-23455+1234'.
*
append ls_telephone to lt_telephone.
append ls_fax to lt_fax.
CALL FUNCTION 'BAPI_BUPA_CREATE_FROM_DATA'
EXPORTING
BUSINESSPARTNEREXTERN =
PARTNERCATEGORY = '2'
PARTNERGROUP = '0001'
CENTRALDATA = ls_central
*CENTRALDATAPERSON = ls_person
CENTRALDATAORGANIZATION = ls_org
CENTRALDATAGROUP =
ADDRESSDATA = ls_address
DUPLICATE_MESSAGE_TYPE =
ACCEPT_ERROR = ' '
IMPORTING
BUSINESSPARTNER = l_buo
TABLES
TELEFONDATA = lt_telephone
FAXDATA = lt_fax
E_MAILDATA = lt_email
RETURN = it_retu
.
*data :ls_customer type BUPA_CENTR_CUST_EXT,
ls_valid_from type BAPIBUS1006_CENTRAL_VALIDITY-VALID_FROM,
ls_valid_to type BAPIBUS1006_CENTRAL_VALIDITY-VALID_TO.
*
ls_customer-ZZRESELLER = '03'.
ls_customer-ZZACCOUNTTYP = '02'.
ls_customer-ZZCHANNEL = '01'.
ls_customer-ZZSITEID = '123'.
ls_customer-ZZPRIMARY = 'ME'.
*
*
CALL FUNCTION 'BUPA_CENTRAL_MAINT_PERIOD'
EXPORTING
IV_PARTNER = l_buo
IV_PARTNER_GUID =
IV_VALID_FROM = ls_valid_from
IV_VALID_TO = ls_valid_to
IS_DATA =
IS_DATA_PERSON =
IS_DATA_ORGAN =
IS_DATA_GROUP =
IS_CENTRAL_CUSTOMER_EXT = ls_customer
IV_X_SAVE = 'X'
IV_MERGE_PERIODS = ' '
TABLES
ET_RETURN = it_retu
.
*
*
data : lv_guid type BU_PARTNER_GUID.
CALL FUNCTION 'BUPA_NUMBERS_GET'
EXPORTING
IV_PARTNER = l_buo
IV_PARTNER_GUID =
IV_PARTNER_EXTERNAL =
IMPORTING
EV_PARTNER =
EV_PARTNER_GUID = lv_guid
EV_PARTNER_EXTERNAL =
ES_BUT000 =
TABLES
ET_RETURN = it_retu
ET_PARTNER =
.
write : /'partner_guid :', lv_guid.
<b>data : wa_cust_data type BUS000_EEW,
it_return type BUS_BAPIRET2_T.
wa_cust_data-ZZRESELLER = '01'.
wa_cust_data-ZZACCOUNTTYP = '02'.
wa_cust_data-ZZSITEID = 'MDC'.
wa_cust_data-ZZPRIMARY = 'abc'.
append it_retu to it_return.
CALL FUNCTION 'BUPA_CENTRAL_CI_CHANGE'
EXPORTING
IS_BUS000_EEW = wa_cust_data
IS_BUS000_EEW_X =
IV_XSAVE = 'X'
IMPORTING
ET_RETURN = it_return
.</b>
if sy-subrc = 0.
*break-point.
To commit the txn
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
.
write:/ 'Created account', l_buo.
*break-point.
else.
write:/ 'Not able to create'.
endif.
Thanks in Advance,
Shwetha.