Tuesday, January 24, 2012

Accessing Application Package class object using CreateObject method.

Let’s say we have 2 application package.

1. UserID and

2. Notification.

Here Notification application package uses dynamic changing application package say based on setup.

For our example we are using UserID application package as setup driven application package and it has UserID as Class.

clip_image002

Structure of UserID application package.

class UserID
method GetOpridsByApplicationPack() Returns array of string;
property array of string oprid_arr;
end-class;

method UserID

end-method;

method GetOpridsByApplicationPack
/+ Returns Array of String +/

%This.oprid_arr = CreateArrayRept("", 0);
Local string &SupervisorId, &ReportsTo;

%This.oprid_arr.push('PS'); /* Logic to populate data in array. */

Return %This.oprid_arr;

end-method;



Below is “Notification” application package structure.

In this application package we are using CreateObject to access “GetOpridsByApplicationPackmethod of UserID class of UserID application package .

We are passing Package name and Class Name while calling so they are variable for us. (In this case its UserID and UserID).

class NotificationManager
method GetOpridsByApplicationPack(&PkgRoot As string, &Appcls_Path As string) Returns array of string;

end-class;

method NotificationManager

end-method;

method GetOpridsByApplicationPack
/+ &PkgRoot as String, +/
/+ &Appcls_Path as String +/
/+ Returns Array of String +/
Local array of string &aryOpridTo;
Local string &Classname;
Local object &u;
&aryOpridTo = CreateArrayRept(" ", 0);
&Classname = &PkgRoot | ":" | &Appcls_Path;
&u = CreateObject(&Classname);
ObjectDoMethod(&u, "GetOpridsByApplicationPack");
&aryOpridTo = &u.oprid_arr;
Return &aryOpridTo;
end-method;

Thursday, January 19, 2012

Data Mover SQL Error ORA-12899: Value Too Large for Column

Error:
Data MoverSQL Error. Stmt #: 0 Error Position: 851 Return: 12899 - ORA-12899: value too large for column "SYSADM"."PS_GP_FORMULA_DTL".&q uot;FM_COMMENT" (actual: 255, maximum: 254)

Data Mover Release: 8.52
Database: HRMS91 (ENG)
Input file: C:\PT8.52\data\hcengs.db (ENG)
Importing GP_FORMULA_DTL
Import GP_FORMULA_DTL 0
Updating statistics for GP_FORMULA_DTL
Records remaining: 11949
Importing GP_FORMULA_DTL
File: Data MoverSQL error. Stmt #: 0 Error Position: 851 Return: 12899 - ORA-12899: value too large for column "SYSADM"."PS_GP_FORMULA_DTL".&q uot;FM_COMMENT" (actual: 255, maximum: 254)
Failed SQL stmt:INSERT INTO PS_GP_FORMULA_DTL (PIN_NUM, EFFDT, SEQ_NUM5, FRML_FUNC_OPTN, FRML_LEFT_PAREN, ENTRY_TYPE_FRML1, PIN_FRML_FLD1_NUM, FRML_FLD1_DAT_TYP, FRML_FLD1_DEC_VAL, FRML_FLD1_DATE_VAL, FRML_FLD1_CHAR_VAL, FRML_FLD1_ATRB_IND, PIN_RND1_NUM, FRML_FLD1_USE_OPTN, FRML_OPER1, FRML_FLD1_OLDV_IND, ENTRY_TYPE_FRML2, PIN_FRML_FLD2_NUM, FRML_FLD2_DAT_TYP, FRML_FLD2_DEC_VAL, FRML_FLD2_DATE_VAL, FRML_FLD2_CHAR_VAL, FRML_FLD2_ATRB_IND, PIN_RND2_NUM, FRML_FLD2_USE_OPTN, FRML_FLD2_OLDV_IND, FRML_RIGHT_PAREN, ENTRY_TYPE_FRML3, PIN_FRML_FLD3_NUM, FRML_FLD3_DAT_TYP, FRML_FLD3_ATRB_IND, PIN_RND3_NUM, FRML_FLD3_USE_OPTN, FM_COMMENT) VALUES (:1, TO_DATE(:2,'YYYY-MM-DD'), :3, :4, :5, :6, :7, :8, :9, TO_DATE(:10,'YYYY-MM-DD'), :11, :12, :13, :14, :15, :16, :17, :18, :19, :20, TO_DATE(:21,'YYYY-MM-DD'), :22, :23, :24, :25, :26, :27, :28, :29, :30, :31, :
Error: Unable to insert row 5091
Error: SQL execute error for GP_FORMULA_DTL
Unsuccessful completion

Solution:
Changes need to done before starting of installation.
Change NLS_LENGTH_SEMANTICS to CHAR which is default as BYTE.
Below are the steps:
SQL> alter system set NLS_LENGTH_SEMANTICS=char scope=both;   
System altered.   
SQL> select value from v$parameter where upper(name)='NLS_LENGTH_SEMANTICS';   
VALUE
-------------------------------------------------------------------------------
CHAR   SQL> select value from v$nls_parameters where parameter='NLS_LENGTH_SEMANTICS';   
VALUE
----------------------------------------------------------------
BYTE   
SQL> startup force
ORACLE instance started.   
Total System Global Area  535662592 bytes
Fixed Size                  1348508 bytes
Variable Size             381684836 bytes
Database Buffers          146800640 bytes
Redo Buffers                5828608 bytes
Database mounted.
Database opened.
SQL> select value from v$parameter where upper(name)='NLS_LENGTH_SEMANTICS';   
VALUE
-------------------------------------------------------------------------------
CHAR   
SQL> select value from v$nls_parameters where parameter='NLS_LENGTH_SEMANTICS';   
VALUE
----------------------------------------------------------------
CHAR   
SQL>

Exit(0) And Exit(1) Function in Application Engine.

Exit(0) – Terminates the current PeopleCode Action in application engine.

Exit(1) – Terminates the current Step in application engine.

Monday, January 9, 2012

Avoid rowset processing in an Application Engine program.

Avoid rowset processing in an Application Engine program. Loading data into a rowset can use a significant amount of memory, approximated by the following formula:

mem = nrows * (row overhead + nrecords * ( rec overhead + nfields * ( field overhead) + average cumulative fielddata))

where

· mem is the amount of memory required to store the rowset.

· nrows is the number of rows.

· row overhead is the overhead per row.

· nrecords is the number of records per row.

· rec overhead is the record overhead (approximately 40 bytes).

· nfields is the number of fields in the record.

· field overhead is the overhead per field (approximately 80 bytes).

· average cumulative fielddata is the average amount of data per field.

Using this formula, a rowset containing 500,000 rows with one record per row, 50 fields, and 200 bytes per field would require approximately 2.3 gigabytes of memory.

Monday, January 2, 2012