!!Benefit Enrollment Information

!Functionality:
This function retrieves information as seen on [IBEN}, for an employee's benefit enrollment.

!Parameters:

|EEM_ID        | The actual ID for the employment record of the employee you are getting data for
|PLAN_CODE     | The plan code you are retrieving
|WHAT          | Identifies which element of the IBEN display you want to access.  This must be one of the values as noted below.
|AS_OF         | ''Optional.'' Provides a date frame to retrieve the data.  If it is not provided, the current system date will be used.
|FLAGS         | ''Optional.'' If set to "N" will return values for un-enrolled records.  Otherwise only Enrolled records are retrieved.  

!WHAT Parameter Values
* Any field name from [P2K_BE_ENROLLMENT_DETAILS]
* {{__COVERAGE_CODE__}} - This will return the actual coverage code that the employee is enrolled in
* {{__BCG.''xxxxx''__}} - Any field name (the ''xxxxx'') from [P2K_BE_COVERAGES] for the coverage that the employee is enrolled in
* {{__BC-B''nnnn''__}} - This will return the [AMOUNT] or [AMOUNT_OVERRIDE] for the component value where ''nnnn'' is the benefit component code
* {{__RECIPIENT_COUNT__}} - Will Return the number of recipients by plan from IBRA/IBRP
* {{__RECIPIENT_COUNT_18__}} - Will Return the number of recipients by plan from IBRA/IBRP that are less than 18 years old

* {{__ON_SCHEDULE__}} - If the employee indicated is eligible for the plan(according to IBSC schedule only) , you will get back “Y”.  Otherwise you will  get back “N”.  See below for schedule eligibility steps.

!Returns: 
Varchar2  (regardless of the type of data being requested)

!Errors:  
* If the employee is not enrolled as of the date specified, and the FLAGS parameter is set to "Y" (default) then NULL is returned
* If an invalid PLAN_CODE parameter is passed, then {{NO SUCH PLAN}} is returned
* If no Enrollment record is found for that employee/plan combination, then {{NO ENROLLMENT}} is returned
* If no enrollment detail information is found as of the date specified (corrupt data), then {{NO BEN DETAIL}} is returned
* If a bad benefit component code is provided, then {{BAD BC CODE}} is returned
* If the BC Code provided does not appear in the enrollment record (plan definition), then {{NO BC CODE}} is returned
* If an invalid WHAT parameter is provided, then {{BAD WHAT}} is returned.
* If you are requesting ON_SCHEDULE, and there is an issue retrieving the employee assignment information {{NO ASSIGNMENT INFO}} is returned
* If you are requesting ON_SCHEDULE, and there is an issue retrieving the benefit schedule information {{*BAD SCHEDULE}} is returned

!Example: 

{{P2K_PU.BEN(~,'VISION','ELIGIBILITY_START_DATE')}}

Will return the [ELIGIBILITY_START_DATE] for the employee's VISION plan enrollment record.

{{P2K_PU.BEN(~,'MED KAISER FLEX','BC-B1040')}}

Will return the deduction amount [BC-B1040] for the employee's MED KAISER FLEX

!Notes
* If a Benefit Component value is requested, the [AMOUNT_OVERRIDE] will be returned.  If this field is zero or NULL, then the [AMOUNT] field will be returned.

* If you want to retrieve records even if the employee is no longer enrolled in the plan, then set the FLAGS parameter to "N"

* Eligibility (for ON_SCHEDULE) is determined by:
** Plan is Not scheduled (on IBPN)
** Employee is specifically scheduled for this plan (IBSC)
** Employee’s Entity-Unit-Group (as of the AS_OF date) are scheduled for this plan (IBSC)
** Employee’s Entity-Unit (as of the AS_OF date) are scheduled for this plan (IBSC)
** Employee’s Entity (as of the AS_OF date) are scheduled for this plan (IBSC)
** All employees are scheduled for this plan (IBSC)


----
![Notes|Edit:Internal.P2K_PU.BEN]
[{InsertPage page='Internal.P2K_PU.BEN' default='Click to create a new notes page'}]