Tuesday, 16 December 2014

Current Opening for PeopleSoft in Birlasoft

Position - PeopleSoft FSCM Technofunctional Consultant

Location - Noida

Exp - 3+ Years

DoSave() and DoSaveNow() in Peoplecode



Dosave and Dosavenow functions are used to save component programmatically in peoplecode envents.


Getrowset And Createrowset in Peoplecode

Getrowset –is used to get rowset for a record in the component buffer.

Createrowset—is used to create rowset for a record which in database, and is also called a Standalone rowset.

Field Change vs Field Edit in Peoplecode Events

Difference between Field Change and Field Edit Event -


Field Change peoplecode event is for recalculating field values based on changes 
made to other fields e.g suppose u have 2 fields one is rate and other is quantity and there is another field which shows the total cost so whenever a value is changed in any of the above 2 field (rate and quantity) the total cost will also change so on field change event of these 2 fields u can write code to calculate the total cost.


Field edit event is used for validating field values if the field doe'snt pass the validation an error msg is diaplayed and the page is redisplayed with the field marked in red e.g to this could be that u may want that the quantity should not exceed 1000 if it does the system should display an error so u can write a peoplecode for that which will chk the quantity if it is greater than 1000 error msg will be displayed.


Events for error & warning -

Answer :  Field edit, Save edit, Search save, row delete, row insert.

Saturday, 13 December 2014

Events in Peoplecode

Record Field Events
FieldChange event
FieldDefault event
FieldEdit event
FieldFormula event
PrePopup event
RowDelete event
RowInit event
RowInsert event
RowSelect event
SaveEdit event
SavePostChange event
SavePreChange event
SearchInit event
SearchSave event
Workflow event
Component Record Field Events
FieldChange event
FieldDefault event
FieldEdit event
PrePopup event
Component Record Events
RowDelete event
RowInit event
RowInsert event
RowSelect event
SaveEdit event
SavePostChange event
SavePreChange event
SearchInit event
SearchSave event
Component Events
PostBuild event
PreBuild event
SavePostChange event
SavePreChange event
Workflow event
Page Events
Activate
Menu Events
ItemSelected

Standalone Rowset in Peoplecode


It’s a rowset that is outside of the component buffer and not related to the component presently being processed. Since it lies outside the data buffer, we will have to write PeopleCode to perform data manipulations like insert / update / delete.

Creation of Standalone Rowset

We use the below PeopleCode to create a standalone rowset. With this step, the rowset is just created with similar structure to that of the record SAMPLE_RECORD. However, the rowset would be empty at this point.

Local Rowset &rsSAlone;
&rsSAlone = CreateRowset(Record.SAMPLE_RECORD);

Populating  Standalone Rowset

Fill Method

&TRG_ID = '12345';
&rsSAlone.Fill("where TRAINING_ID = :1", &TRG_ID);

FillAppend Method

FillAppend is another method that we can use to populate a standalone rowset. This method appends the database records to the rowset starting from position of (last row + 1). Ie; it keeps the existing row intact and do not flush the rowset first like the Fill method.
&TRG_ID = '12345';
&rsSAlone.FillAppend("where TRAINING_ID = :1", &TRG_ID);

CopyTo Method

Local Rowset &rsSAlone2;
&rsSAlone2 = CreateRowset(Record.SAMPLE_RECORD);
&rsSAlone.CopyTo(&rsSAlone2);

Child Rowsets

Local Rowset &Lvl1, &Lvl2, &Lvl3;
&Lvl3 = CreateRowset(Record.SAMPLE_LVL3_REC);
&Lvl2 = CreateRowset(Record.SAMPLE_LVL2_REC, &Lvl3);
&Lvl1 = CreateRowset(Record.SAMPLE_LVL1_REC, &Lvl2);

Peoplecode to populate data in a Grid

Local Rowset &rset0, &rset1; Local Row &ROW;
&rset0 = GetLevel0(); &rset1 = &rset0(1).GetRowset(Scroll.HRB_ITM_MMT_ADD); &rows = &rset1.ActiveRowCount; Local Record &REC, &REC2; &REC = CreateRecord(Record.MASTER_ITEM_TBL); &REC2 = CreateRecord(Record.HRB_ITM_MMT_ADD);
&BUCOUNT = 1; For &j = 1 To &rset1.ActiveRowCount
&PREVBU = &rset1(&j).GetRecord(Record.HRB_ITM_MMT_ADD).GetField(Field.SETID).Value; &r = CurrentRowNumber();
&rset1.InsertRow(&r); End-For;
The grid is placed on level 1 of a secondary page and is populated using Peoplecode written in the Activate event of the secondary page. We use the SQL object &VCHRS_GRD_SQL to fetch some Voucher IDs and Vendor IDs from the database and populate the grid with these values.

Local SQL &VCHRS_GRD_SQL;
/* SQL object for fetching the vouchers and vendors*/
Local Rowset &VCHRS_GRD_RS;
/*Rowset for accessing the Grid*/
 
&VCHRS_GRD_SQL = CreateSQL("SELECT V.VOUCHER_ID, V.VENDOR_ID FROM PS_VOUCHER V WHERE V.BUSINESS_UNIT =:1 AND V.ACCOUNTING_DT > :2", &SGK_BU, &SGK_ACCTG_DT);
/*creating the SQL statement*/
 
&VCHRS_GRD_RS = GetLevel0()(1).GetRowset(Scroll.SGK_VCHR_DVW);
/*creating a rowset corresponding to the grid */
 
While &VCHRS_GRD_SQL.Fetch(&GRD_VOUCHER_ID, &GRD_VENDOR_ID)
&VCHRS_GRD_RS(1).SGK_VCHR_DVW.VOUCHER_ID.Value = &GRD_VOUCHER_ID;
/*assigning the voucher ID to the filed in the grid */
&VCHRS_GRD_RS(1).SGK_VCHR_DVW.VENDOR_ID.Value = &GRD_VENDOR_ID;
/*assigning the Vendor ID to the filed in the grid */
&VCHRS_GRD_RS.InsertRow(0);
/* inserting a new row at the beginning of the grid*/
End-While;
 
&VCHRS_GRD_RS.DeleteRow(1);
/* deleting the empty row left after all the insertions */
&VCHRS_GRD_SQL.Close();
/* closing the SQL object */