Skip to Content

The behaviour of XVBEP and YVBEP global data is not very well documented. Hence the reason for this post. This is written with the learning obtained the hard way from the experience of developing enhancements in standard SD userexits so that it can serve as ready reference for someone who needs to do the same.
Let’s cut to the chase:
There are the following structures provided by standard SAP for us to obtain various standard data in SD userexits:

VBEP – This work area holds the DB values of the schedule line currently being processed. This is especially useful in userexits that are used to manipulate schedule line level data such as USEREXIT_CHECK_VBEP and USEREXIT_XVBEP_FOR_DELETE etc.
XVBEP work area – This work area holds the latest change to the schedule line being currently processed. This is especially useful in userexits that are used to manipulate schedule line level data such as USEREXIT_CHECK_VBEP and USEREXIT_XVBEP_FOR_DELETE etc.

XVBEP internal table – This holds the history of all the changes that are made to any of the schedule lines of any of the items in the order. Hence this table can hold the same schedule line multiple times with differing update flags UPDKZ depending on the number of changes made before saving of the order.

YVBEP work area – This work area holds the old value of the schedule line that need to be changed or deleted from the Database when the order is saved.  This is especially useful in userexits that are used to manipulate schedule line level data such as USEREXIT_CHECK_VBEP and USEREXIT_XVBEP_FOR_DELETE etc.

YVBEP internal table – This holds the saved values from the DB of the schedule lines that are being changed (with UPDKZ blank) and the schedule lines that are to be deleted with the UPDKZ as ‘D’. This indicates that the schedule line needs to be deleted from the DB.

IVBEP internal table – This internal table holds the indices of the latest changed values of the schedule lines of the line item being currently processed i.e. this refers to the latest valid schedule lines that are to be saved to the Database. The field TABIX holds the index of the record in XVBEP that needs to be considered for processing.

IVBEP1 internal table – This internal table holds the indices of the latest changed values of the schedule lines of all the line items in the order i.e. this refers to the latest valid schedule lines that are to be saved to the Database. The field TABIX holds the index of the record in XVBEP that needs to be considered for processing.

It is advisable that XVBEP and YVBEP are not touched and are copied to other local work areas and internal tables for processing if the need is only to obtain the values from the DB or the latest change of the schedule lines.
When values are being read from the internal tables XVBEP, then we have to ensure that we are picking the latest record by reading the internal table IVBEP1 and ensure that the index from which we’re reading the record from XVBEP exists in IVBEP1.
However, since that is not always the case and we might have to update some fields in the schedule line in some way or insert/delete/modify schedule lines in a non-standard way, then we need to be very careful while editing these standard work areas and internal tables, making sure to update the IVBEP1 and IVBEP internal tables accordingly.

The same kind of logic applies to most X/Y standard structures in SAP.

Thanks for reading through until this point.

If you find this useful, please let me know in the comments. If not, even then do let me know in the comments. 🙂

Happy coding, Cheers!

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply