cancel
Showing results for 
Search instead for 
Did you mean: 

Availability check

Former Member
0 Kudos

Hi all

I have requirement like, Ordering plant and supplying plant scenarios, will enter a supplying plant in the sales order, system should check the stock of supplying plant , If stock is available proposed delivery date should pick from the customer calendar which will be assigned in the customer master-->General data--OR If stock is not available in the supplying plant should check the lead time in the material master + customer calendar date and should give the proposed delivery date.

Need your advice on this, which exit needs to modified.

BR

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member223981
Active Contributor
0 Kudos

This does not sound like an easy requirement to meet. Essentially, you need to call the availability check more than once in your requirement. And this definitely is not recommended by SAP.

The availability check is called here:

Function AVAILABILITY_CHECK_CONTROLLER

  **********************************************************************

CALL FUNCTION 'AVAILABILITY_CHECK'

EXPORTING

P_SCHEDSH = P_SCHEDSH

P_SCHEDTR = P_SCHEDTR

TABLES

P_ATPALLX = P_ATPALLX

P_ATPASSRESX = S_ATPASSRESX

P_ATPASSX = P_ATPASSX

P_ATPCSX = P_ATPCSX

P_ATPCSX_R3 = L_ATPCSX_R3

P_ATPDSX = P_ATPDSX

P_ATPFIELDX = P_ATPFIELDX

P_ATPMATX = P_ATPMATX

P_ATPMATX_R3 = L_ATPMATX_R3

P_ATPPLANTX = P_ATPPLANTX

P_ATPREX = P_ATPREX

P_ATPSDUX = P_ATPSDUX

P_ATPSOPX = P_ATPSOPX

P_ATPSSPX = P_ATPSSPX

P_ATPTERMX = P_ATPTERMX

P_ATPREQTERMX = P_ATPREQTERMX

P_MDVEX = P_MDVEX

P_MDVEX_R3 = L_MDVEX_R3

P_MDVEX_APO = L_MDVEX_APO

P_QUOT_CHX = P_QUOT_CHX

P_QUOT_VBX = P_QUOT_VBX

P_T441VX = P_T441VX

P_TMVFX = P_TMVFX

P_ATPDIAX = P_ATPDIAX

P_ATPDIAWX = P_ATPDIAWX

P_ATP_GRP = P_ATP_GRP

P_ATP_GRPMB = P_ATP_GRPMB

CHANGING

P_ATPCA = P_ATPCA

P_ATPCB = P_ATPCB

P_ATPCC = P_ATPCC

EXCEPTIONS

ERROR = 1

OTHERS = 2.

***************************************************************

After function module availability_check is executed, the availability result is returned in P_MDVEX. In here, field MNG02 contains the confirmed quantity.

Then, Function AVAILABILITY_CHECK_CONTROLLER does this:

 

* User-Exit after check

  ***************************************************

IF P_ATPCA-FORCE_R3 IS INITIAL.

CALL CUSTOMER-FUNCTION '002'

TABLES

T_ATPCSX = L_ATPCSX_R3

T_MDVEX = L_MDVEX_R3

CHANGING

P_ATPCC = P_ATPCC.

ELSE.

CALL CUSTOMER-FUNCTION '002'

TABLES

T_ATPCSX = P_ATPCSX

T_MDVEX = P_MDVEX

CHANGING

P_ATPCC = P_ATPCC.

ENDIF.

***************************************************

This is the call to the aforementioned EXIT_SAPLATPC_002 (by SAP SAP). In this exit, you could maintain a logic something like: IF P_MDVEX-MNG02 = 0. CALL FUNCTION 'AVAILABILITY_CHECK'. And you go on to execute the ATP check again. But this time, you call it with different parameters. You could maintain your own logic in here to change the value of P_ATPCSX-BDTER (Requirement Date) so that the ATP check is now calculated with a different required delivery date. Later, this should be reflected in function SD_SCHEDULING_ATP_CALC.

The problem with Venkateswaran K solution is that you are not actually checking availability again. You are just checking against the value in LABST which is different to the ATP check (See SAP note 89362)

venkateswaran_k
Active Contributor
0 Kudos

In program MV45AFZZ -  we can do that..  This will check at the time of saving the sales order.

SE38

Open MV45AFZZ - Program  - Do enhancement in this program by clicking Spiral Icon

In FORM USEREXIT_SAVE_DOCUMENT_PREPARE
 
***Check availability
    loop at xvbap into w_vbap.
      select single * from mard into w_mard where matnr = w_vbap-matnr and

                                      werks = w_vbap-werks.
      if sy-subrc EQ 0.
         if w_vbap-kwmeng > w_mard-labst AND w_vbap-updkz NE 'D'.
            w_stk = w_mard-labst.
            shift w_stk LEFT DELETING LEADING '0'.
            CONCATENATE 'Item ' w_vbap-posnr 'Stock Available' w_stk 'Only..!' INTO w_msg SEPARATED BY SPACE.
            MESSAGE s000(wkomv-kschl) WITH w_msg DISPLAY LIKE 'E'.
            PERFORM FOLGE_GLEICHSETZEN(SAPLV00F).
            FCODE = 'ENT1'.
            SET SCREEN SYST-DYNNR.
            LEAVE SCREEN.
         endif.
      endif.
    endloop.

Regards,

Venkat

Former Member
0 Kudos

these exits will not workout..

Former Member
0 Kudos

Not Sure, check these exits please

EXIT_SAPLATPC_001

EXIT_SAPLATPC_002

MT