cancel
Showing results for 
Search instead for 
Did you mean: 

Confirmed quantity is becoming zero in case of SO Split for batch stock related to Rush orders

Private_Member_46505
Active Participant
0 Kudos

While creating Sales Order from VA01/Web Services if order quantity is 100 then

[mchb1-clabs] 75 will go for ZTAN- 1st line item and [mkol1-slabs] 25 will for ZVN second line item created with userexit_move_field_to_vbak. In case of Web services we are updating confirmed quantity using BAP_MATERIAL_AVAILABILITY.This works fine when there is not batch entered and we will be referring mard-labst & mard-klabs. When we pass batch number we will be using same batch for both line items,everything works fine as expected only thing is the confirmed quantity for second line item becomes zero even though we pass correct available quantity.It becomes zero at some point and schedule is created with zero confirmed quantity.

Are we missing anything.Batch stock is checked in material and configuration we have cross verified and wont see we are missing anything.
Want to know if same batch will be allowed for 2 line items in same sales order,If so then why confirmed quantity is becoming zero.
We tried passing confirmed quantity in userexit_move_field_to_vbep however it gets changed at later point.


Deep down through debugger : Confirmed quantity becomes 0 in below call
* Liefergruppen korrelieren
perform liefergruppendatum_setzen(sapfv45v) using verarb_immer.

PERFORM XVBEP_AENDERN.

Any hint,trick suggestions are welcomed to achieve the requirement.

Accepted Solutions (1)

Accepted Solutions (1)

Private_Member_46505
Active Participant

SCN has been of great help and we were able to resolve the our issue from the below post.

https://archive.sap.com/discussions/thread/1680647

Here goes the solution mentioned in the above thread in case it wont open:

And solution is as below if in case thread is not opening.
In order to give the solution to all reader in the future. I finally find a solution.

I wrote an OSS message to SAP and they answer me in this way:

"Dear Customer,

In a BAPI, the ATP check is performed in the background.

Since the system is performing the availability check

in background, the availability screen cannot be performed.

So it is not able to make decisions regarding full

delivery, delivery proposal...In this case,the system uses

the configuration found in OVZJ. If your availability checking

rule in OVZJ is blank, the system will choose full delivery.

Sorry, but I can not give you a better solution to customizing in

OVZJ, if you wish a partial delivery."

In that transaction in customizing we inserted the value "E" and the partial delivery is created from VA01 and from BAPI too.

Answers (2)

Answers (2)

Lakshmipathi
Active Contributor

Try to create manually from VA01 with the same input parameter and see how system is working.

Private_Member_46505
Active Participant
0 Kudos

When we create manually a screen appears for ATP check and there whatever confirmed quantity we select that appears,issue will be when we run through webservices/BAPI we get zero confirmed quantity.We dont want to run simulate and check since this service is for 5 devices and we want to handle it in backend.

Jelena
Active Contributor
0 Kudos

There are some holes in the story but this is the way I understand the situation. You're using some kind of web service to create a sales order (I'm guessing an FM and BAPI_SALESORDER... is involved here?). As an input to FM/BAPI, you provide 100 EA and a user exit is somehow expected to split this into 75 and 25. And you're saying this does not work as expected and does not work the same way as when you enter 100 EA in VA01?

In this case, debugging the user exit using just FM (or whatever web service calls in SAP) and comparing it to VA01 seems like the only option. Also make sure to check that availability data provided by BAPI is as expected.

This kind of design of splitting quantity into two line items based on availability doesn't seem like a good idea in general though. Why not just have one line and let ATP do its job and create multiple schedule lines? What if availability changes?

Edit: there is an SAP note that describes when SD BAPIs do not work the same way as transaction. I'm not sure this is the case here but wouldn't hurt to find and read it.

Private_Member_46505
Active Participant
0 Kudos

Thank you for the response Jelena and sorry for not sharing complete information.
Yes we are using web services through BAPI to create Sales Order. If input is 100 EA with batch A then as per the batch unrestricted stock available (75) and vendor consignment (25) has to be divided into ZTAN and ZVN respectively. In case of VA01 it does not have issue because ATP screen appears and whatever confirmed quantity is shown on screen it appears exactly in schedule lines,however when its from web services through BAPI from front end it suppresses the ATP check dialog screen.
We have debugged in both cases and availability check FM (BAPI_MATERIAL_AVAILABILITY) provides exact batch stock for required quantity/confirmed quantity.

The expectation from business is to have different line items with different item categories for unrestricted stock and vendor consignment stock for the same batch.

Watch Point (Few Hours Back) : The value does gets changed in program SAPFV45V MVERF_ABARBEITEN_POSITION when MVERF-LMENG(Required Quantity) gets assigned to VBEP-BMENG (Confirmed Quantity) as 0 .

ABAP Solution : I checked the user exit USEREXIT_ADD_FIELD_TO_HEADER - FV45VFZZ - SAPFV45V where I can modify this value as MVERF-LMENG = XVBEP-BMENG only for ZVN in case of SO split item and it works perfect and also did some negative testing to make sure it wont affect other scenarios in anyway.
But the hunt to identify root cause of issue continues as I want to understand what makes it to push confirmed quantity as zero.
I will update in case of any break through.

Jelena
Active Contributor
0 Kudos

Sorry, it's still not clear if your test in VA01 is exactly the same as when the order is placed by FM.

In VA01 do you also enter 100 EA and it is somehow split into 2 lines? What exactly splits it? At what point do you get ATP screen? What do you see in it and for what items?

I'm guessing in VA01 ATP check runs for 2 separate items, not for 100 EA. What parameters do you give to BAPI_MATERIAL_AVAILABILITY then? Naturally, you won't get any screens in BAPI. Scheduling will be made based on whatever values are passed to BAPI, that's all. If you've just checked availability and then immediately post an order but it says stock is not available then either you're not giving the same data to BAPIs or some other data in the order influences ATP check or there is a bug. Logically, there are really no other options.

Again, make sure to search for SAP Notes because such inconsistencies between BAPI and transaction are a known issue. If this is not mentioned in the notes then run two exactly same scenarios, get the results, document this and open an incident with SAP. If you're giving the same exact values to VA01 and to BAPI normally you should expect the same result (again, unless it's already covered in a note).

This is all custom ABAP development and even custom item categories, so I'm not sure how much assistance you could get on SCN. These things need a system access to troubleshoot.