码迷,mamicode.com
首页 > 其他好文 > 详细

客户信贷管理&临时授信

时间:2015-12-07 11:51:13      阅读:423      评论:0      收藏:0      [点我收藏+]

标签:

信贷额度的组成:假如某客户信用限额1万;开出销售订单时锁定1万;一旦发货1万,销售订单1万限额释放,变成发货锁定限额1万。一旦开票,发货1万限额释放,应收锁定1万限额。清帐成功,应收释放1万。信用限额又回到1万了,如此循环。 
? 未清订单价值:未清订单价值是所有未交货的订单条目的价值;未清订单的价值是基于已确认数量的(已
确认数量乘以信用价格=订单的未清订单价值);因信用检查已经被锁住的订单不包含已确认的数量;
只要锁还在,未清订单价值就不会增加 
? 未清交货价值:未清交货价值是所有尚未出具发票的交货条目的价值;做了交货装载未做交货确认(客
户收货)。 
? 未清出具发票价值:未清出具发票价值是所有尚未传输到会计的出具发票条目的价值 
? 来自特殊总账事务的预收款:如果它们与信用限额相关(例如,付款),则会从特殊承付款转移到总承
付款;系统基于付款者更新价值;

http://wenku.baidu.com/link?url=oPMuwXni1B0tSevcDr_o1EPnS87vmuYSrg-AKhoho6xDIBCgDaAr4LsWyHcdzrxdZir25PAwjSYxmi8EfnA9FinymWcFuaMbs4iTs-iCQ6K

以上部分为标准信贷管理的配置和说明,下面就说说临时信贷的东西,临时信贷不在SAP标准范围了,这是根据业务需要整出来为一些信用超额的用户实行的特殊管理。

一张临时授信表,对应到客户级别,订单级别,信贷范围级别,且每条授信数据都是有有效期。

逻辑说明:在信用检查的出口中计算客户的临时授信等数据,并参与到标准的信用计算中,最终对于结果给出标准的信贷返回值。

程序出口:LVKMPFZ1

***INCLUDE LVKMPFZ1 .
* Subroutines for user credit check 1

*---------------------------------------------------------------------*
*       FORM USER_CREDIT_CHECK1                                       *
*---------------------------------------------------------------------*
*       this routine must be programmed, if user activates credit     *
*       check user 1 in T691f                                         *
*       please regard message numbers V1170, V1171 in Table T100      *
*---------------------------------------------------------------------*
*  -->  UCC1_UPDATE       ‘X‘ means during posting a document         *
*                         ‘ ‘ means during processing items           *
*  -->  UCC1_KKBER        credit control area                         *
*  -->  UCC1_KNKLI        credit customer                             *
*  -->  UCC1_FLG_ORDER    ‘X‘ means document is an order              *
*  -->  UCC1_FLG_DELIVERY ‘X‘ means document is a  delivery note      *
*  <--  UCC1_RC           returncode: 0 means OK, 4 means not OK      *
*---------------------------------------------------------------------*
FORM USER_CREDIT_CHECK1 USING   UCC1_UPDATE
                                UCC1_KKBER
                                UCC1_KNKLI
                                UCC1_FLG_ORDER
                                UCC1_FLG_DELIVERY
                          CHANGING
                                UCC1_RC.
* clear the returncode
  CLEAR UCC1_RC.
* credit check: if not positiv, set returncode
* MOVE CON_RC_NOK TO UCC1_RC.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Form USER_CREDIT_CHECK1, End                                                                                                                      A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1  ZLVKMPFZ1_CHECK.    "active version
DATA: DATE_CREDIT_EXPOSURE TYPE D VALUE 99991231,
      SCC_OPEN_ORDER    LIKE S066-OEIKW,
      SCC_OPEN_DELIVERY LIKE S067-OLIKW,
      SCC_OPEN_INVOICE  LIKE S067-OFAKW,
      SCC_SUM_OPENS     LIKE S067-OFAKW,
      SCC_RC,
      SCC_RC_ALL,
      SCC_RC_WARNING,
      SCC_RC_ERROR,
      SCC_RC_STATUS_SET,
      SCC_UPDATE,
      SCC_KKBER LIKE rlikp-kkbeR,
      SCC_KNKLI LIKE rlikp-knkli,
      SCC_FLG_ORDER,
      SCC_FLG_DELIVERY,
      SCC_CMPSX LIKE    rkvbuk-cmpsa.
