以下为公司通讯地址和独立通讯地址的创建和修改。
公司通讯地址
LOOP AT ps_bp_master-address INTO ls_addr WHERE adr_kind EQ 'XXDEFAULT' .
"获取标准地址进行修改
SELECT SINGLE b~address_guid
INTO @DATA(lv_address_guid)
FROM but021_fs AS a
INNER JOIN but020 AS b ON a~addrnumber = b~addrnumber
WHERE a~partner = @ps_bp_master-partner
AND a~adr_kind = @ls_addr-adr_kind.
IF sy-subrc = 0.
cl_uuid_factory=>create_system_uuid( )->convert_uuid_x16( EXPORTING uuid = lv_address_guid
IMPORTING uuid_c32 = ls_addresses-data_key-guid ).
ls_addresses-task = 'U'.
ELSE.
CLEAR ls_addresses-data_key-guid.
ls_addresses-task = 'I'.
ENDIF.
IF ls_addr-adr_kind EQ 'XXDEFAULT'.
ls_addresses-data-postal-data-standardaddress = 'X'. "标准地址
ls_addresses-data-postal-datax-standardaddress = abap_true.
ENDIF.
ls_addr-city1 = |{ ls_addr-city1 ALPHA = IN }|.
ls_addr-city2 = |{ ls_addr-city2 ALPHA = IN }|.
ls_addresses-data-postal-data-langu = ps_bp_master-langu. "语言代码
ls_addresses-data-postal-data-street = ls_addr-street. "街道
DATA(lv_len) = strlen( ls_addr-street ).
IF lv_len GT 60 AND lv_len LE 100.
ls_addresses-data-postal-data-str_suppl1 = ls_addr-street+60(40). "街道2
ELSEIF lv_len GT 100.
ls_addresses-data-postal-data-str_suppl1 = ls_addr-street+60(40). "街道2
ls_addresses-data-postal-data-str_suppl2 = ls_addr-street+100(40). "街道3
ls_addresses-data-postal-data-str_suppl3 = ls_addr-street+140(40). "街道3
ls_addresses-data-postal-data-location = ls_addr-street+180(40). "街道3
ENDIF.
ls_addresses-data-postal-data-city = ls_addr-city1. "街道
ls_addresses-data-postal-data-district = ls_addr-city2. "区域
ls_addresses-data-postal-data-country = ls_addr-country. "国家
ls_addresses-data-postal-data-region = ls_addr-region. "地区
IF ls_addresses-data-postal-data-country EQ 'BR'.
ls_addresses-data-postal-data-taxjurcode = ls_addresses-data-postal-data-region."税务管辖权
ls_addresses-data-postal-datax-taxjurcode = abap_true.
ENDIF.
* LS_ADDRESSES-DATA-POSTAL-DATA-C_O_NAME = LS_ADDR-URI_ADDR. "联系人
ls_addresses-data-postal-data-c_o_name = ls_addr-name_co. "联系人
ls_addresses-data-postal-data-postl_cod1 = ls_addr-post_cod1. "邮政编码
ls_addresses-data-postal-datax-langu = abap_true.
ls_addresses-data-postal-datax-street = abap_true.
ls_addresses-data-postal-datax-str_suppl1 = abap_true.
ls_addresses-data-postal-datax-str_suppl2 = abap_true.
ls_addresses-data-postal-datax-str_suppl3 = abap_true.
ls_addresses-data-postal-datax-location = abap_true.
ls_addresses-data-postal-datax-city = abap_true.
ls_addresses-data-postal-datax-district = abap_true.
ls_addresses-data-postal-datax-country = abap_true.
ls_addresses-data-postal-datax-c_o_name = abap_true. "联系人
* LS_ADDRESSES-DATA-POSTAL-DATAX-LANGU = ABAP_TRUE.
* LS_ADDRESSES-DATA-POSTAL-DATAX-PBOXCIT_NO = ABAP_TRUE. "邮箱
ls_addresses-data-postal-datax-region = abap_true. "地区
ls_addresses-data-postal-datax-postl_cod1 = abap_true. "邮政编码
* LS_ADDRESSES-DATA-POSTAL-DATAX-DISTRICT = ABAP_TRUE.
"地址类型
CLEAR lt_addr_usages.
IF ls_addr-adr_kind NE 'XXDEFAULT'.
ls_addr_usages-data_key-addresstype = ls_addr-adr_kind.
ls_addr_usages-task = ls_addresses-task.
ls_addr_usages-data-standard = 'X'.
ls_addr_usages-datax-standard = 'X'.
APPEND ls_addr_usages TO lt_addr_usages.
ENDIF.
"电话
CLEAR ls_phone.
ls_phone-contact-task = ls_addresses-task.
ls_phone-contact-data-telephone = ls_addr-tel_number. "电话1
ls_phone-contact-data-r_3_user = '1'. "有线电话
ls_phone-contact-datax-telephone = abap_true.
ls_phone-contact-data-errorflag = 'X'.
ls_phone-contact-datax-updateflag = 'M'.
ls_phone-contact-datax-r_3_user = abap_true.
APPEND ls_phone TO lt_phone.
"手机
CLEAR ls_phone.
ls_phone-contact-task = ls_addresses-task.
ls_phone-contact-data-telephone = ls_addr-mobile_number. "电话1
ls_phone-contact-data-r_3_user = '2'. "移动电话
ls_phone-contact-datax-telephone = abap_true.
ls_phone-contact-data-errorflag = 'X'.
ls_phone-contact-datax-updateflag = 'M'.
ls_phone-contact-datax-r_3_user = abap_true.
*
APPEND ls_phone TO lt_phone.
* "传真
* CLEAR LT_FAX.
* LS_FAX-CONTACT-TASK = 'I'.
* LS_FAX-CONTACT-DATA-FAX = LS_ADDR-TEL_NUMBER. "传真
* LS_FAX-CONTACT-DATAX-FAX = ABAP_TRUE.
* APPEND LS_FAX TO LT_FAX.
"电子邮件
CLEAR ls_smtp.
ls_smtp-contact-task = ls_addresses-task.
ls_smtp-contact-data-e_mail = ls_addr-smtp_addr. "E_MAIL
ls_smtp-contact-datax-e_mail = abap_true.
ls_smtp-contact-data-errorflag = 'X'.
ls_smtp-contact-datax-updateflag = 'M'.
APPEND ls_smtp TO lt_smtp.
* LS_ADDRESSES-DATA-COMMUNICATION-FAX-CURRENT_STATE = 'X'.
* LS_ADDRESSES-DATA-COMMUNICATION-FAX-FAX = LT_FAX.
ENDLOOP.
独立通讯地址:
LOOP AT ps_bp_master-address INTO ls_addr WHERE adr_kind EQ 'COM'.
"电话
CLEAR ls_phone .
CLEAR ls_smtp .
CLEAR ls_remark.
ls_phone-contact-data-country = ls_addr-country.
ls_phone-contact-task = 'I'.
ls_phone-contact-data-telephone = ls_addr-tel_number. "电话1
ls_phone-contact-data-r_3_user = '1'. "有线电话
ls_phone-contact-datax-country = abap_true.
ls_phone-contact-datax-updateflag = 'I'.
ls_phone-contact-data-consnumber = sy-tabix.
ls_phone-contact-datax-consnumber = abap_true.
ls_phone-contact-datax-telephone = abap_true.
ls_phone-contact-datax-r_3_user = abap_true.
ls_smtp-contact-task = 'I'.
ls_smtp-contact-data-e_mail = ls_addr-smtp_addr. "
ls_smtp-contact-data-r_3_user = '1'. "
ls_smtp-contact-datax-updateflag = 'I'.
ls_smtp-contact-data-consnumber = sy-tabix.
ls_smtp-contact-datax-consnumber = abap_true.
ls_smtp-contact-datax-e_mail = abap_true.
ls_smtp-contact-datax-r_3_user = abap_true.
ls_remark-task = 'I'.
ls_remark-data-langu = sy-langu.
ls_remark-datax-langu = abap_true.
ls_remark-data-comm_notes = ls_addr-name_co.
ls_remark-datax-comm_notes = abap_true.
APPEND ls_remark TO ls_phone-remark-remarks.
APPEND ls_remark TO ls_smtp-remark-remarks.
ls_smtp-remark-current_state = abap_true.
APPEND ls_phone TO lt_phone.
APPEND ls_smtp TO lt_smtp.
ENDLOOP.
ls_partner-central_data-communication-phone-current_state = abap_true.
ls_partner-central_data-communication-phone-phone = lt_phone.
ls_partner-central_data-communication-smtp-smtp = lt_smtp.
ls_partner-central_data-communication-smtp-current_state = abap_true.
current_state 用来确保覆盖,每次都是最新。
以下为CMS信贷视图的创建和修改。
lv_credit_sgmnt = ls_cms-segment."信用段
lwa_ukm_s_bp_cms-risk_class = ls_cms-risk_class."风险类
lwa_ukm_s_bp_cms-check_rule = ls_cms-check_rule."检查规则
IF lwa_ukm_s_bp_cms-check_rule IS INITIAL.
lwa_ukm_s_bp_cms-check_rule = 'ZALNY' . "信用检查的规则
ENDIF.
lwa_ukm_s_bp_cms-limit_rule = ls_cms-limit_rule."规则
io_partner->set_bp_cms( lwa_ukm_s_bp_cms ).
CALL METHOD io_bupa_factory->get_credit_account
EXPORTING
i_partner = lv_partner
i_credit_sgmnt = lv_credit_sgmnt
RECEIVING
ro_credit_account = io_account.
io_account->get_bp_cms_sgm( IMPORTING es_bp_cms_sgm = lw_bp_credit_sgm ).
lw_bp_credit_sgm-credit_limit = ls_cms-credit_limit."信用额度
lw_bp_credit_sgm-limit_valid_date = ls_cms-limit_valid_date."有效日期
lw_bp_credit_sgm-limit_chg_date = sy-datum."有效日期
lw_bp_credit_sgm-x_limit_zero = 'X'."限额是零 控制定义的限额
io_account->set_bp_cms_sgm( EXPORTING is_bp_cms_sgm = lw_bp_credit_sgm ).
io_bupa_factory->save_all( EXPORTING i_upd_task = abap_true
RECEIVING et_return = lt_return ).
信用段附加数据:
"创建maintain 对象
io_facade = cl_ukm_facade=>create( i_activity = cl_ukm_cnst_eventing=>bp_maintenance ).
io_bupa_factory = io_facade->get_bupa_factory( ).
lv_partner = ls_data-partner.
lv_partner = |{ lv_partner ALPHA = IN }|.
io_partner = io_bupa_factory->get_business_partner( lv_partner ).
io_partner->get_bp_cms( IMPORTING es_bp_cms = lwa_ukm_s_bp_cms ).
io_partner->set_bp_cms( lwa_ukm_s_bp_cms ).
lv_credit_sgmnt = ls_data-credit_sgmnt.
CALL METHOD io_bupa_factory->get_credit_account
EXPORTING
i_partner = lv_partner
i_credit_sgmnt = lv_credit_sgmnt
RECEIVING
ro_credit_account = io_account.
io_account->get_add_infos( EXPORTING i_infocategory = ls_add_info-infocategory
i_select_specified_only = 'X'
RECEIVING rt_add_infos = lt_add_infos ) .
ls_add_info-infocategory = ls_data-infocategory."'30'." sap 信用管理的附加信息类别
ls_add_info-infotype = ls_data-infotype."业务合作伙伴的附加信息类型
ls_add_info-counter = lines( lt_add_infos ) + 1." 一般计数器
ls_add_info-credit_sgmnt = lv_credit_sgmnt." 信用段
ls_add_info-check_relevant = ls_data-check_relevant." 信用检查的相关性
* ls_add_info-inactive_check 信用检查的单个步骤
ls_add_info-amount = ls_data-amount ." 金额
ls_add_info-currency = ls_data-currency ." 货币码
ls_add_info-date_from = ls_data-date_from ."起始日期
ls_add_info-date_to = ls_data-date_to ." 结束日期
* ls_add_info-date_when = ls_data-date_when ."输入在
* date_clear 删除在
ls_add_info-date_follow_up = ls_data-date_follow_up . "重新提交日期
ls_add_info-text = ls_data-text."文本字段
* io_account->get_bp_cms_sgm( IMPORTING es_bp_cms_sgm = lw_bp_credit_sgm ).
**
** lw_bp_credit_sgm-credit_limit = ls_cms-credit_limit."信用额度
** lw_bp_credit_sgm-limit_valid_date = '99991231'."有效日期
** lw_bp_credit_sgm-limit_chg_date = sy-datum."有效日期
** lw_bp_credit_sgm-x_limit_zero = 'X'."限额是零
** lw_bp_credit_sgm-block_reason = '02'."
**
* io_account->set_bp_cms_sgm( EXPORTING is_bp_cms_sgm = lw_bp_credit_sgm ).
io_account->set_add_info( EXPORTING is_add_info = ls_add_info ).
io_bupa_factory->save_all( EXPORTING i_upd_task = abap_true i_with_add_infos = abap_true
RECEIVING et_return = lt_return ).