Friday, 9 December 2016

Difference between SQLExec and SelectSQL in PeopleSoft

The general commands that we use to select data through People Code are
1. SQL Exec - To select different values of a single row.
2. Select SQL - To select multiple values of multiple rows.

1. SQL Exec Syntax 
SQLExec("select distinct EMPLID,ACAD_PROG from PS_ACAD_PROG where emplid = :1", "20163-19955", "20066", &getEmplidID,&getAcadProg); 
2. Select SQL Syntax

Local SQL &GRD_SQL;
Local Rowset &GRD_RS;
Local Record &rec;
Local Rowset &rsGrid, &rsDataSource;


&GRD_RS.Flush();
 &sSQLWhere = "acad_career = 'UGRD'";
&GRD_SQL = CreateSQL("select distinct emplid , phone from ps_hon_no_vw  where " | &sSQLWhere | "");

  While &GRD_SQL.Fetch(&emplid, &phone_nbr)
        
         &GRD_RS(1).PHN_NO_WRK.EMPLID.Value = &emplid;
        
         &GRD_RS(1).PHN_NO_WRK.PHONE.Value = &phone_nbr;
        
         &GRD_RS.InsertRow(0);
      End-While;
      &GRD_RS.DeleteRow(1);
      &GRD_SQL.Close();
   End-If;

 

Sending E-Mail through People Code

To send E-Mail through People Code, it is essential that your SMTP server is configured.

Use this code for sending E-Mail

      &line1 = "This is your Test E-Mail";
      &line2 = "Hi";
      &line3 = "How are you??";
      &line4 = "Hope you Learn it well";
      &line5 = "Sending by Saim-PeopleSoft";
     
     
     
      &MAIL_FLAGS = 0;
      &MAIL_TO = "saim_anwar@live.com";
      &MAIL_CC = "";
      &MAIL_BCC = "";
      &MAIL_SUBJECT = "My First E-Mail through PeopleCode";
      &MAIL_TEXT = "&line1 | Char(13) | &line2 | Char(13) | &line3 | Char(13) | Char(13) | &line5 | Char(13) | Char(13) | &line4 | Char(13) | Char(13) | Char(13) | "Kind Regards" | Char(13) | "Saim Anwer";
      rem &MAIL_TEXT = "Dear ";
     
      &MAIL_FILES = "";
      &MAIL_TITLES = "";
      &MAIL_FROM = "saim@testemail.com";
      &MAIL_SEP = ";";
      &CONTTYPE = "";
      &REPLYTO = "";
      &SENDER = "";
     
      &RET = SendMail(&MAIL_FLAGS, &MAIL_TO, &MAIL_CC, &MAIL_BCC, &MAIL_SUBJECT, &MAIL_TEXT, &MAIL_FILES, &MAIL_TITLES, &MAIL_FROM, &MAIL_SEP, &CONTTYPE, &REPLYTO, &SENDER);
     
      If &RET <> 0 Then
         MessageBox(0, "", 0, 0, "Return code from SendMail= " | &RET);
         /*Do error processing here*/
      End-If;
     

Sunday, 4 December 2016

Page Transfer

Transfer Page Dynamically

use the following Peoplecode

Transfer( True, MenuName.IOBM_FINANCE_PROCESS, BarName.IOBM_PROCESS_FINANCE, ItemName.IOBM_USER_PROF_CP, Page.IOBM_USER_PROF_PG, "A");





True for new Window
False for Current Window

You can perform following actions(%Action)
  • A = add
  • U = update
  • L = update/display all
  • C = correction
  • E = data entry