Standard provide the ‘Buffer Variant’ to extend the use of the buffer mechanism for BOPF. And I found that the default route functionality in forwarding order ( maybe also in trailer document) is using this technique. In the last project we happened to have a requirement similar with the default route functionality but more complicated. So I did some dig about the buffer variant.
So what’s the buffer variant?
Firstly let’s think about the timestamp, the timestamp can be used to record any time in the timeline. Similarly the buffer variant is a variant to record the buffer status ( the data and the changes to the data) in the buffer life cycle.
Actually we’re using the buffer variant all the time.
When user try to open and edit one forwarding order, all the necessary data from all the necessary business objects will be loaded into buffer and a buffer variant 0 is created to record the current status, and all the changes to the forwarding order later will be synchronized to this buffer variant 0. And all the data in buffer variant 0 will be commit to the database when user save the document successfully.
The standard default route generates all the possible routes from the predefined master data, and presents all the routes to the user in a pop up window. When use trigger the button( default route button), system will create each buffer varaint(1, 2, 3, ..N) for each route proposal in parallel to record the changes different proposal will do to the forwarding order. And at the time of user accepting one route, the according buffer variant will be incorporated with the buffer variant 0 to update the stages.
In our case customer want also to see the check log, equipment substitution information and the charge& cost value in the popup window before making the decision to choose one proper route. So we get all the possible route proposals from the customer external systems first, and perform the check, adapt the item equipment type, and finally do the charge and cost for each route proposal. And of course each buffer variant will be created will record all the changes, so finally we get a very complex pop up window holding all the information for the route proposal for customer to evaluate and make the decision.
So we can see that the buffer variant can record multiple different version of one forwarding order instance at the same time. In each buffer variant we can know what are the stages like, what’s item like and all other information. And after series of changes to the forwarding order in the buffer variant, we can get totally different charges and cost before we actually do the changes!
Since all the TM projects could have the route suggestion requirement, I think the buffer variant will be used more frequent in the future !
You can find the detail use of the buffer variant in the helper class /scmtms/cl_bufvar_helper.