Oh functions, how I loathe thee...

I have a form that submits to another page, and on the target page I'm trying to add a function to log the activity.
So I did this:
Target page:
<cfinvoke component="actionlog" method="additem">
    <cfinvokeargument name="details" value="Edited user: #FORM.email#">
</cfinvoke>
And the cfc:
<cfcomponent>
<cffunction name="additem" access="public">
<cfargument name="details" type="string" required="yes">
<cfquery name="addlog" datasource="hepoffice">
INSERT INTO actions
        ( timestamp
        , user
        , action )
VALUES
        ( '#DateFormat(Now(), "yyyy-mm-dd|hh:mm:ss")#'
        , '#GetAuthUser()#'
        , <cfqueryparam value="#arguments.details#" cfsqltype="cf_sql_varchar"> )
</cfquery>
</cffunction>
</cfcomponent>
I've done this sort of thing in the past, and it's worked, but not I'm getting an error:
Error Executing Database Query.
Syntax error in INSERT INTO statement.
The error occurred in D:\Inetpub\staffnet_test\hep\admin\actionlog.cfc: line 12
Called from D:\Inetpub\staffnet_test\hep\admin\hepadmin.cfm: line 87
Called from D:\Inetpub\staffnet_test\hep\admin\hepadmin.cfm: line 75
Called from D:\Inetpub\staffnet_test\hep\admin\hepadmin.cfm: line 64
Called from D:\Inetpub\staffnet_test\hep\admin\hepadmin.cfm: line 1
Called from D:\Inetpub\staffnet_test\hep\admin\hepadmin.cfm: line 1
Called from D:\Inetpub\staffnet_test\hep\admin\actionlog.cfc: line 12
Called from D:\Inetpub\staffnet_test\hep\admin\hepadmin.cfm: line 87
Called from D:\Inetpub\staffnet_test\hep\admin\hepadmin.cfm: line 75
Called from D:\Inetpub\staffnet_test\hep\admin\hepadmin.cfm: line 64
Called from D:\Inetpub\staffnet_test\hep\admin\hepadmin.cfm: line 1
Called from D:\Inetpub\staffnet_test\hep\admin\hepadmin.cfm: line 1
10 :         ( '#DateFormat(Now(), "yyyy-mm-dd|hh:mm:ss")#'
11 :         , '#GetAuthUser()#'
12 :         , <cfqueryparam value="#arguments.details#" cfsqltype="cf_sql_varchar"> )
13 : </cfquery>
14 : </cffunction>
What am I doing wrong?

INSERT INTO actions ( timestamp, user, action ) 
I would bet the problem is one or more of your column names is a reserved word in your database. TIMESTAMP and USER are likely suspects. In which case your options are to rename the columns or escape them (syntax is database specific). (BTW: It is always a good thing to mention your database type when queries are involved)
>  '#DateFormat(Now(), "yyyy-mm-dd|hh:mm:ss")#'
>   Does date format support a time mask?
s Micheal mentioned, DateFormat does not fully support time masks. Not surprising given the function name. But be aware "m" only represents month number, not minutes. That said, if "timestamp" is a datetime column it is best to use datetime objects, not strings. Lose the quotes and dateFormat() and just insert #now()#
-Leigh

