VerifySupplierPercentages

Verify Supplier Percentages

Minor Business Rule

Object Name: B3401350

Parent DLL: CMFG

Location: Client/Server

Language: C

1.Functional Description

1.1Purpose
This function will use cache to Verify that the sum of the Percentages of the suppliers at any given 
date is equal to 100, otherwise it will return an error.



1.2 Setup Notes and Prerequisites
• Cache Action Code
• 'A' Add - add a cache element.
• 'D' Delete - delete a cache element.
• 'T' Terminate - terminate cache (PercentCache)
• 't' Terminate - terminate cache (TotalCache)
• 'V'  Verify that the total of the percentages at any given date within and including effective 
from and effective thru is 100 otherwise issue an error.


1.3Special Logic

This function creates  two caches Percent cache and total cache.  The function appends the input Job 
Number string to the two character ID 'JD' and 'AN8'  to build the two cache names used for the 

calling application.


2.Technical Specifications

Cache Layout:Cache includes all of the following fields; key fields are noted.

Cache : Percent Cache


Data Item Data Structure DescriptionKey Field

AN8mnAddressNumberY

EFFFjdEffectiveFromDateY

EFFTjdEffectiveThruDate

VSPCmnSplitpercentage


Cache2 : Total Cache


JDEDATE      jdDate;                

MATH_NUMERIC      mnTotal;


Data Item Data Structure DescriptionKey Field

JDEDATEjdDateY

MATH_NUMERICmnTotal



I.Perform setup functions 

A.Initialize cache to get handle.
B.If not successful, set error "032E", set Cache Error Code = '2', and return failure.

C.Set Cache Error Code = '0'

D.Set return code to success.


II.Processing Based on Mode.


A.If Cache Action Code is 'A'  CACHE_ADD:

1.Add the element to the cache.
2.If  jdeCacheAdd fails to add the element return CACHE_ERROR.

B.If Cache Action Code is 'D'  CACHE_DELETE:

1.Delete the element from the cache.
2.If  Delete fails set error"032E", Return CACHE_ERROR.


C.If Cache Action Code is 'T'  CACHE_TERMINATE:

1.Terminate the Percent Cache.
2.If  Terminate fails set error "032E", Return CACHE_ERROR.


D.If Cache Action Code is 't'  CACHE)TERMINATE2:

1.Terminate the Total Cache.
2.If  Terminate fails set error "032E" , return CACHE_ERROR.

.


E.If Cache Action Code is 'V'  VERIFY_PERCENT:

1.Open the cursor for PercentCache
2.If  Open is succesfull, add all the dates in the Percent cache (Effective from and Effective 

Through + 1) to the Total Cache.

3.The last date in the total cache should not be processed so we need to remove it from the total 

cache. To do this we loop through all the dates and take one day from the last date.

4.Now we loop through all the dates in the Percent cache and through all the dates in the Total 

Cache (inner loop) if the date in the Total cache is within effective from and effective thru 

accumulate the total cache.

5.Now we loop through all Total Cache Dates . If all the corresponding totals are equal to 100 

return PERCENT_SUCCESS. If One (or more ) of the totals is not equal to 100 return PERCENT_ERROR.  

6.Note that during the call to VERIFY_PERCENT any call to a cache API that fails, we return a 

CACHE_ERROR.


^

Data Structure

D3401350 - Verify Supplier Percentages


Data Item Data Structure DescriptionI/ORequiredNotes

JOB            Job Number                        I/OY      Job Number as string for 

cache name

AN8            Address Number                  IN

EFFF            Effective from (Date)            IN

EFFT            Effective Thru (Date)            IN

VSPC            Percent Split                  IN      Used to calculate the total   

                                    

                                                                        percentage

EV01            Cache Action Code                  IY      'A' adds the cache 

                                                                        'D' deletes the cache 

                                                                        'T' terminates the 

PercentCache 

                                                                        't' terminates the TotalCache 


                                                                        'V' verifies that the total 

of the 

                                                                            percentages is 100.

EV01            ErrorSuccessMessage            ON      '0' = Success  

                                                                        '1' = Percent Error 

                                                                        '2' = Cache Error 

INT01            Number of Keys                  IN      Number of Keys to be used in 

the 

                                                                        cache process. It is 

initialized to                                                                                                 

                                    

                                                                        2.



^

Parameter NameData ItemData TypeReq/OptI/O/Both
mnAddressNumberAN8MATH_NUMERICNONENONE

A number that identifies an entry in the Address Book system, such as employee, applicant, participant, customer, supplier, tenant, or 
location.

mnSplitpercentageVSPCMATH_NUMERICNONENONE

The percentage applied. For Suppler Release Scheduling:  The percentage of the planned quantity that the system applies to the 
corresponding supplier. The total planned quantity must equal 100%. Otherwise, the system displays an error message.

jdEffectiveFromDateEFFFJDEDATENONENONE

A date that indicates one of the following:     o When a component part goes into effect on a bill of material     o When a routing step goes into 
effect as a sequence on the routing for an item     o When a rate schedule is in effect The default is the current system date. You can enter 
future effective dates so that the system plans for upcoming changes. Items that are no longer effective in the future can still be recorded and 
recognized in Product Costing, Shop Floor Management, and Capacity Requirements Planning. The Material Requirements Planning system 
determines valid components by effectivity dates, not by the bill of material revision level. Some forms display data based on the effectivity 
dates you enter.

jdEffectiveThruDateEFFTJDEDATENONENONE

A date that indicates one of the following:     o When a component part is no longer in effect on a bill of material     o When a routing step is no 
longer in effect as a sequence on the routing for an item     o When a rate schedule is no longer active The default is December 31 of the 
default year defined in the Data Dictionary for Century Change Year. You can enter future effective dates so that the system plans for upcoming 
changes. Items that are no longer effective in the future can still be recorded and recognized in Product Costing, Shop Floor Management, 
and Capacity Requirements Planning. The Material Requirements Planning system determines valid components by effectivity dates, not by 
the bill of material revision level. Some forms display data based on the effectivity dates you enter.

cErrorSuccessMessageEV01charNONENONE

An option that specifies the type of processing for an event.

nNumberOfKeysINT01integerNONENONE

Number of Days in Future to Query for Responses Due. 

cActionCodeEV01charNONENONE

An option that specifies the type of processing for an event.

szJobNumberJOBcharNONENONE

Job Number

mnTotalPercentageTOTOWMATH_NUMERICNONENONE

The total of the period percentage amounts for the Depreciation Spread Pattern.

Related Functions

None

Related Tables

None