#!/bin/ksh
################################################################################
#
# Shell Script Name : XX_PAID_INVOICES_WITH_DISTRIBUTION.sh
#
# Purpose : A shell script to upload all components required for
# Paid Invoices with distribution Report
#
# Change History :
#
# Version Date Name Description
# ---------- ------------ --------------- -------------------------
# 1.0 22-Jun-2023 Simhachalam Devaki Original Code
#################################################################################
echo "**********************************************"
echo "Program XX_PAID_INVOICES_WITH_DISTRIBUTION.sh "
echo "**********************************************"
HOME_PATH=`pwd`
APPS_USER="APPS"
XX_USER="XX"
echo "Home Path is : $HOME_PATH"
LOG_FILE=$HOME_PATH/XX_PAID_INVOICES_WITH_DISTRIBUTION_`date +%d`_`date +%m`_`date +%Y`_`date +%H`_`date +%M`_`date +%S`.log
echo "----------------------------" >> $LOG_FILE
echo >> $LOG_FILE
# Copy the LDTs to $XX_TOP/bin
cp $HOME_PATH/XX_PAID_INV_DIS_CP.ldt $XX_TOP/bin
cp $HOME_PATH/XX_PAID_INV_DIS_DD.ldt $XX_TOP/bin
# Copy the LDTs to $XX_TOP/sql
cp $HOME_PATH/XX_PAID_INVOICES_WITH_DISTRIBUTION.sql $XX_TOP/sql
# Copy the data definition and RTF to $XX_TOP/reports/US/
cp $HOME_PATH/XX_PAID_INVOICES_WITH_DISTRIBUTION.xml $XX_TOP/reports/US
cp $HOME_PATH/XX_PAID_INVOICES_WITH_DISTRIBUTION.rtf $XX_TOP/reports/US
echo "Copying of files is completed"
# *******************************************************************
# Function to Check the validity of login-ids and password.
# *******************************************************************
CHKLOGIN(){
if sqlplus -s /nolog <<! >/dev/null 2>&1
WHENEVER SQLERROR EXIT 1;
CONNECT $1 ;
EXIT;
!
then
echo OK
else
echo NOK
fi
}
# *******************************************************************
# Prompt for APPS Password
# *******************************************************************
while [ "$APPSID" = "" -o `CHKLOGIN "$APPSID"` = "NOK" ]
do
if [ "$APPSID" = "" ];then
echo ""
echo "Please enter password for apps user in hidden mode: "
stty -echo
read -s APPS_PWD
stty echo
APPSID=$APPS_USER/$APPS_PWD
else
echo " "
echo "APPS Login Password is not CORRECT"
APPSID=""
fi
done
# *******************************************************************
# Check if CUSTOM Password is Entered else Prompt to get it
# *******************************************************************
while [ "$XXID" = "" -o `CHKLOGIN "$XXID" "DUAL"` = "NOK" ]
do
if [ "$XXID" = "" ];then
echo ""
echo "Please enter password for xxnjt user in hidden mode: "
stty -echo
read -s XX_PWD
stty echo
XXID=$XX_USER/$XX_PWD
else
echo " "
echo "XX Login Password is not CORRECT"
XXID=""
fi
done
# +=================================================================================+
# | GET APPS DBHOST DBPORT and DBSID DETAILS
# +=================================================================================+
while [ "$DBHOST" = "" ]
do
if [ "$DBHOST" = "" ];then
echo "Enter Database Host Name : "
read DBHOST
echo "Enter Database Host Name: " $DBHOST
else
echo "Database Host Name may not be CORRECT" | tee -a $LOG_FILE
DBHOST=""
fi
done
while [ "$DBPORT" = "" ]
do
if [ "$DBPORT" = "" ];then
echo "Enter Database Port : "
read DBPORT
echo "Enter Database Port: " $DBPORT
else
echo "Database Port entered may not be CORRECT" | tee -a $LOG_FILE
DBPORT=""
fi
done
while [ "$DBSID" = "" ]
do
if [ "$DBSID" = "" ];then
echo "Enter Database SID : "
read DBSID
echo "Enter Database SID: " $DBSID
else
echo "Database SID entered may not be CORRECT" | tee -a $LOG_FILE
DBSID=""
fi
done
echo $DBHOST
echo $DBPORT
echo $DBSID
#******************************************************************************
# Uploading the ldt files
#******************************************************************************
#Concurrent program
echo "Registering the concurrent programs"
# -------------------------------------------------------------------------------------
# Registering Concurrent Program : Paid Invoice with Invoice Distribution Report
# -------------------------------------------------------------------------------------
if $FND_TOP/bin/FNDLOAD $APPSID O Y UPLOAD $FND_TOP/patch/115/import/afcpprog.lct $HOME_PATH/XX_PAID_INV_DIS_CP.ldt - WARNING=YES UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE
then
echo " " >> $LOG_FILE
echo "Conc Program Paid Invoice with Invoice Distribution Report registered successfully" >> $LOG_FILE
echo " " >> $LOG_FILE
else
echo " " >> $LOG_FILE
echo "Error registering the Concurrent Program Paid Invoice with Invoice Distribution Report. Please correct and rerun." >> $LOG_FILE
exit 1
fi
# ***********************************************************************************
# Call SQL Script to create SQL File
# ***********************************************************************************
echo "Creating SQL File " >> $LOG_FILE
echo "Creating SQL File "
if sqlplus -s $APPSID @$XX_TOP/sql/XX_PAID_INVOICES_WITH_DISTRIBUTION.sql >> $LOG_FILE 2>&1
then
echo "Installation of the SQL File is successful" >> $LOG_FILE
else
echo "Installation of the SQL File is Unsuccessful in $APPSID" >> $LOG_FILE
echo "Please check and rerun"
echo "Aborting......"
exit 1
fi
#Data and Template Definition
# -------------------------------------------------------------------------------------
# Registering Data Definition and Template : Paid Invoice with Invoice Distribution Report
# -------------------------------------------------------------------------------------
if $FND_TOP/bin/FNDLOAD $APPSID O Y UPLOAD $XDO_TOP/patch/115/import/xdotmpl.lct $HOME_PATH/XX_PAID_INV_DIS_DD.ldt - WARNING=YES UPLOAD_MODE=REPLACE CUSTOM_MODE=FORCE
then
echo " " >> $LOG_FILE
echo "Data Definition and Template Paid Invoice with Invoice Distribution Report registered successfully" >> $LOG_FILE
echo " " >> $LOG_FILE
else
echo " " >> $LOG_FILE
echo "Error registering the Data Definition and Template Paid Invoice with Invoice Distribution Report. Please correct and rerun." >> $LOG_FILE
exit 1
fi
#Data source XML
# -------------------------------------------------------------------------------------
# Upload Data source XML for Paid Invoice with Invoice Distribution Report
# -------------------------------------------------------------------------------------
if java oracle.apps.xdo.oa.util.XDOLoader UPLOAD\
-DB_USERNAME $APPS_USER\
-DB_PASSWORD $APPS_PWD\
-JDBC_CONNECTION $DBHOST:$DBPORT/$DBSID\
-LOB_TYPE DATA_TEMPLATE \
-LOB_CODE PAID_INV_DIS\
-XDO_FILE_TYPE XML \
-FILE_NAME $XX_TOP/reports/US/XX_PAID_INVOICES_WITH_DISTRIBUTION.xml\
-APPS_SHORT_NAME XX\
-LANGUAGE en\
-TERRITORY US\
-CUSTOM_MODE FORCE
then
echo "Uploading the XML Data Source Template for Paid Invoice with Invoice Distribution Report is Successful " >> $LOG_FILE
else
echo "Uploading the XML Data Source Template for Paid Invoice with Invoice Distribution Report is not successful" >> $LOG_FILE
exit 1
fi
# RTF Data Template
# -------------------------------------------------------------------------------------
# Upload RTF Data Template for Paid Invoice with Invoice Distribution Report
# -------------------------------------------------------------------------------------
if java oracle.apps.xdo.oa.util.XDOLoader UPLOAD\
-DB_USERNAME $APPS_USER\
-DB_PASSWORD $APPS_PWD\
-JDBC_CONNECTION $DBHOST:$DBPORT/$DBSID\
-LOB_TYPE TEMPLATE\
-APPS_SHORT_NAME XX\
-LOB_CODE PAID_INV_DIS\
-LANGUAGE en\
-TERRITORY US\
-XDO_FILE_TYPE RTF\
-NLS_LANG AMERICAN\
-FILE_CONTENT_TYPE 'application/rtf'\
-FILE_NAME $XX_TOP/reports/US/XX_PAID_INVOICES_WITH_DISTRIBUTION.rtf\
-CUSTOM_MODE FORCE
then
echo "Uploading the RTF Template for Paid Invoice with Invoice Distribution Report is Successful " >> $LOG_FILE
else
echo "Uploading the RTF Template for Paid Invoice with Invoice Distribution Report is not successful" >> $LOG_FILE
exit 1
fi
echo " "
echo "Installation is completed"
echo "Please check installation log file : "$LOG_FILE
echo "installation Completed..." >> $LOG_FILE
echo " "
exit 0
# *******************************************************************
# End of Script
# ******************************************************************