Loading

Friday, June 14, 2013

How to end a host concurrent program in WARNING status?











 


We had a requirement to end a host based concurrent program to end up in warning status on the failure of a custom validation. After googling and metalink, finally wrote a reusable function on Shell script to accomplish the purpose. Here, I have shared the same,



#! /usr/bin/ksh
#
#************************************************************************************************
# MODIFICATION HISTORY
#
# Person       Version   Date        Comments
# ---------    --------  -------     ------------------------------------------------------------
# Teamsearch   0.1       14/06/2013  Initial creation
#************************************************************************************************
#

#Function Delcaration
#
#  Set concurrent completion status and exit function 
#
exit_warning()
{
date
RC=`sqlplus -s $FCP_LOGIN << EOF
    VAR RetCode NUMBER
    Declare
       lv_session_id    NUMBER;
       lv_cmplte_code   VARCHAR(10);
    lv_req_id        NUMBER := $FCP_REQID;
    lv_resp_id       NUMBER;
    lv_prog_appl_id  NUMBER;
    lv_conc_prog_id  NUMBER;
    lv_resp_appl_id  NUMBER;
    lv_login_id      NUMBER;
    lv_user_id       NUMBER := $FCP_USERID;
    Begin
       :RetCode := 0;
    
    SELECT program_application_id,
              concurrent_program_id,
              responsibility_application_id,
              responsibility_id,
              conc_login_id
      INTO lv_prog_appl_id,
              lv_conc_prog_id,
              lv_resp_appl_id,
              lv_resp_id,
              lv_login_id     
         FROM fnd_concurrent_requests
  WHERE request_id = lv_req_id;

       XX_INT_CMN_PKG.InitSession( lv_session_id,
                                     lv_user_id,
                                     lv_login_id,
                                     lv_resp_id,
                                     lv_resp_appl_id,
                                     lv_req_id,
                                     lv_prog_appl_id,
                                     lv_conc_prog_id );

       If lv_session_id Is Not NULL Then
          If NOT FND_CONCURRENT.SET_COMPLETION_STATUS( 'WARNING', NULL ) Then
             :RetCode := 2;
          End If;
       Else
          :RetCode := 2;
       End If;  
    End;
/
EXIT :RetCode
EOF`

RC=$?
exit $RC
}

#Standard parameters
FCP_LOGIN=${1}
FCP_USERID=${2}
FCP_USERNAME=${3}
FCP_REQID=${4}

#Input Parameters and other standard logic needed as per the program requirements
#In my program, i validate many custom rules and update a flag named lv_fail.
#Finally, check if the custom flag is 'Y' .. if so end the program in WARNING

elif [ "$lv_fail" = "Y" ]
then
  echo "ERROR: Custom Validaiton Failed"
  exit_warning
fi

3 Responses to “How to end a host concurrent program in WARNING status? ”

Anonymous said...
November 4, 2014 at 12:46 PM

You are calling a custom package in your script. What are you doing in XXAR_INT_CMN_PKG.InitSession?


Team search said...
May 14, 2015 at 5:30 AM

The package XX_INT_CMN_PKG initializes the apps session.


Sridevi K said...
October 9, 2016 at 10:24 PM

Regards
Sridevi Koduru (Senior Oracle Apps Trainer Oracleappstechnical.com)
LinkedIn profile - https://in.linkedin.com/in/sridevi-koduru-9b876a8b
Please Contact for One to One Online Training on Oracle Apps Technical, Financials, SCM, SQL, PL/SQL, D2K at training@oracleappstechnical.com | +91 - 9581017828.


Post a Comment

Disclaimer

The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.