1 DATA:lv_partner TYPE bu_partner,
2 lv_credit_sgmnt TYPE ukm_credit_sgmnt.
3 DATA:io_facade TYPE REF TO cl_ukm_facade,
4 io_bupa_factory TYPE REF TO cl_ukm_bupa_factory,
5 io_partner TYPE REF TO cl_ukm_business_partner,
6 io_account TYPE REF TO cl_ukm_account,
7 lw_bp_credit_sgm TYPE ukm_s_bp_cms_sgm.
8 DATA:ltc_return TYPE ukm_t_monitor_return,
9 lsc_return TYPE ukm_s_monitor_return,
10 lv_msg1 TYPE char100.
11
12 LOOP AT gt_data ASSIGNING FIELD-SYMBOL(<fs_data>).
13
14 io_facade = cl_ukm_facade=>create( i_activity = cl_ukm_cnst_eventing=>bp_maintenance ).
15 io_bupa_factory = io_facade->get_bupa_factory( ).
16 lv_partner = <fs_data>-kunnr.
17 lv_credit_sgmnt = '6666'. "信用段
18
19 CALL METHOD io_bupa_factory->get_credit_account
20 EXPORTING
21 i_partner = lv_partner
22 i_credit_sgmnt = lv_credit_sgmnt
23 RECEIVING
24 ro_credit_account = io_account.
25 io_account->get_bp_cms_sgm( IMPORTING es_bp_cms_sgm = lw_bp_credit_sgm ).
26
27 lw_bp_credit_sgm-credit_limit = <fs_data>-credit_limit."信用额度
28 io_account->set_bp_cms_sgm( EXPORTING is_bp_cms_sgm = lw_bp_credit_sgm ).
29 CLEAR: lv_msg1.
30 io_bupa_factory->save_all( EXPORTING i_upd_task = abap_false RECEIVING et_return = ltc_return ).
31
32 LOOP AT ltc_return INTO lsc_return WHERE msgty = 'E' OR msgty = 'A'.
33 CONCATENATE lv_msg1 lsc_return-message INTO lv_msg1.
34 ENDLOOP.
35
36 IF lv_msg1 IS INITIAL.
37 CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
38 EXPORTING
39 wait = abap_true.
40 ELSE.
41 CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK' .
42 ENDIF.
43
44 ENDLOOP .