This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License.








Wednesday, September 06, 2006

ReBuild Account in Oracle iProcurement


Note: If using Firefox, for this article use the link iProc Rebuild Account

Let us assume you have a requirement to make the Account Generator in Oracle iProcurement (11.5.10) rebuild accounts whenever there is a change in Requisition Line Descriptive Flex Fields Attribute5 or Attribute6 or both.

Until 11.5.9, you will be implementing this by placing some code in por_custom_pkg.set_rebuild_dist_value
The code will look similar to below( although might require slight tweak as per your requirements):-

BEGIN

  x_return_code :=
0;

  x_error_msg   :=
'
'
;

 
/* apassi Jan 2004. If the DFF value has been changed then we must

  rebuild the Code Combination taking into consideration all the segments */


  END IF;

  IF nvl(line_att5,
'XXX')
!= nvl(attribute8,
'XXX')

  THEN

    returnvalue :=
'Y';

  END IF;

  IF nvl(line_att6,
'XXX')
!= nvl(attribute9,
'XXX')

  THEN

    returnvalue :=
'Y';

  END IF;

END;


It looks quite simple, ain’t it? Indeed it is quite simple, all you require is the above few lines of code in por_custom_pkg, following which changes to your Line Descriptive Flex 5 & 6 will re-initiate Proc Account Generator workflow.

Well, welcome 11.5.10 !!
The steps in 11.5.10 will be as below( although each step is visually explained in this article with further breakdowns)
a. Extend the Entity Object that contains these attributes.
b. The Extended EO will introduce business attribute properties for these DFF Attributes. This will tell the Oracle iProc engine to regenerate the accounts.
c. Substitute the standard EO by Extended EO
d. Bounce the entire middle tier, try your luck by merely bouncing the Apache.

OK, here with go into the details of each step. These steps are documented in Oracle iProc Manual too, but in a language that can only be understood by Experienced Oracle guys. Hence this article is an effort from me to explain the steps in naïve manner.

Step 1.
FTP and bring all the iProc BC4J classes and XML files onto your PC. Ensure that the location of those packages is included in the CLASSPATH that is defined against your JDeveloper Project. You will need to import server.xml from respective package to open up the BC4J in jDeveloper.

Step 2
Extend the Entity Object PoRequisitionLineEO to create a new entity object named xxxxPoRequisitionLineEO.
Select the BC4J Package that contains the EO that you need to extend. In my case I will select oracle.apps.icx.por.schema.server and right click to see the option for “New Entity Object” as below


Now define a new Entity Object xxxxPoRequisitionLineEO. Move the cursor to Extends Entity and click on button Browse to select PoRequisitionLineEO


Now click on Next, until you see the New from Table button as below. Click on that “New from Table” button.
As in the picture below, select Attribute5 and Attribute6 ( or the appropriate attributes in your case).



Now, your EO will look somewhat similar to below.



Please note that the schema object is PO_REQUISITION_LINES_ALL, simply because in this example, we wish to rebuild the iProcurement Account whenever a change is made to certain attributes in Requisition Line DFF.

Step 3
One of the most important steps is to define these attributes as Business Attributes, to help re-initiate account generator workflow.

Select on Tab “Attribute Properties”

As in above picture, Name=AccountLineBizAttrSet
Value=Y ……click on Add

Step 4
Once having created the Extended Entity Object, next we need to create a Substitution such that our extended EO xxxxPoRequisitionLineEO will replace the standard EO PoRequisitionLineEO

For doing so, right click on the jpx file within which you had opened iProc’s BC4J packages(this was done by importing server.xml initially). Once you right click jpx file, you will see an option “Edit Business Components Project”.



Following this, select “Substitution” option as in the list below




Now, finally you can implement substitution. In the left hand pane select PoRequisitionLineEO under the package oracle.apps.icx.por.schema.server. In the right hand side pane, select xxxxPoRequisitionLineEO from your appropriate package.


Now, this substitution will create a .jpx file for you. In my case, I will name it xxicIcxPorAccReBuild.jpx

This file will look like below

######## Begin xxicIcxPorAccReBuild.jpx #######

<?xml version="1.0" encoding='windows-1252'?>

<!DOCTYPE JboProject SYSTEM "jbo_03_01.dtd">



<JboProject

Name="xxxxIcxPorAccReBuild"

SeparateXMLFiles="true"

PackageName="" >

<DesignTime>

<Attr Name="_version" Value="9.0.3.13.75" />

<Attr Name="_jprName" Value="xxxxIcxPorAccReBuild.jpr" />

<Attr Name="_ejbPackage" Value="false" />

</DesignTime>

<Substitutes>