Similar Messages

  • Plays Function - How to restore the totals that i used to get lisetd on my old PC?

    Any help on how to restore the "Plays" function would be gratefully received!  I have recently installed itunes on a new PC and this function does not seem to work in the Library section.

    Perhaps you need to revist the way you moved your library. This migrate iTunes library post shows ways to do it that bring over all the data intact. If that is no longer possible see my script SyncStats.
    tt2

  • How to register the recipient when create job by function

    I am now use JOB_OPEN , JOB_SUBMIT and JOB_CLOSE to create a job in the program. And need to post the result of the report to the person by email.
    Can you tell me how to register the recipient when create the job.
    ( in sm36, it is easily to do but how to do in coding? )
    regards,
    slam

    Hi
    I think in Back ground using the above fun modules you can't send a mail to the receipient.
    see the use of the above fun modules;
      IF p_bjob = 'X'.
        CONCATENATE sy-cprog sy-datum sy-uzeit
                    INTO jobname SEPARATED BY '_'.
        CALL FUNCTION 'JOB_OPEN'
          EXPORTING
            jobname          = jobname
          IMPORTING
            jobcount         = jobcount
          EXCEPTIONS
            cant_create_job  = 1
            invalid_job_data = 2
            jobname_missing  = 3
            OTHERS           = 4.
        CALL FUNCTION 'GET_PRINT_PARAMETERS'
          IMPORTING
            out_archive_parameters = arc_params
            out_parameters         = print_params
            valid                  = valid
          EXCEPTIONS
            archive_info_not_found = 1
            invalid_print_params   = 2
            invalid_archive_params = 3
            OTHERS                 = 4.
        IF valid = chk.
          SUBMIT ybrep
                          WITH < sel Screen>
                          AND RETURN
                          USER               sy-uname
                          VIA JOB            jobname
                          NUMBER             jobcount
                          TO SAP-SPOOL
                          SPOOL PARAMETERS   print_params
                          ARCHIVE PARAMETERS arc_params
                          WITHOUT SPOOL DYNPRO.
          CALL FUNCTION 'JOB_CLOSE'
            EXPORTING
              jobcount             = jobcount
              jobname              = jobname
              strtimmed            = 'X'
            EXCEPTIONS
              cant_start_immediate = 1
              invalid_startdate    = 2
              jobname_missing      = 3
              job_close_failed     = 4
              job_nosteps          = 5
              job_notex            = 6
              lock_failed          = 7
              invalid_target       = 8
              OTHERS               = 9.
          IF sy-subrc <> 0.
           MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ELSE.
            MESSAGE i029 WITH jobname.
          ENDIF.
        ELSE.
          MESSAGE s000 WITH text-003.
          STOP.
        ENDIF.
      ENDIF.
    Reward points if useful
    Regards
    Anji

  • How to delete the data in a table using function

    hi all,
    i need to delete the data in a table using four parameters in a function,
    the parameters are passed through shell script.
    How to write the function
    Thanks

    >
    But the only thing is that such function cannot be used in SQL.
    >
    Perhaps you weren't including the use of autonomous transactions?
    CREATE OR REPLACE FUNCTION remove_emp (employee_id NUMBER) RETURN NUMBER AS
    PRAGMA AUTONOMOUS_TRANSACTION;
    tot_emps NUMBER;
    BEGIN
    SELECT COUNT(*) INTO TOT_EMPS FROM EMP3;
    DELETE FROM emp3
    WHERE empno = employee_id;
    COMMIT;
    tot_emps := tot_emps - 1;
    RETURN TOT_EMPS;
    END;
    SQL> SELECT REMOVE_EMP(7499) FROM DUAL;
    REMOVE_EMP(7499)
                  12
    SQL> SELECT REMOVE_EMP(7521) FROM DUAL;
    REMOVE_EMP(7521)
                  11
    SQL> SELECT REMOVE_EMP(7566) FROM DUAL;
    REMOVE_EMP(7566)
                  10
    SQL>

  • How to find the number of data items in a file written with ArryToFile function?

    I have written an array of number in 2 column groups to a file using the LabWindows/CVI function ArrayToFile...Now if I want to read the file with FileToArray Function then how do I know the number of items in the file. during the write time I know how many array items to write. but suppose I want the file to read at some later time then How to find the number of items in the file,So that I can read the exact number and present it. Thanks to all
    If you are young work to Learn, not to earn.
    Solved!
    Go to Solution.

    What about:
    OpenFile ( your file );
    cnt = 0;
    while ((br = ReadLine ( ... )) != -2) {
    if (br == -1) {
    // I/O error: handle it!
    break;
    cnt++;
    CloseFile ( ... );
    There are some ways to improve performance of this code, but if you are not reading thousands of lines it's quite fast.
    After this part you can dimension the array to pass to FileToArray... unless you want to read it yourself since you already have it open!
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • HOw to find the BAPI function module

    Hi all,
    I have a field called IEVER in table EIKP.
    How to find the related BAPI function module and BAPI structure for this filed.
    Thanks in advance
    KP

    Hi KP,
       can you tell us the name of the transaction in which you saw this field?
    If it is in PO Creation or Change you can probably look at the bapis
    BAPI_PO_CREATE or BAPI_PO_CHANGE
    Regards,
    Ravi

  • How to create the INBOUND Function Module for INBOUND IDOCs

    Hi Friends,
    Can any Suggest me How to proceed to Create an INBOUND Function Module for Processing the INBOUND IDOCS
    which are recieved from XI Server ?
    I am working in SAP-ISU
    Here i will recieve the INBOUND IDOCs for the Meter Reading Orders.
    We have a Standard INBOUND FUNCTION MODULE
    IDOC_INPUT_ISU_MR_UPLOAD
    which Uploads the Meter Reading Results.
    I copied the Same function Module into ZIDOC_INPUT_
    and working on it.
    Can any one suggest me, whether i am going in correct way or not.
    In IDOC_INPUT_ISU_MR_UPLOAD Inbound fun module,
    BAPI_MTRREADDOC_UPLOAD is used to Update or Insert the Meter Reading Results,
    My requirment is to Insert and Update the Meter Reading Orders which are Inbounded from XI.
    Can I Use the Same BAPI
    BAPI_MTRREADDOC_UPLOAD
    to Update the below fields,
    EABL-SERNR
    EABL-ZWNUMMER
    EABLG-ABLESGR
    EABL-V_ZWSTAND
    EABL-N_ZWSTAND
    EABL-ABLHINW
    EABL-ZSKIPC
    EABL-ADAT
    EABL-ATIMTATS
    EABL-ADATTATS
    EABL-ATIM
    EABL-ZMESSAGE
    EABL-ABLESER(Meter reader number)
    Kindly Suggest me,
    Thanks in Advance,
    Ganesh

    Hello Ganesh
    I think you are going completely astray with you z-function module for IDoc processing.
    If you look at TABLES parameter METERREADINGRESULTS (type BAPIEABLU ) of BAPI_MTRREADDOC_UPLOAD you will find many of the requested fields already:
    EABL-SERNR => BAPIEABLU-SERIALNO
    EABL-ZWNUMMER =>REGISTER
    EABLG-ABLESGR
    EABL-V_ZWSTAND
    EABL-N_ZWSTAND
    EABL-ABLHINW
    EABL-ZSKIPC
    EABL-ADAT
    EABL-ATIMTATS => ACTUALMRTIME
    EABL-ADATTATS => ACTUALMRDATE
    EABL-ATIM
    EABL-ZMESSAGE
    EABL-ABLESER(Meter reader number)
    Field EABL-ZMESSAGE appears to be custom field (at least I cannot find it on ECC 6.0). If this field was added using include CI_EABL then you probably can get these values into the BAPI using the EXTENSIONIN parameter.
    Check routine CHECK_UPLOADRECORDS in the BAPI which allows two extension structures:
    - BAPI_TE_EABL
    - BAPI_TE_EOSB
    Not surprisingly BAPI_TE_EABL contains the include CI_EABL.
    Regards
      Uwe

  • How to get the "last changed by" for a set of function modules?

    How to get the "last changed by" for a set of function modules?
    is there any table to get it??

    See [this|Re: Date of creation of function module] I posted earlier.
    >TFDIR will give you the name of the function group program and the include number.
    >E.g. SAPLZFUNCGROUP Include 01.
    >From this you can construct the include name: LZFUNCGROUPU01.
    >You can look this up in TRDIR to find the creation date (CDAT) of the function module.
    In your case, you need unam and udat.
    matt

  • How to remove the sort function on the drill down and then save

    how to remove the sort function on the drill down and then save in the  change local view of the Query
    Is it possible to change the porperties of any characteristic in the local view and then save?
    If so please post the answer.

    I do not think that option is possible.
    Regards,
    Venkata Boga.

  • Question about cursors in a function and how to return the results

    Hi all,
    Some tech info:
    I'm using Oracle 11G database and APEX 4.0.2.00.06
    I use three cursors in a function. My function is called in an APEX standard report, like this by example:
    SELECT fnc_exp(tab.arg1, tab,arg2) FROM table_exp tab;
    My question is: how can I return the values calculated from my function to a standard APEX report? Before, this function was used like this by Oracle Forms to fetch the cursors in the right table columns:
    open c_a;
    fetch c_a into :loc.arg1;
    close c_a;
    open c_b;
    fetch c_b into :loc.arg2, :loc.arg3, :loc.arg4, :loc.arg5;
    close c_b;
    Thanks for your advices!
    Maybe my solution is not right, if you have better ideas, please suggest :)
    PS: If you need more details, please ask which you need.

    Hi,
    I don't think you can do exactly like that in APEX.
    Go for a pipelined function if you want the value be returned from the function.

  • How to get the value retruned by java script function into my jsp page

    Hai all,
    I had a particular java script function which returns a date.
    function getDate() {
         var sDate;
    // This code executes when the user clicks on a day in the calendar.
    if ("TD" == event.srcElement.tagName)
    // Test whether day is valid.
    if ("" != event.srcElement.innerText)
    //alert(event.srcElement.innerText);
    sDate = document.all.year.value + "-" + document.all.month.value + "-" + event.srcElement.innerText;
    document.all.ret.value = sDate;
    var mahi=window.open("configurexml.jsp?xyz=document.all.ret.value")
    return sDate;}
    Now i want to display this particular date in my jsp page. can anyone tell me the correct approach or a sample code to diaplay this date in my jsp page.
    <%@ page language="java"
    import="javax.xml.parsers.*,java.io.*,org.w3c.dom.*"%><%@ page import="java.util.*" %>
    !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html> <head> <title>Configuring Xml File</title>
    <SCRIPT LANGUAGE="JavaScript" SRC="xyz.js"> </SCRIPT>
    body bgcolor="#d0d0d0" onClick= "return getDate()" >
    <form name="f1">
    <b>20 october 2006 </b>
    Here where i am printing the date i had to get the value from the js function. how to do that. plz help me....

    Are you talking about server-side java code (servlets/jsp) or client side (applet)? Given we are in the JSP forum I'll assume we're talking server side.
    If so, you are making a common but fundamental mistake. JavaScript executes on the client, not on the server. If you want client data on the server it has to get there somehow. The simplest way to do this in JSP land is via HTTP. So... have your JavaScript code call a JSP (or servlet) and pass the value you want as a URL parameter. Of course this will also change the browser location, so if you don't want this to happen use a frame or iframe to capture your HTTP request.
    For example:
    Javascript....
    function someFunction() {
    return 1;
    var value = someFunction();
    location.href="somejsp.jsp?value=" + value;

  • How to refresh the text which is display by windows API function 'findwindow' 'getdc' 'textout'!

    i use the windows api function to dynamelly display text on the frontpanel ,it successed ,but when you move the scrollbar to the left ,right ,top ,bottom,the text will be disappear!! i think it is a very difficulteed problem .in my around ,no one can do! who can help me!
    Attachments:
    textrefresh.vi ‏21 KB
    auto_appear_scroll.vi ‏126 KB

    Very cool!
    It looks like you are using the same functions that LV uses to refresh the screen. Thos functions only let you update within the window you specify. This is why your updates stop at teh edge of the window.
    Normally LV will watch the scroll bar position and re-paint the screen to reflect an scroll bar postion changes. Since you are by-passing LV, you can not rely on LV to refresh your screen when the scroll bars move.
    At this point I can offer two suggestions.
    1) Continue with the approach you started and start adding all of the code required to watch the scroll bars and re-paint as indicated.
    or
    2) Look into the LV Picture control. Based on what you have done using dll calls I would guess that you could probably figure how to do the
    same thing using a picture control. The Picture (being a LV native object) is fully supported by LV so the scrolling work is already done and working. The picture control will let you draw lines, insert text, etc. Take a look at the "Robot Arm" example. It should get you started.
    Finally, the Picture control is pure "G" so it should be platform independent.
    Otherwise let me commend you on your example. You say no one else where you are can do what you have done. After looking at your example, I am not suprised. There are few people in the world that can do what you have done.
    Great work!
    Ben
    Ben Rayner
    Certified LabVIEW Developer
    www.DSAutomation.com
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Does anyone know how to use the bcc functionality for apple mail while accessing it on the cloud from my PC?

    I am currently away from my MAC and want to send an email through apple mail with the bcc functionality.  I am using the cloud to get to my mail, however, I can't figure out how to use the BCC functionality, please help.  Thanks!

    Open your mail,
    lower left corner click on settings,
    go to composing and check BCC, save and your done

  • How to Use the language function for assignment and validation

    Hi All,
    If anyone can explain me in details with example ,how to use the language function for assignments and validations?
    Thanks
    Arnab

    Hi Arnab,
    The expression is checked only for the current MDM session.
    If u login with the ABC language it will always show the ABC language no matter how many times u execute it.
    Try connecting to the DM with the XYZ language.
    It should go to the if part rather than else.
    Hope it helps.
    Thanks,
    Minaz

  • How to use the different class for each screen as well as function.

    Hi Experts,
    How to use the different class for each screen as well as function.
    With BestRegards,
    M.Thippa Reddy.

    Hi ThippaReddy,
    see this sample code
    Public Class ClsMenInBlack
    #Region "Declarations"
        'Class objects
        'UI and Di objects
        Dim objForm As SAPbouiCOM.Form
        'Variables
        Dim strQuery As String
    #End Region
    #Region "Methods"
        Private Function GeRate() As Double
                Return Double
        End Function
    #End Region
    Public Sub SBO_Appln_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean)
            If pVal.BeforeAction = True Then
                If pVal.MenuUID = "ENV_Menu_MIB" Then
                End If
            Else ' Before Action False
                End If
        End Sub
    #End Region
    End Class
    End Class
    Rgds
    Micheal
    Vasu Anna Regional Feeling a???? Just Kidding
    Edited by: micheal willis on Jul 27, 2009 5:49 PM
    Edited by: micheal willis on Jul 27, 2009 5:50 PM

Maybe you are looking for