(LTMOM) Extend Purchasing Contracts To Allow Scale Conditions - SAP Blogs
(LTMOM) Extend Purchasing Contracts To Allow Scale Conditions - SAP Blogs
Community
Technical Articles
Kimveasna Pen
October 29, 2019 5 minute read
Introduction
In this post, I will describe my own experience to extend migration object “Purchasing contract” in order to
allow input of condition scales.
As per SAP deliverd template, we can only enter simple conditions, without quantity nor value scales. As
described in my previous post about Migration Cockpit, I will demonstrate that it is not much di cult than
to use BAPI to create a contract.
Though this blog post is speci c to purchasing contracts, you should apply the same approach for any
migration object enhancement.
This can be con rmed if you open the object in the migration modeler (LTMOM), nothing in the source
structure:
https://blogs.sap.com/2019/10/29/ltmom-extend-purchasing-contracts-to-allow-scale-conditions/ 2/14
2/16/2020 [LTMOM] Extend purchasing contracts to allow scale conditions | SAP Blogs
But don’t be afraid, we are at home, remember target structures are actually structures of BAPI
BAPI_CONTRACT_CREATE:
https://blogs.sap.com/2019/10/29/ltmom-extend-purchasing-contracts-to-allow-scale-conditions/ 3/14
2/16/2020 [LTMOM] Extend purchasing contracts to allow scale conditions | SAP Blogs
This simply means once we know how to call BAPI, we know how to call it from Migration Cockpit. But hold
on, this may sound as a dumb question, but do you know how to create a contract actually?
The following may be obvious, but the correct approach is not to go and ll randomly your structure
mappings and eld mappings until it works. Just take a breath, go step by step
1. Do you really know how to manually create a contract in (ME31K for instance)?
2. Then, do you know how to create the exact same contract with BAPI?
3. Then, and only then, go and map structure and elds accordingly in LTMOM
https://blogs.sap.com/2019/10/29/ltmom-extend-purchasing-contracts-to-allow-scale-conditions/ 4/14
2/16/2020 [LTMOM] Extend purchasing contracts to allow scale conditions | SAP Blogs
Try not to make it too simple, put at least 2 items, di erent values, etc.
I will not go through a long explanation of what is exactly a BAPI, but you may know you can see it (the real
object which holds this function) with SWO1:
https://blogs.sap.com/2019/10/29/ltmom-extend-purchasing-contracts-to-allow-scale-conditions/ 5/14
2/16/2020 [LTMOM] Extend purchasing contracts to allow scale conditions | SAP Blogs
Method display, actually BAPI_CONTRACT_GETDETAIL is a great helper function in our case as it will speed
up our analysis: a call to BAPI_CONTRACT_GETDETAIL with our sample contract number as argument will
reveal a lot of the expected input parameters for scales in BAPI_CONTRACT_CREATE.
Call it in SE37:
https://blogs.sap.com/2019/10/29/ltmom-extend-purchasing-contracts-to-allow-scale-conditions/ 6/14
2/16/2020 [LTMOM] Extend purchasing contracts to allow scale conditions | SAP Blogs
And output structures and values re ect more or less the expected input parameters:
In my case, my sample contract contains 2 items and both price conditions have 3 steps. I will save you time
by summarizing my analysis steps, but I have inferred that the important elds to be populated in input
parameters are:
https://blogs.sap.com/2019/10/29/ltmom-extend-purchasing-contracts-to-allow-scale-conditions/ 7/14
2/16/2020 [LTMOM] Extend purchasing contracts to allow scale conditions | SAP Blogs
Then, I create a variant in SE37 that I can execute in a test sequence with BAPI_TRANSACTION_COMMIT:
my BAPI analysis is complete, I know for sure the required elds to manage scale conditions in a contract. I
can set the relevant mapping in LTMOM.
https://blogs.sap.com/2019/10/29/ltmom-extend-purchasing-contracts-to-allow-scale-conditions/ 8/14
2/16/2020 [LTMOM] Extend purchasing contracts to allow scale conditions | SAP Blogs
I repeat it again and again, you must be sure of your BAPI parameter before you do any mapping in LTMC.
Start by adapting source structures by adding scales under item structure (it is a copy-paste of
BAPIMEOUTITEMSCALEQUAN)
https://blogs.sap.com/2019/10/29/ltmom-extend-purchasing-contracts-to-allow-scale-conditions/ 9/14
2/16/2020 [LTMOM] Extend purchasing contracts to allow scale conditions | SAP Blogs
For ITEM_CONDITION:
https://blogs.sap.com/2019/10/29/ltmom-extend-purchasing-contracts-to-allow-scale-conditions/ 10/14
2/16/2020 [LTMOM] Extend purchasing contracts to allow scale conditions | SAP Blogs
https://blogs.sap.com/2019/10/29/ltmom-extend-purchasing-contracts-to-allow-scale-conditions/ 11/14
2/16/2020 [LTMOM] Extend purchasing contracts to allow scale conditions | SAP Blogs
g_scale_item is a global variable (you can use the same way as you use to do in LSMW) which will be used to
set value in ITEM_COND_SCALE-LINE_NO automatically.
If you have reached this step, you know by heart your required BAPI parameters for
BAPI_CONTRACT_CREATE: this is going to be the nal step, all previous mappings operations which you
have set up will be applied in the generated functions.
All these mappings are the less “visible” parts of the cockpit (but you can still debug it if required). To
ensure you get to BAPI_CONTRACT_CREATE with all parameters lled as expected, set an external
breakpoint in it, and check all parameters are lled correctly. If not, x your mapping, retry, etc.
Conclusion
I hope this explanation is clear enough and will help you in extending SAP-delivered migration templates to
meet your requirements. Remember LTMOM is not a monolithic tool, the logic of data creation remains
https://blogs.sap.com/2019/10/29/ltmom-extend-purchasing-contracts-to-allow-scale-conditions/ 12/14
2/16/2020 [LTMOM] Extend purchasing contracts to allow scale conditions | SAP Blogs
outside, in BAPI function (or any other function like the one for customer/supplier). Once you know how to
create with a BAPI call, you are in a safe place.
Alert Moderator
Assigned tags
Related Questions
Find us on
https://blogs.sap.com/2019/10/29/ltmom-extend-purchasing-contracts-to-allow-scale-conditions/ 13/14
2/16/2020 [LTMOM] Extend purchasing contracts to allow scale conditions | SAP Blogs
Newsletter Support
https://blogs.sap.com/2019/10/29/ltmom-extend-purchasing-contracts-to-allow-scale-conditions/ 14/14