*变量赋值将UCC的变量值赋值给SCC
     SCC_KKBER =  UCC1_KKBER.
     SCC_KNKLI =   UCC1_KNKLI.
     SCC_FLG_ORDER = UCC1_FLG_ORDER.
     SCC_FLG_DELIVERY = UCC1_FLG_DELIVERY.
     SCC_UPDATE =  UCC1_UPDATE.

     "*执行标准的静态检查程序
    CLEAR SCC_RC.

  "实时应回款金额
  DATA:LV_DMBTR TYPE DMBTR.
  CLEAR:LV_DMBTR.
  READ TABLE XVBPA INDEX 1.
  IF SY-SUBRC = 0.
    CLEAR:LV_DMBTR.
      CALL FUNCTION ZFM_DYN_DUE_PAY
        EXPORTING
          IM_VBELC       = ‘‘
          IM_VBELA       = XVBPA-VBELN
          IM_ERDAT       = SY-DATUM
        IMPORTING
          EX_DMBTR       = LV_DMBTR.

        IF LV_DMBTR <= 0.
           UCC1_RC = 0.
        ELSE.
           UCC1_RC = 4.
        ENDIF.
  ENDIF.
  "收款单货款金额
  DATA:LV_SHKDJE TYPE DMBTR.
  CLEAR:LV_SHKDJE.
  CALL FUNCTION ZSD_SKD_HKJE
    EXPORTING
      IM_KUNNR       = UCC1_KNKLI
      IM_KKBER       = UCC1_KKBER
*     IM_ZDJLX       =
*     IM_GJAHR       = SY-DATUM+0(4)
    IMPORTING
      EX_ZHKJE       = LV_SHKDJE.

  "获取临时信用额度
  DATA:LV_LSXYED TYPE DMBTR.
  CLEAR:LV_LSXYED.
  CALL FUNCTION ZFM_GET_TEMP_CREDIT
    EXPORTING
*     IM_VBELC        =
      IM_VBELA        = XVBPA-VBELN
      IM_KUNNR        = UCC1_KNKLI
      IM_KKBER        = UCC1_KKBER
      IM_ERDAT        = SY-DATUM
*     IM_ERDAT2       = SY-DATUM
*     IM_CRBLB        =
    IMPORTING
*     EX_ZJLH         =
      EX_LSXYJE       = LV_LSXYED.

* Ermitteln Alterung
  PERFORM CREDIT_MASTER_GET
    USING SCC_KKBER
          SCC_KNKLI
          T691F-ERLTA
          T691F-ERLST
    CHANGING SAV_FI_VEKTOR_AKTUELL KNKK.
* get credit exposure SD
  IF T691F-STVAW EQ TRUE
  OR T691F-STVLW EQ TRUE.
    PERFORM CREDIT_EXPOSURE_GET
      USING SCC_KKBER
            SCC_KNKLI
            DATE_CREDIT_EXPOSURE
            T014
            T691F-STVAW             "open order
            T691F-STVLW             "open delivery
            T691F-STVLW             "open invoice
      CHANGING
            SCC_OPEN_ORDER
            SCC_OPEN_DELIVERY
            SCC_OPEN_INVOICE
            SAV_OPEN_ORDER_SECURE
            SAV_OPEN_DELIVERY_SECURE
            SAV_OPEN_INVOICE_SECURE
            DELTA_SPTAG
            DELTA_SPWOC
            DELTA_SPMON
            DELTA_SPBUP.
  ENDIF.
