lr template

Download Lr Template

Post on 15-Nov-2014

121 views

Category:

Documents

7 download

Embed Size (px)

TRANSCRIPT

#ifndef _GLOBALS_H #define _GLOBALS_H //-------------------------------------------------------------------// Include Files #include "lrun.h" #include "web_api.h" #include "lrw_custom_body.h" #include "orafuncs.h" //-------------------------------------------------------------------// Global Variables #endif // _GLOBALS_H //********************************************************************** **************** // // Script Name -- LoginTemplate // Author -- Julian Wilton // Purpose -- To act as a template script to perform logon to the application // -- It is designed to act with all business processes that require NCA logon // // Date Created -- 10th Oct 2008 // //Amendments //11 Oct 2008 -- Changed to take full URL as opposed to multiple correlation //13 Oct 2008 -- Added replace code to deal with & //17 Oct 2008 -- Added error handling routines into init section //18 Oct 2008 -- Expanded text check section in login routine // //27 Oct 2008 -- Sunil Girdhar - a) Fixed errorhandling() and cleaned up code. // b) Added call to errorhandling() in exception handler close(). // //06 Nov 2008 -- Sunil Girdhar - Updated generic transaction names in Login() to have // Generic_Logon prefix // //06 Nov 2008 -- Sunil Girdhar - Added Logout() to template //********************************************************************** **************** Login() { web_cleanup_cookies();

