Below code will demonstrate how to call the Apps XML publisher concurrent program through shell script.
#!/bin/sh
# ------------------------------------------------------------------
# Initialize variables.
#-------------------------------------------------------------------
OraUsr=$1
export OraUsr
UserId=$2
export UserId
UsrName=$3
export UsrName
ReqId=$4
export ReqId
#Concurrent program parameters
p_parameter1=$5
export p_parameter1
p_parameter2=$6
export p_parameter2
#APPS Concurrent program short name
program_name="XXAD_PROGRAM_1"
echo "Beging of Execution of program "
# +===========================================================+
# SQL Session to retrieve the Responsibility Short Name
# +===========================================================+
RESPAPPL=`sqlplus -s $OraUsr <<EOF
set head off
set verify off
set feedback off
SELECT application_short_name FROM fnd_application
WHERE application_id = (SELECT responsibility_application_id FROM fnd_concurrent_requests where request_id=$ReqId);
quit;
EOF`
#echo "End SQL Session"
#=============================================================
#SQL Session to retrive the Program application short name
#=============================================================
app_short_name=`sqlplus -s $OraUsr <<EOF
set head off
set verify off
set feedback off
SELECT APPLICATION_SHORT_NAME
FROM fnd_application
WHERE application_id in ( select application_id FROM fnd_concurrent_programs_tl
where concurrent_program_id=(select concurrent_program_id from
fnd_concurrent_requests where request_id=$ReqId) );
quit;
EOF`
#echo "End SQL Session"
# +===========================================================+
# SQL Session to retrieve the Responsibility Name
# +===========================================================+
RESPNAME=`sqlplus -s $OraUsr <<EOF
set head off
set verify off
set feedback off
SELECT '"'||responsibility_name||'"' FROM fnd_responsibility_tl
WHERE responsibility_id = (SELECT responsibility_id FROM fnd_concurrent_requests WHERE request_id=$ReqId);
quit;
EOF`
#echo "End SQL Session"
echo "Begin of Setting Layout"
#echo "Setting Layout to get data in excel sheet"
Lay_out=`sqlplus -s $OraUsr <<EOF
set head off
set verify off
set feedback off
declare
lb_set_layout_option boolean;
begin
lb_set_layout_option := apps.fnd_request.add_layout($app_short_name,$program_name,'en','US','EXCEL');
end;
quit;
EOF`
echo "End of Setting Layout"
echo "Invoking the concurrent program"
OUT_CONC_SUB=`CONCSUB $OraUsr $RESPAPPL $RESPNAME $UsrName WAIT=Y CONCURRENT $app_short_name $program_name "$p_parameter1" "$p_parameter2"`
REQID1=`echo $OUT_CONC_SUB | cut -f3 -d'`
B=`echo $OUT_CONC_SUB | grep 'Completed Normal'`
if [ $? -eq 0 ]
then
echo "Program Completed Successfully"
else
echo "Program Failed. Please check the log of the request id $REQID1"
exit 1
fi
echo "End of Execution of program "
#!/bin/sh
# ------------------------------------------------------------------
# Initialize variables.
#-------------------------------------------------------------------
OraUsr=$1
export OraUsr
UserId=$2
export UserId
UsrName=$3
export UsrName
ReqId=$4
export ReqId
#Concurrent program parameters
p_parameter1=$5
export p_parameter1
p_parameter2=$6
export p_parameter2
#APPS Concurrent program short name
program_name="XXAD_PROGRAM_1"
echo "Beging of Execution of program "
# +===========================================================+
# SQL Session to retrieve the Responsibility Short Name
# +===========================================================+
RESPAPPL=`sqlplus -s $OraUsr <<EOF
set head off
set verify off
set feedback off
SELECT application_short_name FROM fnd_application
WHERE application_id = (SELECT responsibility_application_id FROM fnd_concurrent_requests where request_id=$ReqId);
quit;
EOF`
#echo "End SQL Session"
#=============================================================
#SQL Session to retrive the Program application short name
#=============================================================
app_short_name=`sqlplus -s $OraUsr <<EOF
set head off
set verify off
set feedback off
SELECT APPLICATION_SHORT_NAME
FROM fnd_application
WHERE application_id in ( select application_id FROM fnd_concurrent_programs_tl
where concurrent_program_id=(select concurrent_program_id from
fnd_concurrent_requests where request_id=$ReqId) );
quit;
EOF`
#echo "End SQL Session"
# +===========================================================+
# SQL Session to retrieve the Responsibility Name
# +===========================================================+
RESPNAME=`sqlplus -s $OraUsr <<EOF
set head off
set verify off
set feedback off
SELECT '"'||responsibility_name||'"' FROM fnd_responsibility_tl
WHERE responsibility_id = (SELECT responsibility_id FROM fnd_concurrent_requests WHERE request_id=$ReqId);
quit;
EOF`
#echo "End SQL Session"
echo "Begin of Setting Layout"
#echo "Setting Layout to get data in excel sheet"
Lay_out=`sqlplus -s $OraUsr <<EOF
set head off
set verify off
set feedback off
declare
lb_set_layout_option boolean;
begin
lb_set_layout_option := apps.fnd_request.add_layout($app_short_name,$program_name,'en','US','EXCEL');
end;
quit;
EOF`
echo "End of Setting Layout"
echo "Invoking the concurrent program"
OUT_CONC_SUB=`CONCSUB $OraUsr $RESPAPPL $RESPNAME $UsrName WAIT=Y CONCURRENT $app_short_name $program_name "$p_parameter1" "$p_parameter2"`
REQID1=`echo $OUT_CONC_SUB | cut -f3 -d'`
B=`echo $OUT_CONC_SUB | grep 'Completed Normal'`
if [ $? -eq 0 ]
then
echo "Program Completed Successfully"
else
echo "Program Failed. Please check the log of the request id $REQID1"
exit 1
fi
echo "End of Execution of program "
I am able to submit the concurrent Program. But the output is not coming in Excel format. Actually, RTF template/Layout is not added(View Details -> Options -> Layout). Do you have any idea??
ReplyDeleteNote : When i am running the program from front-end , i am able to get the output & also layout is there (View Details -> Options -> Layout)