Total Pageviews

Thursday, December 16, 2010

Code for Component Interface Mapping for level2

Changes Made for Dynamically generated Code By CI. If Any simplifications are there in code please send a Post.
Note:please drag the  code into Source Component last level record save pre change event.

Local File &fileLog;
Local ApiObject &oSession, &oNdes4Ci;
Local ApiObject &oNstdTbl5Collection, &oNstdTbl5;
Local ApiObject &oNstdTbl6Collection, &oNstdTbl6;

Function errorHandler()
   Local ApiObject &oPSMessageCollection, &oPSMessage;
   Local number &i;
   Local string &sErrMsgSetNum, &sErrMsgNum, &sErrMsgText, &sErrType;

   &oPSMessageCollection = &oSession.PSMessages;
   For &i = 1 To &oPSMessageCollection.Count
      &oPSMessage = &oPSMessageCollection.Item(&i);
      &sErrMsgSetNum = &oPSMessage.MessageSetNumber;
      &sErrMsgNum = &oPSMessage.MessageNumber;
      &sErrMsgText = &oPSMessage.Text;
      &fileLog.WriteLine(&sErrType | " (" | &sErrMsgSetNum | "," | &sErrMsgNum | ") - " | &sErrMsgText);
   End-For;
   rem ***** Delete the Messages from the collection *****;
   &oPSMessageCollection.DeleteAll();
End-Function;

try
   rem ***** Set the Log File *****;
   &fileLog = GetFile("C:\temp\NDES4_CI.log", "w", "a", %FilePath_Absolute);
   &fileLog.WriteLine("Begin");
   rem ***** Get current PeopleSoft Session *****;
   &oSession = %Session;

   rem ***** Set the PeopleSoft Session Error Message Mode *****;
   rem ***** 0 - None *****;
   rem ***** 1 - PSMessage Collection only (default) *****;
   rem ***** 2 - Message Box only *****;
   rem ***** 3 - Both collection and message box *****;
   &oSession.PSMessagesMode = 1;

   rem ***** Get the Component Interface *****;
   &oNdes4Ci = &oSession.GetCompIntfc(CompIntfc.NDES4_CI);
   If &oNdes4Ci = Null Then
      errorHandler();
      throw CreateException(0, 0, "GetCompIntfc failed");
   End-If;

   rem ***** Set the Component Interface Mode *****;
   &oNdes4Ci.InteractiveMode = False;
   &oNdes4Ci.GetHistoryItems = True;
   &oNdes4Ci.EditHistoryItems = False;

   rem ***** Set Component Interface Get/Create Keys *****;
   &oNdes4Ci.NSTDID = NSTD_TBL1.NSTDID.Value;

   rem ***** Execute Get *****;
   REM If Not &oNdes4Ci.Get() Then
rem ***** No rows exist for the specified keys.*****;
   REM errorHandler();
   REM throw CreateException(0, 0, "Get failed");
   REM End-If;

   rem ***** Execute Create ******;
   If Not &oNdes4Ci.Create() Then;
      rem ***** Unable to Create Component Interface for the Add keys provided. *****;
      errorHandler();
      throw CreateException(0, 0, "Create failed");
   End-If;


   rem ***** Begin: Get/Set Component Interface Properties *****;
   rem ***** Get/Set Level 0 Field Properties *****;
   &oNdes4Ci.NSTDID = NSTD_TBL1.NSTDID.Value;
   &fileLog.WriteLine("&oNdes4Ci.NSTDID = " | &oNdes4Ci.NSTDID);


   &oNdes4Ci.NSTDNAME = NSTD_TBL1.NSTDNAME.Value;
   &fileLog.WriteLine("&oNdes4Ci.NSTDNAME = " | &oNdes4Ci.NSTDNAME);

   &oNdes4Ci.NSTDGROUP = NSTD_TBL1.NSTDGROUP.Value;
   &fileLog.WriteLine("&oNdes4Ci.NSTDGROUP = " | &oNdes4Ci.NSTDGROUP);

   rem ***** Set/Get NSTD_TBL5 Collection Field Properties -- Parent: PS_ROOT Collection *****;
   &oNstdTbl5Collection = &oNdes4Ci.NSTD_TBL5;
   Local integer &i16;
   For &i16 = 1 To &oNstdTbl5Collection.Count;
      &oNstdTbl5 = &oNstdTbl5Collection.Item(&i16);
      &oNstdTbl5.NINSTID = NSTD_TBL2.NINSTID.Value;
      &fileLog.WriteLine("&oNstdTbl5.NINSTID = " | &oNstdTbl5.NINSTID);
    
      &oNstdTbl5.NINSTNAME = NSTD_TBL2.NINSTNAME.Value;
      &fileLog.WriteLine("&oNstdTbl5.NINSTNAME = " | &oNstdTbl5.NINSTNAME);
    
      &oNstdTbl5.LOC = NSTD_TBL2.LOC.Value;
      &fileLog.WriteLine("&oNstdTbl5.LOC = " | &oNstdTbl5.LOC);
    
    
      rem ***** Set NSTD_TBL6 Collection Field Properties -- Parent: NSTD_TBL5 Collection *****;
      rem &oNstdTbl6Collection = &oNstdTbl5.NSTD_TBL6;
      Local integer &i210;
      For &i210 = 1 To &oNstdTbl6Collection.Count;
         &oNstdTbl6 = &oNstdTbl6Collection.Item(&i210);
         &oNstdTbl6.N_M1 = NSTD_TBL3.N_M1.Value;
         &fileLog.WriteLine("&oNstdTbl6.N_M1 = " | &oNstdTbl6.N_M1);
      
         &oNstdTbl6.N_M2 = NSTD_TBL3.N_M2.Value;
         &fileLog.WriteLine("&oNstdTbl6.N_M2 = " | &oNstdTbl6.N_M2);
      
         &oNstdTbl6.N_TOTAL = NSTD_TBL3.N_TOTAL.Value;
         &fileLog.WriteLine("&oNstdTbl6.N_TOTAL = " | &oNstdTbl6.N_TOTAL);
      
         &oNstdTbl6.GRADE = NSTD_TBL3.GRADE.Value;
         &fileLog.WriteLine("&oNstdTbl6.GRADE = " | &oNstdTbl6.GRADE);
      
      End-For;
   End-For;
   rem ***** End: Get/Set Component Interface Properties *****;

   rem ***** Execute Save *****;
   If Not &oNdes4Ci.Save() Then;
      errorHandler();
      throw CreateException(0, 0, "Save failed");
   End-If;

   rem ***** Execute Cancel *****;
   If Not &oNdes4Ci.Cancel() Then;
      errorHandler();
      throw CreateException(0, 0, "Cancel failed");
   End-If;

