Delivery agreements for order items - CX_PURCHASE_ACCOUNT
In the slot "tradeAgreement" on the order item the transaction folder (CX_LOG_CUBE) of the main supplier is normally linked.
However, there are two macros that should be used for determining the main supplier:
G_GetMain_A_SupplierMonitor - Put the supplier agreement of the A-supplier on the stack. If the slot "tradeAgreement" is not available, the macro also searches the subMonitors for A-suppliers.
G_GetMainSupplierMonitor - Searches first for A, B and C suppliers, if none is found it takes the supplier with the most current price and puts the supplier agreement on the stack.
Both macros return "NULL" if you could not find a supplier agreement.
With an object of the class CX_ITEM (or inherited) on the stack, you get the object by the following access expression
of the main supplier:
Get(PurchaseItem()) G_GetMain_A_SupplierMonitor Get(DimensionByCondition("type(owner)=CX_SUPPLIER").owner)
or the "CX_PURCHASE_ACCOUNT" from the view of the supplier :
Get(PurchaseItem()) G_GetMain_A_SupplierMonitor Get(DimensionByCondition("type(owner)=CX_PURCHASE_ITEM").owner)
This structure is used in the following modules and can therefore serve as a template:
Purchedt.mod: In the SetFormat of the SupplierList, some functions are called which complete the individual sub-steps.
Autopure.mod: In the macro GetUniqueIDAndNameOfMainSupplier you get the number and name of the main supplier of the transferred item