Functional Description
Purpose
This function has two distinct phases: accumulate and retrieve, each selected by a 'Mode' parameter
passed to the function.
In accumulate mode (called within a loop by the calling program) this function accumulates and stores
discount information for a given Sales Order Detail line in an array. An error indicator is the only
parameter returned to the calling program in accumulate mode.
Retrieve mode (also called within a loop in the calling program) will pass the stored (summarized)
discount information to the calling program, one array element at a time.
Setup Notes and Prerequisites
Special Logic
Technical Specification
2.2Related Tables
2.3Related Business Functions
2.4Processing
The following validation should be performed on the input parameters. If there are any errors,
return a '1' in the error code ERRC.
MODE can be '1', '2', '3' or '4'.
When MODE is '2', CNTF must not be less than 1.
When MODE is 3 (Initialise Array/Linked List):
Mode 3 will be used to initialise (clear) the array or linked list and should be the first call made
to this function. No parameters (other than Mode) will be needed.
When MODE is 4 (Destroy Array/Linked List):
Mode 4 will be used to delete the array or linked list and should be the last call made to this
function. No parameters (other than Mode) will be needed.
When MODE is 1 (Accumulate and Store Discount Information):
The data passed to this function should be stored in a linked list which should have the following
elements:
PAYTERM-Payment Terms Code
PRICE-Extended Price
FPRICE-Foreign Extended Price
DISCOUNT-Amount of Discount
FDISCOUNT-Foreign Amount of Discount
Build the linked list:
Terms Code (PTC) in array_element PAYTERM. Set 'Found' ON or OFF.
new index position (OFF).
Store Extended Price (AEXP) to array_element PRICE[index].
Store Foreign Extended Price (FEA) to array_element FPRICE[index].
Store Foreign Discount Amount (CDS) to array_element FDISCOUNT[index].
Add Foreign Extended Price (FEA) to array_element FPRICE[index].
Add Discount Amount (ADSC) to array_element DISCOUNT[index].
Add Foreign Disc. Amount (CDS) to array_element FDISCOUNT[index].
When MODE is 2 (Retrieve Discount Information):
When MODE is '2', the only parameters passed to this function will be MODE and CNTF. In MODE 2, this
function will be called from within a loop in the calling program. CNTF should always be 1 for the
first call and incremented by 1 for each subsequent call.
Pass to the calling program the contents of array[CNTF], elements PAYTERM, PRICE, FPRICE, DISCOUNT
and FDISCOUNT. When there is no more data in the array, pass back a '1' in the flag field EV01. When
EV01 is passed back as a '1', the fields PAYTERM, PRICE, FPRICE, DISCOUNT and FDISCOUNT should be blank
or zero.
Note: At this stage elements FPRICE and FDISCOUNT will be zero and have been set aside for future
use.
^
D4200240 - AccumulateGetDiscSummary
Special Input Expected
MODEModeProcessing1 = Accumulate & Store Mode 2 = Get Mode 3 = Initialize Mode 4 =
Destroy Mode
PTCPayment Terms CodeReceived when MODE is '1', passed back to calling program when MODE is
'2' as contents of: array_element PAYTERM[CNTF].
AEXPExtended PriceSimilar to PTC: array_element PRICE[CNTF]
FEAForeign Extended PriceSimilar to PTC: array_element FPRICE[CNTF]
ADSCDiscount AmountSimilar to PTC: array_element DISCOUNT[CNTF]
CDSForeign Discount AmountSimilar to PTC: array_element FDISCOUNT[CNTF]
CNTFCount FieldOnly reqd when MODE = 2. This parameter requests the array element to
be retrieved. It should always be 1 for the first call, and incremented by 1 for each subsequent
call.
Special Output Returned
PTCPayment Terms CodeReceived when MODE is '1', passed back to calling program when MODE is
'2' as contents of: array_element PAYTERM[CNTF].
AEXPExtended PriceSimilar to PTC: array_element PRICE[CNTF]
FEAForeign Extended PriceSimilar to PTC: array_element FPRICE[CNTF]
ADSCDiscount AmountSimilar to PTC: array_element DISCOUNT[CNTF]
CDSForeign Discount AmountSimilar to PTC: array_element FDISCOUNT[CNTF]
EV01End Of Array FlagPassed back to calling program when MODE is '2'. Will contain '0'
during the 'Get' process and '1' once the last array element has been passed back.
ERRCErrorCode
^
Parameter Name | Data Item | Data Type | Req/Opt | I/O/Both |
---|---|---|---|---|
cStoreGetOrInitialize | MODE | char | NONE | NONE |
Special Input Expected
| ||||
szPaymentTermsCode | PTC | char | NONE | NONE |
A code that specifies the terms of payment, including the percentage of discount available if the invoice is paid by the discount due date.
| ||||
mnExtendedPrice | AEXP | MATH_NUMERIC | NONE | NONE |
The number of units multiplied by the unit price. | ||||
mnForeignExtendedPrice | FEA | MATH_NUMERIC | NONE | NONE |
The product of the foreign price times the number of units. | ||||
mnDiscountAmount | ADSC | MATH_NUMERIC | NONE | NONE |
The amount of the invoice or voucher pay item that is eligible to be subtracted from the gross amount when the transaction is paid. The
| ||||
mnForeignDiscountAmount | CDS | MATH_NUMERIC | NONE | NONE |
The foreign amount of the discount available as opposed to the amount of the discount actually taken. | ||||
cEndOfArrayFlag | EV01 | char | NONE | NONE |
Special Output Returned
| ||||
nCounter | INT01 | integer | NONE | NONE |
Number of Days in Future to Query for Responses Due. | ||||
cErrorCode | ERRC | char | NONE | NONE |
This error code indicates if any errors occurred during the creation of the Trip Document Detail (F4914) records by the Delivery Document
| ||||
cSuppressErrorMsg | EV01 | char | NONE | NONE |
An option that specifies the type of processing for an event. | ||||
szErrorMsgID | DTAI | char | NONE | NONE |
A code that identifies and defines a unit of information. It is an alphanumeric code up to 8 characters long that does not allow blanks or
| ||||
idPtrToDiscountList | GENLNG | ID | NONE | NONE |
General purpose ID variable. |
None |
None |