web_reg_find("Text=Login", "SaveCount=Home_Count", LAST); web_set_max_html_param_len("1024"); lr_start_transaction("Generic_Logon_10_Oracle_Home_Page"); web_url("AppsLocalLogin.jsp", "URL=http://{ServerInstance}.bc.jsplc.net:8070/OA_HTML/AppsLocalL ogin.jsp", "Resource=0", "RecContentType=text/html", "Referer=", "Snapshot=t1.inf", "Mode=HTML", EXTRARES, "URL=cabo/images/cache/cghec.gif", ENDITEM, LAST); if (atoi(lr_eval_string("{Home_Count}")) > 0){ lr_end_transaction("Generic_Logon_10_Oracle_Home_Page", LR_PASS); //lr_output_message("Welcome successful."); } else{ lr_end_transaction("Generic_Logon_10_Oracle_Home_Page", LR_FAIL); lr_error_message("Generic_Logon_10_Oracle_Home_Page failed."); lr_think_time(60); lr_exit(LR_EXIT_MAIN_ITERATION_AND_CONTINUE, LR_FAIL); return(0); } lr_think_time(3); web_reg_find("Text={Responsibility}", "SaveCount=Login_Count", LAST); lr_start_transaction("Generic_Logon_20_Login");

web_submit_form("fndvald.jsp_2", "Snapshot=t4.inf", ITEMDATA, "Name=username", "Value={UserName}", ENDITEM, "Name=password", "Value={Password}", ENDITEM, LAST); if (atoi(lr_eval_string("{Login_Count}")) > 0){ lr_end_transaction("Generic_Logon_20_Login", LR_PASS); //lr_output_message("Welcome successful."); } else{ lr_end_transaction("Generic_Logon_20_Login", LR_FAIL); lr_error_message("Generic_Logon_20_Login failed with User %s Password %s", lr_eval_string("{UserName}"),lr_eval_string("{Password}")); lr_think_time(10); lr_exit(LR_EXIT_MAIN_ITERATION_AND_CONTINUE, LR_FAIL); return(0); } lr_think_time(10); web_reg_save_param("FullURL", "LB=href=\"javascript:launchForm('", "RB=')\" class=\"xd\">{StartScreen}", "ORD=1", LAST); web_reg_find("Text={StartScreen}", "SaveCount=StartScreen_Count", LAST); lr_start_transaction("Generic_Logon_30_Select_Responsibility"); web_link("{Responsibility}", "Text={Responsibility}", "Snapshot=t5.inf", LAST);

if (atoi(lr_eval_string("{StartScreen_Count}")) > 0){ lr_end_transaction("Generic_Logon_30_Select_Responsibility", LR_PASS); //lr_output_message("Welcome successful."); } else{ lr_end_transaction("Generic_Logon_30_Select_Responsibility", LR_FAIL); lr_error_message("Generic_Logon_30_Select_Responsibility failed with User %s Responsibility %s", lr_eval_string("{UserName}"),lr_eval_string("{Responsibility}")); lr_think_time(10); lr_exit(LR_EXIT_MAIN_ITERATION_AND_CONTINUE, LR_FAIL); return(0); }

// // Remove the & from the trapped url ({FullURL}) and replace with & replace(); // // secgrp_key=1secg web_reg_save_param("secgrp_key", "LB/IC=secgrp_key=", "RB/IC=&", "Ord=1", "Search=Body", "RelFrameId=1", LAST); web_reg_save_param("Resp_app", "LB/IC=var xgv2 = \"", "RB/IC=\"", "Ord=1", "Search=Body", "RelFrameId=1", LAST); //var xgv3 = "SAINS_UKHR_IRC_RECRUITER_SCM" web_reg_save_param("Resp", "LB/IC=var xgv3 = \"",

"RB/IC=\"", "Ord=1", "Search=Body", "RelFrameId=1", LAST); web_reg_save_param("Start_func", "LB/IC=var xgv5 = \"", "RB/IC=\"", "Ord=1", "Search=Body", "RelFrameId=1", LAST); web_reg_save_param("ServerInst_db", "LB/IC=var xgv13 = \"", "RB/IC=\"", "Ord=1", "Search=Body", "RelFrameId=1", LAST); //http://stevux1096f.bc.jsplc.net:8070/pls/jsd11i04/fnd_icx_launch.launch?ICX_TICKET =&resp_app=SQLGL&resp_key=GENERAL_LEDGER_SUPER_USER&secgrp_key=S TANDARD&start_func=RGXGRRST web_reg_save_param("SecondUrl", "LB=ICX_TICKET=&resp_app=", "RB=&other_params=", "ORD=1", LAST); lr_start_transaction("Generic_Logon_40_Start_Oracle_Forms"); web_url("RF.jsp", "URL={FullURL}&formsLink=yes", "Resource=0", "RecContentType=text/html", "Referer=http://{ServerInstance}.bc.jsplc.net:8070/OA_HTML/OA.jsp?O AFunc=OAHOMEPAGE&akRegionApplicationId=0&navRespId=50966&navRespAppI d=800&navSecGrpId=1&transactionid={transactionid}&oapc=2&oas={OasId}", "Snapshot=t6.inf", "Mode=HTML", LAST);

//icx_ticket='.JTZLSdXN4khdwepl2ihmDw..' web_reg_save_param("icx_ticket", "LB=icx_ticket='", "RB='", "ORD=1", LAST); //secgrp='1' start_func= web_reg_save_param("secgrp", "LB=secgrp='", "RB=' start_func=", "ORD=1", LAST); //http://stevux1096f.bc.jsplc.net:8070/pls/jsd11i04/fnd_icx_launch.runforms?ICX_TICK ET=&resp_app=PER&resp_key=SAINS_UKHR_IRC_RECRUITER_SCM&secgrp_key =1&start_func=XXJSINTVSLOT_FN&other_params=" web_reg_find("Text=Oracle Applications 11i", "SaveCount=Launch_Count", LAST); web_url("fnd_icx_launch.runforms", "URL=http://{ServerInstance}.bc.jsplc.net:8070/pls/{dbInformation}/fnd_ icx_launch.runforms?ICX_TICKET=&resp_app={SecondUrl}&other_params=", "Resource=0", "RecContentType=text/html", "Referer=", "Snapshot=t7.inf", "Mode=HTML", LAST); //************************************************

if (atoi(lr_eval_string("{Launch_Count}")) > 0){ //lr_end_transaction("Generic_Logon_30_Select_Responsibility", LR_PASS); //lr_output_message("Welcome successful."); //Transaction time is ended later so nothing to pass here } else{ lr_end_transaction("Generic_Logon_40_Start_Oracle_Forms", LR_FAIL);

lr_error_message("Generic_Logon_40_Start_Oracle_Forms failed with User %s Responsibility %s", lr_eval_string("{UserName}"),lr_eval_string("{Responsibility}")); lr_think_time(10); lr_exit(LR_EXIT_MAIN_ITERATION_AND_CONTINUE, LR_FAIL); return(0); } //************************************************************** web_url("Registry.dat", "URL=http://{ServerInstance}.bc.jsplc.net:8070/OA_JAVA/oracle/forms/r egistry/Registry.dat", "Resource=0", "RecContentType=text/plain", "Referer=", "Snapshot=t8.inf", "Mode=HTML", LAST); web_url("OracleApplications.dat", "URL=http://{ServerInstance}.bc.jsplc.net:8070/OA_JAVA/oracle/apps/fn d/formsClient/OracleApplications.dat", "Resource=0", "RecContentType=text/plain", "Referer=", "Snapshot=t9.inf", "Mode=HTML", EXTRARES, "URL=../jar/fndutil.jar", ENDITEM, "URL=../jar/fndjewtall.jar", ENDITEM, LAST); if (strcmp(".-1", lr_eval_string("{icx_ticket}")) == 0) { //report error lr_error_message("{ScriptName} Failed to logon with user: %s", lr_eval_string("{UserName}")); lr_exit (LR_EXIT_MAIN_ITERATION_AND_CONTINUE,LR_PASS); } nca_set_connect_opt(SCALE_INFO, 8, 20); nca_connect_server("{dbServer}", "{Port}", "module=/application/app/{dbInformation}/product/11.5.3/fnd/11.5.0/forms/US/FNDSC

SGN fndnam=APPS record=names config='{ServerInst_db}' icx_ticket='{icx_ticket}' resp='{Resp_app}/{Resp}' secgrp='{secgrp}' start_func='{Start_func}'::NLS_LANG='AMERICAN_AMERICA.UTF8' FORMS60_USER_DATE_FORMAT='DD-MON-RRRR' FORMS60_USER_DATETIME_FORMAT='DD-MON-RRRR HH24:MI:SS' NLS_DATE_LANGUAGE='AMERICAN' NLS_SORT='BINARY' NLS_NUMERIC_CHARACTERS='.,'"); lr_end_transaction("Generic_Logon_40_Start_Oracle_Forms",LR_AUTO); nca_set_exception("Error", close); return 0; } Logout() { /* web_url("OALogout.jsp", "URL=http://stevux1022a.bc.jsplc.net:8070/OA_HTML/OALogout.jsp?m enu=Y", "Resource=0", "RecContentType=text/html", "Referer=http://stevux1022a.bc.jsplc.net:8070/OA_HTML/OA.jsp?OAFu nc=OAHOMEPAGE&akRegionApplicationId=0&navRespId=51053&navRespAppId=8 00&navSecGrpId=1&transactionid=1997616659&oapc=2&oas=mpCfmRzyT8pVup4XTxszA..", "Snapshot=t8.inf", "Mode=HTML", LAST); */ web_reg_find("Text=Login", "SaveCount=SearchStr1_Count", LAST); lr_start_transaction("Generic_Logon_50_Oracle_Logout"); web_url("OALogout.jsp", "URL=http://{ServerInstance}.bc.jsplc.net:8070/OA_HTML/OALogout.js p?menu=Y", "Resource=0", "RecContentType=text/html", "Referer=http://{ServerInstance}.bc.jsplc.net:8070/OA_HTML/OA.jsp?O AFunc=OAHOMEPAGE&akRegionApplicationId=0&navRespId=20434&navRespAppI

d=101&navSecGrpId=0&transactionid=1269312078&oapc=2&oas=vmhK9LrNn_k1_wp Vo9XPow..", "Snapshot=t8.inf", "Mode=HTML", LAST); // Check result if (atoi(lr_eval_string("{SearchStr1_Count}")) > 0){ lr_output_message("Logout successful."); lr_end_transaction("Generic_Logon_50_Oracle_Logout",LR_PASS); } else{ lr_error_message("Logout failed"); lr_end_transaction("Generic_Logon_50_Oracle_Logout",LR_FAIL); lr_exit(LR_EXIT_MAIN_ITERATION_AND_CONTINUE, LR_FAIL); return(0); } return 0; } /****** Created By: Sunil Girdhar Creation Date: 21-Nov-2008 Business Process document ref: Coll_Adm\CA_07_TransferContractChange.doc Brief description: Ammend work location of an Employee Parameterized Data: a. ColleagueDataType (Leaver.dat) : "NAME" (Full name) or "ID" (Employee number) b. Colleague (Leaver.dat): Full name or Employee Number of the employee for whom work location is to be ammended. c. RequirementStatus: (RequirementStatus.dat): Currently has 2 values: Ammended Req