CrystalReportViewer - Setting parameter throws ancestor error on page navigation

We are having web application reports in the application using BO-XI SDK Viewer API. This API approach was working fine earlier. We upgrade our reporting component to SAP BO-4 (Crystal Server 2011) due to EOL of BOXI.
We have updated new API’s provided by SAP as per guide.
We updated web based Crystal Report Viewer (DHTML Viewer). The crystalreportviewer folder coming with SAP CS 2011.
We applied updated patch set upto last patch released CS2011 SP4 Patch4.
We still facing issue while viewing report in DHTML viewer provided by SAP. Please advice on below.
In our web application we do have updated folder for /crystalreportviewer.
We dynamically creating enterprise session object to get client document which explained as below –
IEnterpriseSession es = null;
try{
es = sm.logon(mUser, mPassword, mAPSName, mAuthType);
}catch(Exception e){
// request dispatched to error page
// Get the Report Application Factory service from Crystal Enterprise
IReportAppFactory rptAppFactory = (IReportAppFactory)es.getService("", "RASReportService");
// Get the InfoStore service from Crystal Enterprise
IInfoStore infoStore = (IInfoStore)es.getService("", "InfoStore");
IInfoObjects oInfoObjects = infoStore.query(“Select * From CI_INFOOBJECTS…for RPT File.”);
ReportClientDocument clientDoc = rptAppFactory.openDocument((IInfoObject)oInfoObjects.get(0), 0, objLocale);
Setting parameter
// Setting Parameter to clientDoc
Object[] parameters = { 
                                                parseDate(fromDate),
                                                parseDate(endDate),
                                                getLanguageID(request),
                                                reportName,
                                                getLanguageID(request)
Fields parameterFields = clientDoc.getDataDefController().getDataDefinition().getParameterFields();
for(int index=0; index < parameters.length; index++){
                ParameterField oldParameter = (ParameterField)parameterFields.getField(index);
                ParameterField newParameter = (ParameterField) oldParameter.clone(true);
                newParameter.getCurrentValues().removeAllElements();                                                   
                ParameterFieldDiscreteValue newDiscreteValueObj = new ParameterFieldDiscreteValue();
                newDiscreteValueObj.setValue(parameters[index]);
                newParameter.getCurrentValues().add(newDiscreteValueObj);
                ParameterFieldController paramController = clientDoc.getDataDefController().getParameterFieldController();
                paramController.modify(oldParameter, newParameter);
// Create an  Viewer
CrystalReportViewer viewer = new CrystalReportViewer();
//Set the name for the interactive viewer
viewer.setName("Crystal_Report_Viewer");
viewer.setDisplayPage(true);
//Set Navigation button false
viewer.setHasHistoryNavigationButtons(false);
//Set best fit to page true
viewer.setBestFitPage(true);
// Set reuse parameter on referesh
viewer.setReuseParameterValuesOnRefresh(true);
// Set Own Page true
viewer.setOwnPage(true);
// Enabled export and print button
viewer.setHasExportButton(true);
viewer.setHasPrintButton(true);
// Group Tree Removed
viewer.setDisplayGroupTree(false);
// Toggle group false
viewer.setHasToggleGroupTreeButton(false);
//viewer.refresh();
// Removed refersh button
viewer.setHasRefreshButton(false);
viewer.setPrintMode(CrPrintMode.ACTIVEX);
// Set the source for the interactive viewer to the client documents report source
viewer.setReportSource(clientDoc.getReportSource());
// Retain parameter and set again for pagination in viewer
setReportURL(viewer,request);
// Process the http request to view the report
viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), out);
//response.flushBuffer();
// Close client document
clientDoc.close();
// Dispose of the viewer object
viewer.dispose();
es.logoff();
Issue we faced?
a) On Pagination thorws exception in webreportinglog as
[@APPNAME@] ERROR [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] WebReportLogger.error(62) | Unable to set the ancestors
com.businessobjects.report.web.json.JSONException: JSONObject["ancestors"] is not a JSONArray.
                at com.businessobjects.report.web.json.JSONObject.getJSONArray(JSONObject.java:456)
                at com.businessobjects.report.web.shared.JSONParameter.getDiscreteValueFromJSON(JSONParameter.java:670)
                at com.businessobjects.report.web.shared.JSONParameter.getValueFromJSON(JSONParameter.java:609)
                at com.businessobjects.report.web.shared.JSONParameter.jsonToDefaultFieldValues(JSONParameter.java:587)
                at com.businessobjects.report.web.shared.JSONParameter.getDefaultValues(JSONParameter.java:474)
                at com.businessobjects.report.web.shared.JSONParameter.toParameterField(JSONParameter.java:872)
                at com.businessobjects.report.web.shared.ParametersHelper.jsonToFields(ParametersHelper.java:309)
                at com.businessobjects.report.web.state.ViewerState.restoreCommonState(ViewerState.java:2838)
                at com.businessobjects.report.web.state.ViewerState.restore(ViewerState.java:2741)
                at com.businessobjects.report.web.component.ViewerContainer.restoreState(ViewerContainer.java:210)
                at com.businessobjects.report.web.WorkflowController.loadViewState(WorkflowController.java:418)
                at com.businessobjects.report.web.WorkflowController.init(WorkflowController.java:393)
