<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://blog.jbheren.com/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>Blog pro de Jean-Baptiste HEREN - Peoplesoft</title>
  <link>http://blog.jbheren.com/</link>
  <atom:link href="http://blog.jbheren.com/feed/category/Peoplesoft/rss2" rel="self" type="application/rss+xml"/>
  <description>Notes d'un consultant freelance en informatique</description>
  <language>fr</language>
  <pubDate>Fri, 11 May 2012 15:27:06 +0200</pubDate>
  <copyright></copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>Finding one component location in the peoplesoft portal</title>
    <link>http://blog.jbheren.com/post/2011/05/26/finding-one-component-location-in-the-peoplesoft-portal</link>
    <guid isPermaLink="false">urn:md5:14497fbf989f6f1bb6d409ebae6004e2</guid>
    <pubDate>Thu, 26 May 2011 11:50:00 +0200</pubDate>
    <dc:creator>Jean-Baptiste HEREN</dc:creator>
        <category>Peoplesoft</category>
            
    <description>    &lt;p&gt;Just replace the 'MY_COMPONENT_GBL' parameter in the following sql script. This works for MS SQl Server. You can add more levels by adding Outer Joins.&lt;/p&gt;

&lt;pre&gt;[SQL]
/* Where is my component in the portal */
SELECT
A.PORTAL_NAME,
E.PORTAL_LABEL AS Parent4_folder,
D.PORTAL_LABEL AS Parent3_folder,
C.PORTAL_LABEL AS Parent2_folder,
B.PORTAL_LABEL AS Parent_folder,
A.PORTAL_LABEL AS Component
FROM
PSPRSMDEFN A
LEFT JOIN PSPRSMDEFN B
ON B.PORTAL_NAME = A.PORTAL_NAME
AND B.PORTAL_OBJNAME = A.PORTAL_PRNTOBJNAME
LEFT JOIN PSPRSMDEFN C
ON C.PORTAL_NAME = B.PORTAL_NAME
AND C.PORTAL_OBJNAME = B.PORTAL_PRNTOBJNAME
LEFT JOIN PSPRSMDEFN D
ON D.PORTAL_NAME = C.PORTAL_NAME
AND D.PORTAL_OBJNAME = C.PORTAL_PRNTOBJNAME
LEFT JOIN PSPRSMDEFN E
ON E.PORTAL_NAME = D.PORTAL_NAME
AND E.PORTAL_OBJNAME = D.PORTAL_PRNTOBJNAME
WHERE A.PORTAL_REFTYPE = 'C'
-- Parameter to set :
  AND A.PORTAL_URI_SEG2 = 'MY_COMPONENT_GBL'
&lt;/pre&gt;


&lt;p&gt;Thanks to François R. for the following code which will do the same recursively. (Oracle only)&lt;/p&gt;

&lt;pre&gt;[SQL]
SELECT DISTINCT RTRIM(REVERSE
(SYS_CONNECT_BY_PATH(REVERSE
((SELECT B.PORTAL_LABEL FROM PSPRSMDEFNLANG B 
WHERE A.PORTAL_NAME = B.PORTAL_NAME
AND A.PORTAL_OBJNAME = B.PORTAL_OBJNAME
AND A.PORTAL_REFTYPE = B.PORTAL_REFTYPE
AND B.LANGUAGE_CD = 'FRA')), ' &amp;gt; ')), ' &amp;gt; ') CHEMIN
FROM PSPRSMDEFN A
WHERE A.PORTAL_NAME = 'EMPLOYEE'
AND A.PORTAL_PRNTOBJNAME = 'PORTAL_ROOT_OBJECT'
START WITH PORTAL_URI_SEG2 = 'MY_COMPONENT'
CONNECT BY PRIOR A.PORTAL_PRNTOBJNAME = A.PORTAL_OBJNAME;
&lt;/pre&gt;</description>
    
    
    
          <comments>http://blog.jbheren.com/post/2011/05/26/finding-one-component-location-in-the-peoplesoft-portal#comment-form</comments>
      <wfw:comment>http://blog.jbheren.com/post/2011/05/26/finding-one-component-location-in-the-peoplesoft-portal#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.jbheren.com/feed/atom/comments/61</wfw:commentRss>
      </item>
    
  <item>
    <title>Peoplesoft Component interface HOWTO</title>
    <link>http://blog.jbheren.com/post/2011/01/13/Peoplesoft-Component-interface-HOWTO</link>
    <guid isPermaLink="false">urn:md5:519990bf61b5c69cea1c4e0e340b8405</guid>
    <pubDate>Thu, 13 Jan 2011 06:12:00 +0100</pubDate>
    <dc:creator>Jean-Baptiste HEREN</dc:creator>
        <category>Peoplesoft</category>
        <category>Application designer</category><category>Component Interface</category><category>Peoplecode</category><category>peoplesoft</category>    
    <description>&lt;p&gt;Here is a tutorial explaining how you can create a function containing one Component INterface, and make use of it from any peolplecode.&lt;/p&gt;


&lt;p&gt;Following example takes the PO Receipt Component to make automatic receipts from a barcode screen.&lt;/p&gt;    &lt;h2&gt;1- Create a new Component Interface with Application designer&lt;/h2&gt;


&lt;p&gt;In application Designer, Select File-&amp;gt;New-&amp;gt;Component Interface&lt;/p&gt;


&lt;p&gt;&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/component_interface/02_-_new_component_interface.png&quot; title=&quot;02_-_new_component_interface.png&quot;&gt;&lt;img src=&quot;http://blog.jbheren.com/public/peoplecode/component_interface/.02_-_new_component_interface_m.jpg&quot; alt=&quot;02_-_new_component_interface.png&quot; title=&quot;02_-_new_component_interface.png, janv. 2011&quot; /&gt;&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;Select The Component you want to access to&lt;/p&gt;


&lt;p&gt;&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/component_interface/03_-_select_component.png&quot; title=&quot;03_-_select_component.png&quot;&gt;&lt;img src=&quot;http://blog.jbheren.com/public/peoplecode/component_interface/.03_-_select_component_m.jpg&quot; alt=&quot;03_-_select_component.png&quot; title=&quot;03_-_select_component.png, janv. 2011&quot; /&gt;&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;Answer YES to following question&lt;/p&gt;


&lt;p&gt;&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/component_interface/04_-_set_default_properties.png&quot; title=&quot;04_-_set_default_properties.png&quot;&gt;&lt;img src=&quot;http://blog.jbheren.com/public/peoplecode/component_interface/.04_-_set_default_properties_m.jpg&quot; alt=&quot;04_-_set_default_properties.png&quot; title=&quot;04_-_set_default_properties.png, janv. 2011&quot; /&gt;&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;Now your componet has been created, you can just save IT&lt;/p&gt;


&lt;p&gt;&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/component_interface/05_-_component_is_created.png&quot; title=&quot;05_-_component_is_created.png&quot;&gt;&lt;img src=&quot;http://blog.jbheren.com/public/peoplecode/component_interface/.05_-_component_is_created_m.jpg&quot; alt=&quot;05_-_component_is_created.png&quot; title=&quot;05_-_component_is_created.png, janv. 2011&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/component_interface/06_-_component_interface_save_as.png&quot; title=&quot;06_-_component_interface_save_as.png&quot;&gt;&lt;img src=&quot;http://blog.jbheren.com/public/peoplecode/component_interface/.06_-_component_interface_save_as_m.jpg&quot; alt=&quot;06_-_component_interface_save_as.png&quot; title=&quot;06_-_component_interface_save_as.png, janv. 2011&quot; /&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;2- Write Peoplecode for you CI&lt;/h2&gt;


&lt;h3&gt;2.1- Drag and drop the Component Interface to the Peoplecode text window. Il will create a template to adapt:&lt;/h3&gt;

&lt;pre&gt;&lt;/pre&gt;
&lt;pre&gt;[vb]
Local File &amp;amp;fileLog; 
Local ApiObject &amp;amp;oSession, &amp;amp;oMYCINAMEPoRecv; 
 
Function errorHandler() 
	Local ApiObject &amp;amp;oPSMessageCollection, &amp;amp;oPSMessage; 
	Local number &amp;amp;i; 
	Local String &amp;amp;sErrMsgSetNum, &amp;amp;sErrMsgNum, &amp;amp;sErrMsgText, &amp;amp;sErrType; 
 
	&amp;amp;oPSMessageCollection = &amp;amp;oSession.PSMessages; 
	For &amp;amp;i = 1 To &amp;amp;oPSMessageCollection.Count 
		&amp;amp;oPSMessage = &amp;amp;oPSMessageCollection.Item(&amp;amp;i); 
		&amp;amp;sErrMsgSetNum = &amp;amp;oPSMessage.MessageSetNumber; 
		&amp;amp;sErrMsgNum = &amp;amp;oPSMessage.MessageNumber; 
		&amp;amp;sErrMsgText = &amp;amp;oPSMessage.Text; 
		&amp;amp;fileLog.WriteLine(&amp;amp;sErrType | &amp;quot; (&amp;quot; | &amp;amp;sErrMsgSetNum | &amp;quot;,&amp;quot; | &amp;amp;sErrMsgNum | &amp;quot;) - &amp;quot; | &amp;amp;sErrMsgText); 
	End-For; 
	rem ***** Delete the Messages from the collection *****; 
	&amp;amp;oPSMessageCollection.DeleteAll(); 
End-Function; 
 
try 
	rem ***** Set the Log File *****; 
	&amp;amp;fileLog = GetFile(&amp;quot;C:\temp\MY_CI_NAME.log&amp;quot;, &amp;quot;w&amp;quot;, &amp;quot;a&amp;quot;, %FilePath_Absolute); 
	&amp;amp;fileLog.WriteLine(&amp;quot;Begin&amp;quot;); 
	rem ***** Get current PeopleSoft Session *****; 
	&amp;amp;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 *****; 
	&amp;amp;oSession.PSMessagesMode = 1; 
 
	rem ***** Get the Component Interface *****; 
	&amp;amp;oMYCINAMEPoRecv = &amp;amp;oSession.GetCompIntfc(CompIntfc.MY_CI_NAME_RECV); 
	If &amp;amp;oMYCINAMEPoRecv = Null Then 
		errorHandler(); 
	throw CreateException(0, 0, &amp;quot;GetCompIntfc failed&amp;quot;); 
	End-If; 
 
	rem ***** Set the Component Interface Mode *****; 
	&amp;amp;oMYCINAMEPoRecv.InteractiveMode = False; 
	&amp;amp;oMYCINAMEPoRecv.GetHistoryItems = True; 
	&amp;amp;oMYCINAMEPoRecv.EditHistoryItems = False; 
 
	rem ***** Set Component Interface Get/Create Keys *****; 
 
	rem ***** Execute Get *****; 
	If Not &amp;amp;oMYCINAMEPoRecv.Get() Then 
		rem ***** No rows exist for the specified keys.*****; 
		errorHandler(); 
		throw CreateException(0, 0, &amp;quot;Get failed&amp;quot;); 
	End-If; 
  
	rem ***** Begin: Get/Set Component Interface Properties *****; 
	rem ***** Get/Set Level 0 Field Properties *****; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.INV_LOT_ID = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.INV_LOT_ID); 
	rem &amp;amp;oMYCINAMEPoRecv.INV_LOT_ID = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.INV_ITEM_ID = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.INV_ITEM_ID); 
	rem &amp;amp;oMYCINAMEPoRecv.INV_ITEM_ID = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.SERIAL_ID = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.SERIAL_ID); 
	rem &amp;amp;oMYCINAMEPoRecv.SERIAL_ID = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.STORAGE_AREA = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.STORAGE_AREA); 
	rem &amp;amp;oMYCINAMEPoRecv.STORAGE_AREA = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.STOR_LEVEL_1 = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.STOR_LEVEL_1); 
	rem &amp;amp;oMYCINAMEPoRecv.STOR_LEVEL_1 = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.STOR_LEVEL_2 = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.STOR_LEVEL_2); 
	rem &amp;amp;oMYCINAMEPoRecv.STOR_LEVEL_2 = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.STOR_LEVEL_3 = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.STOR_LEVEL_3); 
	rem &amp;amp;oMYCINAMEPoRecv.STOR_LEVEL_3 = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.STOR_LEVEL_4 = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.STOR_LEVEL_4); 
	rem &amp;amp;oMYCINAMEPoRecv.STOR_LEVEL_4 = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.CONTAINER_ID = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.CONTAINER_ID); 
	rem &amp;amp;oMYCINAMEPoRecv.CONTAINER_ID = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.UNIT_OF_MEASURE = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.UNIT_OF_MEASURE); 
	rem &amp;amp;oMYCINAMEPoRecv.UNIT_OF_MEASURE = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.RECEIVER_ID = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.RECEIVER_ID); 
	rem &amp;amp;oMYCINAMEPoRecv.RECEIVER_ID = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.QTY = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.QTY); 
	rem &amp;amp;oMYCINAMEPoRecv.QTY = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.SCHED_NBR = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.SCHED_NBR); 
	rem &amp;amp;oMYCINAMEPoRecv.SCHED_NBR = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.SETID = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.SETID); 
	rem &amp;amp;oMYCINAMEPoRecv.SETID = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.SHIPTO_ID = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.SHIPTO_ID); 
	rem &amp;amp;oMYCINAMEPoRecv.SHIPTO_ID = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.VENDOR_ID = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.VENDOR_ID); 
	rem &amp;amp;oMYCINAMEPoRecv.VENDOR_ID = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.SHIPMENT_NO = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.SHIPMENT_NO); 
	rem &amp;amp;oMYCINAMEPoRecv.SHIPMENT_NO = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.CARRIER_ID = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.CARRIER_ID); 
	rem &amp;amp;oMYCINAMEPoRecv.CARRIER_ID = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.BILL_OF_LADING = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.BILL_OF_LADING); 
	rem &amp;amp;oMYCINAMEPoRecv.BILL_OF_LADING = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.BUSINESS_UNIT_PO = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.BUSINESS_UNIT_PO); 
	rem &amp;amp;oMYCINAMEPoRecv.BUSINESS_UNIT_PO = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.PO_ID = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.PO_ID); 
	rem &amp;amp;oMYCINAMEPoRecv.PO_ID = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.LINE_NBR = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.LINE_NBR); 
	rem &amp;amp;oMYCINAMEPoRecv.LINE_NBR = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.BUSINESS_UNIT_IN = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.BUSINESS_UNIT_IN); 
	rem &amp;amp;oMYCINAMEPoRecv.BUSINESS_UNIT_IN = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.VENDOR_LOT_ID = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.VENDOR_LOT_ID); 
	rem &amp;amp;oMYCINAMEPoRecv.VENDOR_LOT_ID = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.TAG_NUMBER = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.TAG_NUMBER); 
	rem &amp;amp;oMYCINAMEPoRecv.TAG_NUMBER = [*]; 
	&amp;amp;fileLog.WriteLine(&amp;quot;&amp;amp;oMYCINAMEPoRecv.TRANSACTION_CODE = &amp;quot; | &amp;amp;oMYCINAMEPoRecv.TRANSACTION_CODE); 
	rem &amp;amp;oMYCINAMEPoRecv.TRANSACTION_CODE = [*]; 
	rem ***** End: Get/Set Component Interface Properties *****; 
 
	rem ***** Execute Save *****; 
	rem If Not &amp;amp;oMYCINAMEPoRecv.Save() Then; 
	rem 	errorHandler(); 
	rem 	throw CreateException(0, 0, &amp;quot;Save failed&amp;quot;); 
	rem End-If; 
 
	rem ***** Execute Cancel *****; 
	rem If Not &amp;amp;oMYCINAMEPoRecv.Cancel() Then; 
	rem 	errorHandler(); 
	rem 	throw CreateException(0, 0, &amp;quot;Cancel failed&amp;quot;); 
	rem End-If; 
 
catch exception &amp;amp;ex 
	rem Handle the exception; 
	&amp;amp;fileLog.WriteLine(&amp;amp;ex.ToString()); 
end-try; 
&amp;amp;fileLog.WriteLine(&amp;quot;End&amp;quot;); 
&amp;amp;fileLog.Close(); 
&lt;/pre&gt;


&lt;h3&gt;2.2- Make changes so that you can include the CI code in a single function&lt;/h3&gt;

&lt;p&gt;This way, your CI will be easyer to use from any application, with a single function call.&lt;/p&gt;


&lt;h4&gt;Change the errorHandler function to get File &amp;amp; Session as a parameter:&lt;/h4&gt;

&lt;pre&gt;[vb]
Function errorHandler(&amp;amp;fileLog As File, &amp;amp;oSession As ApiObject)
   Local ApiObject &amp;amp;oPSMessageCollection, &amp;amp;oPSMessage;
   Local number &amp;amp;i;
   Local string &amp;amp;sErrMsgSetNum, &amp;amp;sErrMsgNum, &amp;amp;sErrMsgText, &amp;amp;sErrType;
   
   &amp;amp;oPSMessageCollection = &amp;amp;oSession.PSMessages;
   For &amp;amp;i = 1 To &amp;amp;oPSMessageCollection.Count
      &amp;amp;oPSMessage = &amp;amp;oPSMessageCollection.Item(&amp;amp;i);
      &amp;amp;sErrMsgSetNum = &amp;amp;oPSMessage.MessageSetNumber;
      &amp;amp;sErrMsgNum = &amp;amp;oPSMessage.MessageNumber;
      &amp;amp;sErrMsgText = &amp;amp;oPSMessage.Text;
      &amp;amp;fileLog.WriteLine(&amp;amp;sErrType | &amp;quot; (&amp;quot; | &amp;amp;sErrMsgSetNum | &amp;quot;,&amp;quot; | &amp;amp;sErrMsgNum | &amp;quot;) - &amp;quot; | &amp;amp;sErrMsgText);
   End-For;
   rem ***** Delete the Messages from the collection *****;
   &amp;amp;oPSMessageCollection.DeleteAll();
