I have a requirement to set the first date of the order line item to either the ATP date, or the ATP date + 25 days. The user is prompted on if the 25 days need to be added or not.
I have most of my code in the MV45AFZB module under the USEREXIT_CHECK_VBAP form. Looping at the XVBEP based on position of VBEP (POSNR), I read the schedule lines and set the first schedule line to the new date. The first schedule line is also updated for the quantities. The other schedule lines have the quantities set to zero, and the dates set to the same date as the first schedule line. I also update the IVBEP1 table similarly.
This allows the date to be set, shows up properly in MD04, and does not abend because the VBEP and IVBEP1 are out of sync.
The problem is that the extra schedule lines don't look right to the user (somewhat confusing), and if you go to manually change the first date, you get an error message that must be answered, then ATP works again.
If I try to mark the 0 quantity schedule lines as deleted (XVBEP-UPDKZ = 'D') then I get abends.
None of the research I have done on the internet has shown how to set schedule line dates in the order while the order is being entered, most show how to change with a batch program.
Can someone point me in the correct direction with a decent example?
Steven M Engel