b) On Export / print button nothing happened even request didn’t passed.
WEB-INF/web.xml entry as below.
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
                <context-param>
        <param-name>crystal_document_view</param-name>
                                <!-- weblayout : Fills the entire report view pane with the report. There is no grey background -->
        <param-value>weblayout</param-value>
                </context-param>
                <context-param>
                                <param-name>crystal_exception_log_file</param-name>
                                <param-value>webreportingexception.log</param-value>
                </context-param>
                <context-param>
        <param-name>crystal_exception_info</param-name>
                                <!-- long - Displays the exception information with the accompanying stack trace. -->
        <param-value>long</param-value>
                </context-param>
                <context-param>
                                <param-name>crystal_image_uri</param-name>
                                <param-value>/TangibleWebApp/crystalreportviewers</param-value>
                </context-param>
                <context-param>
        <param-name>crystal_image_use_relative</param-name>
        <param-value>webapp</param-value>
                </context-param>
                <context-param>
                                <param-name>crystal_processing_indicator_delay</param-name>
                                <param-value>100</param-value>
                </context-param>
                <context-param>
                                <param-name>crystal_use_asynchronous_requests</param-name>
                                <param-value>false</param-value>
                </context-param>
                <context-param>
                                <param-name>crystal_servlet_uri</param-name>
                                <param-value>/TangibleWebApp/CrystalReportViewerHandler</param-value>
                </context-param>
                <servlet>
        <servlet-name>CrystalReportViewerServlet</servlet-name>
        <servlet-class>com.crystaldecisions.report.web.viewer.CrystalReportViewerServlet</servlet-class>
                </servlet>
                <servlet-mapping>
                                <servlet-name>CrystalReportViewerServlet</servlet-name>
                                <url-pattern>/TangibleWebApp/CrystalReportViewerHandler</url-pattern>
                </servlet-mapping>
                <servlet>
                                <servlet-name>document</servlet-name>
                                <servlet-class>com.oreilly.servlet.OpenDoc</servlet-class>
                </servlet>
                <servlet>
                                <servlet-name>InitialServlet</servlet-name>
                                <servlet-class>com.servlet.InitialServlet</servlet-class>
                                <load-on-startup>1</load-on-startup>
                </servlet>
                <servlet>
                                <servlet-name>FactorsLogo</servlet-name>
                                <servlet-class>com.servlet.FactorsLogo</servlet-class>
                </servlet>
                <servlet-mapping>
                                <servlet-name>FactorsLogo</servlet-name>
                                <url-pattern>/servlet/FactorsLogo</url-pattern>
                </servlet-mapping>
                <servlet-mapping>
                                <servlet-name>document</servlet-name>
                                <url-pattern>/servlet/document</url-pattern>
                </servlet-mapping>
                <session-config>
                                <session-timeout>30</session-timeout>
                </session-config>
                <welcome-file-list>
                                <welcome-file>/tangible/index.jsp</welcome-file>
                </welcome-file-list>
                <listener>
                                <listener-class>com.common.util.applistener.AppListener</listener-class> 
                </listener>
</web-app>
Thanks in advance for your advice / suggestions.

Am I right in guessing that you were previously using the ActiveX viewer?
Currently your code is closing the document and logging off Enterprise.  Pretty much any action that is done in the DHTML viewer will cause a postback to the server which will no longer have the document or session available with your current code which will cause all sorts of problems.  You need to persist these objects, and only clean them up once you are completely finished with them.

