Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete confirmed schedule lines, without executing the ATP check?

Former Member
0 Kudos

Sales and Distribution: Concerning ATP (product allocation)

Situation:

Step 1: An order is created with priority low. Quantities are confirmed for line items.

Step 2: A second order is created with a higher priority. No confirmed quantities.

Rescheduling program (SDV03V02) is then executed. This selects and sorts the orders in the correct order.

The confirmed quantities for the first (low priority) order should now be freed up, to be able to allocate those quantities to the second (high priority) order.

The problem I am facing is that the confirmed quantities are NOT released.

We cannot use BAPI_SALESORDER_CHANGE or SD_SALESDOCUMENT_CHANGE to delete or modify the schedule lines, because these function modules execute the ATP check again. And when that happens, quantities are again confirmed and assigned.

How can we get rid of the confirmed schedule lines, without executing the ATP check?

Thanks,

Edwin.

7 REPLIES 7

Former Member
0 Kudos

This should be Posted in SAP SD Forum.

Forum->SAP Solutions->ERP SD Sales

0 Kudos

Yes, thank you. I also did that.

But that forum seems to be more for Functional consultants.

Maybe a developer has had a similar situation, in which case this is a better location...

Former Member
0 Kudos

Additional information: See notes 607036 and 89629. These notes basically say that SAP does not support the use of ATP AND Rescheduling at the same time...

But, we need to.

What needs to be done is to unconfirm the confirmed quantities (removing the schedule lines). But when we try that, SAP runs the ATP check again and immediately confirms new quantities when the Salesorder is saved.

If only we can prevent the ATP check from happening when changing the salesorder (removing the schedule lines) it would be possible to execute V_V2 again (correctly).

I check if I could use the LOGIC_SWITCH structure in the BAPI_SALESORDER_CHANGE, but that did not do the trick...

So the question still remains: How to prevent the ATP check from being executed when deleting or changing schedule lines?

0 Kudos

Found a solution to the problem:

In the Rescheduling program we export a parameter to the memory, to make it possible to delete schedule lines without executing the ATP check.

Deleting of the schedule lines is done with a BAPI, which will call the ATP check automatically for ATP relevant materials. This we want to stop from happening (only when calling the BAPI).

After the BAPI has been called we FREE the MEMORY ID.

The parameter is imported again in Customer-Exit EXIT_SAPLATPC_001.

Transaction.. SMOD
Enhancement.. ATP00001
Component.... EXIT_SAPLATPC_001,
Include...... ZXATPU01.

The customer exit is used in function AVAILABILITY_CHECK_CONTROLLER, just before calling function 'AVAILABILITY_CHECK'.

Simply refreshing the ATP tables in the customer-exit, will prevent the ATP check from being executed (because we removed the list containing the materials for which the ATP check needs to be done). As a result, the function 'AVAILABILITY_CHECK' will not be processed.

0 Kudos

Hi Edwin

  How did you restrict the user exit to be callled only from the BAPI_SALESORDER_CHANGE? I see that AVAILABILITY_CHECK_CONTROLLER is being used in several other programs too. My requirement is that ATP/availability check should not be carried out after the GI date is updated in the schedule lines using the BAPI

It is kind of urgent, any inputs would be higly appreciated.

Thanks

Vamsi

0 Kudos

Hi Vamsi.

I didn't need to. But if I had to prevent or restrict the usage, I would try to read the Abap stack to see what functions were called.

Maybe you can use this as starting point:


* Data declarations

  DATA: lt_abap_callstack          TYPE abap_callstack.

  DATA: ls_abap_callstack          TYPE abap_callstack_line.

 

* Code

CALL FUNCTION 'SYSTEM_CALLSTACK'

    EXPORTING

      max_level = 2

    IMPORTING

      callstack = lt_abap_callstack.

  CLEAR: ls_abap_callstack.

* Check if the function was called

  LOOP AT lt_abap_callstack INTO ls_abap_callstack

                            WHERE blockname = 'BAPI_SALESORDER_CHANGE'.

    EXIT.

  ENDLOOP.

Cheers,

Edwin.

0 Kudos

Edwin...Thanks a lot for you response, it was very helpful.