catch Exception &ex
   rem Handle the exception;
   &fileLog.WriteLine(&ex.ToString());
end-try;
&fileLog.WriteLine("End");
&fileLog.Close();

Wednesday, December 15, 2010

Preventing Inserting Rows Using Peoplecode

The PeoleCode below will prevent users from inserting more than 2 rows on a grid. The "+" button will disappear the moment a 2nd row is added by a user. I have place this code on a record field under rowinit event. why because with out Getrowset()(Scroll.Rec Name)  by default the active row count will be 1.So the condition is satisfied for first row.For second row it'll not satisfy the condition So it cannot accept to insert 2nd row.
If GetRowset().ActiveRowCount = 1 Then
GetRowset().InsertEnabled = True;
Else
GetRowset().InsertEnabled = False;
End-If;

Important Hcm Tables


            1. Human Resources Information/ Personal Data:

PERSONAL_DATA,               PERS_NID
 
                                       2. Employment Data:

                      
EMPLOYMENT
- general employment data, such as various service dates, etc.
 
                                3. Department Information
 
                         
DEPT_TBL
This is one of foundation tables in HR. You will rarely query against it directly; more likely you will join to it to get the description or short description. Department codes in PeopleSoft are different from what was used in HRS/Legacy, and department data is effective dated.
 
                                    4. Job code information
 
                          JOBCODE_TBL
This is also a foundation table. This table holds job codes, descriptions and related  data such as FLSA classification, pay plan, grade and structure information.
 
                                       5. Job Data:

                                      JOB
 Job (roughly equates to assignment records in legacy). Contains job records along with other data. Effective dated someone's job history will be stored in this table. Remember, Empl Records refer to an employee's job record(s). The existence of multiple Empl Records means that they have
had or are currently holding multiple jobs Empl Records start with 0, and their benefits are tied to Empl Record #0.
 
                                6. Benefits Data :


BEN_PROG_PARTIC – Stores the Benefit Program to which the employee is assigned.

LEAVE_PLAN – Stores enrollment in leave plans.

HEALTH_BENEFIT – Stores e nrollment in health insurance plans.

SAVINGS_PLAN -- Stores enrollment in TDA, ORP and Deferred Compensation

LIFE_ADD_BEN -- Stores enrollment in life insurance plans.

RTRMNT_PLAN – Stores TRS enrollment.

DISABILITY_BEN – Stores enrollment in disability plans.
 
 
                                           7. Tax Data:

FED_TAX_DATA – Contains federal tax data, including nonresident alien data.

STATE_TAX_DATA – Although there is no state withholding in Texas, this record is necessary to maintain state of residence and unemployment jurisdiction.
 
                                      8. Payroll Data:

Payroll processing check data (records used by the payroll process to store check history)

PAY_CALENDAR,    PAY_CHECK,    PAY_LINE

PAY_CHECK,    PAY_EARNINGS,       PAY_TAX