* gets the delta of current order, that must computed to credit database
  CLEAR: DELTA_OEIKW, DELTA_OLIKW, DELTA_OFAKW.
  IF T691F-STVAW EQ TRUE
  OR T691F-STVLW EQ TRUE.
    IF SCC_FLG_ORDER EQ TRUE.
      PERFORM CREDIT_DELTA_ORDER.
*       CHANGING DELTA_OEIKW DELTA_OLIKW DELTA_OFAKW.
    ENDIF.
*
    IF SCC_FLG_ORDER EQ CHARY.
      PERFORM CREDIT_DELTA_SM_ORDER.
    ENDIF.
*
    IF SCC_FLG_DELIVERY EQ TRUE.
      PERFORM CREDIT_DELTA_DELIVERY.
*       CHANGING DELTA_OEIKW DELTA_OLIKW DELTA_OFAKW.
    ENDIF.
  ENDIF.
* offene werte bestimmen


   SCC_SUM_OPENS = SCC_SUM_OPENS - LV_SHKDJE - LV_LSXYED.

  IF T691F-STVAW EQ TRUE.
    ADD DELTA_OEIKW TO SCC_OPEN_ORDER.
    SCC_SUM_OPENS = SCC_SUM_OPENS + SCC_OPEN_ORDER.
  ENDIF.
  IF T691F-STVLW EQ TRUE.
    ADD DELTA_OLIKW TO SCC_OPEN_DELIVERY.
    ADD DELTA_OFAKW TO SCC_OPEN_INVOICE.
    SCC_SUM_OPENS = SCC_SUM_OPENS + SCC_OPEN_DELIVERY
                                  + SCC_OPEN_INVOICE.
  ENDIF.
* Kreditlimit anpassen
  PERFORM KNKK-KLIMK_CHANGE USING T691F CHANGING SAV_KNKK_KLIMK.
* open values  > creditlimit
  IF SCC_SUM_OPENS GT SAV_KNKK_KLIMK.
    PERFORM MESSAGE_EXCEEDED_VALUE USING SCC_FLG_ORDER SCC_SUM_OPENS.
    MOVE CON_RC_NOK TO SCC_RC.
    ELSE.
      CLEAR:RC_CHECK,RC_WARNING.
*      IF SY-TCODE = ‘VA02‘.
*        CALL FUNCTION ‘SD_ORDER_CREDIT_RELEASE‘
*          EXPORTING
*            VBELN             = XVBPA-VBELN
**           IF_SYNCHRON       = ‘X‘
*                  .
*
*      ENDIF.
  ENDIF.
* set returncodes and status
*  PERFORM INDICATORS_SET USING    SCC_UPDATE
*                                  SCC_RC
*                                  T691F-STSET
*                                  T691F-STREA
*                         CHANGING SCC_RC_ALL
*                                  SCC_RC_WARNING
*                                  SCC_RC_ERROR
*                                  SCC_RC_STATUS_SET
*                                  SCC_CMPSX.
* set returncodes and status for ageing FI data
  PERFORM AGEING_FI_DATA       USING    SAV_FI_VEKTOR_AKTUELL
                                        SCC_UPDATE
                                        T691F-STSET
                                        T691F-STREA
                               CHANGING RC_CHECK_M
                                        SCC_RC_ALL
                                        SCC_RC_WARNING
                                        SCC_RC_STATUS_SET
                                        RKVBUK-CMPSM
                                        FI_VEKT_REA.
ENDENHANCEMENT.
*$*$-End:   (1)---------------------------------------------------------------------------------$*$*
ENDFORM.

 

 

订单解冻函数:SD_ORDER_CREDIT_RELEASE 效果等同于VKM1

状态更新函数:I_CHANGE_STATUS                 强制修改状态,用前需检查状态未变更,否则状态会DUMP

信贷金额限度:CREDITLIMIT_CHANGE            upd_knkk ‘I’ ‘U‘...

客户信贷管理&临时授信

标签:

原文地址:http://www.cnblogs.com/sapSB/p/5025337.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!