Chinaunix首页 | 论坛 | 博客
  • 博客访问: 596395
  • 博文数量: 154
  • 博客积分: 10208
  • 博客等级: 上将
  • 技术积分: 2225
  • 用 户 组: 普通用户
  • 注册时间: 2007-11-16 14:02
文章分类

全部博文(154)

文章存档

2012年(4)

2011年(44)

2010年(50)

2009年(4)

2008年(52)

我的朋友

分类:

2011-03-21 13:27:36

*&---------------------------------------------------------------------*
*&      Form  FRM_GET_CASHFLOW
*&---------------------------------------------------------------------*
*       text:抓取贷款合同的现金流

*       贷款合同计划还款明细
*----------------------------------------------------------------------*
FORM frm_get_cashflow .

  DATA:lt_vzzbepp LIKE gt_vzzbepp,
       lt_vzzkopo LIKE gt_vzzkopo,
       lwa_loan LIKE LINE OF gt_loan,
       lwa_tzpa LIKE LINE OF gt_tzpa,
       lwa_tzpab LIKE LINE OF gt_tzpab,
       lwa_vzzkoko LIKE LINE OF gt_vzzkoko,
       lwa_vzzkopo LIKE LINE OF gt_vzzkopo.
  DATA:lt_vvzzkopo TYPE STANDARD TABLE OF vvzzkopo.
  DATA:lv_disb_amt TYPE rloam-bavwr.

  CLEAR:gt_vzzbepp.
  SORT:gt_vzzkoko BY bukrs sanlf rkey1,
       gt_tzpa BY gsart,
       gt_tzpab BY bukrs gsart.
  LOOP AT gt_loan INTO lwa_loan.
    CLEAR:lt_vzzkopo,lt_vvzzkopo,
          lt_vzzbepp,lv_disb_amt.
    lv_disb_amt = lwa_loan-bzusage.
    READ TABLE gt_vzzkoko INTO lwa_vzzkoko
      WITH KEY bukrs = lwa_loan-bukrs
               sanlf = lwa_loan-sanlf
               rkey1 = lwa_loan-ranl
      BINARY SEARCH.
    IF sy-subrc = 0.
      LOOP AT gt_vzzkopo INTO lwa_vzzkopo
        WHERE bukrs = lwa_vzzkoko-bukrs
          AND sanlf = lwa_vzzkoko-sanlf
          AND rkey1 = lwa_vzzkoko-rkey1
          AND dguel_kk = lwa_vzzkoko-dguel_kk
          AND nlfd_ang = lwa_vzzkoko-nlfd_ang.
        APPEND lwa_vzzkopo TO lt_vzzkopo.
      ENDLOOP.
      CALL FUNCTION 'VZZKOPO_TO_VVZZKOPO'
        TABLES
          ivzzkopo  = lt_vzzkopo
          evvzzkopo = lt_vvzzkopo.
      READ TABLE gt_tzpa INTO lwa_tzpa
        WITH KEY gsart = lwa_loan-gsart
        BINARY SEARCH.
      IF sy-subrc = 0.
        READ TABLE gt_tzpab INTO lwa_tzpab
          WITH KEY bukrs = lwa_loan-bukrs
                   gsart = lwa_loan-gsart
          BINARY SEARCH.
        IF sy-subrc = 0.
*         取已发放贷款的支出(本金,标识='I')
          CALL FUNCTION 'LOAN_FLOWS_SUPPLY'
            EXPORTING
              i_bukrs                  = lwa_loan-bukrs
              i_ranl                   = lwa_loan-ranl
              no_storno                = 'X'
            TABLES
              o_vzzbepp                = lt_vzzbepp
            EXCEPTIONS
              ranl_not_found           = 1
              i_dvalut_until_too_early = 2
              OTHERS                   = 3.
*         取未发放贷款的模拟支出(本金,标识='S')
*          CALL FUNCTION 'DISBURSEMENT_SIMULATE'
*            EXPORTING
*              i_tzpa                = lwa_tzpa
*              i_tzpab               = lwa_tzpab
*              i_datefrom            = lwa_vzzkoko-dguel_kk
*              i_bdisburse           = lv_disb_amt
*              i_currency            = lwa_loan-santwhr
*              i_bukrs               = lwa_loan-bukrs
*              i_gsart               = lwa_loan-gsart
*            TABLES
*              e_bepp                = lt_vzzbepp
*            EXCEPTIONS
*              sbewart_1_2_not_found = 1
*              sbewziti_not_found    = 2
*              OTHERS                = 3.
          IF sy-subrc = 0.
*           取现金流(计划、本金)
            CALL FUNCTION 'CASH_FLOW_CONSTRUCT_LOAN'
              EXPORTING
                i_koko                         = lwa_vzzkoko
                i_saktpas                      = ' '
                i_ssolist                      = lwa_loan-ssolist
                i_vdarl                        = lwa_loan
              TABLES
                i_bepp                         = lt_vzzbepp
                i_kopo                         = lt_vvzzkopo
              EXCEPTIONS
                keine_tilgungskonditionen      = 01
                laufzeitende_fehlt             = 02
                laufzeitende_nicht_ermittelbar = 03
                laufzeit_oder_rate_fehlt       = 04
                negative_tilgung_aufgetreten   = 05.
            IF sy-subrc = 0.
              APPEND LINES OF lt_vzzbepp TO gt_vzzbepp.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDLOOP.

ENDFORM.                    " FRM_GET_CASHFLOW

阅读(1955) | 评论(0) | 转发(0) |
0

上一篇:submit使用

下一篇:贷款机构BAPI导入

给主人留下些什么吧!~~