End-Function;
&lt;/pre&gt;


&lt;h4&gt;Create Functions containing Your CI operations, so that it will be easier to integrate in any peoplecode program.&lt;/h4&gt;

&lt;pre&gt;[vb]
// Function returns a rowset from MY_BCODE_TBL corresponding to &amp;amp;barcode parameter
Function getBarcodeRecord(&amp;amp;barcode As string) Returns Record
   Local Rowset &amp;amp;RwsBarcode;
   Local Record &amp;amp;REcBarcode;
   
   &amp;amp;RwsBarcode = CreateRowset(Record.MY_BCODE_TBL);
   &amp;amp;RwsBarcode.Fill(&amp;quot;WHERE RECV_CARD_ID = :1&amp;quot;, &amp;amp;barcode);
   
   &amp;amp;REcBarcode = CreateRecord(Record.MY_BCODE_TBL);
   &amp;amp;REcBarcode = &amp;amp;RwsBarcode(1).GetRecord(1);
   
   Return &amp;amp;REcBarcode;
End-Function;

// This Function is scheduling a job
Function RunJobRecv(&amp;amp;barcode As string) Returns boolean
   Local boolean &amp;amp;success = False;
   Local ProcessRequest &amp;amp;prcsrqst;
   Local JavaObject &amp;amp;Obj;
   Local Record &amp;amp;RecRECVLOAD;
   Local Record &amp;amp;RecRECVPUSH;
   Local Record &amp;amp;RecINPSSTGE;
   
   // Select data using barcode ID - start;
   Local Record &amp;amp;REcBarcode;
   &amp;amp;REcBarcode = getBarcodeRecord(&amp;amp;barcode);
   // Select data using barcode ID - end;
   
   &amp;amp;jobname = &amp;quot;MYRECVJOB&amp;quot;;
   
   // Create Data In Needed Run Control Parameters;
   // 01 - RECVLOAD;
   &amp;amp;RecRECVLOAD = CreateRecord(Record.RUN_CNTL_RECVLD);
   &amp;amp;RecRECVLOAD.OPRID.Value = %UserId;
   &amp;amp;RecRECVLOAD.RUN_CNTL_ID.Value = &amp;amp;jobname;
   &amp;amp;RecRECVLOAD.RECVLOAD_OPT.Value = &amp;quot;2&amp;quot;;
   &amp;amp;RecRECVLOAD.BUSINESS_UNIT.Value = &amp;amp;REcBarcode.BUSINESS_UNIT_IN.Value;
   &amp;amp;RecRECVLOAD.WHERE_CLAUSE.Value = &amp;quot;BUSINESS_UNIT = '&amp;quot; | &amp;amp;RecRECVLOAD.BUSINESS_UNIT.Value | &amp;quot;'&amp;quot;;
   If Not &amp;amp;RecRECVLOAD.Insert() Then
      &amp;amp;RecRECVLOAD.Update();
   End-If;
   
   // 02 - RUN_PO_RECEIPT;
   &amp;amp;RecRECVPUSH = CreateRecord(Record.RECV_RUN_CNTL);
   &amp;amp;RecRECVPUSH.OPRID.Value = %UserId;
   &amp;amp;RecRECVPUSH.RUN_CNTL_ID.Value = &amp;amp;jobname;
   &amp;amp;RecRECVPUSH.RECEIVER_ID.Value = &amp;quot;&amp;quot;;
   &amp;amp;RecRECVPUSH.BUSINESS_UNIT.Value = &amp;amp;REcBarcode.BUSINESS_UNIT_IN.Value;
   If Not &amp;amp;RecRECVPUSH.Insert() Then
      &amp;amp;RecRECVPUSH.Update();
   End-If;
   
   REM Schedule the Job;
   &amp;amp;prcsrqst = CreateProcessRequest(&amp;quot;PSJob&amp;quot;, &amp;amp;jobname);
   &amp;amp;prcsrqst.RunControlID = &amp;amp;jobname;
   &amp;amp;prcsrqst.JobName = &amp;amp;jobname;
   &amp;amp;prcsrqst.Schedule();
   
   If &amp;amp;prcsrqst.Status = 0 Then
      /* Schedule succeeded. */
      &amp;amp;success = True;
   Else
      /* Process (job) not scheduled, do error processing */
      &amp;amp;success = False;
   End-If;
   /*
   &amp;amp;Obj = CreateJavaObject(&amp;quot;java.lang.Thread&amp;quot;);
   &amp;amp;Obj.start();
   
   &amp;amp;RunStatus = &amp;quot;0&amp;quot;;
   While &amp;amp;RunStatus &amp;lt;&amp;gt; &amp;quot;9&amp;quot; And
         &amp;amp;RunStatus &amp;lt;&amp;gt; &amp;quot;3&amp;quot; And
         &amp;amp;RunStatus &amp;lt;&amp;gt; &amp;quot;1&amp;quot; And
         &amp;amp;RunStatus &amp;lt;&amp;gt; &amp;quot;10&amp;quot;
      REM Directly use the Java sleep() Method for 5 seconds;
      &amp;amp;Obj.sleep(5000);
      SQLExec(&amp;quot;SELECT RUNSTATUS FROM PSPRCSRQST WHERE PRCSINSTANCE = :1&amp;quot;, &amp;amp;prcsrqst.ProcessInstance, &amp;amp;RunStatus);
      REM MessageBox(0, &amp;quot;&amp;quot;, 0, 0, &amp;quot;Sleep(), Runstatus = %1&amp;quot;, &amp;amp;RunStatus);
   End-While;
   &amp;amp;Obj.stop();
   
   rem WriteLog(&amp;quot;Process MYRECVJOB is Finished&amp;quot;);
   
   If &amp;amp;prcsrqst.Status = 10  Or
         &amp;amp;prcsrqst.Status = 3  Then
      REM Process your errors;
      &amp;amp;success = False;
   Else
      REM Process your success;
      &amp;amp;success = True;
   End-If;
   */
   Return &amp;amp;success;
End-Function;

// Adds data to a log table
Function LogBarcode(&amp;amp;barcode As string, &amp;amp;qty As number, &amp;amp;transaction_code As string) Returns boolean
   Local Record &amp;amp;RecLog;
   &amp;amp;RecLog = CreateRecord(Record.PH_RECV_BCD_LOG);
   &amp;amp;RecLog.RECV_CARD_ID.Value = &amp;amp;barcode;
   &amp;amp;RecLog.QTY.Value = &amp;amp;qty;
   &amp;amp;RecLog.TRANSACTION_CODE.Value = &amp;amp;transaction_code;
   &amp;amp;RecLog.DT_TIMESTAMP.Value = %Datetime;
   &amp;amp;RecLog.OPRID.Value = %UserId;
   
   Return &amp;amp;RecLog.Insert();
End-Function;

// ErrorHandler Function
Function errorHandler(&amp;amp;fileLog As File, &amp;amp;oSession As ApiObject)
   Local ApiObject &amp;amp;oPSMessageCollection, &amp;amp;oPSMessage;
   Local number &amp;amp;i;
   Local string &amp;amp;sErrMsgSetNum, &amp;amp;sErrMsgNum, &amp;amp;sErrMsgText, &amp;amp;sErrType;
   
   &amp;amp;oPSMessageCollection = &amp;amp;oSession.PSMessages;
   For &amp;amp;i = 1 To &amp;amp;oPSMessageCollection.Count
      &amp;amp;oPSMessage = &amp;amp;oPSMessageCollection.Item(&amp;amp;i);
      &amp;amp;sErrMsgSetNum = &amp;amp;oPSMessage.MessageSetNumber;
      &amp;amp;sErrMsgNum = &amp;amp;oPSMessage.MessageNumber;
      &amp;amp;sErrMsgText = &amp;amp;oPSMessage.Text;
      &amp;amp;fileLog.WriteLine(&amp;amp;sErrType | &amp;quot; (&amp;quot; | &amp;amp;sErrMsgSetNum | &amp;quot;,&amp;quot; | &amp;amp;sErrMsgNum | &amp;quot;) - &amp;quot; | &amp;amp;sErrMsgText);
   End-For;
   rem ***** Delete the Messages from the collection *****;
   &amp;amp;oPSMessageCollection.DeleteAll();
End-Function;

/* Jean-Baptiste HEREN
   This function Gets Barcode and Qty from the barcode entry screen- Transaction 103;
 - Then it Uses a Component Interface to simulate the manual entry on;
   The Data Exchange &amp;gt; Create Transactions &amp;gt; Receiving &amp;gt; Purchasing Receiving;*/
Function WriteReceipt(&amp;amp;barcode As string, &amp;amp;qty As number) Returns boolean
   
   Local File &amp;amp;fileLog;
   Local ApiObject &amp;amp;oSession, &amp;amp;oMYCINAMEPoRecv;
   // Jean-Baptiste HEREN - Select data using barcode ID - start;
   Local Record &amp;amp;REcBarcode;
   &amp;amp;REcBarcode = getBarcodeRecord(&amp;amp;barcode);
   // Jean-Baptiste HEREN - Select data using barcode ID - end;
   
   try
      rem ***** Set the Log File *****;
      If %UserId = &amp;quot;jean-baptiste.heren&amp;quot; Then
         &amp;amp;fileLog = GetFile(&amp;quot;\\MyMachine\temp\CI\MY_CI_NAME_RECV_WriteReceipt.log&amp;quot;, &amp;quot;w&amp;quot;, &amp;quot;a&amp;quot;, %FilePath_Absolute);
      Else
         &amp;amp;fileLog = GetFile(&amp;quot;MY_CI_NAME_RECV.log&amp;quot;, &amp;quot;w&amp;quot;, &amp;quot;a&amp;quot;, %FilePath_Relative);
      End-If;
      &amp;amp;fileLog.WriteLine(&amp;quot;Begin&amp;quot;);
      rem ***** Get current PeopleSoft Session *****;
      &amp;amp;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 *****;
      &amp;amp;oSession.PSMessagesMode = 1;
      
      rem ***** Get the Component Interface *****;
      &amp;amp;oMYCINAMEPoRecv = &amp;amp;oSession.GetCompIntfc(CompIntfc.MY_CI_NAME_RECV);
      If &amp;amp;oMYCINAMEPoRecv = Null Then
         errorHandler(&amp;amp;fileLog, &amp;amp;oSession);
         throw CreateException(0, 0, &amp;quot;GetCompIntfc failed&amp;quot;);
      End-If;
      
      rem ***** Set the Component Interface Mode *****;
      &amp;amp;oMYCINAMEPoRecv.InteractiveMode = True;
      &amp;amp;oMYCINAMEPoRecv.GetHistoryItems = True;
      &amp;amp;oMYCINAMEPoRecv.EditHistoryItems = False;
      
      rem ***** Set Component Interface Get/Create Keys *****;
      
      rem ***** Execute Get *****;
      If Not &amp;amp;oMYCINAMEPoRecv.Get() Then
         rem ***** No rows exist for the specified keys.*****;
         errorHandler(&amp;amp;fileLog, &amp;amp;oSession);
         throw CreateException(0, 0, &amp;quot;Get failed&amp;quot;);
      End-If;
      
      
      rem ***** Begin: Get/Set Component Interface Properties *****;
      rem ***** Get/Set Level 0 Field Properties *****;
      
      // Jean-Baptiste HEREN - Write the session related to creation of a new reception line;
      &amp;amp;transaction_code = &amp;quot;0103&amp;quot;;
      &amp;amp;oMYCINAMEPoRecv.TRANSACTION_CODE = &amp;amp;transaction_code;
      // Jean-Baptiste HEREN - Fill with the barcode ID data;
      &amp;amp;oMYCINAMEPoRecv.SETID = &amp;amp;REcBarcode.SETID.Value;
      &amp;amp;oMYCINAMEPoRecv.SHIPTO_ID = &amp;amp;REcBarcode.SHIPTO_ID.Value;
      &amp;amp;oMYCINAMEPoRecv.VENDOR_ID = &amp;amp;REcBarcode.VENDOR_ID.Value;
      &amp;amp;oMYCINAMEPoRecv.BUSINESS_UNIT_IN = &amp;amp;REcBarcode.BUSINESS_UNIT_IN.Value;
      &amp;amp;oMYCINAMEPoRecv.CARRIER_ID = &amp;amp;REcBarcode.CARRIER_ID.Value;
      &amp;amp;oMYCINAMEPoRecv.BILL_OF_LADING = &amp;amp;REcBarcode.BILL_OF_LADING.Value;
      &amp;amp;oMYCINAMEPoRecv.BUSINESS_UNIT_PO = &amp;amp;REcBarcode.BUSINESS_UNIT_PO.Value;
      &amp;amp;oMYCINAMEPoRecv.PO_ID = &amp;amp;REcBarcode.PO_ID.Value;
      &amp;amp;oMYCINAMEPoRecv.LINE_NBR = &amp;amp;REcBarcode.LINE_NBR.Value;
      &amp;amp;oMYCINAMEPoRecv.UNIT_OF_MEASURE = &amp;amp;REcBarcode.UNIT_OF_MEASURE.Value;
      REM Still use Quantyty from Barcode screen;
      &amp;amp;oMYCINAMEPoRecv.QTY = &amp;amp;qty;
      rem ***** End: Get/Set Component Interface Properties *****;
      
      rem ***** Execute Save *****;
      If Not &amp;amp;oMYCINAMEPoRecv.Save() Then;
         errorHandler(&amp;amp;fileLog, &amp;amp;oSession);
         &amp;amp;success = False;
         throw CreateException(0, 0, &amp;quot;Save failed&amp;quot;);
      Else
         &amp;amp;success = True;
         If Not LogBarcode(&amp;amp;barcode, &amp;amp;qty, &amp;amp;transaction_code) Then
            &amp;amp;fileLog.WriteLine(&amp;quot;LogBarcode Failed&amp;quot;);
         End-If;
      End-If;
      
      rem ***** Execute Cancel *****;
      rem If Not &amp;amp;oMYCINAMEPoRecv.Cancel() Then;
      rem 	errorHandler(&amp;amp;fileLog, &amp;amp;oSession);
      rem 	throw CreateException(0, 0, &amp;quot;Cancel failed&amp;quot;);
      rem End-If;
      
   catch Exception &amp;amp;ex
      rem Handle the exception;
      &amp;amp;fileLog.WriteLine(&amp;amp;ex.ToString());
   end-try;
   &amp;amp;fileLog.WriteLine(&amp;quot;End&amp;quot;);
   &amp;amp;fileLog.Close();
   Return &amp;amp;success;
End-Function;

/* Jean-Baptiste HEREN
   This function Closes the Receipt session - Transaction 105;
   - It Uses a Component Interface to simulate the manual entry on;
     The Data Exchange &amp;gt; Create Transactions &amp;gt; Receiving &amp;gt; Purchasing Receiving;*/