<Substitute OldName ="oracle.apps.icx.por.schema.server.PoRequisitionLineEO" NewName ="oracle.apps.icx.por.schema.server.xxxxPoRequisitionLineEO" />

</Substitutes>

</JboProject>

######## End xxicIcxPorAccReBuild.jpx #######



Now, to move this .jpx file from one environment to another( to move the substitution definition)
you can either use personalization or you may use the script below

######################Script to load substitution definition to new environment######################

##By Anil Passi

##Please note that this can very well be done by simply exporting and importing the personalizations
too.

##This is so, because the Substitution is stored as a personalization in Oracle.

##Anyhow, because I like to experiment, i prefered using JPXImporter, and it worked

MACHINE_NAME=0

PORT_NUMBER=0

export MACHINE_NAME

export PORT_NUMBER

getPortMachine()

{

MACHINE_NAME=`sqlplus -s apps/$APPS_PWD <<EOF

set pages 0

set lines 1023

select fnd_profile.value('CSF_EMAP_DS_HOST') from dual ;

exit

EOF`



PORT_NUMBER=`sqlplus -s apps/$APPS_PWD <<EOF

set pages 0

set feed off

select fnd_profile.value('CSF_MAP_DB_PORT') from dual ;

exit

EOF`

}

getPortMachine

echo "**********************************"

echo $MACHINE_NAME is Machine Name

echo "**********************************"

sleep 5

echo $PORT_NUMBER is port number

echo "**********************************"

sleep 5

"Echo load substitution"

adjava oracle.jrad.tools.xml.importer.JPXImporter $XXPO_TOP/bin/xxxxIcxPorAccReBuild.jpx -username
apps -password $APPS_PWD -dbconnection "(description=(address_list=(address=(community=tcp.world)(protocol=tcp)(host=$MACHINE_NAME)(port=$PORT_NUMBER)))(connect_data=(sid=$TWO_TASK)))"

######################END OF Script to load substitution ######################

Step 5.

Hang on, not there as yet. You need to deploy the new EO and its implementation on the Unix
server under appropriate directory structure.

This will involve three files, i.e. xxxxPoRequisitionLineEO.xml, xxxxPoRequisitionLineEOImpl.java & xxxxPoRequisitionLineEOImpl.class

Please note that it is not mandatory to deploy the .java file, but I recommend this to be a
good practice.



xxxxPoRequisitionLineEO.xml will contain the EO definition and this file is generated by jDeveloper
to hold meta info of extended EO.

xxxxPoRequisitionLineEOImpl will generate by your favourite jDeveloper too.



If you feel confident, the entire Rebuilding functionality can be implemented without touching
jDeveloper, but for that you will be directly modifying the files that I have pasted below.
In my personal opinion use jDeveloper.

######### Beginning of xxxxPoRequisitionLineEOImpl.java#########

package oracle.apps.icx.por.schema.server;

import oracle.jbo.server.EntityDefImpl;

import oracle.jbo.server.AttributeDefImpl;

import oracle.jbo.Key;

// ---------------------------------------------------------------

// --- Anil Passi iProc Rebuild account.

// ---------------------------------------------------------------



public class xxxxPoRequisitionLineEOImpl extends PoRequisitionLineEOImpl

{

protected static final int MAXATTRCONST = EntityDefImpl.getMaxAttrConst("oracle.apps.icx.por.schema.server.PoRequisitionLineEO");

private static oracle.apps.fnd.framework.server.OAEntityDefImpl mDefinitionObject;



/**

*

* This is the default constructor (do not remove)

*/

public xxxxPoRequisitionLineEOImpl()

{

}



/**

*

* Retrieves the definition object for this instance class.

*/

public static synchronized EntityDefImpl getDefinitionObject()

{

if (mDefinitionObject == null)

{

mDefinitionObject = (oracle.apps.fnd.framework.server.OAEntityDefImpl)EntityDefImpl.findDefObject("oracle.apps.icx.por.schema.server.xxxxPoRequisitionLineEO");

}

return mDefinitionObject;

}



// Generated method. Do not modify.



protected Object getAttrInvokeAccessor(int index, AttributeDefImpl attrDef) throws Exception

{

if (index == ATTRIBUTE5)

{

return getAttribute5();

}

if (index == ATTRIBUTE6)

{

return getAttribute6();

}

return super.getAttrInvokeAccessor(index, attrDef);

}

// Generated method. Do not modify.



protected void setAttrInvokeAccessor(int index, Object value, AttributeDefImpl attrDef) throws
Exception

{

if (index == ATTRIBUTE5)

{

setAttribute5((String)value);

return;

}

if (index == ATTRIBUTE6)

{

setAttribute6((String)value);

return;

}

super.setAttrInvokeAccessor(index, value, attrDef);

return;

}



/**

*

* Gets the attribute value for Attribute5, using the alias name Attribute5

*/

public String getAttribute5()

{

return super.getAttribute5();

}



/**

*

* Sets <code>value</code> as the attribute value for Attribute5

*/

public void setAttribute5(String value)

{

super.setAttribute5(value);

}

/**

*

* Gets the attribute value for Attribute6, using the alias name Attribute6

*/

public String getAttribute6()

{

return super.getAttribute6();

}

/**

*

* Sets <code>value</code> as the attribute value for Attribute6

*/

public void setAttribute6(String value)

{

super.setAttribute6(value);

}

/**

*

* Creates a Key object based on given key constituents

*/

public static Key createPrimaryKey(oracle.jbo.domain.Number requisitionLineId)

{

return new Key(new Object[] {requisitionLineId});

}

}

