Monday, May 25, 2015

Invoking ODI Scenario from Oracle Application through Concurrent Program

Following code snippet will help you in invoking ODI scenarios from Oracle Application through a Concurrent Program. 

Invoking ODI scenario from E-Business suite will provide more control in executing the integration and interfaces between oracle and other legacy systems. This will be handy when you have unexpected shutdowns of ERP. You do not have to reschedule all the scenarios in ODI. ERP will run all the scheduled requests, whenever system is up and running.

This program is generic in nature. You can schedule it or call this from any other program. I have used UNIX scripting for achieving this functionality, however there are various other methods to achieve this.

Define a Concurrent program with the executable type as Shell scripting (Host) and following parameters.



Create a shell script using the following code. This code will automatically identify and control the execution of ODI scenario based on ERP instance. You may have to slightly change according to your version of OS and file system and other parameters.

Please comment and let me know if this was helpful.

**** TEST CODE STARTS HERE ****

export v_param1=`echo $1|cut -f9 -d " "|cut -f2 -d '"' `
export v_param2=`echo $2|cut -f9 -d " "|cut -f2 -d '"' `
export v_param3=`echo $3|cut -f9 -d " "|cut -f2 -d '"' `
export v_param4=`echo $4|cut -f9 -d " "|cut -f2 -d '"' `

v_scenario_name=${5}
v_scenario_ver=${6}
v_execution_context=${7}
v_log_level=${8}
v_package_name=${9}
v_instance_name=${TWO_TASK}

echo "Shell script start date - "
date

echo "Parameter Values"
#echo "Connection String is $v_param1"
#echo "User ID is $v_param2"
echo "User Name is $v_param3"
echo "Request ID is $v_param4"

echo "ODI Scenario Name - $v_scenario_name"
echo "ODI Scenario Version - $v_scenario_ver"
echo "Execution Context - $v_execution_context"
echo "ODI Log Level - $v_log_level"
echo "ODI Agent Name - $v_agent_name"
echo "ODI Package Name - $v_package_name"
echo "APPS Instance Name - $v_instance_name"

if [ $v_instance_name == "PROD" ]
then

v_url="erpapps.wafigroup.local"
v_agent_name="PRODAGENT"
v_odi_path="/u11/odiuser/oracledi/agent/bin/startscen.sh"

elif [ $v_instance_name == "TEST" ]
then

v_url="erpdev.wafigroup.local"
v_agent_name="TESTAGENT"
v_odi_path="/d04/odiuser/oracledi/agent/bin/startscen.sh"

elif [ $v_instance_name == "SUPPORT" ]
then

#v_url="erpdev.wafigroup.local"
#v_agent_name="TESTAGENT"
#v_odi_path="/d04/odiuser/oracledi/agent/bin/startscen.sh"

v_url="erptest.wafigroup.local"
v_agent_name="AGENTSUPPORT"
v_odi_path="/f04/odiuser/oracledi/agent/bin/startscen.sh"

fi

echo "APPS URL - $v_url"
echo ""

echo "Executing ODI Scenario from APPS"

rsh $v_url -l odiuser $v_odi_path $v_scenario_name $v_scenario_ver $v_execution_context $v_log_level  -NAME=$v_agent_name -SESSION_NAME=$v_package_name

echo $?

echo "Execution Completed time - "
date

exit 0