Funtion modules for credit check:
SD_ORDER_CREDIT_CHECK-->for sales order
SD_DELIVERY_CREDIT_CHECK--->for delivery
SM_ORDER_CREDIT_CHECK-->for service order/CRM
1.Take sales order for example, set breakpoint at SD_ORDER_CREDIT_CHECK->
Enter a new item or change item quantity(cost) to trigger a new check
When FM is hitted, search for the coding for specific check, for example static check
->
* static check
if no_check is initial.
clear rkvbuk-cmpsa.
if t691f-cmpaa eq true
and
( update eq true or
t691f-cecki eq true or
t691f-strea eq con_error ).
perform static_credit_check using update <<<<<<<<Set here
xvbak-kkber
xvbak-knkli
flg_order
flg_delivery
changing
rc_check_a rc_check rc_warning
rc_error rc_status_set
rkvbuk-cmpsa.
xvbak-kkber 1000 -->credit control area
xvbak-knkli 0000001050 -->credit account
flg_order X
2.When above BP is hit, F5 to enter the Form for static check
PERFORM CREDIT_EXPOSURE_GET is to get the exposure
T691F-STVAW and T691F-STVLW are the "open order" and "open delivery" field in OVA8
SCC_OPEN_ORDER -->open order value
SCC_OPEN_DELIVERY -->open delivery value
SCC_OPEN_INVOICE -->open invoice value
3.PERFORM CREDIT_DELTA_ORDER is to calculate the current sales order value
Set BP at the next line after this Form and Press F5 to enter this FORM->
CALL FUNCTION 'MCV_STATISTICS_ORDER' -->FM for statistics update for order
SET BP at subroutine->
Program SAPLMCS1
Subroutine/Method/Module OFFENE_WERTE_EINT
Then search for PERFORM cmpre_calculate(saplvkmp)-->program for credit price calculation
4.After CREDIT_DELTA_ORDER is complete DELTA_OEIKW is filled with current sales order
value, it is added to SCC_OPEN_ORDER(open order value)
SCC_SUM_OPENS = SCC_SUM_OPENS + SCC_OPEN_DELIVERY
+ SCC_OPEN_INVOICE.
Open order, delivery and invoice value is summed up.
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.
ENDIF.
Then it is compared with the credit limit maintained in FD32.
If the open value is large than credit limit, message is issued to inform user that the credit check failed.
The message type depends on setting in OVA8.