Need help in using SQL in a jsp file to compare date and time

hi every one,
Actually I am doing a project using JSP. I need to compare a date field in the database (MS Acess) to the current system date and time. I have to do this in a select statement.
I have alredy defined a variable of type Date in the JSP file and I am comparing this variable to the date in the database through a select statemant.
Here is what I am doing
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
          java.util.Date today = new java.util.Date();
          String myDate=sdf.format(today);
query = "SELECT Car_ID, Model_ID, Year, Ext_Color, Price from Cars where EDate <= "+myDate+" ;";
EDate is the feild in the database and it's format is (5/12/2008 5:29:47 PM) it is of type Date/Time in MS Acess.
when I execute the query it gives the following error
SQL error:java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'EDate <= 2008-10-16 08:10:07'.
I hope any one can help me with that error and answer my question, I've tried too many things but nothing helps
Thanks in advance :-)

Hi,
When the comparision is needed to be done with the current date , we don't need to send in Java
Date then format it and compare with MS Acess Date.
In MS Access we have Date() function which will give you the current date.
So you can try rewriting your query as following :
query = "SELECT Car_ID, Model_ID, Year, Ext_Color, Price from Cars where EDate <= Date() ;"; ---------------------
Hope this helps.
Thanks

Similar Messages

  • How to get the most current file based on date and time stamp using SSIS?

    Hello,
    Let us assume that files get copied in a specific directory. We need to pick up a file and load data. Can you guys let me know how to get the most current file based on date and time stamp using SSIS?
    Thanks
    thx regards dinesh vv

    hi simon
    i excuted this script it is giving error..
       Microsoft SQL Server Integration Services Script Task
       Write scripts using Microsoft Visual C# 2008.
       The ScriptMain is the entry point class of the script.
    using System;
    using System.Data;
    using Microsoft.SqlServer.Dts.Runtime;
    using System.Windows.Forms;
    namespace ST_9a6d985a04b249c2addd766b58fee890.csproj
        [System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
        public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
            #region VSTA generated code
            enum ScriptResults
                Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
                Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
            #endregion
            The execution engine calls this method when the task executes.
            To access the object model, use the Dts property. Connections, variables, events,
            and logging features are available as members of the Dts property as shown in the following examples.
            To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;
            To post a log entry, call Dts.Log("This is my log text", 999, null);
            To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);
            To use the connections collection use something like the following:
            ConnectionManager cm = Dts.Connections.Add("OLEDB");
            cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";
            Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
            To open Help, press F1.
            public void Main()
                string file = Dts.Variables["User::FolderName"].Value.ToString();
                string[] files = System.IO.Directory.GetFiles(Dts.Variables["User::FolderName"].Value.ToString());
                System.IO.FileInfo finf;
                DateTime currentDate = new DateTime();
                string lastFile = string.Empty;
                foreach (string f in files)
                    finf = new System.IO.FileInfo(f);
                    if (finf.CreationTime >= currentDate)
                        currentDate = finf.CreationTime;
                        lastFile = f;
                Dts.Variables["User::LastFile"].Value = lastFile;
                Dts.TaskResult = (int)ScriptResults.Success;
    thx regards dinesh vv

  • SQL Where clause when comparing dates and times in ASP

    Hello,
    I am trying to pull data from my database which is dependant on both the date and time in HH24 format. So, my where clause looks something like this:
    select * from thisTable where activity_time >= myCurrentDate
    (myCurrentDate is a variable that is built which gives it the following format DD-MON-YYYY HH24:MI:SS)
    So, the actual passed string to my call is:
    select * from thisTable where ACTIVITY_TIME >= '02-DEC-2008 18:22:00' order by ACTIVITY_TIME asc
    However, when calling this, I get the famous "ORA-01830: date format picture ends before converting entire input string"
    Can anyone please help me?!?!?!?
    Thanks in advance

    Enrique answered your immediate question, but I'd like to point up a broader issue, and that is that you should <b><u>always</u></b> use the TO_DATE and TO_CHAR functions at the sql statement level when working with date datatypes. That way you are never dependent on some default over which you have no control. I call that is 'defensive coding'.

  • Need help in using sql loader

    Hi,
    I am using sqlloader to load data from csv file to a table. csv file format is as below. And the condition is to load only data from locations DHL and ABC
    item loc scheddate qty
    10000001     DHL     7/13/2011     100
    1000002     DHL     7/14/2011     10
    101     ABC     7/15/2011     1000
    10000002     ABC     7/16/2011     100
    100 X 7/16/2011 0
    and I am loading into table tab1
    (note: there are few other cols which are nullable and don't want to isnert them)
    here is the code I have written
    LOAD DATA
    INFILE file1.csv'
    REPLACE
    INTO TABLE tab1
    WHEN (LOC = 'DHL')
    FIELDS TERMINATED BY ","
    TRAILING NULLCOLS
    ITEM,
    LOC,
    SCHEDDATE DATE "MM/DD/YYYY",
    QTY,
    EXPDATE DATE (:SCHEDDATE,'MM/DD/YYYY'),
    STARTDATE DATE "MM/DD/YYYY" ":SCHEDDATE",
    SEQNUM SEQUENCE(1000,1),
    ORDERNUM CONSTANT "2",
    INTEGRATION_JOBID CONSTANT "RBI603"
    INTO TABLE igpmgr.INTINS_SCHEDRCPTS
    WHEN (LOC = 'ABC')
    FIELDS TERMINATED BY ","
    TRAILING NULLCOLS
    ITEM,
    LOC,
    SCHEDDATE DATE "MM/DD/YYYY",
    QTY,
    EXPDATE DATE "MM/DD/YYYY" "to_char(to_date(:SCHEDDATE,'MM/DD/YYYY')+365,'DD/MM/YYYY')",
    STARTDATE DATE "MM/DD/YYYY" ":SCHEDDATE",
    SEQNUM SEQUENCE(1000,1),
    ORDERNUM CONSTANT "2",
    INTEGRATION_JOBID CONSTANT "RBI603"
    But its only inserting rows from loc DHL and not from ABC...
    Please help me..
    Thanks,
    Ravi.

    Hello Ravi,
    Based on your sample data, adding commas to match the field terminators specified in the control file:10000001,DHL,7/13/2011,100
    1000002,DHL,7/14/2011,10
    101,ABC,7/15/2011,1000
    10000002,ABC,7/16/2011,100
    100,X,7/16/2011,0Consider the following:LOAD DATA
    INFILE test.csv'
    APPEND
    INTO TABLE tab1
    WHEN (LOC = 'ABC')
    FIELDS TERMINATED BY ","
    TRAILING NULLCOLS
    ( ITEM
    , LOC
    , SCHEDDATE          DATE "MM/DD/YYYY"
    , QTY                                                -- moved to the fourth column to match the order presented in the sample data
    , EXPDATE            DATE "MM/DD/YYYY"               -- changed specified date format to use double quotes instead of single quotes and swapped order of DD & MM to match SCHEDDATE in sample data, but also not present in the sample data, so would expect this to be treated as null, so not sure why it is specified
    , STARTDATE          DATE "MM/DD/YYYY" ":SCHEDDATE"
    , SEQNUM             SEQUENCE(1000,1)
    , ORDERNUM           CONSTANT          "2"
    , INTEGRATION_JOBID  CONSTANT          "RBI603"
    INTO TABLE tab1
    WHEN (LOC = 'DEF')
    FIELDS TERMINATED BY ","
    TRAILING NULLCOLS
    ( ITEM               POSITION(1)                     -- added POSITION(1) to allow sqlldr to start reading from the beginning of the line
    , LOC
    , SCHEDDATE          DATE "MM/DD/YYYY"
    , QTY                                                -- moved to the fourth column to match the order presented in the sample data
    , EXPDATE            DATE "MM/DD/YYYY"               -- not present in the sample data, so would expect this to be treated as null, so not sure why it is specified
    , STARTDATE          DATE "MM/DD/YYYY" ":SCHEDDATE"
    , SEQNUM             SEQUENCE(1000,1)
    , ORDERNUM           CONSTANT          "2"
    , INTEGRATION_JOBID  CONSTANT          "RBI603"
    )Hope this helps,
    Luke
    Please mark the answer as helpful or answered if it is so. If not, provide additional details.
    Always try to provide actual or sample statements and the full text of errors along with error code to help the forum members help you better.

  • Need help to use 'When' clause in CTL file

    Hi,
    I have a requirement
    in ctl file while loading file names in to a table we need to ignore if the filename already exist in the table
    eg:
    load infile.txt
    into a
    when filename not in (select filename from a) append
    filename varchar(1000)
    is it possible?? any way to achieve this?? Pleas help..
    Thanks in advance..

    user3647602 wrote:
    Hi,
    I have a requirement
    in ctl file while loading file names in to a table we need to ignore if the filename already exist in the table
    eg:
    load infile.txt
    into a
    when filename not in (select filename from a) append
    filename varchar(1000)
    is it possible?? any way to achieve this?? Pleas help..
    Thanks in advance..Easiest method i can think of would be to use an EXTERNAL TABLE instead of SQL LOADER.
    Much more flexible.
    Cheers,

  • Need help changing from SQL dbo to mdf file

    My project was started using dbo is there a way to change this to an mdf without changing out the database.

    I think you answered my question the datasets in my project are connected to sqlexpress instance, Iwant to remove this connection and add a connection to an MDF file in my project. Maybe this will help explain my question better. 
    You cannot directly add connection to mdf file.But you can achieve this by first attching this MDF file to SQL express( this has some limitations like max of  4 Gfile can be attached to Sql server 2008 and 10 G for 2012).Is this you want to achieve ?
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • I bought my apple tv in USA and use in Indonesia, but I can't set date and time.

    How to set date and time so I can Home sharing with apple tv .

    Call the shop in NYC and find out.

  • I need help on using up Microsoft.

    i need help on using up microsoft
    Moderator's Note: Post was moved and changed the title into a subject-related title. This is to keep the forum organized and let other forum users easily see and respond to this post.

    Please, we need the error message word for word. If you do not get an error message, please, elaborate in greater detail …
    Furthermore, which phone model do you use?

  • Unable to insert date and time when using date datatype

    Hi
    I am hitting a bit of a problem when using the date datatype. When trying to save a row to the table where the field it throws an error ora 01830 and complains about converting the date format picture ends...etc. Now when I do the insert, I use the to_date function with the format of "dd-mon-yyyy hh24:mi:ss". Of course, when I remove the time element, everything is perfect.
    Checking sysdate, I noticed that the time element wasn't be displayed, and I used alter session set nls_date_format to set the date and time I want to save to the table, which worked!
    Then based on advice in a previous thread to permanently fix the problem, I used alter system set nls_date_format ="dd-mon-yyyy hh24:mi:ss" scope=spfile; This showed that it was altered, and I can see the setting in the em. In sqlplus, I shutdown the database, and restarted with startup mount; alter database open; and then selecting sysdate, it still shows the date as dd-mon-yy, and still no time! Checking the em, and looking up the nls_date_format the setting is still shown as "dd-mon-yyyy hh24:mi:ss".
    So, my question is this - what am I doing wrong? Why can't save date and time using date in Oracle 11g?????
    Thanks

    user633278 wrote:
    Hi
    I am hitting a bit of a problem when using the date datatype. When trying to save a row to the table where the field it throws an error ora 01830 and complains about converting the date format picture ends...etc. Now when I do the insert, I use the to_date function with the format of "dd-mon-yyyy hh24:mi:ss". Of course, when I remove the time element, everything is perfect.
    Checking sysdate, I noticed that the time element wasn't be displayed, and I used alter session set nls_date_format to set the date and time I want to save to the table, which worked!
    Then based on advice in a previous thread to permanently fix the problem, I used alter system set nls_date_format ="dd-mon-yyyy hh24:mi:ss" scope=spfile; This showed that it was altered, and I can see the setting in the em. In sqlplus, I shutdown the database, and restarted with startup mount; alter database open; and then selecting sysdate, it still shows the date as dd-mon-yy, and still no time! Checking the em, and looking up the nls_date_format the setting is still shown as "dd-mon-yyyy hh24:mi:ss".
    So, my question is this - what am I doing wrong? Why can't save date and time using date in Oracle 11g?????
    ThanksYou most certainly can save the time. A DATE column, by definition stores date and time. What you describe is a presentation problem, and setting nls_date_format at the system as an init parm is the weakest of all settings as it is overridden by several other locations.
    without seeing the exact sql that produced the error (not just your description of what you think you were doing) it is impossible to say for sure.
    However, I'd suggest you read http://edstevensdba.wordpress.com/2011/04/07/nls_date_format/

  • JSP: Date and Time Count down

    Hi All,
    Sorry if i come to the wrong place.
    I am thinking to write a code by using JSP to count down Date and Time. I have one field in my microsoft access format as Date/Time. I want to get the remain time by using the time in my microsoft access minus the current time in the machine and then count down the remain time.
    Could you please advise??
    Thanks for any advise you may give me,
    Kimsan

    Hi All,
    Sorry if i come to the wrong place.
    I am thinking to write a code by using JSP to count down Date and Time. I have one field in my microsoft access format as Date/Time. I want to get the remain time by using the time in my microsoft access minus the current time in the machine and then count down the remain time.
    Could you please advise??
    Thanks for any advise you may give me,
    Kimsan

  • Need help in using a Secondary Index of a GL Table

    Hello ABAPers,
    Good morning/afternoon!
    I  was wondering if anyone could give me a hand on this issue.
    To give you a brief background, I need to retrieve Open and Cleared items in the last 24 hours, that is, from 11 am yesterday till 10:59:59 today. The criteria is to pull the information using Entry Date (CPUDT) and Entry Time (CPUTM) from BKPF and using BELNR, retrieve the postings in BSIS and BSAS. as you can see in the piece of code. However, this process takes soooooo long to run.
    Below is the code snippet.
    We use 46C and MS SQL database.
    The index fields of BKPF~ZB2 are: MANDT, CPUDT and BLART.
    The index fields of BSIS~Z01are: BUKRS, GJAHr, HKONT, PRCTR, GSBER
    TYPES: BEGIN OF i_bseg,
           bukrs LIKE bkpf-bukrs,
           hkont LIKE bsis-hkont,
           gjahr LIKE bkpf-gjahr,
           belnr LIKE bkpf-belnr,
           buzei LIKE bsis-buzei,
           bldat LIKE bsis-bldat,
           budat LIKE bsis-budat,
           waers LIKE bsis-waers,
           monat LIKE bsis-monat,
           shkzg LIKE bsis-shkzg,
           gsber LIKE bsis-gsber,
           dmbtr LIKE bsis-dmbtr,
           wrbtr LIKE bsis-wrbtr,
           cpudt LIKE bkpf-cpudt,
           cputm LIKE bkpf-cputm,
           END OF i_bseg.
    *Internal Tables
    DATA:
          i_bkpf TYPE TABLE OF bkpf,
          i_bseg TYPE STANDARD TABLE OF i_bseg.
    Select records from yesterday's entry date.
        SELECT  bukrs belnr gjahr monat budat cpudt cputm waers
                FROM bkpf INTO  CORRESPONDING FIELDS OF TABLE i_bkpf
                WHERE ( cpudt = so_date2-low AND
                        cputm >= so_cputm-low AND
                        cputm <= so_cputm-high )
                OR    ( cpudt = so_date2-high AND
                        cputm >= so_time2-low AND
                        cputm <= so_time2-high )
                %_HINTS MSSQLNT 'INDEX("BKPF" "BKPF~ZB2")'.
        IF sy-subrc NE 0.
          MESSAGE e006 WITH 'BKPF'.
        ENDIF.
    Select Open Items***
        SELECT bukrs hkont gjahr belnr buzei  budat bldat
               waers monat shkzg gsber  dmbtr wrbtr
               FROM bsis
               APPENDING CORRESPONDING FIELDS OF TABLE i_bseg
               FOR ALL ENTRIES IN i_bkpf
               WHERE bukrs = i_bkpf-bukrs
               AND gjahr = i_bkpf-gjahr
               AND hkont IN so_saknr
               AND belnr = i_bkpf-belnr
               %_HINTS MSSQLNT 'INDEX("BSIS" "BSIS~Z01")'.
    Also get any cleared items ***
        SELECT bukrs hkont gjahr belnr buzei  budat bldat
               waers monat shkzg gsber  dmbtr wrbtr
               FROM bsas
               APPENDING CORRESPONDING FIELDS OF TABLE i_bseg
               FOR ALL ENTRIES IN i_bkpf
               WHERE bukrs IN so_bukrs
               AND   hkont IN so_saknr
               AND   gjahr = sp_gjahr
               AND   belnr = i_bkpf-belnr.
    Many thanks,
    Rosemarie

    Thanks for your response.
    The date and time fields are defined in my selection screen and the default values pre-set in the INITIALIZATION, so the dates and times are already stored as a range.
    The problem is why is the process taking so long. Is the syntax for the INDEX correct?
    PARAMETERS:p_not RADIOBUTTON GROUP pass.
    SELECT-OPTIONS:
      so_date2 FOR bkpf-cpudt,         " Entry Date
      so_cputm FOR sy-uzeit,         " Entry Time
      so_time2 for sy-uzeit.        " Entry Time 2
    INITIALIZATION.
    RANGES: so_time2 FOR sy-uzeit.
      g_date = sy-datum - 1.
      g_year = sy-datum+0(4).
      sp_gjahr = g_year.
      CONCATENATE sp_gjahr '0101' INTO g_from_date.
      g_from_time = '110000'.
      g_24_hour   = '235959'.
      g_time_diff = g_24_hour - g_from_time.
      g_to_time = g_from_time + g_time_diff.
      g_to_time2 = g_from_time - 1.
      MOVE: 'I'      TO so_cpudt-sign,
            'BT'     TO so_cpudt-option,
            g_from_date   TO so_cpudt-low,
            sy-datum TO so_cpudt-high.
      APPEND so_cpudt.
      MOVE: 'I'      TO so_date2-sign,
            'BT'     TO so_date2-option,
            g_date   TO so_date2-low,
            sy-datum TO so_date2-high.
      APPEND so_date2.
      MOVE: 'I'         TO so_cputm-sign,
            'BT'        TO so_cputm-option,
            g_from_time TO so_cputm-low,
            g_to_time   TO so_cputm-high.
      APPEND so_cputm.
      MOVE: 'I'         TO so_time2-sign,
            'BT'        TO so_time2-option,
            '000000'    TO so_time2-low,
             g_to_time2 TO so_time2-high.
      APPEND so_time2.

  • Need help in using FM BAPI_MATERIAL_SAVEDATA

    Gurus,
    I need help in using the FM BAPI_MATERIAL_SAVEDATA. The FM is returning a message that says "The field MARA-MEINS/BAPI_MARA-BASE_UOM(_ISO) is defined as a required field; it does not contain an entry".
    I have supplied the necessary details and yet the FM won't push through.
    If possible, please post sample codes.
    Below is my sample code:
    ===============================================
    REPORT  zmm_materialupload.
    eject
    $$******************************************************************************
    $$    TYPES
    $$******************************************************************************
    eject
    $$******************************************************************************
    $$    INTERNAL TABLES (custom structure
    $$******************************************************************************
    eject
    $$******************************************************************************
    $$    RANGES
    $$******************************************************************************
    eject
    $$******************************************************************************
    $$    FIELD-SYMBOLS
    $$******************************************************************************
    eject
    $$******************************************************************************
    $$    PARAMETERS & SELECT-OPTIONS
    $$******************************************************************************
    SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE text-001.
    *SELECT-OPTIONS: s_matnr FOR mara-matnr.
    SELECT-OPTIONS: s_mtart FOR mara-mtart.
    SELECT-OPTIONS: s_mbrsh FOR mara-mbrsh DEFAULT 'P'.
    SELECT-OPTIONS: s_werks FOR marc-werks DEFAULT '1000' OBLIGATORY.
    SELECT-OPTIONS: s_lgort FOR marc-lgpro DEFAULT 'OPSL' OBLIGATORY.
    PARAMETERS: p_path  LIKE rlgrap-filename DEFAULT 'C:\Documents and Settings\training_11\Desktop\Book4 (2ITEMS).txt' OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK 1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          field_name = 'P_FNAME'
        IMPORTING
          file_name  = p_path.
    eject
    $$******************************************************************************
    $$    START-OF-SELECTION
    $$******************************************************************************
    START-OF-SELECTION.
      PERFORM check_input.
      PERFORM get_file.
      PERFORM filter_input.
    PERFORM populate_tabs.
      PERFORM bapi_mat.
    eject
    $$******************************************************************************
    $$    FORMS
    $$******************************************************************************
    FORM bapi_mat.
      LOOP AT it_tab INTO wa_tab.
        CALL FUNCTION 'BAPI_MATERIAL_GETINTNUMBER'
          EXPORTING
            material_type    = wa_tab-mtart
            industry_sector  = wa_tab-mbrsh
            required_numbers = 1
          TABLES
            material_number  = it_matnr.
      ENDLOOP.
      LOOP AT it_matnr INTO wa_matnr.
        READ TABLE it_tab INTO wa_tab INDEX sy-tabix.
        wa_tab-matnr = wa_matnr-material.
        MODIFY it_tab FROM wa_tab INDEX sy-tabix.
      ENDLOOP.
      PERFORM populate_tabs.
      CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
        EXPORTING
         headdata                   = it_headdata
        clientdata                 = it_clientdata
        clientdatax                = it_clientdatax
        plantdata                  = it_plantdata
        plantdatax                 = it_plantdatax
        FORECASTPARAMETERS         =
        FORECASTPARAMETERSX        =
        PLANNINGDATA               =
        PLANNINGDATAX              =
        STORAGELOCATIONDATA        =
        STORAGELOCATIONDATAX       =
        valuationdata              = it_valuationdata
        valuationdatax             = it_valuationdatax
         WAREHOUSENUMBERDATA        =
        WAREHOUSENUMBERDATAX       =
        SALESDATA                  =
        SALESDATAX                 =
        STORAGETYPEDATA            =
        STORAGETYPEDATAX           =
        flag_online                = ' '
        flag_cad_call              = ' '
        NO_DEQUEUE                 = ' '
        NO_ROLLBACK_WORK           = ' '
       IMPORTING
         return                     = it_return
       TABLES
         materialdescription        = it_materialdescription
         unitsofmeasure             = it_unitsofmeasure
         unitsofmeasurex            = it_unitsofmeasurex
         internationalartnos        = it_internationalartnos
         materiallongtext           = it_materiallongtext
         taxclassifications         = it_taxclassifications
         returnmessages             = it_returnmessages
        PRTDATA                    =
        PRTDATAX                   =
        EXTENSIONIN                =
        EXTENSIONINX               =
      IF sy-subrc = 0.
      ENDIF.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait   = 'X'
        IMPORTING
          return = it_return.
    ENDFORM.                    "bapi_mat
    *&      Form  GET_FILE
          text
    FORM get_file.
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
        EXPORTING
          text = 'Getting data from file...'.
      MOVE: p_path TO gv_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = gv_file
          filetype                = 'ASC'
          has_field_separator     = 'X'
          read_by_line            = 'X'
        TABLES
          data_tab                = it_tab
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    "GET_FILE
    *&      Form  check_input
          text
    FORM check_input.
    Material Type
      IF s_mtart-low IS INITIAL AND s_mtart-high IS INITIAL.
       s_mtart = 'IEQ'.
       s_mtart-low = 'ABF'.        "Waste
       s_mtart-high = 'ZTRD'.      "Stock Items
       APPEND s_mtart.
      ENDIF.
      IF s_mtart-low IS NOT INITIAL AND s_mtart-high IS INITIAL.
        MOVE: s_mtart-low TO s_mtart-high.
      ENDIF.
    Industry Sector
      IF s_mbrsh-low IS INITIAL AND s_mbrsh-high IS INITIAL.
       s_mbrsh = 'IEQ'.
       SELECT mbrsh
       FROM mara
       INTO TABLE it_mbrsh.
       s_mbrsh-low = wa_mbrsh-mbrsh.
       LOOP AT it_mbrsh INTO wa_mbrsh.
         s_mbrsh-high = wa_mbrsh-mbrsh.
       ENDLOOP.
       APPEND s_mbrsh.
      ENDIF.
      IF s_mbrsh-low IS NOT INITIAL AND s_mbrsh-high IS INITIAL.
        MOVE: s_mbrsh-low TO s_mbrsh-high.
      ENDIF.
    Plant
      IF s_werks-low IS INITIAL AND s_werks-high IS INITIAL.
        s_werks = 'IEQ'.
        s_werks-low = '1000'.
        s_werks-high = '2000'.
      ENDIF.
      IF s_werks-low IS NOT INITIAL AND s_werks-high IS INITIAL.
        MOVE: s_werks-low TO s_werks-high.
      ENDIF.
    Storage Location
      IF s_lgort-low IS NOT INITIAL AND s_lgort-high IS INITIAL.
        MOVE: s_lgort-low TO s_lgort-high.
      ENDIF.
    ENDFORM.                    "check_input
    *&      Form  Filter_input
          text
    FORM filter_input.
      SORT it_tab BY matnr mtart mbrsh werks lgort.
      LOOP AT it_tab INTO wa_tab.
       IF wa_tab-mtart NOT IN s_mtart.
         DELETE it_tab WHERE mtart NOT IN s_mtart.
       ENDIF.
       IF wa_tab-mbrsh NOT IN s_mbrsh.
         DELETE it_tab WHERE mbrsh NOT IN s_mbrsh.
       ENDIF.
        IF wa_tab-werks NOT IN s_werks.
          DELETE it_tab WHERE werks NOT IN s_werks.
        ENDIF.
        IF wa_tab-lgort NOT IN s_lgort.
          DELETE it_tab WHERE lgort NOT IN s_lgort.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "Filter_input
    *&      Form  populate_tabs
          text
    FORM    populate_tabs.
      LOOP AT it_tab INTO wa_tab.
        MOVE: wa_tab-matnr TO wa_headdata-material,
              wa_tab-mbrsh TO wa_headdata-ind_sector,
              wa_tab-mtart TO wa_headdata-matl_type,
                       'X' TO wa_headdata-basic_view,
                       'X' TO wa_headdata-sales_view,
                       'X' TO wa_headdata-purchase_view,
                       'X' TO wa_headdata-mrp_view,
                       'X' TO wa_headdata-account_view.
             wa_tab-matkl TO wa_clientdata-matl_group,
             wa_tab-meins TO wa_clientdata-base_uom,
             wa_tab-groes TO wa_clientdata-size_dim,
             wa_tab-gewei TO wa_clientdata-unit_of_wt,
             wa_tab-ntgew TO wa_clientdata-net_weight,
                      'X' TO wa_clientdatax-matl_group,
                      'X' TO wa_clientdatax-base_uom,
                      'X' TO wa_clientdata-size_dim,
                      'X' TO wa_clientdatax-unit_of_wt,
                      'X' TO wa_clientdatax-net_weight,
             wa_tab-werks TO wa_plantdata-plant,
             wa_tab-ekgrp TO wa_plantdata-pur_group,
             wa_tab-prctr TO wa_plantdata-profit_ctr,
             wa_tab-werks TO wa_plantdatax-plant,
                      'X' TO wa_plantdatax-pur_group,
                      'X' TO wa_plantdatax-profit_ctr,
             wa_tab-werks TO wa_valuationdata-val_area,
             wa_tab-bklas TO wa_valuationdata-val_class,
             wa_tab-peinh TO wa_valuationdata-price_unit,
             wa_tab-verpr TO wa_valuationdata-moving_pr,
             wa_tab-stprs TO wa_valuationdata-std_price,
             wa_tab-xlifo TO wa_valuationdata-lifo_fifo,
             wa_tab-werks TO wa_valuationdatax-val_area,
                      'X' TO wa_valuationdatax-val_class,
                      'X' TO wa_valuationdatax-price_unit,
                      'X' TO wa_valuationdatax-moving_pr,
                      'X' TO wa_valuationdatax-std_price,
                      'X' TO wa_valuationdatax-lifo_fifo.
        APPEND wa_headdata TO it_headdata.
       APPEND wa_clientdata TO it_clientdata.
       APPEND wa_plantdata TO it_plantdata.
       APPEND wa_valuationdata TO it_valuationdata.
       MODIFY it_tab FROM wa_tab TRANSPORTING matnr.
      ENDLOOP.
    ENDFORM.                    "populate_tabs
    $$******************************************************************************

    Hai.
    check the below example.
    REPORT z34332_bdc_create_material .
    data: la_headdata type BAPIMATHEAD,
    la_clientdata type BAPI_MARA,
    la_CLIENTDATAX type BAPI_MARAX,
    la_return type BAPIRET2.
    data: i_materialdescription type table of BAPI_MAKT,
    wa_materialdescription like line of i_materialdescription.
    la_headdata-MATERIAL = '000000000000000004'.
    la_headdata-IND_SECTOR = 'M'.
    la_headdata-MATL_TYPE = 'FERT'.
    la_clientdata-BASE_UOM = 'FT3'.
    la_CLIENTDATAX-BASE_UOM = 'X'.
    la_clientdata-MATL_GROUP = '01'.
    la_CLIENTDATAX-MATL_GROUP = 'X'.
    wa_materialdescription = 'TEST'.
    append wa_materialdescription to i_materialdescription.
    clear: wa_materialdescription.
    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
    EXPORTING
    headdata = la_headdata
    CLIENTDATA = la_clientdata
    CLIENTDATAX = la_CLIENTDATAX
    PLANTDATA =
    PLANTDATAX =
    FORECASTPARAMETERS =
    FORECASTPARAMETERSX =
    PLANNINGDATA =
    PLANNINGDATAX =
    STORAGELOCATIONDATA =
    STORAGELOCATIONDATAX =
    VALUATIONDATA =
    VALUATIONDATAX =
    WAREHOUSENUMBERDATA =
    WAREHOUSENUMBERDATAX =
    SALESDATA =
    SALESDATAX =
    STORAGETYPEDATA =
    STORAGETYPEDATAX =
    FLAG_ONLINE = ' '
    FLAG_CAD_CALL = ' '
    IMPORTING
    RETURN = la_return
    TABLES
    MATERIALDESCRIPTION = i_materialdescription
    UNITSOFMEASURE =
    UNITSOFMEASUREX =
    INTERNATIONALARTNOS =
    MATERIALLONGTEXT =
    TAXCLASSIFICATIONS =
    RETURNMESSAGES =
    PRTDATA =
    PRTDATAX =
    EXTENSIONIN =
    EXTENSIONINX =
    write: la_return-TYPE, ',', la_return-MESSAGE.
    clear: la_headdata, la_return, la_clientdata, la_clientdatax.
    regards.
    sowjanya.b.

  • Need help in using ActiveX to retrieve a VARIANT

    Need help in using ActiveX to retrieve a VARIANT.
    Variant is shown as       var{VT_Ul1,1}  in debug
    Using the following
    hr = CA_VariantGetShort (&var, &value);
    I get 0 for my answer instead of 1.
    Solved!
    Go to Solution.

    Answered my own question.
    VT_Ul1 is an unsigned char and not a short.

  • Need help on Using Oracle Acces Manager 11g

    Hi
    I Need help on Using Oracle Acces Manager Admin console to configure for SSO.
    I am new to Identity Management
    I have installed OAM 11g and configured for OAM in new weblogic domain
    Please help to proceed forward.
    Thanks
    Swapnil

    Hi
    Thanks for your reply
    I am able to login to the console
    I am unable to login the the weblogic server from another machine but abl eto do so from the machine where all this is installed
    What i feel is there needs to be some configurataion maybe policy or Agent
    IDMDomainAgent is configured and so is the OAM server configured .
    Please advice some books or link how to do achieve logging into the weblogic em/console from a remote machine
    Thanks in Advance

  • HT1430 guys, I need help, im trying to the the new software IOS 7.0 and it requires 3.7 GB free space. im using the IPhone4 and it had 6.4 GB capacity. i've deleted so much and it still says I only have 1.4 GB, I dont understand where the 5GB are being us

    guys, I need help, im trying to the the new software IOS 7.0 and it requires 3.7 GB free space. im using the IPhone4 and it has 6.4 GB capacity. i've deleted so much and it still says I only have 1.4 GB, I dont understand where the 5GB are being used.
    has any one experienced that? I cancelled my icloud account coz i tot the 5GB where there. im so confused. please help.
    Dee

    First thing to try is to reset your device. Press and hold the Home and Sleep buttons simultaneously ignoring the red slider should one appear until the Apple logo appears. Let go of the buttons and let the device restart. See if that fixes your problem.

Maybe you are looking for

  • DI error when binding user defined table

    Hi, I am using matrix. Im binding a User defined table '@NEW' to a Datasource oForm.DataSources.DBDataSources.Add("@NEW") I also bind the fields to column of the matrix as given below oColumn = oColumns.Item("CodeNo") oColumn.DataBind.SetBound(True,

  • Iphoto 9.6 is not sharing with Facebook,iMessage,iCloud and is not working for print orders

    iphoto 9.6 on yosemite is deleting all of the pics from the former library, iphoto 9.6 can't share with Facebook despite that it is oke with the account. no sharing with iMessage and no sharing with iCloud possible the choices stay grey. also print o

  • Oracle HTTP Server (companion cd)

    Does the 10G companion cd support OC4J? If so could someone provide and example on configuration and deploying war files? I was able to modify the server.xml file to allow the Home OC4J container to be started with opmn, but I was not sure how to con

  • ESA Development

    Is the ESA still being actively developed for? Since the final cutover to Cisco, they have sent EOL notices for a couple of AsyncOS versions but nothing new has come out. The last version is from more than 1 year ago and the Outlook plugin is more th

  • Adobe audition help needed ASAP

    Im am currently recording a audio book at 48000 24bit mono (as requested by individual) and i need to do three things and I'm not sure id=f the order is important and if I have extra steps not needed. Three things needed repair clipping, delete noise