######### end of xxxxPoRequisitionLineEOImpl.java#########





#########Begin New EO Definition within xml########

<?xml version="1.0" encoding='windows-1252'?>

<!DOCTYPE Entity SYSTEM "jbo_03_01.dtd">



<Entity

Name="xxxxPoRequisitionLineEO"

Extends="oracle.apps.icx.por.schema.server.PoRequisitionLineEO"

DBObjectType="table"

DBObjectName="PO_REQUISITION_LINES_ALL"

AliasName="xxxxPoRequisitionLineEO"

BindingStyle="Oracle"

UseGlueCode="false"

CodeGenFlag="4"

RowClass="oracle.apps.icx.por.schema.server.xxxxPoRequisitionLineEOImpl"

DefClass="oracle.apps.fnd.framework.server.OAEntityDefImpl"

CollClass="oracle.apps.fnd.framework.server.OAEntityCache" >

<DesignTime>

<Attr Name="_isCodegen" Value="true" />

<Attr Name="_version" Value="9.0.3.13.75" />

<AttrArray Name="_publishEvents">

</AttrArray>

</DesignTime>

<Attribute

Name="Attribute5"

Precision="255"

Type="java.lang.String"

ColumnName="ATTRIBUTE5"

ColumnType="VARCHAR2"

SQLType="VARCHAR"

TableName="PO_REQUISITION_LINES_ALL" >

<Properties>

<Property Name ="AccountLineBizAttrSet" Value ="Y" />

</Properties>

<DesignTime>

<Attr Name="_OverrideAttr" Value="true" />

</DesignTime>

</Attribute>

<Attribute

Name="Attribute6"

Precision="255"

Type="java.lang.String"

ColumnName="ATTRIBUTE6"

ColumnType="VARCHAR2"

SQLType="VARCHAR"

TableName="PO_REQUISITION_LINES_ALL" >

<Properties>

<Property Name ="AccountLineBizAttrSet" Value ="Y" />

</Properties>

<DesignTime>

<Attr Name="_OverrideAttr" Value="true" />

</DesignTime>

</Attribute>

</Entity>

#########End New EO Definition within xml########



Last Step

#######Finish Recompilation of deployment#######

Recompile the .java file on the server as below. I do this to ensure that everything will work
in production without any grief.

#Note that i should have actually created a new directory structure to keep

#this extended file. But if i were to redo this, i would create a new directory structure

#Neverthless, this is still safe to Recompile your deployment on Server itself.



echo deploy xxxxPoRequisitionLineEOImpl.class

cp $XXPO_TOP/bin/xxxxPoRequisitionLineEOImpl.class $JAVA_TOP/oracle/apps/icx/por/schema/server/xxxxPoRequisitionLineEOImpl.class



echo deploy xxxxPoRequisitionLineEOImpl.java

cp $XXPO_TOP/bin/xxxxPoRequisitionLineEOImpl.java $JAVA_TOP/oracle/apps/icx/por/schema/server/xxxxPoRequisitionLineEOImpl.java



echo deploy xxxxPoRequisitionLineEO.xml

cp $XXPO_TOP/bin/xxxxPoRequisitionLineEO.xml $JAVA_TOP/oracle/apps/icx/por/schema/server/xxxxPoRequisitionLineEO.xml



cd $JAVA_TOP/oracle/apps/icx/por/schema/server

echo "Now compiling....."

javac xxxxPoRequisitionLineEOImpl.java



#######Finish Recompilation of deployment#######



Your comments are welcome, if you feel I should elaborate any section further. I believe almost
every second client on 11.5.10 iProcurement will have to implement this functionality.



Thanks,

Anil Passi

Comments on ""

 

post a comment