Function CloseReceipt(&amp;amp;barcode) Returns boolean
   Local File &amp;amp;fileLog;
   Local ApiObject &amp;amp;oSession, &amp;amp;oMYCINAMEPoRecv;
   // Jean-Baptiste HEREN - Select data using barcode ID - start;
   Local Record &amp;amp;REcBarcode;
   &amp;amp;REcBarcode = getBarcodeRecord(&amp;amp;barcode);
   // Jean-Baptiste HEREN - Select data using barcode ID - end;
   
   try
      rem ***** Set the Log File *****;
      If %UserId = &amp;quot;jean-baptiste.heren&amp;quot; Then
         &amp;amp;fileLog = GetFile(&amp;quot;\\MyMachine\temp\CI\MY_CI_NAME_RECV_CloseReceipt.log&amp;quot;, &amp;quot;w&amp;quot;, &amp;quot;a&amp;quot;, %FilePath_Absolute);
      Else
         &amp;amp;fileLog = GetFile(&amp;quot;MY_CI_NAME_RECV.log&amp;quot;, &amp;quot;w&amp;quot;, &amp;quot;a&amp;quot;, %FilePath_Relative);
      End-If;
      &amp;amp;fileLog.WriteLine(&amp;quot;Begin&amp;quot;);
      rem ***** Get current PeopleSoft Session *****;
      &amp;amp;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 *****;
      &amp;amp;oSession.PSMessagesMode = 1;
      
      rem ***** Get the Component Interface *****;
      &amp;amp;oMYCINAMEPoRecv = &amp;amp;oSession.GetCompIntfc(CompIntfc.MY_CI_NAME_RECV);
      If &amp;amp;oMYCINAMEPoRecv = Null Then
         errorHandler(&amp;amp;fileLog, &amp;amp;oSession);
         throw CreateException(0, 0, &amp;quot;GetCompIntfc failed&amp;quot;);
      End-If;
      
      rem ***** Set the Component Interface Mode *****;
      &amp;amp;oMYCINAMEPoRecv.InteractiveMode = True;
      &amp;amp;oMYCINAMEPoRecv.GetHistoryItems = True;
      &amp;amp;oMYCINAMEPoRecv.EditHistoryItems = False;
      
      rem ***** Set Component Interface Get/Create Keys *****;
      
      rem ***** Execute Get *****;
      If Not &amp;amp;oMYCINAMEPoRecv.Get() Then
         rem ***** No rows exist for the specified keys.*****;
         errorHandler(&amp;amp;fileLog, &amp;amp;oSession);
         throw CreateException(0, 0, &amp;quot;Get failed&amp;quot;);
      End-If;
      
      
      rem ***** Begin: Get/Set Component Interface Properties *****;
      rem ***** Get/Set Level 0 Field Properties *****;
      
      // Jean-Baptiste HEREN - Write the session related to creation of a new reception line;
      &amp;amp;qty = 0;
      &amp;amp;transaction_code = &amp;quot;0105&amp;quot;;
      
      &amp;amp;oMYCINAMEPoRecv.TRANSACTION_CODE = &amp;amp;transaction_code;
      REM JBH - Fill with the barcode ID data.value;
      &amp;amp;oMYCINAMEPoRecv.SETID = &amp;amp;REcBarcode.SETID.Value;
      &amp;amp;oMYCINAMEPoRecv.SHIPTO_ID = &amp;amp;REcBarcode.SHIPTO_ID.Value;
      REM &amp;amp;oMYCINAMEPoRecv.VENDOR_ID = &amp;amp;REcBarcode.VENDOR_ID.Value;
      REM &amp;amp;oMYCINAMEPoRecv.BUSINESS_UNIT_IN = &amp;amp;REcBarcode.BUSINESS_UNIT_IN.value;
      &amp;amp;oMYCINAMEPoRecv.CARRIER_ID = &amp;amp;REcBarcode.CARRIER_ID.Value;
      &amp;amp;oMYCINAMEPoRecv.BILL_OF_LADING = &amp;amp;REcBarcode.BILL_OF_LADING.Value;
      REM &amp;amp;oMYCINAMEPoRecv.BUSINESS_UNIT_PO = &amp;amp;REcBarcode.BUSINESS_UNIT_PO.value;
      REM &amp;amp;oMYCINAMEPoRecv.PO_ID = &amp;amp;REcBarcode.PO_ID.value;
      REM &amp;amp;oMYCINAMEPoRecv.LINE_NBR = &amp;amp;REcBarcode.LINE_NBR.value;
      REM &amp;amp;oMYCINAMEPoRecv.UNIT_OF_MEASURE = &amp;amp;REcBarcode.UNIT_OF_MEASURE.value;
      REM Still use Quantyty from Barcode screen;
      REM &amp;amp;oMYCINAMEPoRecv.QTY = &amp;amp;qty;
      rem ***** End: Get/Set Component Interface Properties *****;
      
      rem ***** Execute Save *****;
	  // Jean-Baptiste HEREN - Usually, you want you CI to save your component at end, so uncomment the SAVE part
      If Not &amp;amp;oMYCINAMEPoRecv.Save() Then;
         errorHandler(&amp;amp;fileLog, &amp;amp;oSession);
         &amp;amp;success = False;
         throw CreateException(0, 0, &amp;quot;Save failed&amp;quot;);
      Else
         &amp;amp;success = True;
         If Not LogBarcode(&amp;amp;barcode, &amp;amp;qty, &amp;amp;transaction_code) Then
            &amp;amp;fileLog.WriteLine(&amp;quot;LogBarcode Failed&amp;quot;);
         End-If;
      End-If;
      
      rem ***** Execute Cancel *****;
      rem If Not &amp;amp;oMYCINAMEPoRecv.Cancel() Then;
      rem 	errorHandler(&amp;amp;fileLog, &amp;amp;oSession);
      rem 	throw CreateException(0, 0, &amp;quot;Cancel failed&amp;quot;);
      rem End-If;
      
   catch Exception &amp;amp;ex
      rem Handle the exception;
      &amp;amp;fileLog.WriteLine(&amp;amp;ex.ToString());
   end-try;
   &amp;amp;fileLog.WriteLine(&amp;quot;End&amp;quot;);
   &amp;amp;fileLog.Close();
   Return &amp;amp;success;
End-Function;
&lt;/pre&gt;



&lt;h2&gt;3- Write a program witch is using your CI&lt;/h2&gt;

&lt;p&gt;This kind of code is usually called from a Fast entry screen or External Interface&lt;/p&gt;

&lt;pre&gt;[vb]
// JBH - Declare Custom Functions Using Component Interface;
Declare Function WriteReceipt PeopleCode MY_RECV_TABLE.RECV_CARD_ID FieldFormula;
Declare Function CloseReceipt PeopleCode MY_RECV_TABLE.RECV_CARD_ID FieldFormula;

REM Run the Component Interface;
If All(MY_RECV_TABLE.RECV_CARD_ID.Value) And
      All(MY_RECV_TABLE.QTY.Value) Then
   MY_RECV_TABLE.RECV_CARD_ID.Value = RTrim(MY_RECV_TABLE.RECV_CARD_ID.Value);
   REM Check That This Barcode has not already been used;
   SQLExec(&amp;quot;SELECT 1 FROM PS_PH_RECV_BCD_LOG WHERE RECV_CARD_ID = :1&amp;quot;, MY_RECV_TABLE.RECV_CARD_ID.Value, &amp;amp;result);
   If &amp;amp;result &amp;lt;&amp;gt; 1 Then
      // Here we call our Component Interface
      If Not WriteReceipt(MY_RECV_TABLE.RECV_CARD_ID.Value, MY_RECV_TABLE.QTY.Value) Then
         WinMessage(&amp;quot;Reception Failed!&amp;quot;);
      Else
         SetCursorPos(%Page, MY_RECV_TABLE.RECV_CARD_ID, CurrentRowNumber());
         REM Save The succesfully recorded barcode;
         MY_RECV_TABLE.RECV_CARD_ID_OK.Value = MY_RECV_TABLE.RECV_CARD_ID.Value;
         REM Clean Screen;
         MY_RECV_TABLE.RECV_CARD_ID.Value = &amp;quot;&amp;quot;;
         MY_RECV_TABLE.QTY.Value = 0;
      End-If;
   Else
      WinMessage(&amp;quot;Card ID has already been scanned !&amp;quot;);
      SetCursorPos(%Page, MY_RECV_TABLE.RECV_CARD_ID, CurrentRowNumber());
      REM Clean Screen;
      MY_RECV_TABLE.RECV_CARD_ID.Value = &amp;quot;&amp;quot;;
      MY_RECV_TABLE.QTY.Value = 0;
   End-If;
End-If;
&lt;/pre&gt;</description>
    
    
    
          <comments>http://blog.jbheren.com/post/2011/01/13/Peoplesoft-Component-interface-HOWTO#comment-form</comments>
      <wfw:comment>http://blog.jbheren.com/post/2011/01/13/Peoplesoft-Component-interface-HOWTO#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.jbheren.com/feed/atom/comments/49</wfw:commentRss>
      </item>
    
  <item>
    <title>Graphic box en SQR</title>
    <link>http://blog.jbheren.com/post/2010/12/07/Graphic-box-en-SQR</link>
    <guid isPermaLink="false">urn:md5:079dbd65ae5dc911f36dd3b3a2b09c59</guid>
    <pubDate>Tue, 07 Dec 2010 11:31:00 +0100</pubDate>
    <dc:creator>Jean-Baptiste HEREN</dc:creator>
        <category>Peoplesoft</category>
        <category>peoplesoft</category><category>sqr</category>    
    <description>&lt;h2&gt;Voici comment imprimer une boite (un cadre) avec SQR Report.&lt;/h2&gt;    &lt;pre&gt;
!* Graphic Box
!* GRAPHIC (a, b, c) BOX d e f
!* a = line
!* b = colonn
!* c = width (largeur)
!* d = high (hauteur)
!* e = Thickness (épaisseur du trait)
!* f = Background opacity (Opacité du fond) (Grisé)
&lt;/pre&gt;


&lt;p&gt;Exemple de boite avec Cadre &amp;amp; Grisée&lt;/p&gt;