Similar Messages

  • CRM Outlook Client - Set regarding throws an error

    When I switch from the Account entity to other entities in the Set Regarding (Look Up Record) I get an error:
    An error has occurred. Try this action again. If the problem continues, check the Microsoft Dynamics CRM Community for solutions or contact your organization's Microsoft Dynamics CRM Administrator. Finally, you can contact Microsoft Support.
    It´s in a CRM 2011 UR 18 environment + Outlook 2010/2013. This error happens to all users even though I tried given a test user a system admin privileges.
    The script error I get is this:
       <Message>Unable to get property 'Success' of undefined or null reference</Message>
       <Line>670</Line>
       <URL>/_controls/lookup/lookupinfo.aspx?LookupStyle=single&browse=0&enableRemoveBtn=1&objecttypes=1%2c2%2c3%2c112%2c1010%2c4402%2c10000%2c10014</URL>
       <PageURL>/_controls/lookup/lookupinfo.aspx?LookupStyle=single&browse=0&enableRemoveBtn=1&objecttypes=1%2c2%2c3%2c112%2c1010%2c4402%2c10000%2c10014</PageURL>
       <Function>anonymousr:Unabletogetproperty'Success'ofundefinedornullreference</Function>
       <CallStack>
        <Function>anonymousr:Unabletogetproperty'Success'ofundefinedornullreference</Function>
       </CallStack>
    I´ve tried trace logs on the server without much help + Diagnostics for Outlook give similar results as the script error above.
    Has anybody encountered this error before or similar?
    Regards,
    Ragnar

    Hi Ragnar,
        Can you verify that the version of the Outlook plugin you have is 5.0.9690.4376? This is the version for UR 18:
    http://support2.microsoft.com/kb/2958724
    If not, please download and uninstall your current version of the Outlook plugin, and reinstall with this version:
    http://www.microsoft.com/en-us/download/details.aspx?id=44265

  • Error in page navigation

    I have a login page which navigates to the next page ones logged in and i have to validate that only a single user can login i.e, the same username and password is valid. If not an error message is displayed that the login data is not valid. I have done it as below:
    if(this.getUserName().getValue()=="abcd" && this.getPassword().getValue()=="1234"){
    userName=this.getUserName().getValue().toString();
    password=this.getPassword().getValue().toString();
    ADFContext.getCurrent().getSessionScope().put("userName",userName);
    ADFContext.getCurrent().getSessionScope().put("password",password);
    else{
    FacesMessage msg = new FacesMessage("Please check your login data");
    msg.setSeverity(FacesMessage.SEVERITY_ERROR);
    FacesContext.getCurrentInstance().addMessage(null, msg);
    But the error message is being displayed in the next page instead of getting displayed in the same login page on hitting the login button. Can any one help me where I am going wrong.? thanks!

    i dont know how you perform navigation.
    in adfc-config
    based some condition you can do that.
    <view id="HomePage">
        <page>/HomePage.jspx</page>
      </view>
      <view id="SupplierAppIndex">
        <page>/Index.jspx</page>
      </view>
      <control-flow-rule id="__5">
        <from-activity-id id="__6">HomePage</from-activity-id>
        <control-flow-case id="__7">
          <from-outcome id="__13">success</from-outcome>
          <to-activity-id id="__8">Index</to-activity-id>
        </control-flow-case>
        <control-flow-case id="__14">
          <from-outcome id="__16">error</from-outcome>
          <to-activity-id id="__15">HomePage</to-activity-id>
        </control-flow-case>
      </control-flow-rule>
      <managed-bean id="__1">
        <managed-bean-name id="__3">HomePage</managed-bean-name>
        <managed-bean-class id="__2">com.rits.suplr.view.backing.HomePage</managed-bean-class>
        <managed-bean-scope id="__4">session</managed-bean-scope>
        <!--oracle-jdev-comment:managed-bean-jsp-link:1HomePage.jspx-->
      </managed-bean>
      <managed-bean id="__10">
        <managed-bean-name id="__12">Index</managed-bean-name>
        <managed-bean-class id="__9">com.rits.suplr.view.backing.Index</managed-bean-class>
        <managed-bean-scope id="__11">backingBean</managed-bean-scope>
      </managed-bean>here can see homepage dologin() methods return value "success" means it return index or else stay in homepage.

  • Detaul Error handling page

    Ok I had my cfm server hacked last week. They used a sql
    injection. The think that is driving me nuts is I can not set up a
    "Detaul Error handling page" in my cfm server. my other older
    version 5 works fine. Why have they never fixed this bug.
    I looked up the issue and found a fix it did not worked. Does
    anyone hae a sugggestion on how I can fix this so an intruder can
    not ready ever bit of code on the error page to help fine tune
    there attacks.

    user3935812 wrote:
    I have the same question.No kidding, seeing as you are the exact same user...
    This is all Myfaces specific. The best you can do in a standard web environment is to use the error handling built into the server, which basically means catching specific HTTP error codes. Here is an example:
    http://www.java2s.com/Tutorial/Java/0400__Servlet/ServletErrorPage.htm

  • Set Adobe Acrobat XI Pro. When I want to save the file in WORD, EXCEL or esporta file into ... immediately throws an error "save as failed to process this document no file was created". What's the problem?

    Set Adobe Acrobat XI Pro. When I want to save the file in WORD, EXCEL or esporta file into ... immediately throws an error "save as failed to process this document no file was created".
    What's the problem?
    Any help in finding a solution is greatly appreciated.
    Thank you,

    Installed AcrobatXI PRO 11.0.09  on seven computers and laptops. Two of them gives an error when you try to save a document in WORD, EXCEL, Power Point, or when exporting to... error: Save failed to process this document. No File was created.
    But all good saves in the format of TXT and jpg.
    I have uninstalled and restored and re-installed and updated and registry cleaned and removed using the special utility Cleaner Tool for Acrobat, but nothing helps.
    On one notebook with Windows 8.1 and Microsoft office 2013, on another laptop with Windows 7 and Microsoft office 2010, the same problem, although there are computers with Windows 7 and Microsoft office 2010 and everything works.
    Tell me where to find the problem and how to solve it.
    Thank you.

  • Good day!     On the ultrabook Asus (System Settings: WIN 8.1 64-bit, Core I5-3317U CPU @ 1.70 Ghz, Memory 4 Gb), set Adobe Acrobat XI Pro 11.0.09 When you convert to any format via SaveAs in WORD, EXCEL, or via the Export file in ... throws the error "Un

    Good day!
    On the ultrabook Asus (System Settings: WIN 8.1 64-bit, Core I5-3317U CPU @ 1.70 Ghz, Memory 4 Gb), set Adobe Acrobat XI Pro 11.0.09
    When you convert to any format via SaveAs in WORD, EXCEL, or via the Export file in ... throws the error "Unable to process the document in the module Save As. File not created"

    Hi,
    Was it working fine for you before?
    Is it with some specific documents?
    Are you able to convert the word/excel files to pdf?
    Regards,
    Rave

  • Good day!   On the ultrabook Asus (System Settings: WIN 8.1 64-bit, Core I5-3317U CPU @ 1.70 Ghz, Memory 4 Gb), set Adobe Acrobat XI Pro 11.0.09  When you convert to any format via SaveAs in WORD, EXCEL, or via the Export file in ... throws the error "Una

    Good day!
    On the ultrabook Asus (System Settings: WIN 8.1 64-bit, Core I5-3317U CPU @ 1.70 Ghz, Memory 4 Gb), set Adobe Acrobat XI Pro 11.0.09
    When you convert to any format via SaveAs in WORD, EXCEL, or via the Export file in ... throws the error "Unable to process the document in the module Save As. File not created"

    This happens with any file .
    Send a file with the screen errors and system data . Also send a couple of files PDF.
    Translates only txt format.
    Acrobat установлен: C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\Acrobat.exe
        Версия: 11.0.9.29
      Дата создания: 2014/09/12
        Время создания: 13:43:46
    Браузер по умолчанию:
    Версия BIOS: _ASUS_ - 1072009
    Версия ОС: 6.2.9200 
    Всего виртуальной памяти: 4194176 KB
    Всего физической памяти: 4077252 KB
    Графическая плата: Intel(R) HD Graphics 4000
        Версия: 10.18.10.3412
        Отметить: Не поддерживается
    Доступная виртуальная память: 3638168 KB
    Доступная физическая память: 1689940 KB
    Имя пользователя: Vazgen
    Имя системы: VAZGENTAICHI
    Монитор:
        Название: Intel(R) HD Graphics 4000
        Разрешение: 1920 x 1080 x 60
        Бит на пиксел: 32
    Название ОС: Microsoft Windows Vista
    Папка Windows: C:\WINDOWS
    Папка для временных файлов: C:\Users\Vazgen\AppData\Local\Temp\
    Почтовая программа по умолчанию: Microsoft Outlook
        mapi32.dll
        Версия: 1.0.2536.0 (winblue_rtm.130821-1623)
    Производитель ОС: Microsoft Corporation
    Процессор: Intel64 Family 6 Model 58 Stepping 9 GenuineIntel  ~1696  Mhz
    Сведения о Windows:
       Планшетный ПК: Да
       Начальная версия: Нет
       Media Center Edition: Нет
       Медленный компьютер: Нет
    Сведения о сеансе:
       Тип загрузки: Обычный
       Завершение работы: Нет
       Сеть: Доступно
       Внутри Citrix: Нет
       Внутри VMWare: Нет
       Удаленный сеанс: Нет
       Удаленное управление: Нет
       Использование JAWS: Нет
       Использование Windows-Eyes: Нет
       Использование NVDA: Нет
    Сведения об Acrobat:
       Изолирование программной среды: Отключить
       Связанная программа для чтения: Нет
       Multi-Reader с поддержкой Desktop: Отключить
    Сведения об отображении:
       Ширина экрана: 1920
       Высота экрана: 1080
       Число мониторов: 2
       Число кнопок мыши: 2
       Мышь с колесом прокрутки: Нет
       С маркером Windows: Нет
       Двухбайтовая кодировка: Нет
       С редактором метода ввода: Да
       В программе для чтения с экрана: Нет
    Сведения об учетной записи:
       Права пользователя: Администратор
       Управление учетной записью пользователя: Ограниченное
       Целостность процесса: Не определено
       Тип профиля: Отсутствует
    Установленные приложения:
       Версия Office: Office 2013 32-bit
    Файл подкачки: 4194303 KB
    Часовой пояс: Московское время (зима)
    Язык: Русский (Россия)
    C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\plug_ins\Accessibility.api
        Версия: 11.0.9.29
      Дата создания: 2014/09/12
        Время создания: 13:44:20
    C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\plug_ins\Annots.api
        Версия: 11.0.9.29
      Дата создания: 2014/09/12
        Время создания: 13:44:22
    C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\plug_ins\IA32.api
        Версия: 11.0.9.29
      Дата создания: 2014/09/12
        Время создания: 13:44:18
    C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\plug_ins\PaperCapture.api
        Версия: 11.0.9.29
      Дата создания: 2014/09/12
        Время создания: 13:43:36
    C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\plug_ins\SaveAsRTF.api
        Версия: 11.0.9.29
      Дата создания: 2014/09/12
        Время создания: 13:44:20
    C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\plug_ins\SendMail.api
        Версия: 11.0.9.29
      Дата создания: 2014/09/12
        Время создания: 13:44:20
    C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\plug_ins\Updater.api
        Версия: 11.0.9.29
      Дата создания: 2014/09/12
        Время создания: 13:44:22

  • How to send/set parameter from BSP page to iview

    Dear Expert,
    Can advise me how to send or set parameter from BSP page to iview ?
    http://xxx.xxx.com/irj/portal?navigationtarget=roles://pcd:portal_content/FLD.ObjetLibrary/FLD.Iviews/FLD.CRM/ET/bsppage.htm?lv_param=xxx
    I want to view my bsp page in portal but with parameter value.
    I can open my bsp page without parameter value like link below :
    http://xxx.xxx.com/irj/portal?navigationtarget=roles://pcd:portal_content/FLD.ObjetLibrary/FLD.Iviews/FLD.CRM/ET/
    Thnx & Regards,
    Pieter

    Hi,
    your BSP page get's integrated via an iFrame. So, simply speaking, it's not possible to pass an parameter back.
    But what you can try is to use the Portal DataBag component. In the BSP page, store the information you want to pass in the browser. The iView/Portal than has to check if there is a new parameter / value stored.
    SAP Help: http://help.sap.com/saphelp_nw70/helpdata/en/68/322a9261c54e51b7965f86aac3dae2/frameset.htm
    br,
    Tobias

  • Popup window error must set parameter windowInfo

    Hi Friends,
    I am getting error as :- must set parameter windowInfo,when I am clicking on the link to view the Modal window.
    I am providing the correct window name, btu still teh error coming.
    any clue please.
         IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI
         .getComponentInfo()
         .findInWindows("OrderPopupWindow");

    Check if you are setting the windowInfo properly or not.
    IWDWindow window = wdComponentAPI.getWindowManager().createWindow( <b><u>windowInfo</u></b>, true);
    Bala

  • Optional Parameter - Oracle Package Throws an Error

    Hi there,
    I have an Oracle Package & it has a stored procedure with optional parameter. The calling code is in ColdFusion.
    When I run my webpage the Oracle throws below error.
    " [Macromedia][Oracle JDBC Driver][Oracle]ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'GET_CONTRACT_BY_DYN_SQL' ORA-06550: line 1, column 7: PL/SQL: Statement ignored "
    Calling Code (ColdFusion)
    <cfstoredproc procedure="CONTRACTS_PKG.GET_CONTRACT_BY_DYN_SQL" datasource="#REQUEST.dsn#">
         <cfprocparam cfsqltype="CF_SQL_INTEGER" type="in" value="1" variable="P_CONTRACTID">     
         <cfprocresult name="qDataDynSQL" resultset="1">
    </cfstoredproc>
    <br>Dynamic SQL Query:
    <cfdump var="#qDataDynSQL#" label="Dynamic SQL Query">
    Oracle Package
    create or replace
    PACKAGE CONTRACTS_PKG AS
    TYPE T_CURSOR IS REF CURSOR;
    PROCEDURE GET_CONTRACT_BY_DYN_SQL(P_CONTRACTID IN NUMBER, P_COLS IN VARCHAR2 DEFAULT '*', IO_CURSOR IN OUT T_CURSOR);
    END CONTRACTS_PKG;
    create or replace
    PACKAGE BODY CONTRACTS_PKG AS
    -- Get Contract Using Dynamic SQL
    PROCEDURE GET_CONTRACT_BY_DYN_SQL(P_CONTRACTID IN NUMBER, P_COLS IN VARCHAR2 DEFAULT '*', IO_CURSOR IN OUT T_CURSOR)
    IS
    V_CURSOR T_CURSOR;
    V_SQL VARCHAR2(200);
    BEGIN
    IF p_contractid > 0 THEN
    V_SQL := 'SELECT '|| P_COLS || ' FROM CONTRACTS WHERE contract_id = ' || P_CONTRACTID ;
    ELSE
    V_SQL := 'SELECT '|| P_COLS || ' FROM CONTRACTS';
    END IF;
    OPEN V_CURSOR FOR V_SQL;
    IO_CURSOR := V_CURSOR;
    END GET_CONTRACT_BY_DYN_SQL;
    END CONTRACTS_PKG;
    Does anyone knows why it throws an error? As you can see in the package header & body the parameter P_COLS has the default value as '*'.
    Looking forward to hear from someone.
    Thanks,
    Hitesh Patel

    931198 wrote:
    I have an Oracle Package & it has a stored procedure with optional parameter. The calling code is in ColdFusion.
    When I run my webpage the Oracle throws below error.Never mind the error - your approach is most definitely a candidate for Oracle WTF.
    Nothing sane about this approach. Especially the decision not to use bind variables and slowing down cursor processing significantly by burning a lot more CPU cycles on hard parsing and fragmenting the SQL Shared Pool in the process.
    Why not used MS Access instead? It is far more suited as a mickey mouse database for a goofy application?
    Why am I badmouthing your approach to Oracle? Because that is exactly the primary cause, the #1 reason, for poor Oracle performance and run-time problems dealing with Shared Pool fragmentation. It is something that many Oracle experts blog about, talk about, write about. It is addressed in numerous books, Oracle documentation, and even Oracle Support Notes.
    And despite the amount of information available on how to get the basics rights in using Oracle... this approach you are pursuing still refuses to die. So it deserves to be beaten with a lead pipe when it rears its ugly head here in this forum..

  • Does Hibernate throw and error if the result set is above a specific #

    Does Hibernate throw and error if the result set is above a specific #
    of records?

    why do you ask?Maybe he hasn't been able to find the bug in his code yet, so he's casting further and further about for more and more esoteric explanations for what he's seeing? ;-)
    (God knows I've been there...)

  • RESTORE detected an error on page (0:0) in database as read from the backup set

    Hello Experts-
    I am facing a very bizarre situations here, I was trying to restore a database from server 1 to server 2, first I take backup manually and then copy the backup to the server 2 location and restore it easily, I do this all the time but now I am getting this
    error:"RESTORE detected an error on page (0:0) in database <database>as read from the backup set</database>". So I tried to verify the backup with restore verify only and I get the message the data is invalid. Here is the bizarre part,
    I tried to restore the same database from the backup taken by my backup job automatically and it worked and I restore verify the data and it is valid. So, anytime I took a manual backup and try to restore it I get an error, but I can restore the backup from
    my backup job, please advise and share your experience , thank you.

    it is a dynamic query that runs and take backup of all the dbs except the one we don't want, and the version is sql server 2012 sp1 on server. Part of the backup query
    SET
    @fileName = @path 
    +'\'+
    @name+'_'
    + @fileDate
    +
    '.BAK';
    BACKUP
    DATABASE @name
    TO
    DISK
    = @fileName
    WITH
    COMPRESSION,
    INIT   
    end

  • Endeca : multi invoice pay throwing correct error for internal user but it is failing to throw the same error for external user

    Hi,
    1) Internal User expected exception:
    Exception: Payments,apply credits,disputes and print are not supported when multiple customer/currency transactions are selected
    2) External User is throwing below error instead of throwing above exception.
    Error
      You are trying to access a page that is no longer active.
      The referring page may have come from a previous session. Please select Home
       to proceed.
    found this MACCHECK from fnd logs of external user payment.
    MACCHECK: . Parameter failing validation is :mode. The parameter mode with value MultiPay could not be recognized as part of Server's response on the previous request.  Incoming URL is : /OA_HTML/OA.jsp?page=/oracle/apps/ar/irec/endeca/webui/EndecaDummyPG . Current URL is : /OA_HTML/OA.jsp?page=/oracle/apps/ar/irec/endeca/webui/OIREndecaCustHomePG&akRegionApplicationId=222&_ti=1125493452&oapc=10&retainAM=Y&addBreadCrumb=N&oas=6-LL4ndIUFLX-2zjQAQD6A.. . Referer URL is : https://<hostname>:4443/endeca/web/ar/customer?doAsUserLanguageId=en_US&languageId=en_US . HTTP Request Method is : POST
    can someone please help.
    Thanks,
    RRS

    Well, I compared my classpath between my windows batch file and the
    makefile (that comes with the samples installation) on Solaris and realized
    that I am using different sets of jars.
    So, I removed the extra jars from the makefile to narrow down the
    problem. If I remove the /opt/SUNWam/lib/servlet.jar from the makefile,
    I can reproduce this problem on the Solaris box as well.
    When I include this servlet.jar on my windows machine the program works!
    Only jars I have in my classpath are amclientsdk.jar and servlet.jar which
    I have copied from my installation (/opt/SUNWam/lib) on the Solaris box.
    Just the same way, by copying the am_services.jar, saaj-api.jar, and jaxm-api.jar,
    from the Solarix box to the windows machine,
    I am also able to pull the assertions from the Access Manager.
    I installed Sun Java Enterprise System 2005Q1 on a Solaris 10 machine.
    During the installation, I configured to install the Access Manager
    in Sun Application Server.
    Why do I need to have different set of jars on the windows machine
    for the Access Manager client SDK ?
    Could you please point me to a download link where I could download
    the correct Windows Access Manager Client SDK for
    Sun Java System Access Manager 6.0 (Sun JES 2005Q1)?
    Thanks.

  • Get and Set Parameter ID in BDC Call transaction

    Hi all
    I have written this BDC program to run a transaction eg33  to install meter. After meter get installled System generates  Device location number. I need to use this device location number in calling another transaction il03.  but my data fetching using get and set parameter id is not giving accurate result. Kindly check my code and suggest where should I improve. Or whatelse can I do to fullfill this type of requirement other than GET and SET PARAMETER ID.
    REPORT  ZAC_EG33 NO STANDARD PAGE HEADING
                     LINE-SIZE 100.
    TABLES: EABL,
            BUT000,
            ZISUH0003.
    DATA :
          XYZ LIKE IFLO-TPLNR.
    DATA: IT_STATUS TYPE ZISUH0003.
    DATA: G_INDEX TYPE I,
          G_START_COL TYPE I VALUE '1',      "start column
          G_START_ROW TYPE I VALUE '14',      "start row
          G_END_COL   TYPE I VALUE '18',     "maximum column
          G_END_ROW   TYPE I VALUE '75',  "maximum row
          G_TEXT(20),                         "stores error messages
          G_PAGES        TYPE I,
          G_CURRENT_PAGE TYPE I,
          G_COUNT LIKE SY-DBCNT.
    data: l_file   type file_table,
          file1    type string,
          l_title  type string,
          LENGTH   TYPE I,
          FILES    type filetable,
          SUBRC    type i,
          STR_FILE type STRING,
          D_FILE   type RLGRAP-FILENAME,
          filename TYPE String,
          L_itab_date(10).
    FIELD-SYMBOLS : <FS>.
    DATA: IT_EXCEL LIKE STANDARD TABLE OF ALSMEX_TABLINE WITH HEADER LINE,
          IT_MESS TYPE STANDARD TABLE OF BDCMSGCOLL WITH HEADER LINE.
    TYPES: BEGIN OF TY_OPEN,
            HAUS LIKE REG30-HAUS,
            EADAT(10),
            GERAETNEU LIKE REG30-GERAETNEU,
            MESSDRCK LIKE REG30-MESSDRCK,
            ZWSTANDCE LIKE REG30-ZWSTANDCE,
            END OF TY_OPEN.
    DATA : T_ANLAGE LIKE EANLD-ANLAGE,
           VSTELLE LIKE EVBS-VSTELLE,
           S_ANLAGE LIKE EANLD-ANLAGE,
           temp_c(7).
    DATA: IT_OPEN TYPE STANDARD TABLE OF TY_OPEN WITH HEADER LINE.
    DATA: BDCDATA TYPE STANDARD TABLE OF BDCDATA WITH HEADER LINE.
    SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN SKIP 2.
    PARAMETERS: P_FILE like RLGRAP-FILENAME OBLIGATORY.
    SELECTION-SCREEN SKIP 2.
    SELECTION-SCREEN END OF BLOCK 1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE  .
      PERFORM GET_FILE_NAME.
      MOVE FILENAME TO P_FILE.
    START-OF-SELECTION.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        FILENAME                      = p_file
        I_BEGIN_COL                   = 1  "VF_START_COL
        I_BEGIN_ROW                   = 2  "VF_START_ROW
        I_END_COL                     = 5  "VF_END_COL
        I_END_ROW                     = 10000  "VF_END_ROW
      TABLES
        INTERN                        = IT_EXCEL
      EXCEPTIONS
        INCONSISTENT_PARAMETERS       = 1
        UPLOAD_OLE                    = 2
        OTHERS                        = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    IF IT_EXCEL[] IS INITIAL.
      G_TEXT = 'No Data Uploaded'.
    ELSE.
      SORT IT_EXCEL BY ROW COL.
      LOOP AT IT_EXCEL.
        MOVE : IT_EXCEL-COL TO G_INDEX.
        ASSIGN COMPONENT G_INDEX OF STRUCTURE IT_OPEN TO <FS>.
        MOVE IT_EXCEL-VALUE TO <FS>.
        AT END OF ROW.
          IF NOT IT_OPEN IS INITIAL.
          APPEND IT_OPEN." TO IT_LINE.
          CLEAR IT_OPEN.
          CLEAR IT_EXCEL.
          ENDIF.
        ENDAT.
      ENDLOOP.
    ENDIF.
    REFRESH IT_EXCEL.
    ULINE.
    FORMAT COLOR 3 ON.
    WRITE: /1 sy-vline ,
           2 'Material No.' ,
           25 sy-vline,
            2 'Logs' ,
            100 sy-vline.
    uline.
    FORMAT COLOR OFF.
    PERFORM BDC_OPEN_READING.
    MESSAGE S013(ZPS).
    *&      Form  GET_FILE_NAME
          text
    -->  p1        text
    <--  p2        text
    FORM GET_FILE_NAME .
    REFRESH FILES.
    call method cl_gui_frontend_services=>file_open_dialog
                exporting
                  window_title            = l_title
                changing
                  file_table              = files
                  rc                      = subrc
                exceptions
                  file_open_dialog_failed = 1
                  cntl_error              = 2
                  error_no_gui            = 3
                  others                  = 4.
              check sy-subrc = 0.
              loop at files into l_file.
                str_file = l_file.
                move str_file to filename.
                exit.
              endloop.
    ENDFORM.                    " GET_FILE_NAME
    *&      Form  BDC_OPEN_READING
          text
    -->  p1        text
    <--  p2        text
    FORM BDC_OPEN_READING .
    LOOP AT IT_OPEN.
    REFRESH BDCDATA.
    clear : temp_c.
    move it_open-MESSDRCK to temp_c.
    condense : temp_c.
    PERFORM MAP1.
    CALL TRANSACTION 'EG33' USING BDCDATA MODE 'A' MESSAGES INTO IT_MESS.
    +***changes by added on 28/02/08 +
    get parameter id 'IFL' FIELD XYZ.
    PERFORM MAP2.
    set parameter id 'IFL' FIELD XYZ.
    ++*
    CALL TRANSACTION 'IL03' USING BDCDATA MODE 'A' MESSAGES INTO IT_MESS.
    +****end change added on 28.02.08+DATA: G_INSNO LIKE IT_OPEN-HAUS.
    IF NOT IT_MESS[] IS INITIAL.
      G_INSNO = IT_OPEN-HAUS.
      PERFORM GET_MESSAGES  TABLES IT_MESS USING G_INSNO." IT_LINE.
    ENDIF.
    READ TABLE IT_MESS WITH KEY MSGTYP = 'E'.
    IF SY-SUBRC NE 0.
    READ TABLE IT_MESS WITH KEY MSGTYP = 'S'  MSGNR = '622'.
    IF SY-SUBRC EQ 0.
    SELECT SINGLE VSTELLE FROM EVBS INTO VSTELLE WHERE HAUS = IT_OPEN-HAUS.
    SELECT SINGLE ANLAGE FROM EANL INTO T_ANLAGE WHERE VSTELLE = VSTELLE.
    MOVE T_ANLAGE TO IT_STATUS-ANLAGE.
    MOVE 'X' TO IT_STATUS-RFC.
    *perform get_date_format using IT_OPEN-EADAT.
    MOVE IT_OPEN-EADAT TO IT_STATUS-ADATE.
    SELECT SINGLE ANLAGE FROM ZISUH0003 INTO  S_ANLAGE WHERE ANLAGE =
    T_ANLAGE.
      IF SY-SUBRC EQ 4.
        INSERT ZISUH0003 FROM IT_STATUS.
      ELSE.
        UPDATE ZISUH0003 FROM IT_STATUS.
      ENDIF.
      ENDIF.
      ENDIF.
      REFRESH IT_MESS.
      CLEAR   IT_MESS.
    ENDLOOP.
    ENDFORM.                    " BDC_OPEN_READING
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR BDCDATA.
      BDCDATA-PROGRAM  = PROGRAM.
      BDCDATA-DYNPRO   = DYNPRO.
      BDCDATA-DYNBEGIN = 'X'.
      APPEND BDCDATA.
    ENDFORM.
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
      IF FVAL <> SPACE.
        CLEAR BDCDATA.
        BDCDATA-FNAM = FNAM.
        BDCDATA-FVAL = FVAL.
        APPEND BDCDATA.
      ENDIF.
    ENDFORM.
    *&      Form  MAP1
          text
    -->  p1        text
    <--  p2        text
    FORM MAP1 .
    perform bdc_dynpro      using 'SAPLE30D' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'REG30-GERAETNEU'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'REG30-HAUS'
                                  IT_OPEN-HAUS.  "'100000000033'.
    perform bdc_field       using 'REG30-EADAT'
                                  IT_OPEN-EADAT.  "'18.02.2006'.
    perform bdc_field       using 'REG30-GERAETNEU'
                                  IT_OPEN-GERAETNEU.  "'66a'.
    perform bdc_dynpro      using 'SAPLE30D' '0220'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'REG30-TEMP_AREA(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=SAVE'.
    perform bdc_field       using 'REG30-MESSDRCK'
                                   temp_c. "IT_OPEN-MESSDRCK'0.0125'.
    perform bdc_field       using 'REG30-GERWECHS'
                                  '05'.
    perform bdc_field       using 'REG30-ANZDAYSOFPERIOD(01)'
                                  '30'.
    perform bdc_field       using 'REG30-ZWSTANDCE(01)'
                                  IT_OPEN-ZWSTANDCE.  "'10'.
    perform bdc_field       using 'REG30-ZWSTANDCE(02)'
                                  '0'.
    perform bdc_field       using 'REG30-PERVERBR(01)'
                                  '0'.
    perform bdc_field       using 'REG30-PERVERBR(02)'
                                  '0'.
    perform bdc_field       using 'REG30-TEMP_AREA(01)'
                                  '0001'.
    perform bdc_field       using 'REG30-TEMP_AREA(02)'
                                  '0001'.
    perform bdc_field       using 'REG30-PR_AREA_AI(01)'
                                  '0001'.
    perform bdc_field       using 'REG30-PR_AREA_AI(02)'
                                  '0001'.
    ENDFORM.                    " MAP1
    ****CHANGEs added BY ALKA 28.02.08
    *&      Form  MAP2
          text
    -->  p1        text
    <--  p2        text
    FORM MAP2 .
    perform bdc_dynpro      using 'SAPMILO0' '1110'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'IFLO-TPLNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'IFLO-TPLNR'
                                  XYZ..
    perform bdc_field       using 'RILO0-TPLKZ'
                                  'AO_GP'.
    perform bdc_dynpro      using 'SAPMILO0' '2100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'IFLO-PLTXT'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\04'.
    perform bdc_field       using 'IFLO-PLTXT'
                                  'DEVICE LOCATION'.
    perform bdc_dynpro      using 'SAPMILO0' '2100'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BU'.
    perform bdc_field       using 'IFLO-PLTXT'
                                  'DEVICE LOCATION'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'ITOBATTR-EINZL'.
    perform bdc_field       using 'ITOBATTR-IEQUI'
                                  'X'.
    perform bdc_field       using 'ITOBATTR-EINZL'
                                  'X'.
    ENDFORM.                    " MAP2
    *****END CHANGE added on 28.02.08
    *&      Form  get_date_format
          text
         -->P_IT_ORDER_TABLE_C_DATE  text
    FORM get_date_format USING L_ITAB_DATE." LIKE SY-DATUM.
    data: d_temp(4),
          m_temp(2),
          y_temp(4).
    *move L_ITAB_DATE to L_ITAB_DATE.
    y_temp = L_ITAB_DATE(4).
    m_temp = L_ITAB_DATE+4(2).
    d_temp = L_ITAB_DATE+6(2).
    CONCATENATE d_temp '.' m_temp '.' y_temp into L_ITAB_DATE.
    ENDFORM.                    " get_date_format
    *&      Form  GET_MESSAGES
          text
         -->P_IT_MESS  text
         -->P_G_INSNO  text
    FORM GET_MESSAGES  TABLES IT_MESS STRUCTURE BDCMSGCOLL USING G_INSNO .TABLES T100.
    DATA: L_MSTRING(255).
    LOOP AT IT_MESS WHERE MSGTYP = 'E'   OR MSGTYP = 'S'.
          SELECT SINGLE * FROM T100 WHERE SPRSL = IT_MESS-MSGSPRA
                                    AND   ARBGB = IT_MESS-MSGID
                                    AND   MSGNR = IT_MESS-MSGNR.
          IF SY-SUBRC = 0.
            L_MSTRING = T100-TEXT.
            IF L_MSTRING CS '&1'.
              REPLACE '&1' WITH IT_MESS-MSGV1 INTO L_MSTRING.
              REPLACE '&2' WITH IT_MESS-MSGV2 INTO L_MSTRING.
              REPLACE '&3' WITH IT_MESS-MSGV3 INTO L_MSTRING.
              REPLACE '&4' WITH IT_MESS-MSGV4 INTO L_MSTRING.
            ELSE.
              REPLACE '&' WITH IT_MESS-MSGV1 INTO L_MSTRING.
              REPLACE '&' WITH IT_MESS-MSGV2 INTO L_MSTRING.
              REPLACE '&' WITH IT_MESS-MSGV3 INTO L_MSTRING.
              REPLACE '&' WITH IT_MESS-MSGV4 INTO L_MSTRING.
            ENDIF.
            CONDENSE L_MSTRING.
          ENDIF.
          CONDENSE G_INSNO.
          CONCATENATE 'For' ' ' G_INSNO ',' L_MSTRING INTO L_MSTRING SEPARATED BY SPACE.
    FORMAT COLOR 2 ON.
    *IF IT_MESS-MSGTYP = 'S' AND IT_MESS-MSGNR = '622'.
    *WRITE: 1 sy-vline,
            L_MSTRING    under 'Error Messages',
           100 sy-vline.
    *ULINE.
    *ELSEIF IT_MESS-MSGTYP = 'E'.
    WRITE: 1 sy-vline,
             L_MSTRING    under 'Logs',
            100 sy-vline.
    ULINE.
    *ENDIF.
    ENDLOOP.
    ENDFORM.                    " GET_MESSAGES

    i think there might be some time gap between CALL TRANSACTION and GET PARAMETER ID.....,that is to say,the new No. has not been generated and what you fetch is an old No..
    i think you should use the "CALL TRANSACTION" like the following one:
    CALL TRANSACTION 'EG33' USING BDCDATA MODE 'A'  UPDATE 'L'  MESSAGES INTO IT_MESS .
    then i think you can get the right value.
    P.S: the different update model(from SAP document)
           upd Effect
    "A"   Asynchronous update. Updates of called programs are executed in the same way as if in the             COMMIT WORK statement the AND WAIT addition was not specified.
    "S" Synchronous processing. Updates of the called programs are executed in the same way as if in the COMMIT WORK statement the AND WAIT addition had been specified.
    "L" Local update. Updates of the called program are executed in such a way as if the SET UPDATE TASK LOCAL statement had been executed in it.
    Other As for "A".

  • Next / Previous button throwing an error. Please help

    I wrote this next previous button code and it is throwing an
    error. I don't understand why or what I am missing.
    I want it to show 4 records for a page. Here is my code and
    the error.
    Code:
    <cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
    <cfquery name="feat" datasource="#sitedatasource#"
    username="#siteUserID#" password="#sitePassword#" maxRows=4>
    SELECT feature.title AS ViewField1, feature.MYFile AS
    ViewField2, feature.ID AS ID
    FROM feature
    </cfquery>
    <cflock timeout="2" scope="application"
    type="READONLY">
    <cfset application.feat=feat>
    </cflock>
    <cfset MaxRows_feat=4>
    <cfset
    StartRow_feat=Min((PageNum_feat-1)*MaxRows_feat+1,Max(feat.RecordCount,1))>
    <cfset
    EndRow_feat=Min(StartRow_feat+MaxRows_feat-1,feat.RecordCount)>
    <cfset
    TotalPages_feat=Ceiling(feat.RecordCount/MaxRows_feat)>
    <cfset QueryString_feat=Iif(CGI.QUERY_STRING NEQ
    "",DE("&"&CGI.QUERY_STRING),DE(""))>
    <cfset
    tempPos=ListContainsNoCase(QueryString_feat,"PageNum_feat=","&")>
    <cfif tempPos NEQ 0>
    <cfset
    QueryString_feat=ListDeleteAt(QueryString_feat,tempPos,"&")>
    </cfif>
    <cflock timeout="2" scope="application"
    type="READONLY"><cfoutput query="feat"
    maxrows="4">#ViewField1#</cfoutput></cflock>
    <cfif PageNum_feat GT 1>
    <a
    href="#CurrentPage#?PageNum_feat=#Max(DecrementValue(PageNum_feat),1)##QueryString_feat#"
    onmouseout="MM_swapImgRestore()"
    onmouseover="MM_swapImage('Previous','','../img/previous-over.gif',1)"><img
    src="../img/previous.gif" alt="Previous Records" name="Previous"
    width="96" height="27" border="0" id="Previous" /></a>
    <cfif PageNum_feat LT TotalPages_feat>
    <a
    href="#CurrentPage#?PageNum_feat=#Min(IncrementValue(PageNum_feat),TotalPages_feat)##Quer yString_feat#"
    onmouseout="MM_swapImgRestore()"
    onmouseover="MM_swapImage('next','','../img/next-over.gif',1)"><img
    src="../img/next.gif" alt="Next Record" name="next" width="96"
    height="27" border="0" id="next" /></a>
    The Error:
    Variable PAGENUM_FEAT is undefined.
    The error occurred in
    C:\Websites\x9vdzd\feature\featured.cfm: line 8
    6 : </cfquery>
    7 : <cfset MaxRows_feat=4>
    8 : <cfset
    StartRow_feat=Min((PageNum_feat-1)*MaxRows_feat+1,Max(feat.RecordCount,1))>
    9 : <cfset
    EndRow_feat=Min(StartRow_feat+MaxRows_feat-1,feat.RecordCount)>
    10 : <cfset
    TotalPages_feat=Ceiling(feat.RecordCount/MaxRows_feat)>
    I thought I had it defined! What am I missing?
    Thanks
    Phoenix

    that is strange... it should work fine - it does in my tests.
    here is somewhat updated & modified code to try. i have
    included
    comments to try and explain what is being done.
    basic logic is as follows:
    -form is submitted
    -check if file has been selected
    -try uploading new file
    -if new file upload succeeds, delete old file if it exists
    (as part of
    updating existing record, as new records obviously would not
    have any
    old image)
    -update/insert record data as necessary
    here's the code:
    <cfif isdefined("form.feat_OK")><!--- form submitted
    --->
    <!--- set file uploading vars --->
    <cfparam name="fileuploaded" type="boolean"
    default="false">
    <cfparam name="uploadedfile" default="">
    <cfset pathToFile = "c:\websites\x9vdzd\img\feature\">
    <!--- --->
    <cfif len(trim(form.MYFile))><!--- if a file has
    been selected --->
    <!--- try uploading new file --->
    <cftry>
    <cffile Action="upload" filefield="MYFile"
    accept="image/gif,
    image/jpg, image/jpeg, image/pjpeg"
    destination="#pathToFile" nameconflict="MAKEUNIQUE">
    <cfset fileuploaded = true>
    <cfset uploadedfile = cffile.serverfile>
    <cfcatch type="any">
    <!--- if upload did not suceed, reset file uploading vars
    --->
    <cfset fileuploaded = false>
    <cfset uploadedfile = "">
    <!--- this can be further enhanced by setting some var to
    hold error
    message and return it to user --->
    </cfcatch>
    </cftry>
    </cfif>
    <cfif form.id gt 0><!--- we are updating an
    existing record --->
    <!--- if new file upload was successful and the feature
    has an image
    associated with it - delete old image --->
    <cfif fileuploaded is true AND
    len(trim(form.oldimage))>
    <cfif FileExists(pathToFile & form.oldimage)>
    <cffile action="delete" file="#pathToFile &
    form.oldimage#">
    </cfif>
    </cfif>
    <cfquery datasource="#sitedatasource#"
    username="#siteUserID#"
    password="#sitePassword#">
    UPDATE feature
    SET
    feature.title=<cfqueryparam cfsqltype="cf_sql_varchar"
    value="#form.title#">,
    feature.Body=<cfqueryparam cfsqltype="cf_sql_longvarchar"
    value="#form.PDSeditor#">,
    feature.MYFile=<cfqueryparam cfsqltype="cf_sql_varchar"
    value="#uploadedfile#" null="#NOT fileuploaded#">
    WHERE ID = <cfqueryparam value="#form.ID#"
    cfsqlType="CF_SQL_INTEGER">
    </cfquery>
    <cfelse><!--- we are inserting a new record --->
    <cfquery datasource="#sitedatasource#"
    username="#siteUserID#"
    password="#sitePassword#">
    INSERT INTO feature
    (title, body, MYFile)
    VALUES
    (<cfqueryparam cfsqltype="cf_sql_varchar"
    value="#form.title#">,
    <cfqueryparam cfsqltype="cf_sql_longvarchar"
    value="#form.PDSeditor#">,
    <cfqueryparam cfsqltype="cf_sql_varchar"
    value="#uploadedfile#"
    null="#NOT fileuploaded#">)
    </cfquery>
    </cfif>
    <!--- relocate user to previous page after insert/update
    --->
    <cflocation url="feature-manager.cfm">
    </cfif>
    hth
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com

Maybe you are looking for