FUNCTION zfmsd_credit_to_bi. *"---------------------------------------------------------------------- *"*"本地接口: *" EXPORTING *" VALUE(EV_TYPE) TYPE BAPI_MTYP *" VALUE(EV_MSG) TYPE BAPI_MSG *" TABLES *" IT_IN STRUCTURE ZSSD0047 *" ET_DATA STRUCTURE ZSSD0048 *"---------------------------------------------------------------------- DATA:lt_ukm_totals TYPE TABLE OF ukm_totals, ls_ukm_totals LIKE LINE OF lt_ukm_totals. IF it_in[] IS INITIAL. ev_type = 'E'. ev_msg = '信用段与客户必填'. ENDIF. IF it_in[] IS NOT INITIAL. "助记码 SELECT partner, bu_sort1 FROM but000 FOR ALL ENTRIES IN @it_in[] WHERE partner = @it_in-kunnr INTO TABLE @DATA(lt_but000). SORT lt_but000 BY partner. "客户名称 SELECT kunnr, name1, name2 FROM kna1 FOR ALL ENTRIES IN @it_in[] WHERE kunnr = @it_in-kunnr INTO TABLE @DATA(lt_kna1). SORT lt_kna1 BY kunnr. "应收单未审批金额 SELECT credit_sgmnt,partner,zysdamount FROM ztsd0027 FOR ALL ENTRIES IN @it_in[] WHERE credit_sgmnt = @it_in-credit_sgmnt AND partner = @it_in-kunnr INTO TABLE @DATA(lt_ztsd0027). SORT lt_ztsd0027 BY credit_sgmnt partner. ENDIF. LOOP AT it_in[] ASSIGNING FIELD-SYMBOL(<fs_in>). et_data-kunnr = <fs_in>-kunnr. et_data-credit_sgmnt = <fs_in>-credit_sgmnt. "助记码 READ TABLE lt_but000 INTO DATA(ls_but000) WITH KEY partner = <fs_in>-kunnr BINARY SEARCH. IF sy-subrc EQ 0. et_data-sort1 = ls_but000-bu_sort1. ENDIF. "客户名称 READ TABLE lt_kna1 INTO DATA(ls_kna1) WITH KEY kunnr = <fs_in>-kunnr BINARY SEARCH. IF sy-subrc EQ 0. et_data-name1 = ls_kna1-name1 && ls_kna1-name2. ENDIF. CALL FUNCTION 'UKM_COMMTS_READ' EXPORTING i_partner = <fs_in>-kunnr i_segment = <fs_in>-credit_sgmnt TABLES et_ukm_totals = lt_ukm_totals. LOOP AT lt_ukm_totals INTO ls_ukm_totals WHERE partner = <fs_in>-kunnr AND credit_sgmnt = <fs_in>-credit_sgmnt. "信贷风险类别 et_data-comm_typ = ls_ukm_totals-comm_typ. "信贷风险类别描述 SELECT SINGLE comm_typ_txt FROM ukmcomm_typest INTO et_data-comm_typ_txt WHERE comm_typ = et_data-comm_typ AND langu = sy-langu. "信用敞口金额 IF et_data-comm_typ = '500'. "公司的期初上线方案导致重复信贷数据,重复信贷数据扣除的表是ZTSD0027,而在前台重复信贷金额会记录在500计费凭证值中 "传给外围时需要扣除 READ TABLE lt_ztsd0027 INTO DATA(ls_ztsd0027) WITH KEY credit_sgmnt = <fs_in>-credit_sgmnt partner = <fs_in>-kunnr BINARY SEARCH. IF sy-subrc EQ 0. et_data-amount = ls_ukm_totals-amount - ls_ztsd0027-zysdamount. ELSE. et_data-amount = ls_ukm_totals-amount. ENDIF. ELSE. et_data-amount = ls_ukm_totals-amount. ENDIF. APPEND et_data TO et_data[]. CLEAR:ls_ukm_totals. ENDLOOP. IF sy-subrc NE 0. APPEND et_data TO et_data[]. ENDIF. CLEAR:lt_ukm_totals,ls_but000,ls_kna1,et_data. ENDLOOP. ENDFUNCTION.
函数:UKM_COMMTS_READ
标签:额度,查询,lt,客户,ls,et,totals,data,kunnr From: https://www.cnblogs.com/ap-ad-java-abap/p/18357441