&lt;pre&gt;[sql]
graphic  (#num_ligne,#col_gauche,#largeur_cellule) box #hauteur_cellule #epaisseur_trait #opacite_fond
&lt;/pre&gt;</description>
    
    
    
          <comments>http://blog.jbheren.com/post/2010/12/07/Graphic-box-en-SQR#comment-form</comments>
      <wfw:comment>http://blog.jbheren.com/post/2010/12/07/Graphic-box-en-SQR#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.jbheren.com/feed/atom/comments/2</wfw:commentRss>
      </item>
    
  <item>
    <title>Peoplesoft Auto Numbering</title>
    <link>http://blog.jbheren.com/post/2009/11/20/Peoplesoft-Auto-Numbering</link>
    <guid isPermaLink="false">urn:md5:81a037778588fd2a924e7fef2dad956d</guid>
    <pubDate>Fri, 20 Nov 2009 12:02:00 +0100</pubDate>
    <dc:creator>Jean-Baptiste HEREN</dc:creator>
        <category>Peoplesoft</category>
        <category>Application designer</category><category>Peoplecode</category><category>peoplesoft</category>    
    <description>&lt;p&gt;Peoplesoft Auto numbering allow to manage a counter for a specific ID. This
definition allows to describe ID's size, beginning Segment and eventually
diffrent parameter depending on SETID (like Order, Receipt, RMA ID's).&lt;/p&gt;
&lt;p&gt;This post describes the diffrerent steps to :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create a new Peoplesoft page &amp;amp; component, place it in a menu's folder
an register in portal.&lt;/li&gt;
&lt;li&gt;Setup Autonumbering on this new page's data.&lt;/li&gt;
&lt;/ul&gt;    &lt;br /&gt;
&lt;h2&gt;1- Setup application designer&lt;/h2&gt;
We will setup auto add new and modified objects to the current project. This is
a very important thing to do when you make changes to PeopleSoft objects so
that you will never forget anything ;when migrate your project to another
environment.&lt;br /&gt;
In application designer; go in Tools -&amp;gt; Options menu.&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/01-_application_designer_options.jpg&quot;&gt;&lt;img title=&quot;01-_application_designer_options.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.01-_application_designer_options_m.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;

 &lt;br /&gt;
&lt;h2&gt;2- Create the new field that will be used as an ID&lt;/h2&gt;
This new Field &lt;strong&gt;MY_FIELD_ID&lt;/strong&gt; will contain the generated ID. Set
a comfortable size (10 to 20 CHARS Upper) and save it.&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/02-_File_New_Field.jpg&quot;&gt;&lt;img title=&quot;02-_File_New_Field.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.02-_File_New_Field_s.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;3- Create the Record witch will contain ID and related data&lt;/h2&gt;
In Peoplesoft, Records are just Tables (or view). When you come from the
Relational Database univers, It is quite confusing at the beginning, but each
Editor has his own Language...&lt;br /&gt;
Create a new record for storing your ID and data.&lt;br /&gt;
 &lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/03_-_File_new_record.jpg&quot;&gt;&lt;img title=&quot;03_-_File_new_record.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.03_-_File_new_record_s.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Add you new Field as ID &amp;amp; Key, with some attached data.I you do not plan to
use The Business Unit Key, you can keep only the Autonum Field as a Key.&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/03_-_MY_RECORD_TBL.jpg&quot;&gt;&lt;img title=&quot;03_-_MY_RECORD_TBL.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.03_-_MY_RECORD_TBL_s.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;h2&gt;4- Set record Group&lt;/h2&gt;
Record Groups allow to link Each SETIDs with one Business Units, depending on
Record, by using record groups.&lt;br /&gt;
&lt;br /&gt;
This step is needed for auto numbering to work well, except if you prefer to
&amp;quot;hard code&amp;quot; Directly the SETID in autonumbering function as described in the
peoplecode exemple at the end of this post.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Create record group (or take an existing one)&lt;/h3&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/03-_Add_Record_Group.jpg&quot;&gt;&lt;img title=&quot;03-_Add_Record_Group.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.03-_Add_Record_Group_m.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h3&gt;Add your record(s)&lt;/h3&gt;
 &lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/03_-_Save_record_group.jpg&quot;&gt;&lt;img title=&quot;03_-_Save_record_group.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.03_-_Save_record_group_m.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h3&gt;Update Set  Control Group (in this example, we use only the SHARE
SETID)&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;UPDATE&lt;br /&gt;
PS_SET_CNTRL_GROUP&lt;br /&gt;
SET&lt;br /&gt;
SETID = '&lt;strong&gt;SHARE&lt;/strong&gt;' // or your SETID&lt;br /&gt;
FROM&lt;br /&gt;
PS_SET_CNTRL_GROUP&lt;br /&gt;
WHERE&lt;br /&gt;
REC_GROUP_ID = '&lt;strong&gt;MY_01&lt;/strong&gt;' // You Record Group&lt;/p&gt;
&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;
&lt;p&gt;UPDATE&lt;br /&gt;
PS_SET_CNTRL_REC&lt;br /&gt;
SET&lt;br /&gt;
SETID = '&lt;strong&gt;SHARE&lt;/strong&gt;' // or your SETID&lt;br /&gt;
FROM&lt;br /&gt;
PS_SET_CNTRL_REC&lt;br /&gt;
WHERE&lt;br /&gt;
REC_GROUP_ID = '&lt;strong&gt;MY_01&lt;/strong&gt;' // You Record Group&lt;/p&gt;
&lt;/blockquote&gt;
&lt;br /&gt;
&lt;h2&gt;5- Create one page to add/display data&lt;/h2&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/04_-_File_New_page.jpg&quot;&gt;&lt;img title=&quot;04_-_File_New_page.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.04_-_File_New_page_s.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Add You fields on the page &amp;amp; Save.&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/04_-_MY_PAGE_PGE.jpg&quot;&gt;&lt;img title=&quot;04_-_MY_PAGE_PGE.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.04_-_MY_PAGE_PGE_m.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;h2&gt;6- create the component witch contains the page&lt;/h2&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/05_-_File_New_Component.jpg&quot;&gt;&lt;img title=&quot;05_-_File_New_Component.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.05_-_File_New_Component_s.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Set Component's Properties&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/05_-_Component_properties.jpg&quot;&gt;&lt;img title=&quot;05_-_Component_properties.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.05_-_Component_properties_m.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;

&lt;br /&gt;
Add your page(s) in it and set an Item &lt;strong&gt;Label&lt;/strong&gt; as it will appear
as the &lt;strong&gt;title of your page in tab&lt;/strong&gt;.&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/05_-_Component_pages.jpg&quot;&gt;&lt;img title=&quot;05_-_Component_pages.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.05_-_Component_pages_m.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;7- Create the menu &amp;amp; Portal Folder witch contains the component&lt;/h2&gt;
If you don't already have an available menu, create a menu and Bar Item.&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/06_-_File_new_Menu.jpg&quot;&gt;&lt;img title=&quot;06_-_File_new_Menu.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.06_-_File_new_Menu_s.jpg&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/06_-_Menu_add_bar_Item.jpg&quot;&gt;&lt;img title=&quot;06_-_Menu_add_bar_Item.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.06_-_Menu_add_bar_Item_s.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/06_-_Menu_add_bar_Item.jpg&quot;&gt;&lt;img title=&quot;06_-_Menu_add_bar_Item.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.06_-_Menu_add_bar_Item_s.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
Deploy the components tab in the project View &amp;amp; Drag the component to the
menu&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/06_-_Menu_drag_component_1.jpg&quot;&gt;&lt;img title=&quot;06_-_Menu_drag_component_1.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.06_-_Menu_drag_component_1_s.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;

&lt;br /&gt;
Change Menu Item Label. This label will appear as the menu entry text in the
portal. Save.&lt;br /&gt;
 &lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/06_-_New_Menu_Item_properties.jpg&quot;&gt;&lt;img title=&quot;06_-_New_Menu_Item_properties.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.06_-_New_Menu_Item_properties_m.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;

&lt;br /&gt;
Now we need In PIA, navigate to Peopletools -&amp;gt; Portal -&amp;gt; Structure &amp;amp;
content.&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/06_-_PIA_Structure_and_contents_menu.jpg&quot;&gt;&lt;img title=&quot;06_-_PIA_Structure_and_contents_menu.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/06_-_PIA_Structure_and_contents_menu.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;

&lt;br /&gt;
Navigate as needed and select  the add folder link, write name (Keep it
Simple) and description then save.&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/06_-_Portal_add_folder.jpg&quot;&gt;&lt;img title=&quot;06_-_Portal_add_folder.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.06_-_Portal_add_folder_s.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Add the new folder to the Project (Think about Migration)&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/06_-_Insert_folder_to_Project.jpg&quot;&gt;&lt;img title=&quot;06_-_Insert_folder_to_Project.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.06_-_Insert_folder_to_Project_s.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;

 &lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;8- Register the component in the portal&lt;/h2&gt;
This operation will create a content reference in the portal, to the component
we have created, so that it is available in the portal.&lt;br /&gt;
&lt;br /&gt;
Open your component in Application Designer and click on register component
wizard button.&lt;br /&gt;
&lt;img title=&quot;07_-_register_Component_1_-_wizard_button.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/07_-_register_Component_1_-_wizard_button.jpg&quot; /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/07_-_registration_wizard_-_start.jpg&quot;&gt;
&lt;img title=&quot;07_-_registration_wizard_-_start.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.07_-_registration_wizard_-_start_s.jpg&quot; /&gt;
&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Select the menu you have created, as it contains our new component.&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/07_-_registration_wizard_-_select_menu.jpg&quot;&gt;&lt;img title=&quot;07_-_registration_wizard_-_select_menu.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.07_-_registration_wizard_-_select_menu_s.jpg&quot; /&gt;
&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Select the Folder name you created, set a label and description. Default
Content reference name is OK.&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/07_-_registration_wizard_-_create_content_reference.jpg&quot;&gt;
&lt;img title=&quot;07_-_registration_wizard_-_create_content_reference.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.07_-_registration_wizard_-_create_content_reference_s.jpg&quot; /&gt;
&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Then check your parameters and validate.&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/07_-_registration_wizard_-_finish.jpg&quot;&gt;&lt;img title=&quot;07_-_registration_wizard_-_finish.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.07_-_registration_wizard_-_finish_s.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;

 &lt;br /&gt;
Now your content reference is created and available in the portal. You can
checkit in the menu folder you specified.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;9- Setup the standard auto numbering Type and ID&lt;/h2&gt;
Two tables will be populated:&lt;br /&gt;
SELECT * FROM PS_AUTO_NUMFLD_TBL&lt;br /&gt;
SELECT * FROM PS_AUTO_NUM_TBL&lt;br /&gt;
&lt;br /&gt;
Create a &lt;strong&gt;new translate value&lt;/strong&gt; on &lt;strong&gt;NUM_TYPE&lt;/strong&gt;
Field for use in AUTO_NUMFLD_TBL. we will use this translate value when we will
create the a new Auto Numbering number Type in the portal.&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/08_-_Add_translate_value.jpg&quot;&gt;&lt;img title=&quot;08_-_Add_translate_value.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.08_-_Add_translate_value_s.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Add the new Auto numbering Entry&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/08_-_portal_auto_numbering_add_new_value.jpg&quot;&gt;
&lt;img title=&quot;08_-_portal_auto_numbering_add_new_value.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.08_-_portal_auto_numbering_add_new_value_m.jpg&quot; /&gt;
&lt;/a&gt;&lt;br /&gt;
 &lt;br /&gt;
Create this definition for each SETID you need.&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/08_-_Auto_numbering_definition_page.jpg&quot;&gt;&lt;img title=&quot;08_-_Auto_numbering_definition_page.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.08_-_Auto_numbering_definition_page_m.jpg&quot; /&gt;
&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;10- Write Peoplecode to manage the auto numbering on our ID&lt;/h2&gt;
&lt;h3&gt;1- RECORDNAME.AUTONUMFIELD.Searchinit&lt;/h3&gt;
&lt;br /&gt;
If %Mode = &amp;quot;A&amp;quot; Then&lt;br /&gt;
   MY_RECORD_TBL.MY_FIELD_ID.Value = &amp;quot;NEXT&amp;quot;;&lt;br /&gt;
   MY_RECORD_TBL.MY_FIELD_ID.Enabled = False;&lt;br /&gt;
End-If;&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;2- Create a Sequence Record View&lt;/h3&gt;
Create a new record (view) with following structure and SQL code. This view
will be called by the function AutoNumberCommit in next step.&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/08_-_02_create_record_view_for_autonumbering_function.jpg&quot;&gt;
&lt;img title=&quot;08_-_02_create_record_view_for_autonumbering_function.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/.08_-_02_create_record_view_for_autonumbering_function_m.jpg&quot; /&gt;
&lt;/a&gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;blockquote&gt;
&lt;p&gt;SELECT A.SETID&lt;br /&gt;
 , A.BEG_SEQ&lt;br /&gt;
 , A.DESCR&lt;br /&gt;
  FROM PS_AUTO_NUM_TBL A&lt;br /&gt;
 WHERE A.NUM_TYPE='&lt;strong&gt;XXXX'&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;3- RECORDNAME.AUTONUMFIELD.Save PreChange&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;Declare Function AutoNumberCommit PeopleCode FUNCLIB_ORDENT.ORDER_NO
FieldFormula;&lt;br /&gt;
&lt;br /&gt;
REM Function AutoNumberCommit(&amp;amp;setidStr, &amp;amp;businessUnitStr,
&amp;amp;recNameStr, &amp;amp;numTypeStr, &amp;amp;begSeqStr, &amp;amp;zeroPadB,
&amp;amp;finalNbrStr) Returns boolean;&lt;br /&gt;
&lt;br /&gt;
If Not (RecordDeleted(MY_RECORD_TBL.MY_FIELD_ID)) Then&lt;br /&gt;
   If MY_RECORD_TBL.MY_FIELD_ID.Value = &amp;quot;NEXT&amp;quot; Then&lt;br /&gt;
      &amp;amp;NUMBER_TYPE =
&lt;strong&gt;&amp;quot;XXXX&amp;quot;&lt;/strong&gt;;&lt;br /&gt;
      &amp;amp;ZERO_PAD = &amp;quot;Y&amp;quot;;&lt;br /&gt;
      &amp;amp;USERID = %UserId;&lt;br /&gt;
      &amp;amp;BEG_SEQ = &amp;quot;BEG&amp;quot;;&lt;br /&gt;
      &amp;amp;RECORD_GROUP =
Record.PH_KANBAN_AN_VW;&lt;br /&gt;
AutoNumberCommit(&amp;quot; &amp;quot;, MY_RECORD_TBL.BUSINESS_UNIT, &amp;amp;RECORD_GROUP,
&amp;amp;NUMBER_TYPE, &amp;amp;BEG_SEQ, &amp;amp;ZERO_PAD, &amp;amp;FINAL_NUM);&lt;br /&gt;
 //You can also set directly the SETID if you prefer.&lt;br /&gt;
 //&amp;amp;continue = AutoNumberCommit(&amp;quot;SHARE&amp;quot;, &amp;quot; &amp;quot;, &amp;amp;RECORD_GROUP,
&amp;amp;NUMBER_TYPE, &amp;amp;BEG_SEQ, &amp;amp;ZERO_PAD, &amp;amp;FINAL_NUM);&lt;br /&gt;
      MY_RECORD_TBL.MY_FIELD_ID.Value =
&amp;amp;FINAL_NUM;&lt;br /&gt;
   End-If;&lt;br /&gt;
End-If;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;11- Test onscreen&lt;/h2&gt;
Now you should be able to test your screen by adding new value.&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/09_-_screen_add_value.jpg&quot;&gt;&lt;img title=&quot;09_-_screen_add_value.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/autonumbering/09_-_screen_add_value.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Saving your page will call the SavePreChange peoplecode containing
AutoNumberCommit function and save your data with resulting ID.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
    
    
    
          <comments>http://blog.jbheren.com/post/2009/11/20/Peoplesoft-Auto-Numbering#comment-form</comments>
      <wfw:comment>http://blog.jbheren.com/post/2009/11/20/Peoplesoft-Auto-Numbering#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.jbheren.com/feed/atom/comments/19</wfw:commentRss>
      </item>
    
  <item>
    <title>Peoplecode File attachment</title>
    <link>http://blog.jbheren.com/post/2009/11/13/Peoplecode-File-Attachment</link>
    <guid isPermaLink="false">urn:md5:0cd9b00d92278e5b242582db65b8792d</guid>
    <pubDate>Fri, 13 Nov 2009 22:47:00 +0100</pubDate>
    <dc:creator>Jean-Baptiste HEREN</dc:creator>
        <category>Peoplesoft</category>
        <category>Peoplecode</category><category>peoplesoft</category>    
    <description>&lt;p&gt;Peoplesoft allows File attachment from the web client. Here is a little
HowTo.&lt;/p&gt;
&lt;p&gt;// Peoplesoft permet assez facilement d'utiliser la fonction classique des
interfaces web visant à &amp;quot;uploader&amp;quot; un fichier. Voici un aperçu de la
méthode.&lt;/p&gt;    &lt;h2&gt;1- Add Needed Special Fields to your applications's record&lt;/h2&gt;
&lt;strong&gt;First&lt;/strong&gt; You will have to add two fields containing Filename to
you current application's record.&lt;br /&gt;
Usually you add it to the primary record (aka MY_SCREEN_RECORD in following
peoplecode) :&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;ATTACHSYSFILENAME (The system file name.)&lt;/li&gt;
&lt;li&gt;ATTACHUSERFILE    (The user file name).&lt;/li&gt;
&lt;/ul&gt;
This can be done by adding the standard FILE_ATTACH_SBR subrecord.&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/add_attachment/img_field_attachement.jpg&quot;&gt;
&lt;img title=&quot;img_field_attachement.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/add_attachment/.img_field_attachement_m.jpg&quot; /&gt;
&lt;/a&gt;&lt;br /&gt;
&lt;strong&gt;Then&lt;/strong&gt; add three buttons to you page :&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;ADD : usually ATTACHADD field&lt;/li&gt;
&lt;li&gt;VIEW : usually ATTACHVIEW field&lt;/li&gt;
&lt;li&gt;DELETE: usually ATTACHDELETE field&lt;/li&gt;
&lt;/ul&gt;
You can use the standard work record FILE_ATTACH_WRK or just create one with
your own fields, like in this example (more flexible).&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;2- (Optional) Create record to save File Informations &amp;amp; Data&lt;/h2&gt;
If you want to use the database to store the file data, you will have to create
a record containing this data.&lt;br /&gt;
This record must have the following Structure :&lt;br /&gt;
for example : MY_RECORD_STK&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/add_attachment/stock_record_structure.jpg&quot;&gt;&lt;img title=&quot;stock_record_structure.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/add_attachment/.stock_record_structure_m.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
To achieve this, you can use thr standard subrecord FILE_ATTACH_SBR.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;3- Add needed peoplecode &amp;amp; associate it with buttons&lt;/h2&gt;
Here are peoplecodes examples, to be placed on Fieldchange Events, for the
three different actions Add, view and remove buttons.&lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/add_attachment/img_button_attachement.jpg&quot;&gt;&lt;img title=&quot;img_button_attachement.jpg, nov. 2009&quot; alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/add_attachment/.img_button_attachement_m.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;- Add Attachment&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;
/*******************************************************************************/&lt;br /&gt;

/* Declarations */&lt;br /&gt;
Local string &amp;amp;URLDestination, &amp;amp;DirAndFilename, &amp;amp;FileType,
&amp;amp;UserFile;&lt;br /&gt;
Local number &amp;amp;MaxSize;&lt;br /&gt;
&lt;br /&gt;
/* Affectations */&lt;br /&gt;
/* here we set file destination - we can use a record but it is quite better to
use an ftp server if possible ftp://ftp.my.address/my_folder */&lt;br /&gt;
&amp;amp;URLDestination = &amp;quot;record://MY_RECORD_STK&amp;quot;;&lt;br /&gt;
&amp;amp;SUBDIRECTORY = &amp;quot;&amp;quot;;&lt;br /&gt;
&amp;amp;DirAndFilename = &amp;quot;&amp;quot;;&lt;br /&gt;
&amp;amp;FileType = &amp;quot;&amp;quot;;&lt;br /&gt;
&amp;amp;UserFile = &amp;quot;&amp;quot;;&lt;br /&gt;
&amp;amp;MaxSize = 0; /* no limit */&lt;br /&gt;
&lt;br /&gt;
/* Check mandatory Field (file attahment decription)  */&lt;br /&gt;
If None(MY_SCREEN_RECORD.DESCR254) Then&lt;br /&gt;
   MessageBox(0, &amp;quot;&amp;quot;, 0, 0, &amp;quot;Fields are mandatory &amp;quot;);&lt;br /&gt;
   Return;&lt;br /&gt;
End-If;&lt;br /&gt;
&lt;br /&gt;
/* Use reference IDs as filename, just for unicity */&lt;br /&gt;
&amp;amp;ATTACHUSERFILE = MY_SCREEN_RECORD.MY_UNIQUE_ID.Value;&lt;br /&gt;
&lt;br /&gt;
/* reemove special characters */&lt;br /&gt;
&amp;amp;ATTACHUSERFILE = Substitute(&amp;amp;ATTACHUSERFILE, &amp;quot; &amp;quot;, &amp;quot;_&amp;quot;);&lt;br /&gt;
&amp;amp;ATTACHUSERFILE = Substitute(&amp;amp;ATTACHUSERFILE, &amp;quot;;&amp;quot;, &amp;quot;_&amp;quot;);&lt;br /&gt;
&amp;amp;ATTACHUSERFILE = Substitute(&amp;amp;ATTACHUSERFILE, &amp;quot;+&amp;quot;, &amp;quot;_&amp;quot;);&lt;br /&gt;
&amp;amp;ATTACHUSERFILE = Substitute(&amp;amp;ATTACHUSERFILE, &amp;quot;%&amp;quot;, &amp;quot;_&amp;quot;);&lt;br /&gt;
&amp;amp;ATTACHUSERFILE = Substitute(&amp;amp;ATTACHUSERFILE, &amp;quot;&amp;amp;&amp;quot;, &amp;quot;_&amp;quot;);&lt;br /&gt;
&amp;amp;ATTACHUSERFILE = Substitute(&amp;amp;ATTACHUSERFILE, &amp;quot;'&amp;quot;, &amp;quot;_&amp;quot;);&lt;br /&gt;
&amp;amp;ATTACHUSERFILE = Substitute(&amp;amp;ATTACHUSERFILE, &amp;quot;!&amp;quot;, &amp;quot;_&amp;quot;);&lt;br /&gt;
&amp;amp;ATTACHUSERFILE = Substitute(&amp;amp;ATTACHUSERFILE, &amp;quot;@&amp;quot;, &amp;quot;_&amp;quot;);&lt;br /&gt;
&amp;amp;ATTACHUSERFILE = Substitute(&amp;amp;ATTACHUSERFILE, &amp;quot;#&amp;quot;, &amp;quot;_&amp;quot;);&lt;br /&gt;
&amp;amp;ATTACHUSERFILE = Substitute(&amp;amp;ATTACHUSERFILE, &amp;quot;$&amp;quot;, &amp;quot;_&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
/* Attaching file */&lt;br /&gt;
&amp;amp;return = AddAttachment(&amp;amp;URLDestination, &amp;amp;ATTACHUSERFILE,
&amp;amp;FileType, &amp;amp;ATTACHSYSFILE, &amp;amp;MaxSize);&lt;br /&gt;
&lt;br /&gt;
If &amp;amp;return = %Attachment_Success /* 0 */ Then&lt;br /&gt;
   Record.MY_SCREEN_RECORD.FLAG.Value = &amp;quot;Y&amp;quot;;&lt;br /&gt;
   Record.MY_SCREEN_RECORD.ATTACHSYSFILENAME.Value =
&amp;amp;ATTACHUSERFILE | &amp;amp;ATTACHSYSFILE;&lt;br /&gt;
   DoSaveNow();&lt;br /&gt;
Else&lt;br /&gt;
   MY_SCREEN_RECORD.FLAG.Value = &amp;quot;N&amp;quot;;&lt;br /&gt;
   Evaluate &amp;amp;return&lt;br /&gt;
   When = 7 /* %Attachment_DestSystNotFound  */&lt;br /&gt;
      MessageBox(0, &amp;quot;&amp;quot;, 0, 0, &amp;quot;Cannot locate
destination system '&amp;quot; | &amp;amp;URLDestination | &amp;quot;'. (Return code &amp;quot; | &amp;amp;return
| &amp;quot; )&amp;quot;);&lt;br /&gt;
      Break;&lt;br /&gt;
   When = 8 /* %Attachment_DestSystFailedLogin  */&lt;br /&gt;
      MessageBox(0, &amp;quot;&amp;quot;, 0, 0, &amp;quot;Unable to login to
destination system for ftp. (Return code &amp;quot; | &amp;amp;return | &amp;quot; )&amp;quot;);&lt;br /&gt;
      Break;&lt;br /&gt;
   When-Other&lt;br /&gt;
      MessageBox(0, &amp;quot;&amp;quot;, 0, 0, &amp;quot;Attachment Failed :
Error &amp;quot; | &amp;amp;return);&lt;br /&gt;
   End-Evaluate;&lt;br /&gt;
End-If;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;- View attachment&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;
/*******************************************************************************/&lt;br /&gt;

Local string &amp;amp;URL_ID, &amp;amp;ATTACHSYSFILENAME, &amp;amp;ATTACHUSERFILE;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;URL_ID = &amp;quot;record://MY_RECORD_STK&amp;quot;;&lt;br /&gt;
&amp;amp;ATTACHSYSFILENAME = Record.MY_SCREEN_RECORD.ATTACHSYSFILENAME.Value;&lt;br /&gt;
&amp;amp;ATTACHUSERFILE = Record.MY_SCREEN_RECORD.ATTACHSYSFILENAME.Value;&lt;br /&gt;
&amp;amp;MESSAGE_LVL = 1;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;RETCODE = ViewAttachment(&amp;amp;URL_ID, &amp;amp;ATTACHSYSFILENAME,
&amp;amp;ATTACHUSERFILE);&lt;br /&gt;
&lt;br /&gt;
/* Error Messages */&lt;br /&gt;
If (&amp;amp;RETCODE = %Attachment_Cancelled) Then&lt;br /&gt;
      MessageBox(0, MsgGetText(137, 1, &amp;quot;File
Attachment Status&amp;quot;), 137, 3, &amp;quot;AddAttachment cancelled&amp;quot;);&lt;br /&gt;
End-If;&lt;br /&gt;
If (&amp;amp;RETCODE = %Attachment_Failed) Then&lt;br /&gt;
   MessageBox(0, MsgGetText(137, 1, &amp;quot;File Attachment Status&amp;quot;), 137,
19, &amp;quot;ViewAttachment failed&amp;quot;);&lt;br /&gt;
End-If;&lt;br /&gt;
If (&amp;amp;RETCODE = %Attachment_FileTransferFailed) Then&lt;br /&gt;
   MessageBox(0, MsgGetText(137, 1, &amp;quot;File Attachment Status&amp;quot;), 137,
21, &amp;quot;ViewAttachment failed: File Transfer did not succeed&amp;quot;);&lt;br /&gt;
End-If;&lt;br /&gt;
/* following error messsage only in iclient mode */&lt;br /&gt;
If (&amp;amp;RETCODE = %Attachment_NoDiskSpaceAppServ) Then&lt;br /&gt;
   MessageBox(0, MsgGetText(137, 1, &amp;quot;File Attachment Status&amp;quot;), 137,
22, &amp;quot;ViewAttachment failed: No disk space on the app server&amp;quot;);&lt;br /&gt;
End-If;&lt;br /&gt;
/* following error messsage only in iclient mode */&lt;br /&gt;
If (&amp;amp;RETCODE = %Attachment_NoDiskSpaceWebServ) Then&lt;br /&gt;
   MessageBox(0, MsgGetText(137, 1, &amp;quot;File Attachment Status&amp;quot;), 137,
23, &amp;quot;ViewAttachment failed: No disk space on the web server&amp;quot;);&lt;br /&gt;
End-If;&lt;br /&gt;
If (&amp;amp;RETCODE = %Attachment_FileExceedsMaxSize) Then&lt;br /&gt;
   MessageBox(0, MsgGetText(137, 1, &amp;quot;File Attachment Status&amp;quot;), 137,
24, &amp;quot;ViewAttachment failed: File exceeds the max size&amp;quot;);&lt;br /&gt;
End-If;&lt;br /&gt;
If (&amp;amp;RETCODE = %Attachment_DestSystNotFound) Then&lt;br /&gt;
   MessageBox(0, MsgGetText(137, 1, &amp;quot;File Attachment Status&amp;quot;), 137,
25, &amp;quot;ViewAttachment failed: Cannot locate destination system for ftp&amp;quot;);&lt;br /&gt;
End-If;&lt;br /&gt;
If (&amp;amp;RETCODE = %Attachment_DestSysFailedLogin) Then&lt;br /&gt;
   MessageBox(0, MsgGetText(137, 1, &amp;quot;File Attachment Status&amp;quot;), 137,
26, &amp;quot;ViewAttachment failed: Unable to login into destination system for
ftp&amp;quot;);&lt;br /&gt;
End-If;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;br /&gt;
&lt;h3&gt;- Delete attachment&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;
/*******************************************************************************/&lt;br /&gt;

Declare Function delete_attachment PeopleCode FILE_ATTACH_WRK.ATTACHDELETE
FieldChange;&lt;br /&gt;
&lt;br /&gt;
Function my_delete_attachment() Returns integer&lt;br /&gt;
   Local string &amp;amp;URL_ID, &amp;amp;ATTACHSYSFILENAME,
&amp;amp;ATTACHUSERFILE;&lt;br /&gt;
   &lt;br /&gt;
   &amp;amp;URL_ID = &amp;quot;record://MY_RECORD_STK&amp;quot;;&lt;br /&gt;
   &amp;amp;ATTACHSYSFILENAME =
Record.MY_SCREEN_RECORD.ATTACHSYSFILENAME.Value;&lt;br /&gt;
   &amp;amp;ATTACHUSERFILE =
Record.MY_SCREEN_RECORD.ATTACHSYSFILENAME.Value;&lt;br /&gt;
   &amp;amp;MESSAGE_LVL = 1;&lt;br /&gt;
   &lt;br /&gt;
   delete_attachment(&amp;amp;URL_ID, &amp;amp;ATTACHSYSFILENAME,
&amp;amp;ATTACHUSERFILE, &amp;amp;MESSAGE_LVL, &amp;amp;RETCODE);&lt;br /&gt;
   &lt;br /&gt;
   If &amp;amp;RETCODE = 0 Then&lt;br /&gt;
      MY_SCREEN_RECORD.FLAG.Value = &amp;quot;N&amp;quot;;&lt;br /&gt;
      MY_SCREEN_RECORD.ATTACHSYSFILENAME = &amp;quot;&amp;quot;;&lt;br /&gt;
   End-If;&lt;br /&gt;
   &lt;br /&gt;
   Return &amp;amp;RETCODE;&lt;br /&gt;
End-Function;&lt;br /&gt;
&lt;br /&gt;
/* Main */&lt;br /&gt;
&amp;amp;return = my_delete_attachment();&lt;br /&gt;
DoSaveNow();&lt;/p&gt;
&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
    
    
    
          <comments>http://blog.jbheren.com/post/2009/11/13/Peoplecode-File-Attachment#comment-form</comments>
      <wfw:comment>http://blog.jbheren.com/post/2009/11/13/Peoplecode-File-Attachment#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.jbheren.com/feed/atom/comments/22</wfw:commentRss>
      </item>
    
  <item>
    <title>Déplacer un fichier avec Peoplecode</title>
    <link>http://blog.jbheren.com/post/2009/11/04/D%C3%A9placer-un-fichier-avec-Peoplecode</link>
    <guid isPermaLink="false">urn:md5:2936d208cfec5af19a0cd7bcc3b90f22</guid>
    <pubDate>Wed, 04 Nov 2009 21:39:00 +0100</pubDate>
    <dc:creator>Jean-Baptiste HEREN</dc:creator>
        <category>Peoplesoft</category>
        <category>Peoplecode</category><category>peoplesoft</category>    
    <description>&lt;div&gt;Pour faire court voici un exemple d'utilisation de la commande exec() et
d'un fichier batch pour déplacer un fichier.&lt;/div&gt;    &lt;blockquote&gt;
&lt;div&gt;&lt;br /&gt;
/********************************/&lt;/div&gt;
&lt;div&gt;/* Initialisation des variables */&lt;/div&gt;
&lt;div&gt;/********************************/&lt;/div&gt;
&lt;div&gt;Local File &amp;amp;File;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&amp;amp;file_dir = UNE_TABLE_AET.FILE_DIRECTORY;&lt;/div&gt;
&lt;div&gt;&amp;amp;file_name = UNE_TABLE_AET.FILE_NAME;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&amp;amp;new_file_dir = UNE_TABLE_AET.FILE_DIR_SERVER;&lt;/div&gt;
&lt;div&gt;&amp;amp;new_file_name = &amp;amp;file_name | &amp;quot;_&amp;quot;
| UNE_TABLE_AET.PROCESS_INSTANCE;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&amp;amp;cheminbatch = &amp;amp;new_file_dir | UNE_TABLE_AET.PROCESS_INSTANCE
| &amp;quot;.bat &amp;quot;;&lt;/div&gt;
&lt;div&gt;&amp;amp;chemin = &amp;amp;file_dir | &amp;amp;file_name;&lt;/div&gt;
&lt;div&gt;&amp;amp;cheminnouveau = &amp;amp;new_file_dir | &amp;amp;new_file_name;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&amp;amp;commandcp = &amp;quot;move &amp;quot; | &amp;amp;chemin | &amp;quot; &amp;quot; | &amp;amp;cheminnouveau;&lt;/div&gt;
&lt;div&gt;&amp;amp;commandrm = &amp;quot;del &amp;quot; | &amp;amp;chemin;&lt;/div&gt;
&lt;div&gt;&amp;amp;commandrm2 = &amp;quot;del &amp;quot; | &amp;amp;cheminbatch;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;/* Ecriture d'un BATCH script de déplacement &amp;amp; renommage du fichier
*/&lt;/div&gt;
&lt;div&gt;&amp;amp;File = GetFile(&amp;amp;cheminbatch, &amp;quot;W&amp;quot;, &amp;quot;A&amp;quot;, %FilePath_Absolute);&lt;/div&gt;
&lt;div&gt;&amp;amp;File.WriteLine(&amp;amp;commandcp);&lt;/div&gt;
&lt;div&gt;&amp;amp;File.WriteLine(&amp;amp;commandrm);&lt;/div&gt;
&lt;div&gt;&amp;amp;File.WriteLine(&amp;amp;commandrm2);&lt;/div&gt;
&lt;div&gt;&amp;amp;File.Close();&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;/* création d'un fichier log.*/&lt;/div&gt;
&lt;div&gt;REM &amp;amp;cheminbatch = &amp;amp;cheminbatch | &amp;quot; &amp;gt; &amp;quot; | &amp;amp;new_file_dir |
UNE_TABLE_AET.PROCESS_INSTANCE | &amp;quot;.log&amp;quot;;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;/* Exécution de du batch */&lt;/div&gt;
&lt;div&gt;If Exec(&amp;amp;cheminbatch, %Exec_Synchronous + %FilePath_Absolute) &amp;gt;= 0
Then&lt;/div&gt;
&lt;div&gt;   MessageBox(0, &amp;quot;&amp;quot;, 0, 0, &amp;quot;Déplacement du fichier de %1 à %2
réussi&amp;quot;, &amp;amp;chemin, &amp;amp;cheminnouveau);&lt;/div&gt;
&lt;div&gt;End-If;&lt;/div&gt;
&lt;/blockquote&gt;</description>
    
    
    
          <comments>http://blog.jbheren.com/post/2009/11/04/D%C3%A9placer-un-fichier-avec-Peoplecode#comment-form</comments>
      <wfw:comment>http://blog.jbheren.com/post/2009/11/04/D%C3%A9placer-un-fichier-avec-Peoplecode#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.jbheren.com/feed/atom/comments/35</wfw:commentRss>
      </item>
    
  <item>
    <title>Peoplesoft : Nomenclatures à plat en sql</title>
    <link>http://blog.jbheren.com/post/2008/06/04/Peoplesoft-%3A-Nomenclatures-a-plat-en-sql</link>
    <guid isPermaLink="false">urn:md5:f0a60675379bdf1a4e3b361df2873dc9</guid>
    <pubDate>Wed, 04 Jun 2008 11:40:00 +0200</pubDate>
    <dc:creator>Jean-Baptiste HEREN</dc:creator>
        <category>Peoplesoft</category>
        <category>peoplesoft</category><category>SQL</category>    
    <description>&lt;p&gt;Voici un petit exemple de code sql, permettant d'obtenir la nomenclature à
plat telle qu'elle est affichée dans les écrans de consultation des
nomenclatures de production.&lt;/p&gt;    &lt;p&gt;Voici un petit exemple de code sql, permettant d'obtenir la nomenclature à
plat telle qu'elle est affichée dans les écrans de consultation des
nomenclatures de production.&lt;/p&gt;
Cette requête utilise la fonction coalesce(), qui permet d'obtenir le premier
élément non nul d'une liste. Testé avec succès sous SQL server 2000 &amp;amp;
2005.&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
&lt;br /&gt;
/******************************************************************/&lt;br /&gt;
/* Get the Flat BOM with simple
Query                            
*/&lt;br /&gt;
/* This example get the Current BOM Revision with Deepness of 5  
*/&lt;br /&gt;
/******************************************************************/&lt;br /&gt;
&lt;br /&gt;
SELECT&lt;br /&gt;
BUSINESS_UNIT,&lt;br /&gt;
ROOT_ITEM,&lt;br /&gt;
-- The coalesce instruction returns the first not null Element from the listed
parameters.&lt;br /&gt;
COALESCE(Level5,Level4,Level3,Level2,Level1) AS Level,&lt;br /&gt;
COALESCE(INV_ITEM_ID5,INV_ITEM_ID4,INV_ITEM_ID3,INV_ITEM_ID2,INV_ITEM_ID1) AS
ITEM_ID,&lt;br /&gt;
COALESCE(POS_NBR5,POS_NBR4,POS_NBR3,POS_NBR2,POS_NBR1) AS POS_NBR,&lt;br /&gt;
COALESCE(QTY_PER5,QTY_PER4,QTY_PER3,QTY_PER2,QTY_PER1) AS QTY_PER&lt;br /&gt;
FROM&lt;br /&gt;
(&lt;br /&gt;
-- Select all Leafs : Level5&lt;br /&gt;
SELECT DISTINCT&lt;br /&gt;
A.BUSINESS_UNIT,&lt;br /&gt;
A.INV_ITEM_ID as ROOT_ITEM,&lt;br /&gt;
CASE WHEN A.INV_ITEM_ID is null THEN null ELSE 1 END AS Level1,&lt;br /&gt;
A.COMPONENT_ID AS INV_ITEM_ID1,&lt;br /&gt;
A.POS_NBR AS POS_NBR1,&lt;br /&gt;
A.QTY_PER AS QTY_PER1,&lt;br /&gt;
CASE WHEN B.INV_ITEM_ID is null THEN null ELSE 2 END AS Level2,&lt;br /&gt;
B.COMPONENT_ID AS INV_ITEM_ID2,&lt;br /&gt;
B.POS_NBR AS POS_NBR2,&lt;br /&gt;
B.QTY_PER AS QTY_PER2,&lt;br /&gt;
CASE WHEN C.INV_ITEM_ID is null THEN null ELSE 3 END AS Level3,&lt;br /&gt;
C.COMPONENT_ID AS INV_ITEM_ID3,&lt;br /&gt;
C.POS_NBR AS POS_NBR3,&lt;br /&gt;
C.QTY_PER AS QTY_PER3,&lt;br /&gt;
CASE WHEN D.INV_ITEM_ID is null THEN null ELSE 4 END AS Level4,&lt;br /&gt;
D.COMPONENT_ID AS INV_ITEM_ID4,&lt;br /&gt;
D.POS_NBR AS POS_NBR4,&lt;br /&gt;
D.QTY_PER AS QTY_PER4,&lt;br /&gt;
CASE WHEN E.INV_ITEM_ID is null THEN null ELSE 5 END AS Level5,&lt;br /&gt;
E.COMPONENT_ID AS INV_ITEM_ID5,&lt;br /&gt;
E.POS_NBR AS POS_NBR5,&lt;br /&gt;
E.QTY_PER AS QTY_PER5&lt;br /&gt;
FROM PS_EN_BOM_COMPS A&lt;br /&gt;
  LEFT OUTER JOIN PS_EN_BOM_COMPS B ON&lt;br /&gt;
       A.BUSINESS_UNIT = B.BUSINESS_UNIT&lt;br /&gt;
   AND A.COMPONENT_ID = B.INV_ITEM_ID&lt;br /&gt;
   and A.BOM_STATE    = B.BOM_STATE&lt;br /&gt;
   and A.BOM_TYPE     = B.BOM_TYPE&lt;br /&gt;
   and A.BOM_CODE     = B.BOM_CODE&lt;br /&gt;
  LEFT OUTER JOIN PS_EN_BOM_COMPS C ON&lt;br /&gt;
       C.BUSINESS_UNIT = B.BUSINESS_UNIT&lt;br /&gt;
   AND C.INV_ITEM_ID   = B.COMPONENT_ID&lt;br /&gt;
   and C.BOM_STATE    = B.BOM_STATE&lt;br /&gt;
   and C.BOM_TYPE     = B.BOM_TYPE&lt;br /&gt;
   and C.BOM_CODE     = B.BOM_CODE&lt;br /&gt;
  LEFT OUTER JOIN PS_EN_BOM_COMPS D ON&lt;br /&gt;
       D.BUSINESS_UNIT = C.BUSINESS_UNIT&lt;br /&gt;
   AND D.INV_ITEM_ID   = C.COMPONENT_ID&lt;br /&gt;
   and D.BOM_STATE    = C.BOM_STATE&lt;br /&gt;
   and D.BOM_TYPE     = C.BOM_TYPE&lt;br /&gt;
   and D.BOM_CODE     = C.BOM_CODE&lt;br /&gt;
  LEFT OUTER JOIN PS_EN_BOM_COMPS E ON&lt;br /&gt;
       E.BUSINESS_UNIT = D.BUSINESS_UNIT&lt;br /&gt;
   AND E.INV_ITEM_ID   = D.COMPONENT_ID&lt;br /&gt;
   and E.BOM_STATE    = D.BOM_STATE&lt;br /&gt;
   and E.BOM_TYPE     = D.BOM_TYPE&lt;br /&gt;
   and E.BOM_CODE     = D.BOM_CODE&lt;br /&gt;
WHERE A.BOM_STATE = 'PR'&lt;br /&gt;
  and A.BOM_TYPE  = 'PR'&lt;br /&gt;
  and A.BOM_CODE  = 1&lt;br /&gt;
  AND (getdate() BETWEEN A.DATE_IN_EFFECT AND A.DATE_OBSOLETE)&lt;br /&gt;
  AND (getdate() BETWEEN B.DATE_IN_EFFECT AND B.DATE_OBSOLETE)&lt;br /&gt;
  AND (getdate() BETWEEN C.DATE_IN_EFFECT AND C.DATE_OBSOLETE)&lt;br /&gt;
  AND (getdate() BETWEEN D.DATE_IN_EFFECT AND D.DATE_OBSOLETE)&lt;br /&gt;
  AND (getdate() BETWEEN E.DATE_IN_EFFECT AND E.DATE_OBSOLETE)&lt;br /&gt;
UNION&lt;br /&gt;
-- Select all Leafs : Level4&lt;br /&gt;
SELECT DISTINCT&lt;br /&gt;
A.BUSINESS_UNIT,&lt;br /&gt;
A.INV_ITEM_ID as ROOT_ITEM,&lt;br /&gt;
CASE WHEN A.INV_ITEM_ID is null THEN null ELSE 1 END AS Level1,&lt;br /&gt;
A.COMPONENT_ID AS INV_ITEM_ID1,&lt;br /&gt;
A.POS_NBR AS POS_NBR1,&lt;br /&gt;
A.QTY_PER AS QTY_PER1,&lt;br /&gt;
CASE WHEN B.INV_ITEM_ID is null THEN null ELSE 2 END AS Level2,&lt;br /&gt;
B.COMPONENT_ID AS INV_ITEM_ID2,&lt;br /&gt;
B.POS_NBR AS POS_NBR2,&lt;br /&gt;
B.QTY_PER AS QTY_PER2,&lt;br /&gt;
CASE WHEN C.INV_ITEM_ID is null THEN null ELSE 3 END AS Level3,&lt;br /&gt;
C.COMPONENT_ID AS INV_ITEM_ID3,&lt;br /&gt;
C.POS_NBR AS POS_NBR3,&lt;br /&gt;
C.QTY_PER AS QTY_PER3,&lt;br /&gt;
CASE WHEN D.INV_ITEM_ID is null THEN null ELSE 4 END AS Level4,&lt;br /&gt;
D.COMPONENT_ID AS INV_ITEM_I4,&lt;br /&gt;
D.POS_NBR AS POS_NBR4,&lt;br /&gt;
D.QTY_PER AS QTY_PER4,&lt;br /&gt;
NULL AS Level5,&lt;br /&gt;
NULL AS INV_ITEM_ID5,&lt;br /&gt;
NULL AS POS_NBR5,&lt;br /&gt;
NULL AS QTY_PER5&lt;br /&gt;
FROM PS_EN_BOM_COMPS A&lt;br /&gt;
  LEFT OUTER JOIN PS_EN_BOM_COMPS B ON&lt;br /&gt;
       A.BUSINESS_UNIT = B.BUSINESS_UNIT&lt;br /&gt;
   AND A.COMPONENT_ID = B.INV_ITEM_ID&lt;br /&gt;
   and A.BOM_STATE    = B.BOM_STATE&lt;br /&gt;
   and A.BOM_TYPE     = B.BOM_TYPE&lt;br /&gt;
   and A.BOM_CODE     = B.BOM_CODE&lt;br /&gt;
  LEFT OUTER JOIN PS_EN_BOM_COMPS C ON&lt;br /&gt;
       C.BUSINESS_UNIT = B.BUSINESS_UNIT&lt;br /&gt;
   AND C.INV_ITEM_ID   = B.COMPONENT_ID&lt;br /&gt;
   and C.BOM_STATE    = B.BOM_STATE&lt;br /&gt;
   and C.BOM_TYPE     = B.BOM_TYPE&lt;br /&gt;
   and C.BOM_CODE     = B.BOM_CODE&lt;br /&gt;
  LEFT OUTER JOIN PS_EN_BOM_COMPS D ON&lt;br /&gt;
       D.BUSINESS_UNIT = C.BUSINESS_UNIT&lt;br /&gt;
   AND D.INV_ITEM_ID   = C.COMPONENT_ID&lt;br /&gt;
   and D.BOM_STATE    = C.BOM_STATE&lt;br /&gt;
   and D.BOM_TYPE     = C.BOM_TYPE&lt;br /&gt;
   and D.BOM_CODE     = C.BOM_CODE&lt;br /&gt;
WHERE A.BOM_STATE = 'PR'&lt;br /&gt;
  and A.BOM_TYPE  = 'PR'&lt;br /&gt;
  and A.BOM_CODE  = 1&lt;br /&gt;
  AND (getdate() BETWEEN A.DATE_IN_EFFECT AND A.DATE_OBSOLETE)&lt;br /&gt;
  AND (getdate() BETWEEN B.DATE_IN_EFFECT AND B.DATE_OBSOLETE)&lt;br /&gt;
  AND (getdate() BETWEEN C.DATE_IN_EFFECT AND C.DATE_OBSOLETE)&lt;br /&gt;
  AND (getdate() BETWEEN D.DATE_IN_EFFECT AND D.DATE_OBSOLETE)&lt;br /&gt;
UNION&lt;br /&gt;
-- Select all Level3&lt;br /&gt;
SELECT DISTINCT&lt;br /&gt;
A.BUSINESS_UNIT,&lt;br /&gt;
A.INV_ITEM_ID as ROOT_ITEM,&lt;br /&gt;
CASE WHEN A.INV_ITEM_ID is null THEN null ELSE 1 END AS Level1,&lt;br /&gt;
A.COMPONENT_ID AS INV_ITEM_ID1,&lt;br /&gt;
A.POS_NBR AS POS_NBR1,&lt;br /&gt;
A.QTY_PER AS QTY_PER1,&lt;br /&gt;
CASE WHEN B.INV_ITEM_ID is null THEN null ELSE 2 END AS Level2,&lt;br /&gt;
B.COMPONENT_ID AS INV_ITEM_ID2,&lt;br /&gt;
B.POS_NBR AS POS_NBR2,&lt;br /&gt;
B.QTY_PER AS QTY_PER2,&lt;br /&gt;
CASE WHEN C.INV_ITEM_ID is null THEN null ELSE 3 END AS Level3,&lt;br /&gt;
C.COMPONENT_ID AS INV_ITEM_ID3,&lt;br /&gt;
C.POS_NBR AS POS_NBR3,&lt;br /&gt;
C.QTY_PER AS QTY_PER3,&lt;br /&gt;
NULL AS Level4,&lt;br /&gt;
NULL AS INV_ITEM_ID4,&lt;br /&gt;
NULL AS POS_NBR4,&lt;br /&gt;
NULL AS QTY_PER4,&lt;br /&gt;
NULL AS Level5,&lt;br /&gt;
NULL AS INV_ITEM_ID5,&lt;br /&gt;
NULL AS POS_NBR5,&lt;br /&gt;
NULL AS QTY_PER5&lt;br /&gt;
FROM PS_EN_BOM_COMPS A&lt;br /&gt;
  LEFT OUTER JOIN PS_EN_BOM_COMPS B ON&lt;br /&gt;
       A.BUSINESS_UNIT = B.BUSINESS_UNIT&lt;br /&gt;
   AND A.COMPONENT_ID = B.INV_ITEM_ID&lt;br /&gt;
   and A.BOM_STATE    = B.BOM_STATE&lt;br /&gt;
   and A.BOM_TYPE     = B.BOM_TYPE&lt;br /&gt;
   and A.BOM_CODE     = B.BOM_CODE&lt;br /&gt;
  LEFT OUTER JOIN PS_EN_BOM_COMPS C ON&lt;br /&gt;
       C.BUSINESS_UNIT = B.BUSINESS_UNIT&lt;br /&gt;
   AND C.INV_ITEM_ID   = B.COMPONENT_ID&lt;br /&gt;
   and C.BOM_STATE    = B.BOM_STATE&lt;br /&gt;
   and C.BOM_TYPE     = B.BOM_TYPE&lt;br /&gt;
   and C.BOM_CODE     = B.BOM_CODE&lt;br /&gt;
WHERE A.BOM_STATE = 'PR'&lt;br /&gt;
  and A.BOM_TYPE  = 'PR'&lt;br /&gt;
  and A.BOM_CODE  = 1&lt;br /&gt;
  AND (getdate() BETWEEN A.DATE_IN_EFFECT AND A.DATE_OBSOLETE)&lt;br /&gt;
  AND (getdate() BETWEEN B.DATE_IN_EFFECT AND B.DATE_OBSOLETE)&lt;br /&gt;
  AND (getdate() BETWEEN C.DATE_IN_EFFECT AND C.DATE_OBSOLETE)&lt;br /&gt;
UNION&lt;br /&gt;
-- Select all Level2&lt;br /&gt;
SELECT DISTINCT&lt;br /&gt;
A.BUSINESS_UNIT,&lt;br /&gt;
A.INV_ITEM_ID as ROOT_ITEM,&lt;br /&gt;
CASE WHEN A.INV_ITEM_ID is null THEN null ELSE 1 END AS Level1,&lt;br /&gt;
A.COMPONENT_ID AS INV_ITEM_ID1,&lt;br /&gt;
A.POS_NBR AS POS_NBR1,&lt;br /&gt;
A.QTY_PER AS QTY_PER1,&lt;br /&gt;
CASE WHEN B.INV_ITEM_ID is null THEN null ELSE 2 END AS Level2,&lt;br /&gt;
B.COMPONENT_ID AS INV_ITEM_ID2,&lt;br /&gt;
B.POS_NBR AS POS_NBR2,&lt;br /&gt;
B.QTY_PER AS QTY_PER2,&lt;br /&gt;
NULL AS Level3,&lt;br /&gt;
NULL AS INV_ITEM_ID3,&lt;br /&gt;
NULL AS POS_NBR3,&lt;br /&gt;
NULL AS QTY_PER3,&lt;br /&gt;
NULL AS Level4,&lt;br /&gt;
NULL AS INV_ITEM_ID4,&lt;br /&gt;
NULL AS POS_NBR4,&lt;br /&gt;
NULL AS QTY_PER4,&lt;br /&gt;
NULL AS Level5,&lt;br /&gt;
NULL AS INV_ITEM_ID5,&lt;br /&gt;
NULL AS POS_NBR5,&lt;br /&gt;
NULL AS QTY_PER5&lt;br /&gt;
FROM PS_EN_BOM_COMPS A&lt;br /&gt;
  LEFT OUTER JOIN PS_EN_BOM_COMPS B ON&lt;br /&gt;
       A.BUSINESS_UNIT = B.BUSINESS_UNIT&lt;br /&gt;
   AND A.COMPONENT_ID = B.INV_ITEM_ID&lt;br /&gt;
   and A.BOM_STATE    = B.BOM_STATE&lt;br /&gt;
   and A.BOM_TYPE     = B.BOM_TYPE&lt;br /&gt;
   and A.BOM_CODE     = B.BOM_CODE&lt;br /&gt;
   AND (getdate() BETWEEN A.DATE_IN_EFFECT AND A.DATE_OBSOLETE)&lt;br /&gt;
   AND (getdate() BETWEEN B.DATE_IN_EFFECT AND B.DATE_OBSOLETE)&lt;br /&gt;
WHERE A.BOM_STATE = 'PR'&lt;br /&gt;
  and A.BOM_TYPE  = 'PR'&lt;br /&gt;
  and A.BOM_CODE  = 1&lt;br /&gt;
UNION&lt;br /&gt;
-- Select all Level1&lt;br /&gt;
SELECT DISTINCT&lt;br /&gt;
A.BUSINESS_UNIT,&lt;br /&gt;
A.INV_ITEM_ID as ROOT_ITEM,&lt;br /&gt;
CASE WHEN A.INV_ITEM_ID is null THEN null ELSE 1 END AS Level1,&lt;br /&gt;
A.COMPONENT_ID AS INV_ITEM_ID1,&lt;br /&gt;
A.POS_NBR AS POS_NBR1,&lt;br /&gt;
A.QTY_PER AS QTY_PER1,&lt;br /&gt;
NULL AS Level2,&lt;br /&gt;
NULL AS INV_ITEM_ID2,&lt;br /&gt;
NULL AS POS_NBR2,&lt;br /&gt;
NULL AS QTY_PER2,&lt;br /&gt;
NULL AS Level3,&lt;br /&gt;
NULL AS INV_ITEM_ID3,&lt;br /&gt;
NULL AS POS_NBR3,&lt;br /&gt;
NULL AS QTY_PER3,&lt;br /&gt;
NULL AS Level4,&lt;br /&gt;
NULL AS INV_ITEM_ID4,&lt;br /&gt;
NULL AS POS_NBR4,&lt;br /&gt;
NULL AS QTY_PER4,&lt;br /&gt;
NULL AS Level5,&lt;br /&gt;
NULL AS INV_ITEM_ID5,&lt;br /&gt;
NULL AS POS_NBR5,&lt;br /&gt;
NULL AS QTY_PER5&lt;br /&gt;
FROM PS_EN_BOM_COMPS A&lt;br /&gt;
WHERE A.BOM_STATE = 'PR'&lt;br /&gt;
  and A.BOM_TYPE  = 'PR'&lt;br /&gt;
  and A.BOM_CODE  = 1&lt;br /&gt;
  AND (getdate() BETWEEN A.DATE_IN_EFFECT AND A.DATE_OBSOLETE)&lt;br /&gt;
) Z&lt;br /&gt;
WHERE Z.BUSINESS_UNIT = :1&lt;br /&gt;
  AND Z.ROOT_ITEM = :2&lt;br /&gt;
ORDER BY
INV_ITEM_ID1,INV_ITEM_ID2,INV_ITEM_ID3,INV_ITEM_ID4,INV_ITEM_ID5&lt;/code&gt;</description>
    
          <enclosure url="http://blog.jbheren.com/public/sql/BOM_View.sql"
      length="8071" type="text/plain" />
    
    
          <comments>http://blog.jbheren.com/post/2008/06/04/Peoplesoft-%3A-Nomenclatures-a-plat-en-sql#comment-form</comments>
      <wfw:comment>http://blog.jbheren.com/post/2008/06/04/Peoplesoft-%3A-Nomenclatures-a-plat-en-sql#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.jbheren.com/feed/atom/comments/42</wfw:commentRss>
      </item>
    
  <item>
    <title>Peoplesoft data mover</title>
    <link>http://blog.jbheren.com/post/2008/03/31/Peoplesoft-data-mover</link>
    <guid isPermaLink="false">urn:md5:53a9dfe133843b9186687fb514a7abce</guid>
    <pubDate>Mon, 31 Mar 2008 17:56:00 +0200</pubDate>
    <dc:creator>Jean-Baptiste HEREN</dc:creator>
        <category>Peoplesoft</category>
        <category>peoplesoft</category><category>SQL</category>    
    <description>&lt;p&gt;Data mover est un outil très pratique, permettant l'export et l'import de
données dans des tables. Cela peut servir à copier des éléments de paramétrage
ou des jeux de tests d'une base à l'autre.&lt;/p&gt;    &lt;h2&gt;L'interface&lt;/h2&gt;
On ne peut pas faire plus simple. Il s'agit d'une fenêtre de saisie disposant
d'un bouton Exécution (Feu tricolore)&lt;br /&gt;
&lt;img alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/tools/.datamover01_m.jpg&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Le Principe&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;On se connecte à la base Source et on lance un script d'export&lt;/li&gt;
&lt;li&gt;On se connecte à la base cible et on lance un script d'import&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Exemple de script d'export&lt;/h2&gt;
SET OUTPUT c:\temp\data\TABLE_HDR.dat;&lt;br /&gt;
SET LOG    c:\temp\data\TABLE_HDR_EXPORT.log;&lt;br /&gt;
&lt;br /&gt;
-- Export Tables&lt;br /&gt;
EXPORT PS_TABLE_HDR;&lt;br /&gt;
EXPORT PS_TABLE_LINE WHERE KEY='TEST';&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Exemple de script d'import&lt;/h2&gt;
SET INPUT c:\temp\data\TABLE_HDR.dat;&lt;br /&gt;
SET LOG    c:\temp\data\TABLE_HDR__IMPORT.log;&lt;br /&gt;
&lt;br /&gt;
-- Export Tables&lt;br /&gt;
DELETE FROM PS_TABLE_HDR;&lt;br /&gt;
IMPORT PS_TABLE_HDR;&lt;br /&gt;
&lt;br /&gt;
DELETE FROM PS_TABLE_LINE WHERE KEY='TEST';;&lt;br /&gt;
IMPORT PS_TABLE_LINE;&lt;br /&gt;</description>
    
    
    
          <comments>http://blog.jbheren.com/post/2008/03/31/Peoplesoft-data-mover#comment-form</comments>
      <wfw:comment>http://blog.jbheren.com/post/2008/03/31/Peoplesoft-data-mover#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.jbheren.com/feed/atom/comments/34</wfw:commentRss>
      </item>
    
  <item>
    <title>Imprimer une étiquette sur Zebra en Sqr</title>
    <link>http://blog.jbheren.com/post/2008/03/20/Imprimer-une-etiquette-sur-Zebra-en-Sqr</link>
    <guid isPermaLink="false">urn:md5:7eba72db005f4060bc0adb048b3dc260</guid>
    <pubDate>Thu, 20 Mar 2008 06:01:00 +0100</pubDate>
    <dc:creator>Jean-Baptiste HEREN</dc:creator>
        <category>Peoplesoft</category>
        <category>peoplesoft</category><category>sqr</category><category>zebra</category>    
    <description>&lt;p&gt;Voici un morceau de code illustrant comment générer un programme ZPL2 en
sqr, afin d'imprimer une étiquette sur une imprimante Zebra. L'exemple ci-après
imprime une étiquette contenant du texte, deux codes barre et un cadre.&lt;/p&gt;    Les &amp;quot;imprimantes codes barre&amp;quot; ne sont pas des imprimantes classiques. Pour
obtenir un résultat de leur part, il faut leur transmettre des instructions
dans un langage spécifique. Il s'agit donc dans cet exemple, de transmettre à
l'imprimante, un fichier contenant un programme compréhensible par celle-ci.
Les Zebra utilisent un langage de balises appelé ZPL. Les instructions se
présente sous la forme suivante : &lt;code&gt;^XXparm0,parm1,parm3&lt;/code&gt; Où XX est
le nom de l'instruction, et parmx sont les paramètres. Pour plus de détails sur
ce langage, vous trouverez facilement la documentations sur le site de
Zebra.&lt;br /&gt;
&lt;br /&gt;
L'unité utilisée pour les coordonnées sur l'étiquette est le pixel. Tout dépend
donc de la résolution de l'imprimante, généralement définie en points par pouce
(DPI). Ici j'utilise une fonction qui se charge de la conversion de cm à pixel,
en utilisant un dpi paramétré à 300.&lt;br /&gt;
&lt;p&gt;
!----------------------------------------------------------------------!&lt;br /&gt;
! Author : Jean-Baptiste
Heren                                        
!&lt;br /&gt;
! Procedure print-zebra-tag          
                       
!&lt;br /&gt;
!----------------------------------------------------------------------!&lt;br /&gt;
! Description: Print Tags on a Zebra
Printer                          
!&lt;br /&gt;
!----------------------------------------------------------------------!&lt;br /&gt;
begin-procedure print-zebra-tag&lt;br /&gt;
&lt;br /&gt;
  ! Set Filename&lt;br /&gt;
  let $filepath = RTRIM($filepath,' ')&lt;br /&gt;
  if substr($filepath,length($filepath),1) &amp;lt;&amp;gt; '\'&lt;br /&gt;
    let $filepath = $filepath || '\'&lt;br /&gt;
  end-if&lt;br /&gt;
&lt;br /&gt;
  let $filename = $barcode_value || '.txt'&lt;br /&gt;
  let $filename = $filepath || $filename&lt;br /&gt;
    &lt;br /&gt;
  ! Open File&lt;br /&gt;
  open $filename as 1  for-writing record=1000:vary
status=#filestat&lt;br /&gt;
  if #filestat &amp;lt;&amp;gt; 0&lt;br /&gt;
    SHOW 'Could not Open File ' $filename&lt;br /&gt;
  else   &lt;br /&gt;
       ! Get Positions in Pixels&lt;br /&gt;
       do cm-to-pixels(5  ,#YLABEL)&lt;br /&gt;
       do cm-to-pixels(18 ,#XLABEL)&lt;br /&gt;
       ! cols&lt;br /&gt;
       do cm-to-pixels(0.5,#XCOL0)&lt;br /&gt;
       do cm-to-pixels(3  ,#XCOL1)&lt;br /&gt;
       do cm-to-pixels(6  ,#XCOL2)&lt;br /&gt;
       do cm-to-pixels(12 ,#XCOL3)&lt;br /&gt;
       ! Lines&lt;br /&gt;
       do cm-to-pixels(1.5,#YGZONE)&lt;br /&gt;
       do cm-to-pixels(0.1,#YLINE6)&lt;br /&gt;
       do cm-to-pixels(0.3,#YLINE5)&lt;br /&gt;
       do cm-to-pixels(1  ,#YLINE4)&lt;br /&gt;
       do cm-to-pixels(1.8,#YLINE3)&lt;br /&gt;
       do cm-to-pixels(2.6,#YLINE2)&lt;br /&gt;
       do cm-to-pixels(3.4,#YLINE1)&lt;br /&gt;
       do cm-to-pixels(4.3,#YLINE0)&lt;br /&gt;
       &lt;br /&gt;
       let $label_format  =
'^XA^LRN^FWR^CF0,52,39^LH20,20^PON'&lt;br /&gt;
       let
$heading       = '^FO'|| TO_CHAR(#YLINE0) ||','||
TO_CHAR(#XCOL0) || '^CF0,52,39^FD' || 'Address : ' || $LOCAL_ADDRESS || ' Tel:
'|| $LOCAL_PHONE || ' Fax: ' || $LOCAL_FAX ||'^FS'&lt;br /&gt;
       let
$line1_1       = '^FO'|| TO_CHAR(#YLINE1) ||','||
TO_CHAR(#XCOL1) || '^CF0,65,52^FD' || 'Ref :' || '^FS'&lt;br /&gt;
       let
$line1_2       = '^FO'|| TO_CHAR(#YLINE1) ||','||
TO_CHAR(#XCOL2) || '^CF0,65,52^FD' || $inv_item_id || ', Rev ' || $revision ||
'^FS'&lt;br /&gt;
       let
$line1_3       = '^FO'|| TO_CHAR(#YLINE1) ||','||
TO_CHAR(#XCOL3) || '^B3,,110,Y^FD' || $inv_item_id || '^FS'&lt;br /&gt;
       let
$line2_1       = '^FO'|| TO_CHAR(#YLINE2) ||','||
TO_CHAR(#XCOL1) || '^CF0,52,39^FD' || 'Designation :' || '^FS'&lt;br /&gt;
       let
$line2_2       = '^FO'|| TO_CHAR(#YLINE2) ||','||
TO_CHAR(#XCOL2) || '^CF0,52,39^FD' || $ITEM_DESCR || '^FS'&lt;br /&gt;
       let
$line3_1       = '^FO'|| TO_CHAR(#YLINE3) ||','||
TO_CHAR(#XCOL1) || '^CF0,52,39^FD' || 'Quantite :' || '^FS'&lt;br /&gt;
       let
$line3_2       = '^FO'|| TO_CHAR(#YLINE3) ||','||
TO_CHAR(#XCOL2) || '^CF0,52,39^FD' || To_CHAR(#QtyOnTag) || '^FS'&lt;br /&gt;
       let
$line4_1       = '^FO'|| TO_CHAR(#YLINE4) ||','||
TO_CHAR(#XCOL1) || '^CF0,52,39^FD' || 'N. Lot :' || '^FS'&lt;br /&gt;
       let
$line4_2       = '^FO'|| TO_CHAR(#YLINE4) ||','||
TO_CHAR(#XCOL2) || '^CF0,52,39^FD' || $barcode_value || '^FS'&lt;br /&gt;
       let
$line4_3       = '^FO'|| TO_CHAR(#YLINE4) ||','||
TO_CHAR(#XCOL3) || '^B3,,110,Y^FD' || $barcode_value || '^FS'&lt;br /&gt;
       let
$line5_1       = '^FO'|| TO_CHAR(#YLINE5) ||','||
TO_CHAR(#XCOL1) || '^CF0,52,39^FD' || 'Date :' || '^FS'&lt;br /&gt;
       let
$line5_2       = '^FO'|| TO_CHAR(#YLINE5) ||','||
TO_CHAR(#XCOL2) || '^CF0,52,39^FD' || $SysDateTime || '^FS'&lt;br /&gt;
       ! Graphics&lt;br /&gt;
       let $graphic_box   = '^FO0,0^GB'
|| TO_CHAR(#YLABEL) || ','|| TO_CHAR(#XLABEL) || ',5^FS'&lt;br /&gt;
       let $graphic_line  = '^FO0,0^GB0,' ||
TO_CHAR(#YLABEL) || ',5^FS'&lt;br /&gt;
       let $label_end     =
'^XZ'&lt;br /&gt;
       &lt;br /&gt;
       let $LINE = $label_format || $heading ||
$line1_1  || $line1_2 || $line1_3 || $line2_1 || $line2_2 || $line3_1 ||
$line3_2 || $line4_1 || $line4_2 || $line4_3 || $line5_1 || $line5_2 ||
$graphic_box || $graphic_line || $label_end&lt;br /&gt;
      ! Write File&lt;br /&gt;
      #DEBUG SHOW 'Zebra data : ' $LINE&lt;br /&gt;
      write 1 from $LINE&lt;br /&gt;
  end-if&lt;br /&gt;
  CLOSE 1&lt;br /&gt;
end-if&lt;br /&gt;
end-procedure&lt;br /&gt;
&lt;br /&gt;
!----------------------------------------------------------------------!&lt;br /&gt;
! Author : Jean-Baptiste
Heren                                        
!&lt;br /&gt;
! Procedure To convert cm to pixels using a DPI fixed
parameter        !&lt;br /&gt;
! Cette procédure convertit des cm en Pixels suivant un dpi paramétré 
!&lt;br /&gt;
!----------------------------------------------------------------------!&lt;br /&gt;
begin-procedure cm-to-pixels(#cm, :#pixels)&lt;br /&gt;
! This Could be also a parameter&lt;br /&gt;
let #dpi = 300&lt;br /&gt;
! Conversion&lt;br /&gt;
let #inches = #cm *0.39&lt;br /&gt;
! Rounding&lt;br /&gt;
let #pixels = round(#dpi * #inches,0) ! Integer divide&lt;br /&gt;
end-procedure&lt;/p&gt;</description>
    
          <enclosure url="http://blog.jbheren.com/public/sqr/zebra.sqc"
      length="4444" type="text/plain" />
          <enclosure url="http://blog.jbheren.com/public/sqr/zplmanualx10.pdf"
      length="3838778" type="application/pdf" />
    
    
          <comments>http://blog.jbheren.com/post/2008/03/20/Imprimer-une-etiquette-sur-Zebra-en-Sqr#comment-form</comments>
      <wfw:comment>http://blog.jbheren.com/post/2008/03/20/Imprimer-une-etiquette-sur-Zebra-en-Sqr#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.jbheren.com/feed/atom/comments/23</wfw:commentRss>
      </item>
    
  <item>
    <title>Ecrire un fichier avec Peoplecode</title>
    <link>http://blog.jbheren.com/post/2008/01/23/TutoFichierPeoplecode</link>
    <guid isPermaLink="false">urn:md5:0ff22f3ba568801c7ce9257576b907ff</guid>
    <pubDate>Mon, 25 Feb 2008 20:10:00 +0000</pubDate>
    <dc:creator>Jean-Baptiste HEREN</dc:creator>
        <category>Peoplesoft</category>
        <category>FileLayout</category><category>Interface</category><category>Peoplecode</category>    
    <description>&lt;p&gt;Avec Peoplesoft, il existe plusieurs moyens de créer un fichier. Ceux-ci
sont très utiles dans le développement d'interfaces avec d'autres logiciels ou
appareils spécifiques.&lt;/p&gt;
&lt;p&gt;Je présente ici deux solutions. La première laisse la main au développeur
pour l'écriture des enregistrements. La seconde utilise une définition de
colonages basée sur un Record.&lt;/p&gt;    &lt;br /&gt;
&lt;h2&gt;1- Accéder au fichier&lt;/h2&gt;
&lt;p&gt;Dans les deux cas, nous commencerons par définir Notre Fichier, puis
l'ouvrir en écriture.&lt;/p&gt;
&lt;p&gt;Local File &amp;amp;myFile;&lt;br /&gt;
Local String &amp;amp;FileName, &amp;amp;FilePath;&lt;/p&gt;
&lt;p&gt;&amp;amp;FilePath = &amp;quot;/temp/&amp;quot;;&lt;br /&gt;
&amp;amp;FileName = &amp;quot;test.csv&amp;quot;;&lt;/p&gt;
&lt;p&gt;&amp;amp;myFile = GetFile(&amp;amp;FilePath | &amp;amp;FileName, &amp;quot;W&amp;quot;,
%FilePath_Absolute);&lt;/p&gt;
&lt;h2&gt;2- Ecriture &amp;quot;Manuelle&amp;quot;&lt;/h2&gt;
Dans ce cas, nous pouvons simplement écrire des lignes formatées manuellement
dans une chaîne de caractères.&lt;br /&gt;
&lt;br /&gt;
Local String &amp;amp;ligne;&lt;br /&gt;
Local SQL &amp;amp;mySql;&lt;br /&gt;
Local Boolean &amp;amp;result;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;result = &amp;amp;mySql.Fetch(&amp;amp;FIELD1, &amp;amp;FIELD2, &amp;amp;FIELD3,
&amp;amp;FIELD4, &amp;amp;FIELD5);&lt;br /&gt;
&lt;br /&gt;
&amp;amp;Ligne = &amp;amp;FIELD1 | &amp;quot;;&amp;quot; | &amp;amp;FIELD2 | &amp;quot;;&amp;quot; | &amp;amp;FIELD3 | &amp;quot;;&amp;quot; |
&amp;amp;FIELD4 | &amp;quot;;&amp;quot; | &amp;amp;FIELD5;&lt;br /&gt;
&amp;amp;myFile.writeLine(&amp;amp;Ligne);&lt;br /&gt;
&lt;br /&gt;
&amp;amp;mySql.close();&lt;br /&gt;
&amp;amp;myFile.Close();
&lt;h2&gt;3- Utilisation d'un FileLayout&lt;/h2&gt;
Le FileLayout est un &amp;quot;objet&amp;quot; peoplesoft qui permet de définir des formats de
fichiers en utilisant des records. L'avantage du couple Record / FileLayout
réside dans le fait que lors des opérations de lecture/écriture, le développeur
n'a pas à se soucier du format. Il est tés facile de passer une ligne de
fichier directement dans une ligne de Record, et inversement.&lt;br /&gt;
&lt;br /&gt;
Pour créer un FileLayout : &lt;br /&gt;
&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/filelayout/New_FileLayout.png&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/filelayout/.New_FileLayout_t.jpg&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/filelayout/New_FileLayout2.png&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/filelayout/.New_FileLayout2_t.jpg&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/filelayout/New_FileLayout3.png&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/filelayout/.New_FileLayout3_t.jpg&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://blog.jbheren.com/public/peoplecode/filelayout/New_FileLayout4.png&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blog.jbheren.com/public/peoplecode/filelayout/.New_FileLayout4_t.jpg&quot; /&gt;&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;File / new /FileLayout&lt;/li&gt;
&lt;li&gt;Glisser Déposer le record désiré dans la fenêtre du FileLayout&lt;/li&gt;
&lt;li&gt;Définir le format au niveau Global (double clic sur le nom du
FileLayout)&lt;/li&gt;
&lt;li&gt;Définir le format du Segment (douvle clic sur le nom du Record)&lt;/li&gt;
&lt;li&gt;Sauvegarde&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Utilisation du FileLayout en Peoplecode.&lt;/p&gt;
&lt;p&gt;Il suffit d'appliquer le format à un fichier défini précédemment.&lt;/p&gt;
&lt;p&gt;&amp;amp;myFile.SetFileLayout(FileLayout.MYRECORD_LAYOUT);&lt;/p&gt;
&lt;p&gt;Une fois ce format défini, nous pouvons passer aux opérations de
lecture/écriture, en utilisant les Records et Rowsets.&lt;/p&gt;
&lt;h3&gt;3.1 - Ecriture ligne par ligne&lt;/h3&gt;
&lt;p&gt;Sélection des données via un objet sql et utilisation d'un Record pour
stocker le résultat.&lt;/p&gt;
&lt;p&gt;Local SQL &amp;amp;mySql;&lt;br /&gt;
Local Record &amp;amp;myRecord;&lt;br /&gt;
Local Boolean &amp;amp;result;&lt;/p&gt;
&lt;p&gt;&amp;amp;mySql = GetSQL(SQL.THE_SQL_OBJECT, &amp;amp;PARAM1, &amp;amp;PARAM2);&lt;br /&gt;
REM Boucle sur chaque Ligne Résultante;&lt;br /&gt;
While &amp;amp;mySql.Fetch(&amp;amp;MyRecord)&lt;br /&gt;
  REM écriture du record;&lt;br /&gt;
  &amp;amp;myFile.writeRecord(&amp;amp;myRecord);&lt;br /&gt;
end-While;&lt;/p&gt;
&amp;amp;mySql.close();&lt;br /&gt;
&amp;amp;myFile.close();&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;3.2 - Ecriture du Rowset en une fois&lt;/h3&gt;
&lt;p&gt;Sélection d'un ensemble de données dans un Rowset.&lt;/p&gt;
&lt;p&gt;Local Rowset &amp;amp;myRowset = CreateRowset(Record.MYRECORD);&lt;br /&gt;
&amp;amp;myRowset.Fill(&amp;quot;WHERE FIELD1 = :1 AND FIELD2 = :2&amp;quot;, &amp;amp;PARAM1,
&amp;amp;PARAM2);&lt;/p&gt;
&lt;p&gt;REM Ecriture de l'ensemble des lignes sélectionnées;&lt;br /&gt;
&amp;amp;myFile.WriteRowset(&amp;amp;myRowset, True);&lt;/p&gt;
REM Fremeture du Fichier;&lt;br /&gt;
&amp;amp;myFile.close();&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;4- Pour conclure&lt;/h2&gt;
Il est intéressant de noter que la lecture d'un fichier suit les mêmes règles
que l'écriture. Il suffira d'utiliser par exemple,  les méthodes
ReadLine() ou ReadRowset().&lt;br /&gt;</description>
    
    
    
          <comments>http://blog.jbheren.com/post/2008/01/23/TutoFichierPeoplecode#comment-form</comments>
      <wfw:comment>http://blog.jbheren.com/post/2008/01/23/TutoFichierPeoplecode#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.jbheren.com/feed/atom/comments/41</wfw:commentRss>
      </item>
    
  <item>
    <title>Ecrire un fichier plat en sqr</title>
    <link>http://blog.jbheren.com/post/2008/02/19/Ecrire-un-fichier-plat-en-sqr</link>
    <guid isPermaLink="false">urn:md5:98d0969c43fedc0320c87f00131f3e1d</guid>
    <pubDate>Tue, 19 Feb 2008 20:42:00 +0100</pubDate>
    <dc:creator>Jean-Baptiste HEREN</dc:creator>
        <category>Peoplesoft</category>
        <category>sqr</category>    
    <description>&lt;p&gt;Voici les trois étapes nécessaires pour l'écriture d'un fichier plat en
sqr:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Ouverture : Instruction &lt;strong&gt;OPEN&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Ecriture: Instruction &lt;strong&gt;WRITE&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Fermeture : Instruction &lt;strong&gt;CLOSE&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;    &lt;p&gt;Dans cet exemple, Nous créons un fichier &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: italic;&quot;&gt;text.txt&lt;/span&gt; dans le dossier &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: italic;&quot;&gt;/temp&lt;/span&gt;, et y écrivons deux
chaines de caractères, en précisant pour chaque 'colonne', sa taille
fixe.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;!  Init FileName and File Number&lt;/strong&gt;&lt;br /&gt;
let $File_name = '/temp/text.txt'&lt;br /&gt;
move 1 to  #FILE_NO&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: bold;&quot;&gt;! Put Something to
$values&lt;/span&gt;&lt;br /&gt;
let $value1 = 'foo1'&lt;br /&gt;
let $value2 = 'foo2'&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;! 1- Create the File and attach it to the specified File
Number&lt;/strong&gt;&lt;br /&gt;
OPEN $File_name as #FILE_NO for-writing record=20000:VARY&lt;br /&gt;
                                      
status=#filestat                                                      &lt;br /&gt;

&lt;strong&gt;! 2- Write one line (aka record)&lt;/strong&gt;&lt;br /&gt;
write #FILE_NO
from             &lt;br /&gt;

     $Value1:16 &lt;strong&gt;! fixed zize to 16
chars&lt;/strong&gt;&lt;br /&gt;
     $Value2:4  &lt;strong&gt;! fixed zize to 4
chars&lt;/strong&gt;&lt;br /&gt;
    &lt;br /&gt;
&lt;strong&gt;! 3 - close File&lt;/strong&gt;&lt;br /&gt;
Close #FILE_NO&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Biensûr, ils est courant de placer une boucle de type BEGIN-SQL/END-SQL
autour de l'étape 2, sachant que chaque appel à la commande WRITE crée une
nouvelle ligne dans le fichier.&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.jbheren.com/post/2008/02/19/Ecrire-un-fichier-plat-en-sqr#comment-form</comments>
      <wfw:comment>http://blog.jbheren.com/post/2008/02/19/Ecrire-un-fichier-plat-en-sqr#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.jbheren.com/feed/atom/comments/33</wfw:commentRss>
      </item>
    
  <item>
    <title>Fonction sleep() pour Peoplecode</title>
    <link>http://blog.jbheren.com/post/2008/01/29/Fonction-sleep-pour-Peoplecode</link>
    <guid isPermaLink="false">urn:md5:a77701f468a167909d98cbd8d577a768</guid>
    <pubDate>Tue, 29 Jan 2008 22:58:00 +0100</pubDate>
    <dc:creator>Jean-Baptiste HEREN</dc:creator>
        <category>Peoplesoft</category>
            
    <description>&lt;p&gt;En Peoplecode pur, il n'existe pas de fonction sleep() ou de wait(). Voici
donc un fonction qui utilise une méthode Java pour arriver à ses fins.&lt;/p&gt;    &lt;p&gt;Function Sleep(&amp;amp;ms)&lt;br /&gt;
   Local JavaObject &amp;amp;javaThread;&lt;br /&gt;
   try&lt;br /&gt;
      &amp;amp;javaThread =
GetJavaClass(&amp;quot;java.lang.Thread&amp;quot;);&lt;br /&gt;
      // Java Sleep takes milliseconds.&lt;/p&gt;
&lt;p&gt;      &amp;amp;javaThread.sleep(&amp;amp;ms);&lt;br /&gt;
      &amp;amp;javaThread = Null;&lt;br /&gt;
   catch Exception &amp;amp;Ex&lt;br /&gt;
      &amp;amp;javaThread = Null;&lt;br /&gt;
   end-try;&lt;br /&gt;
End-Function;&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.jbheren.com/post/2008/01/29/Fonction-sleep-pour-Peoplecode#comment-form</comments>
      <wfw:comment>http://blog.jbheren.com/post/2008/01/29/Fonction-sleep-pour-Peoplecode#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.jbheren.com/feed/atom/comments/31</wfw:commentRss>
      </item>
    
  <item>
    <title>Peoplecode : Lancer un traitement et en attendre le résultat.</title>
    <link>http://blog.jbheren.com/post/2008/01/29/Peoplecode-%3A-Traitement-lancant-un-autre-traitement</link>
    <guid isPermaLink="false">urn:md5:72fdfcc5b4df86378c56f3c4c861dcb9</guid>
    <pubDate>Tue, 29 Jan 2008 22:55:00 +0100</pubDate>
    <dc:creator>Jean-Baptiste HEREN</dc:creator>
        <category>Peoplesoft</category>
        <category>Peoplecode</category><category>peoplesoft</category>    
    <description>&lt;p&gt;Voici comment en Peoplecode, il est possible d'exécuter d'autres traitements
et d'attendre leur fin avant de poursuivre.&lt;/p&gt;    &lt;blockquote&gt;
&lt;p&gt;Local ProcessRequest &amp;amp;prcsrqst;&lt;br /&gt;
Local JavaObject &amp;amp;Obj;   &lt;br /&gt;
     &lt;br /&gt;
      &amp;amp;prcsrqst =
CreateProcessRequest(&amp;quot;Application Engine&amp;quot;, &amp;quot;TEST&amp;quot;);&lt;br /&gt;
      &amp;amp;prcsrqst.RunControlID =
TEST_AET.RUN_CNTL_ID.Value;&lt;br /&gt;
      &amp;amp;prcsrqst.Schedule();&lt;br /&gt;
     &lt;br /&gt;
      &amp;amp;Obj =
CreateJavaObject(&amp;quot;java.lang.Thread&amp;quot;);&lt;br /&gt;
      &amp;amp;Obj.start();&lt;br /&gt;
     &lt;br /&gt;
      &amp;amp;RunStatus = &amp;quot;0&amp;quot;;&lt;br /&gt;
      While &amp;amp;RunStatus &amp;lt;&amp;gt; &amp;quot;9&amp;quot; And&lt;br /&gt;
           
&amp;amp;RunStatus &amp;lt;&amp;gt; &amp;quot;3&amp;quot; And&lt;br /&gt;
           
&amp;amp;RunStatus &amp;lt;&amp;gt; &amp;quot;1&amp;quot; And&lt;br /&gt;
           
&amp;amp;RunStatus &amp;lt;&amp;gt; &amp;quot;10&amp;quot;&lt;br /&gt;
         REM Directly use the Java
sleep() Method for 5 seconds;&lt;br /&gt;
         &amp;amp;Obj.sleep(5000);&lt;br /&gt;
         SQLExec(&amp;quot;SELECT RUNSTATUS FROM
PSPRCSRQST WHERE PRCSINSTANCE = :1&amp;quot;, &amp;amp;prcsrqst.ProcessInstance,
&amp;amp;RunStatus);&lt;br /&gt;
         REM MessageBox(0, &amp;quot;&amp;quot;, 0, 0,
&amp;quot;Sleep(), Runstatus = %1&amp;quot;, &amp;amp;RunStatus);&lt;br /&gt;
      End-While;&lt;br /&gt;
      &amp;amp;Obj.stop();&lt;br /&gt;
     &lt;br /&gt;
      rem WriteLog(&amp;quot;Process TEST is Finished&amp;quot;);&lt;br /&gt;
     &lt;br /&gt;
      If &amp;amp;prcsrqst.Status = 10 /* No success */
Or&lt;br /&gt;
           
&amp;amp;prcsrqst.Status = 3 /*( Error)*/ Then&lt;br /&gt;
         /* Process your errors
*/&lt;br /&gt;
         Exit (1);&lt;br /&gt;
      Else&lt;br /&gt;
        /* Process your success */&lt;br /&gt;
      End-If;&lt;/p&gt;
&lt;/blockquote&gt;</description>
    
    
    
          <comments>http://blog.jbheren.com/post/2008/01/29/Peoplecode-%3A-Traitement-lancant-un-autre-traitement#comment-form</comments>
      <wfw:comment>http://blog.jbheren.com/post/2008/01/29/Peoplecode-%3A-Traitement-lancant-un-autre-traitement#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.jbheren.com/feed/atom/comments/20</wfw:commentRss>
      </item>
    
  <item>
    <title>Squelette Sqr Report</title>
    <link>http://blog.jbheren.com/post/2008/01/25/Squelette-Sqr-Report</link>
    <guid isPermaLink="false">urn:md5:f376872d52e84c0d779efee0e1acd308</guid>
    <pubDate>Fri, 25 Jan 2008 14:15:00 +0100</pubDate>
    <dc:creator>Jean-Baptiste HEREN</dc:creator>
        <category>Peoplesoft</category>
        <category>peoplesoft</category><category>sqr</category>    
    <description>SQR est un langage assez fastidieux à déboger, et l'on se laisse
souvent prendre aux petits pièges comme par exemple, la nécessité d'indenter
les ordres sql pour qu'ils fonctionnent...
&lt;div&gt;Voici donc un squelette de programme sqr. J'espère que comme pour moi, il
vous évitera d'obtenir des erreurs avant même d'avoir commencé à programmer
:).&lt;/div&gt;    &lt;p&gt;Vous trouverez joint à ce post, le fameux fichier WORDFILE.TXT permettant la
coloration syntaxique de SQR dans l'éditeur UltraEdit.&lt;/p&gt;
&lt;div&gt;&lt;code&gt;#INCLUDE 'SETENV.SQC'&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;BEGIN-SETUP&lt;/div&gt;
&lt;div&gt;    #INCLUDE 'SETUP01.SQC'&lt;/div&gt;
&lt;div&gt;END-SETUP&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;!-------------------------------------------&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;!
Begin-Heading&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;! Standard
Section ran on each pages&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;!-------------------------------------------&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;BEGIN-HEADING 6&lt;/div&gt;
&lt;div&gt;  print 'header' ()&lt;/div&gt;
&lt;div&gt;END-HEADING&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;!-------------------------------------------&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;!
Begin-Footing&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;! Standard
Section ran on each pages&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;!-------------------------------------------&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;BEGIN-FOOTING 4&lt;/div&gt;
&lt;div&gt;  last-page           ()  ' /' ' '
     ! &amp;quot;Page 12 of 25.&lt;/div&gt;
&lt;div&gt;END-FOOTING&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;!-------------------------------------------&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;! Begin
Report&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;! Main section
of program execution (standard for Reports).&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;!-------------------------------------------&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;BEGIN-REPORT&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;   !
We have to manualy manage the line position&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;   let #line = 1&lt;/div&gt;
&lt;div&gt;   let #col = 1&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;   let $mytext1 = 'test1'&lt;/div&gt;
&lt;div&gt;   let $mytext2 = 'test2'&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;   !
Print my text1&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;   print $mytext1 (#line, #col)&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;   &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;!
We have to manualy manage the line position&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;   ADD 1 TO #line&lt;/div&gt;
&lt;div&gt;   ADD 10 TO #col   &lt;/div&gt;
&lt;div&gt;
&lt;div&gt;   &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;!
Print my text2&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;   print $mytext2 (#line, #col)&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;   ADD 1 TO #line&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;   do MY-REPORT&lt;/div&gt;
&lt;div&gt;END-REPORT&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;!-------------------------------------------&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;! Your Custom
Procedure&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;! Put here the
main part of your Report&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;!-------------------------------------------&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;BEGIN-PROCEDURE MY-REPORT&lt;/div&gt;
&lt;div&gt;  print 'page1' (#line, #col)&lt;/div&gt;
&lt;div&gt;  &lt;/div&gt;
&lt;div&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt; !
Create new page&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;  new-page&lt;/div&gt;
&lt;div&gt;  MOVE 1 TO #line&lt;/div&gt;
&lt;div&gt;  MOVE 1 TO #col &lt;/div&gt;
&lt;div&gt;  print 'page2' (#line, #col)&lt;/div&gt;
&lt;div&gt;END-PROCEDURE !MY-REPORT&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</description>
    
          <enclosure url="http://blog.jbheren.com/public/sqr/WORDFILE.TXT"
      length="67933" type="text/plain" />
          <enclosure url="http://blog.jbheren.com/public/sqr/squelette.sqr"
      length="4399" type="text/plain" />
    
    
          <comments>http://blog.jbheren.com/post/2008/01/25/Squelette-Sqr-Report#comment-form</comments>
      <wfw:comment>http://blog.jbheren.com/post/2008/01/25/Squelette-Sqr-Report#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.jbheren.com/feed/atom/comments/30</wfw:commentRss>
      </item>
    
  <item>
    <title>Purges des tables de LANG pour les pages</title>
    <link>http://blog.jbheren.com/post/2008/01/25/Purges-des-tables-de-LANG-pour-les-pages</link>
    <guid isPermaLink="false">urn:md5:19c960fc45cd312e38db494e73d3e9ad</guid>
    <pubDate>Fri, 25 Jan 2008 14:04:00 +0100</pubDate>
    <dc:creator>Jean-Baptiste HEREN</dc:creator>
        <category>Peoplesoft</category>
        <category>peoplesoft</category>    
    <description>&lt;p&gt;Il vous est certainement arrivé de trouver une page en Français fortement
différente de ce qu'elle est en Anglais. Ceci est souvent dû au fait que les
développeurs précédents on édité les pages, directement en Français.&lt;/p&gt;
&lt;p&gt;Le script SQL suivant permet de visualiser ces définitions, puis de les
supprimer afin de retrouver le même rendu dans toutes les langues.&lt;/p&gt;
1- Quitter Application designer&lt;br /&gt;
&lt;br /&gt;
2- Lancer le script en remplaçant le TM_INT_DRT_PNL par le nom de ta page
(SELECT avant le DELETE histoire de voir ce que tu vas supprimer)&lt;br /&gt;
&lt;p&gt;3- Ouvrir la page dans application designer (En Anglais), faire une petite
modif et la sauvegarder.&lt;/p&gt;    &lt;blockquote&gt;
&lt;div&gt;SELECT * FROM PSPNLDEFNLANG&lt;/div&gt;
&lt;div&gt;WHERE PNLNAME = 'TM_INT_DRT_PNL';&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;SELECT * FROM PSPNLBTNLANG&lt;/div&gt;
&lt;div&gt;WHERE PNLNAME = 'TM_INT_DRT_PNL';&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;SELECT * FROM PSPNLFIELDLANG&lt;/div&gt;
&lt;div&gt;WHERE PNLNAME = 'TM_INT_DRT_PNL';&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;SELECT * FROM PSPNLHTMLLANG&lt;/div&gt;
&lt;div&gt;WHERE PNLNAME = 'TM_INT_DRT_PNL';&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;// Attention tout de même à ne pas lancer cette purge si vous n'êtes pas
sûrs de vous ...&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;DELETE FROM PSPNLDEFNLANG&lt;/div&gt;
&lt;div&gt;WHERE PNLNAME = 'TM_INT_DRT_PNL';&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;DELETE FROM PSPNLBTNLANG&lt;/div&gt;
&lt;div&gt;WHERE PNLNAME = 'TM_INT_DRT_PNL';&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;DELETE FROM PSPNLFIELDLANG&lt;/div&gt;
&lt;div&gt;WHERE PNLNAME = 'TM_INT_DRT_PNL';&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;DELETE FROM PSPNLHTMLLANG&lt;/div&gt;
&lt;div&gt;WHERE PNLNAME = 'TM_INT_DRT_PNL';&lt;/div&gt;
&lt;div&gt;commit;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;</description>
    
    
    
          <comments>http://blog.jbheren.com/post/2008/01/25/Purges-des-tables-de-LANG-pour-les-pages#comment-form</comments>
      <wfw:comment>http://blog.jbheren.com/post/2008/01/25/Purges-des-tables-de-LANG-pour-les-pages#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.jbheren.com/feed/atom/comments/29</wfw:commentRss>
      </item>
    
</channel>
</rss>