PAY_DEDUCTION,       PAY_OTH_EARNS 

 
                   9. Payroll funding distribution data (records that tie funding to payroll actuals):


PAY_ERN_DIST,   PAY_DED_DIST,   PAY_TAX_DIST
 
                 10. Other employee level payroll data:


GENL_DEDUCTION - Genearl deduction.

GENL_DED_CD        - General deduction code.

ADDL_PAY_EFFDT -  additional pay effdt.

ADDL_PAY_DATA   - additional pay data.

ADDL_PAY_ERNCD - additional pay earn code.

DIRECT_DEPOSIT  - Direct deposit.

DIR_DEP_DISTRIB - Direct deposit distribution.
 
                   
                               11. Position Data:

POSITION_DATA—identifies position data for each business unit.

                                  12.Tenure Data:

EG_TENURE  Tenure Data.

Important Hrms Tables

Human Resources Information foundations tables:
JOB -- Contains job records along with other data. Effective dated someone's job history will be stored in this table.
Key Fields:
EMPLID
EMPL_RCD
EFFDT
EFFSEQ

DEPT_TBL -- Get the description or short description. Department codes in PeopleSoft are different from what was used in HRS/Legacy, and department data is effective dated.
Key Fields:
SETID
DEPTID
EFFDT

JOBCODE_TBL -- This table holds job codes, descriptions and related data such as FLSA classification, pay plan, grade and structure information.
Key Fields:
SETID
JOBCODE
EFFDT

EMPLOYEES –
Key Fields:
EMPLID
EMPL_RCD

EMPLOYMENT-- General employment data, such as various service dates, etc.
Key Fields:
EMPLID
EMPL_RCD#

COMPANY_TBL --
Key Fields:
COMPANY
EFFDT

PERSONAL_DATA – Contains the Personal Data of employees
Key Fields:
EMPLID

PERS_NID –
Key Fields:
EMPLID

Benefits Data:
BEN_PROG_PARTIC – Stores the Benefit Program to which the employee is assigned.

LEAVE_PLAN – Stores enrollment in leave plans.
HEALTH_BENEFIT – Stores enrollment in health insurance plans
SAVINGS_PLAN -- Stores enrollment in TDA, ORP and Deferred Compensation
LIFE_ADD_BEN -- Stores enrollment in life insurance plans.
RTRMNT_PLAN – Stores TRS enrollment.
DISABILITY_BEN – Stores enrollment in disability plans.
BENEF_PLAN_TBL
BENEFIT_VW

Tax Data:
FED_TAX_DATA – Contains federal tax data, including nonresident alien data
STATE_TAX_DATA – Although there is no state withholding in Texas, this record is necessary to maintain state of residence and unemployment jurisdiction.

Payroll Data:
Payroll processing check data (records used by the payroll process to store check history)
PAY_CALENDAR
PAY_CHECK
PAY_LINE
PAY_CHECK
PAY_EARNINGS
PAY_OTH_EARNS
PAY_DEDUCTION
PAY_TAX

Payroll funding distribution data (records that tie funding to payroll actuals):
PAY_ERN_DIST
PAY_DED_DIST
PAY_TAX_DIST

Other employee level payroll data:
GENL_DEDUCTION
GENL_DED_CD
ADDL_PAY_EFFDT
ADDL_PAY_DATA
ADDL_PAY_ERNCD
DIRECT_DEPOSIT
DIR_DEP_DISTRIB

Position Data:
POSITION_DATA—identifies position data for each business unit.

Tenure Data:
EG_TENURE Data

How many types of records are there?
There are six types of records
1. SQL table - Corresponding physical SQL table in the database we create with build option.
2. SQL View – It is not a physical SQL table on the database, it gives the replicate of joined tables. It is used for security and faster access.
3. Dynamic View – It is actually stored in the form of SQL view text and is executed at runtime. It uses the built in indexes. Whereas normal view is executed and stored in the database.
4. Derived/Work record - It is a temporary workspace to be used during on line panel processing and is not stored in the database, therefore derived work records are not built. They cannot be seen in the update/display mode. Once the panel is cancelled it is removed from the buffer.
5. Sub Records – A group of fields commonly used in multiple records.
6. Query View – A Query view is a view constructed using People soft Query tool.
What are the two Processing Modes?
Interactive Mode:
In interactive mode (formerly called standard), when the user exits a field that has a field-level event (for example, FieldChange, FieldEdit, RowInsert PeopleCode, prompt validation, related display, and so on):
  • A transmission to the application server is performed to run that field-level event.
  • The page is displayed again.

Deferred Mode:
Deferred mode enables you to defer many of the conditions that need server processing until running them on the application server is required or requested. For example, when a user exits a field that has a field-level event (like FieldChange or FieldEdit PeopleCode, prompt validation, related display, and so on), that event is not run until the next transmission to the application server. When the next transmission to the server occurs, PeopleTools determines which fields have changed since the last transmission. Logic on