Sunday, January 28, 2018

Behavior of think-time Functions in PeopleSoft

Some issues are uncommon, weird and hard to understand what exactly went wrong. One such weird issue in peoplesoft is related to Think-time functions. I know many of my colleagues who were stressed to the core and said ‘Its time to leave this planet’ because of this peculiar issue in Peoplesoft. Come!! Let’s sort this one out.

Think-time PeopleCode event (<think-time event>), but a SQL update has occurred in the commit interval.

In this article, let’s see what think-time functions are, and some of the limitations that require our attention when dealing with such functions.


Basically, any function that waits for user input or external process to complete is a think time function. Messagebox, for instance, waits for user to click Ok or Cancel button… Exec() function running in synchronous mode which suspends processing until the triggered process is complete.

Listed below are the think-time function in PS

  • DoCancel
  • DoModal
  • DoModalComponent
  • Exec(Only when it runs in Synchronous Mode)
  • AddAttachment, MAddAttachment, ViewAttachment, DetachAttachment
  • InsertImage, CropImage
  • CreateObject, ObjectDoMethod, ObjectSetProperty, ObjectGetProperty(When object Required User- action)
  • Prompt
  • RemoteCall
  • RevalidatePassword
  • WinExec(Only in Synchronous mode)
  • Winmessage and Messagebox(Depending on Style Parameter)
  • Calls to an External DLL

Think-time functions in Application Engine

Are you using Exec() or RemoteCall() in AE to run a batch file or a remote process? You should consider the following then:

Exec(&unixCmd, %Exec_Asynchronous + %FilePath_Absolute); /*Running in Asynchronous mode*/
&ExitCode = Exec(&unixCmd, %Exec_Synchronous + %FilePath_Absolute); /*Running in Synchronous mode*/

Running Exec() in Asynchronous mode is not a think-time function, as the AE process does not wait for the invoked command to complete. With Synchronous mode it is different, because the AE process needs to wait for the invoked command to complete. OH!! That’s Pathetic.. Don’t expect it to wait for you if you haven’t committed pending transactions, you will end up in think-time event error. 

The simple solution here is to issue a Commit before Exec() is invoked. If AE was written to be Restartable, then make sure that the previous step is committed before the step executing Exec. For AE with ‘Disable Restart’ checked, a CommitWork() has to be issued before Exec(). Easy right?

Think-time functions in Component Interface

Think-time functions are usually suppressed and ignored in CI. So, in such cases better to write a separate logic for CI.

If %CompIntfc then
/*Logic for CI*/
Else
/*Get user Input*/
End-if;

Think-time Functions in Peoplecode

Winmessage() and MessageBox() behaves as a think-time function only when the style parameter specifies more than one button. When you make the style parameter to show only Ok Button(0), then it behaves like a normal function. If style is neglected, Winmessage() displays both Ok and Cancel Button which acts as a think-time function. Hence you must always specify with style parameter like Winmessage(“Test Message”, 0) to show only Ok button.

Sometimes you would have noticed that your MessageBox or Winmessage does not work before call to a Transfer or TransferExact function. If you want to display your message, then change the style to show OK and Cancel Button.

It’s not so hard to debug when you receive error in peoplecode related to think-time functions. PeopleBooks suggests us not to use think-time functions in SavePreChange, Workflow, RowSelect, SavePostChange, and any peoplecode event that executes as a result of ScrollSelect, ScrollSelectNew, RowScrollSelect, or RowScrollSelectNew function call, and any peoplecode event that executes as a result of Rowset class Select or SelectNew method. If you are using think-time functions in one of the above events, just get red of it.



6 comments:

  1. Really nice and definitely it will be useful for many people. Kindly keep update like this.

    Logistics Software
    Fleet Management Software
    ERP Software Companies

    ReplyDelete
  2. COEPD LLC- Center of Excellence for Professional Development is the most trusted online training platform to global participants. We are primarily a community of Business Analysts who have taken the initiative to facilitate professionals of IT or Non IT background with the finest quality training. Our trainings are delivered through interactive mode with illustrative scenarios, activities and case studies to help learners start a successful career. We impart knowledge keeping in view of the challenging situations individuals will face in the real time, so that they can handle their job deliverables with at most confidence.

    http://coepd.us/business-analyst-online-training.html

    ReplyDelete
  3. I am trying to print BI reports in sequence, but when I try to loop through, I get these thinktime errors:


    &oReportDefn.ProcessReport(&template, "", %Date, "PDF");
    CommitWork();
    &oReportDefn.DisplayOutput();

    Can you explain this?

    Thanks

    JPS

    ReplyDelete
  4. Amazing Article ! I have bookmarked this article page as i received good information from this. All the best for the upcoming articles. I will be waiting for your new articles. Thank You ! Kindly Visit Us @ Coimbatore Travels | Ooty Travels | Coimbatore Airport Taxi | Coimbatore taxi | Coimbatore Taxi

    ReplyDelete