Search This Blog

Friday, October 30, 2009

Creating the CI in easier way and Save the development time

Below are the CI codes manually written without dragging and dropping it. This will help to save the time for developing a CI using peoplecode. What we need to know is the placement of fields in the collection. For example , if the field is in the second collection, access the second collection through the first collection and get the field. Similar to accessing the field in a scroll.

Below is the code for creating a Personal Data CI:

&MYSESSION = %Session;

      &MYCI = &MYSESSION.GetCompIntfc(CompIntfc.CI_PERSONAL_DATA);

      &MYCI.GETHISTORYITEMS = True;

      &MYCI.EDITHISTORYITEMS = True;

      &MYCI.INTERACTIVEMODE = True;

      &MYCI.KEYPROP_EMPLID = "NEW";

      &MYCI.CREATE();

      &MYCI.PROP_BIRTHDATE = &BIRTHDATE;

      &MYCI.PROP_DERIVED_EMP = &EMP;

      &MYCI.PROP_DERIVED_CWR = &CWR;

      &NAME_1 = &MYCI.COLL_NAME_TYPE_VW;

        &LEVEL1_NAME = &NAME_1.item(1);

      &LEVEL1_NAME.KEYPROP_NAME_TYPE = "";

      &NAME_2 = &LEVEL1_NAME.COLL_NAMES;

      &LEVEL1_NAME = &NAME_2.item(1);

      &LEVEL1_NAME.PROP_FIRST_NAME = &FIRST;

      &LEVEL1_NAME.PROP_MIDDLE_NAME = &MIDDLE;

      &LEVEL1_NAME.PROP_LAST_NAME = &LAST;

      &EMPLID_NEW = &MYCI.KEYPROP_EMPLID;

      &MYCI.Save();

     

      If Not &MYCI.Save() Then;

/******Do the processing here*****/

      End-If;

      If &MYCI.Save() Then;

         /****Do the processing here******/

         End-If;

Below is the code for Inserting a new row into the record using CI

&MYJOBSESSION = %Session;

      &MYJOBCI = &MYJOBSESSION.GetCompIntfc(CompIntfc.CI_JOB_DATA_EMP);

      &MYJOBCI.GETHISTORYITEMS = True;

      &MYJOBCI.EDITHISTORYITEMS = True;

      &MYJOBCI.INTERACTIVEMODE = True;

     

      &MYJOBCI.KEYPROP_EMPLID = give emplid;

     &MYJOBCI.KEYPROP_EMPL_RCD = 0;

      &MYJOBCI.CREATE();

     

      &JOBCOLL = &MYJOBCI.COLL_JOB;

      &LEVEL1_JOB = &JOBCOLL.item(1);

     

      &LEVEL1_JOB.PROP_BUSINESS_UNIT = &BU;

      &LEVEL1_JOB.PROP_JOBCODE = &JOBCODE;

      &LEVEL1_JOB.PROP_COMPANY = ∁

      &LEVEL1_JOB.PROP_DEPTID = &DEPT;

      &LEVEL1_JOB.PROP_LOCATION = &LOC;

      &LEVEL1_JOB.PROP_SUPERVISOR_ID = &SUPERID;

     

      &MYJOBCI.Save();

     

      If Not &MYJOBCI.Save() Then;

/*****Do error processing here*********/

      End-If;

      If &MYJOBCI.Save() Then;

/*****Do error processing here*********/

      End-If;

Save the development time and get to know your CI better.

Happy Learning!

No comments:

Post a Comment