Creating commission based on source document invoice
Creating commission based on source document invoice
Functional Requirements
The trigger for the creation of a commission based on source document invoice, is the standard message handling of an invoice. In order to setup this process, just create an individual SD invoice message type (application V3) with all corresponding steps (access sequence, message schema, message condition) and assign the “printing” program, which call the creation of commission.
As result, the commission is created automatically in the background, when the message is processed successful. The status of the processing and also the created commission number, you can see in the message protocol / log of the invoice.
Create commission - successful invoice message log
Relevant for a successful creation, is that all customizing settings have been done, like commission type definition and determination, number range definition, item type definition and determination, etc.
To ensure, that there is for each invoice always only one commission, a corresponding check is processed during commission creation.
Create commission - invoice message log with error
If you want to reprocess the creation and start an additional message, you first must delete the existing commission with the reference to this invoice.
During the processing all defined values of the settings, the source invoice, the VSS order the invoice is coming from and the vehicle that is assigned to the VSS order, are stored in the corresponding commission tables. Also, some admin stuff like created by, creation date, etc. are stored.
Create commission - detail view
The commission date initially is the creation date of the commission. But this date is especially important, because it is used also for the complete calculation as basis date, e.g. for determination of price conditions, and also to check validity of relevant employee. So, in case the customer defines here different dates as relevant calculation basis, e.g. invoicing date or selling date of the car / car contract date, this date should be updated with BAdI during commission creation.
Concerning the register / table “conditions” nothing happens during the automatic creation. Register and table are initial empty.
Create commission - register "conditions"
Also during the creation, the partner verification and determination is done. Based on the determined commission type definition (main partner) there is a check that corresponding partner role is assigned within the invoice. If the partner role is not in the invoice, no commission will be created.
Is the partner role assigned, the creation checks the settings of “relevant employee”.
Is the partner number not assigned here, the commission will also be created, but with the status, that is assigned to the business operation “CRNR” (Create inactive commission) in the status schema settings, e.g. in proaxia example case this is “0008” (not relevant for HR transfer). In that case the commission result automatically is zero.
Create commission - info & register "participants" when partner is not assigned
Is the partner number assigned in the relevant employee settings, the commission will be created normally with the status that is marked as “initial”, e.g. in proaxia example case this is “0001” (new). In that case the creation checks in addition, if the main partner is part of a valid pool definition. If he is, also all additional partners from pool will be added with the defined pool partner role from commission type definition.
Create commission - info & register "participants" when partner is assigned
When all data of the commission is determined, finally the calculation in formula builder is called and the result is returned to the commission calculation table.
The main idea to show relevant values of the calculation and also the calculation result, is to display them in the HTML view of tab / register “price/commission”.