Adding Price-by Key Fields
You might need to add more price by keys than those delivered with the system data. The following steps provide an example of how to add item weight using the All Price-by Key Fieldnames page. You can follow the same steps to add other fields.
Note: Adding price by key fields for records that are not already being used by Enterprise Pricer is considered a customization.
Follow these steps to add item weight as a pricing key to PeopleSoft Enterprise Pricer:
Add the INV_ITEM_UOM record and the SHIPPING_WEIGHT field on the All Price-by Key Fieldnames page.
Assign the new SHIPPING_WEIGHT field to the transaction code that you are using on the Price Key Fields page.
Select the new SHIPPING_WEIGHT field from the list at the bottom of the page. Click the Build Price-by Key fields button to associate the new field to the transaction code.
If the new field requires a table to prompt for valid values when the pricing key is used on the price rule, create a view and assign the prompt table to the pricing key on the Price Key Fields page.
This is the same page you used in step 2.
If no prompt table is assigned to a pricing key, you can enter any value on the price rule for that field.
You may need to modify the PeopleCode to recognize the new pricing key. When a new pricing key is added to the list of available keys and it is assigned to a transaction code, it may require a change to the PeopleCode method used to pass a value to that new pricing key. The following method in PeopleSoft CRM contains the logic used to pass a value for each pricing key defined for the Order Capture transaction code. If a new pricing key is added to the transaction code, you should review the following PeopleCode program to make sure that the pricing key is used by the system:
Application Package: RB_PRICER:PricingUtil:InputList
Method: CreatePricingKeysLocal( )
This method is used to assign a value from PeopleSoft Order Capture to each pricing key defined for the Order Capture transaction code. If multiple pricing keys are defined for the same record, you modify the PeopleCode only once. Subsequently, you can select any field from that record as a pricing key without having to modify the code. You can modify the code in CreatePricingKeysLocal( ) to handle all the fields from a specific record without having to specify the field name.
In other cases, the value for a field will require more logic to determine what value to assign to the pricing key. If you must add a new record for which all the fields can be used as pricing keys to the PeopleCode, you use the same logic and add a new condition to the Evaluate logic. For example, if you need to add multiple fields from record INV_ITEM_UOM to the list of pricing keys, you can add the following condition:
When Record.INV_ITEM_UOM &recItemUom = createrecord(RECORD.INV_ITEM_UOM); &recItemUom.SETID.value = %Super.ProductSetid; &recItemUom.INV_ITEM_ID.value = %This.GetInvItemId(&recLine.PRODUCT_ ID.Value); &recItemUom.UNIT_OF_MEASURE.value = &recLine.UNIT_OF_MEASURE.value; &recItemUom.SelectByKey(); &strValue = &recItemUom.GetField(@("FIELD." | &strFieldname)).Value; Break;
You can add the PeopleCode once and then use any field from record INV_ITEM_UOM as a pricing key.
Example
The following example shows the code that you need when more logic is needed in order to determine the value for a specific pricing key. When the pricing key is INV_ITEM_UOM.SHIPPING_WEIGHT, you can run the GetWeight( ) method to calculate the weight for the item:
When Record.INV_ITEM_UOM Evaluate &strFieldname When Field.SHIPPING_WEIGHT &strValue = %This.GetWeight(&recLine.PRODUCT_ID.value, &recLine.UNIT_OF_MEASURE.value); Break;
This is the existing and new code for the customization:
rem ================================================================== rem Method: CreatePricingKeysLocal rem rem Description: Pass the pricing key information to the engine. rem ==================================================================; method CreatePricingKeysLocal /+ &objLine as EOEP_PRICER:DataStructure:Line, +/ /+ &recLine as Record +/ Local integer &iCount, &iCount2; Local Record &recAppkeyFld, &recDestination; Local string &strFieldname, &strValue, &strVoid; Local number &numBO, &numShipToBoid, &numProfileSeq; Local boolean &bRetVal; Local RO_CAPTURE:BusinessLogic:Records:Destination &objDestination; Local array of string &arrReturn; For &iCount = 1 To &c_rsPricingKeys.ActiveRowCount &recAppkeyFld = (&c_rsPricingKeys)(&iCount).PW_PRCKEY_VW; &strFieldname = &recAppkeyFld.FIELDNAME.Value; &strValue = ""; When Record.RO_HEADER rem -----------------------------------------------------------; rem Copy key value from header ; rem -----------------------------------------------------------; &strValue = %Super.HeaderRec.GetField(@("FIELD." | &strFieldname)).Value; Break; When Record.INV_ITEM_UOM rem -----------------------------------------------------------; rem Copy key value from Inventory Item UOM ; rem -----------------------------------------------------------; &recItemUom = createrecord(RECORD.INV_ITEM_UOM); &recItemUom.SETID.value = %Super.ProductSetid; &recItemUom.INV_ITEM_ID.value = %This.GetInvItemId(&recLine.PRODUCT_ ID.Value); &recItemUom.UNIT_OF_MEASURE.value = &recLine.UNIT_OF_MEASURE.value; &recItemUom.SelectByKey(); &strValue = &recItemUom.GetField(@("FIELD." | &strFieldname)).Value; Break; . . . End-Evaluate; If &strValue <> "" Then %This.AddPricingKey(&objLine, &recAppkeyFld.EOEP_KEY_FLD_CD.Value, &str Value); End-If; End-For;
This is the new code for the customization to retrieve values from the table and pass them to the pricing engine:
When Record.INV_ITEM_UOM rem -----------------------------------------------------------; rem Copy key value from Inventory Item UOM ; rem -----------------------------------------------------------; &recItemUom = createrecord(RECORD.INV_ITEM_UOM); &recItemUom.SETID.value = %Super.ProductSetid; &recItemUom.INV_ITEM_ID.value = %This.GetInvItemId(&recLine.PRODUCT_ ID.Value); &recItemUom.UNIT_OF_MEASURE.value = &recLine.UNIT_OF_MEASURE.value; &recItemUom.SelectByKey(); &strValue = &recItemUom.GetField(@("FIELD." | &strFieldname)).Value; Break; . . . End-Evaluate;