Passing values for a prepared statement encounters problem

I have a query which runs fine when executed from sqlplus
SELECT SYSDATE + (INTERVAL '10' MINUTE) FROM dual;
The same query when run using a java statement also works well.
when I use a Prepared statement like
String sql = SELECT SYSDATE + (INTERVAL ? MINUTE) FROM dual;
PreparedStatement ps = this.getPreparedStatement(sql.toString());
ps.setString(1, "10");
and execute I get the following exception
ORA-00920: invalid relational operator
I tried another way which also gives me a similar exception
String timeout = "10";
SELECT SYSDATE + (INTERVAL" + timeout + "MINUTE) FROM dual;
Can anybody tell me why the problem happens. Is anything wrong in passing values dynamically for an 'interval' function in oracle?

asokan_srini wrote:
Yes friends
Thanks for the reply. It worked out this way as u said
sql.append("SELECT SYSDATE + (INTERVAL ");
sql.append("'" + Integer.parseInt(timeout) + "' MINUTE) FROM dual");
Mr.masijade said.
First of all, there is no reason to do this command, really, but okay.
     There may be scenarios like this to use the command
          select * from mytable where (systimestamp - lastUpdateTimestamp) > Interval '10' Minute
Is there any other better way to get all records updated before a certain timestamp?Use Timestamp to create a timestamp and PreparedStatement's setTimestamp(), maybe?

Similar Messages

  • I need to pass value for Actual GI date field in VL01N t code, I am using BAPI_DELIVERYPROCESSING_EXEC. can any one tell me how can i pass vaule ?

    I need to pass value for Actual GI date field in VL01N t code, I am using BAPI_DELIVERYPROCESSING_EXEC. can any one tell me how can i pass vaule ?

    Hi Abdul,
    Sorry for my unprecise answer, but you talk about a tcode, but you're using a BAPI Call. Maybe you want to call the transaction in batch mode?
    http://help.sap.com/saphelp_erp60_sp/helpdata/de/fa/09715a543b11d1898e0000e8322d00/content.htm
    Regards,
    Franz

  • Prepared statements related problem

    Hi,
    i have this strange problem with prepared statements i think.
    When i execute an insert query without prepared statements i works fine (always), when i use prepared statements it sometimes gives a db error saying i'm trying to insert a null value.
    The problem is that I'm not!!!
    If i were why does it work sometimes?
    It may be a bug but i don't know where to look for it... is it a prepared statements, application server or db2 problem?

    This is the code...
         public void insertArticolo(Articolo item) throws Exception {
              PreparedStatement ps = null;
                   try {          
                        StringBuffer sql = new StringBuffer("insert into RUW.RUWT1_ARTICOLO (");
                        sql.append("C_ENTE, C_CONCESSIONE,N_ANNO_RUOLO,N_PROGR_RUOLO,N_PARTITA,N_PROGR_PARTITA,N_PROGR_TRIBUTO, ");
                        sql.append("C_TRIBUTO, C_TIPO_UFF,C_UFFICIO,");
                        sql.append("C_TIPO_IMP, N_ANNO_IMP, L_CARICO, S_ARTICOLO");
                        sql.append(") values (");
                        sql.append("?" + ", ");
                        sql.append("?" + ", ");
                        sql.append("?" + ", ");
                        sql.append("?" + ", ");
                        sql.append("?" + ", ");
                        sql.append("?" + ", ");
                        sql.append("?" + ", ");
                        sql.append("?" + ", ");
                        sql.append("?" + ", ");
                        sql.append("?" + ", ");
                        sql.append("?" + ", ");
                        sql.append("?" + ", ");
                        sql.append("?" + ", ");
                        sql.append("?");
                        sql.append(")");
                        ps = connectionCreatePreparedStatement(sql.toString());
                        System.out.println(sql.toString());
                        KeyArticolo keyArticolo = item.getKeyArticolo();
                        KeyPartita keyPartita = keyArticolo.getKeyPartita();
                        Ente ente = keyPartita.getKeyRuolo().getEnte();
                        System.out.println("/"+ ente.getCodEnte()+ "/");
                        System.out.println("/"+ keyPartita.getKeyRuolo().getConcessione().getCodConc()+ "/");
                        System.out.println("/"+ keyPartita.getKeyRuolo().getAnnoRuolo()+ "/");
                        System.out.println("/"+ keyPartita.getKeyRuolo().getProgRuolo()+ "/");
                        System.out.println("/"+ keyPartita.getNumPartita()+ "/");
                        System.out.println("/"+ keyPartita.getProgPartita()+ "/");
                        System.out.println("/"+ item.getKeyArticolo().getProgArticolo()+ "/");
                        System.out.println("/"+ item.getCodEntrata()+ "/");
                        System.out.println("/"+ ente.getTipoUfficio()+ "/");
                        System.out.println("/"+ ente.getCodUfficio()+ "/");
                        System.out.println("/"+ item.getTipoImposta()+ "/");
                        System.out.println("/"+ item.getAnnoImposta()+ "/");
                        System.out.println("/"+ item.getCaricoOrigine()+ "/");
                        if (item.getDescArticolo().equals("")) {
                             item.setDescArticolo(" ");
                        System.out.println("/"+ item.getDescArticolo()+ "/");
                        ps.setLong(1,ente.getCodEnte());
                        ps.setLong(2,keyPartita.getKeyRuolo().getConcessione().getCodConc());
                        ps.setLong(3,keyPartita.getKeyRuolo().getAnnoRuolo());
                        ps.setLong(4,keyPartita.getKeyRuolo().getProgRuolo());
                        ps.setLong(5,keyPartita.getNumPartita());
                        ps.setLong(6,keyPartita.getProgPartita());
                        ps.setLong(7,item.getKeyArticolo().getProgArticolo());
                        ps.setString(8,item.getCodEntrata());
                        ps.setString(9,ente.getTipoUfficio());
                        ps.setString(10,ente.getCodUfficio());
                        ps.setString(11,item.getTipoImposta());
                        ps.setLong(12,item.getAnnoImposta());
                        ps.setLong(13,item.getCaricoOrigine());
                        ps.setString(14,item.getDescArticolo());
                        ps.executeUpdate();
                   catch (Exception e) {
                        e.printStackTrace();
                        connectionCloseStatement(ps);
                        throw e;
              }and this is the result of the systemout
    [10/03/06 14.07.07:051 CET] 76357635 SystemOut O insert into RUW.RUWT1_ARTICOLO (C_ENTE, C_CONCESSIONE,N_ANNO_RUOLO,N_PROGR_RUOLO,N_PARTITA,N_PROGR_PARTITA,N_PROGR_TRIBUTO, C_TRIBUTO, C_TIPO_UFF,C_UFFICIO,C_TIPO_IMP, N_ANNO_IMP, L_CARICO, S_ARTICOLO) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
    /13199/
    /66/
    /2002/
    /1564/
    /28330/
    /1/
    /2/
    /0997/
    /120/
    /2002/
    /11900/
    / /

  • Prepared Statement - updating problem

    Hello all together!
    I've a problem and I hope somebody could help me out of misery!
    I have created a table and now I want to update a special cell and my aim is to use prepared statements
    I have generated it in the form mentioned below:
    public void setValueAt(Object newValue, int row, int col) {
    try {
    stmtPrep.setString(1, getColumnName(col)); // this should initalize the column I want to update
    stmtPrep.setObject(2, newValue); //this is the new value which should be set
    rowElements = getElementsOfRow(row);
    stmtPrep.setInt(3, (Integer.parseInt((String)rowElements[0]))); //this is my primary key
    stmtPrep.executeUpdate();
    stmtPrep.clearParameters();
    rs.updateRow();
    } catch (SQLException e) {e.printStackTrace(); }
    My SQL-Statement looks like this:
    private String queryPrep = "update Buch set ? = ? where isbn = ?";
    My problem is that column is not set.... am I not allowed to set column name in the prepared statement??
    how do I manage to show my changes in a master/detail implementation?
    anybode a clue????

    Hi majandrah,
    My SQL-Statement looks like this:
    private String queryPrep = "update Buch set ? = ?
    where isbn = ?";Sorry, not allowed.
    My problem is that column is not set.... am I not
    allowed to set column name in the prepared
    statement??No, you are not. Parameters can only be used for literal values -- not for names of columns , tables, etc.
    how do I manage to show my changes in a master/detail
    implementation?
    anybode a clue????I suggest using the java.text.MessageFormat class, like so:
    MessageFormat queryPrep = new MessageFormat("update BUCH set {0} = ? where ISBN = ?");
    String query = queryPrep.format(String[]{getColumnName(col)});
    // Now use your (posted) code, starting at line...
    stmtPrep.setObject(2, newValue);Good Luck,
    Avi.

  • Dynamically obtain parameter count for a prepared statement

    Hi JDBC Gurus,
    Given a prepared statement, is there a way to figure out the parameter count at runtime? I need this info. to prompt the user for parameter values at the right time from my GUI tool. Any help will be greatly appreciated.

    i don't know of any way to do this put perusing through the API i am wondering what the getMetaData method of PreparedStatement is supposed to do. it says returns the meta data of a ResultSet's columns but i think it could contain info about the parameters for the PreparedStatement. i guess i just don't see why that method is there... anyone?

  • Passing values for field catalog

    Hi experts,
        To pass values to fieldcatalog i need one practical example
         Can anyone help me
    Reg
    R.Vijai

    *& Report  ZSUJ
    REPORT  zsuj.
    TYPE-POOLS: slis.
    Data Declaration Section
    DATA:wa_fieldcat_alv TYPE slis_fieldcat_alv.
    DATA:it_fieldcat_alv TYPE slis_t_fieldcat_alv.
    DATA:BEGIN OF itab OCCURS 0,
           ch    TYPE c,
           vbeln TYPE vbak-vbeln,
           posnr TYPE vbap-posnr,
           netwr TYPE vbap-netwr,
           vkorg TYPE vbak-vkorg,
           matnr TYPE vbap-matnr,
           meins TYPE vbap-meins,
         END OF itab.
    DATA:BEGIN OF it_head OCCURS 0,
           vbeln TYPE vbak-vbeln,
          vkorg TYPE vbak-vkorg,
         END OF it_head.
    DATA:BEGIN OF it_item OCCURS 0,
           vbeln TYPE vbak-vbeln,
           posnr TYPE vbap-posnr,
           netwr TYPE vbap-netwr,
          vkorg TYPE vbak-vkorg,
           matnr TYPE vbap-matnr,
           meins TYPE vbap-meins,
         END OF it_item.
    DATA:wa_keyinfo TYPE slis_keyinfo_alv.
    DATA:it_events TYPE slis_t_event,
         wa_event TYPE slis_alv_event.
    DATA:it_listheader TYPE slis_t_listheader,
         wa_listheader TYPE slis_listheader.
    DATA:wa_sortinfo TYPE slis_sortinfo_alv,
         it_sortinfo TYPE slis_t_sortinfo_alv.
    DATA:wa_layout TYPE slis_layout_alv.
    DATA: v_report TYPE sy-repid.
    Selection Screen
    SELECTION-SCREEN SKIP 3.
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : so_erdat FOR sy-datum.
    PARAMETERS : r_list RADIOBUTTON GROUP rad1,
                 r_grid RADIOBUTTON GROUP rad1,
                 r_hier RADIOBUTTON GROUP rad1,
                 r_blck RADIOBUTTON GROUP rad1.
    SELECTION-SCREEN : END OF BLOCK b1.
    Start-of-selection.
    START-OF-SELECTION.
      IF r_list EQ 'X' OR r_grid EQ 'X'.
        SELECT vbakvbeln vbapposnr vbapnetwr vbakvkorg vbapmatnr vbapmeins
                        INTO CORRESPONDING FIELDS OF TABLE itab
                        FROM vbak INNER JOIN vbap ON vbakvbeln = vbapvbeln
                        WHERE vbak~erdat IN so_erdat.
      ELSEIF r_hier EQ 'X'.
        SELECT vbeln FROM vbak INTO TABLE it_head
                          WHERE erdat IN so_erdat.
        IF it_head[] IS NOT INITIAL.
          SELECT vbeln posnr netwr matnr meins FROM vbap INTO TABLE it_item
                          FOR ALL ENTRIES IN it_head
                          WHERE vbeln = it_head-vbeln.
        ENDIF.
      ELSEIF r_blck EQ 'X'.
      ENDIF.
    Build Field Catalogue
      IF r_list EQ 'X' OR r_grid EQ 'X'.
        PERFORM build_catalog.
      ELSEIF r_hier EQ 'X'.
        PERFORM build_catalog1.
      ELSEIF r_blck EQ 'X'.
        PERFORM build_catalog2.
      ENDIF.
    Events
      PERFORM get_events.
    Build Comment
      PERFORM buil_comment.
    Sort Info on Table
      PERFORM build_sortinfo.
    Layout
      PERFORM build_layout.
    Key info for Heirarchical list.
      PERFORM set_keyinfo.
      v_report = sy-repid.
    End-of-selection.
    END-OF-SELECTION.
      IF r_list EQ 'X'.
        PERFORM list_display.
      ELSEIF r_grid EQ 'X'.
        PERFORM grid_display.
      ELSEIF r_hier EQ 'X'.
        PERFORM hier_display.
      ELSEIF r_blck EQ 'X'.
        PERFORM blockd_list.
      ENDIF.
    *&      Form  build_catalog
      Build Field Catalogue.
    FORM build_catalog .
      DATA : c_pos TYPE i.
    row_pos        like sy-curow, " output in row
            col_pos        like sy-cucol, " position of the column
            fieldname      type slis_fieldname,
            tabname        type slis_tabname,
            currency(5)    type c,
            cfieldname     type slis_fieldname, " field with currency unit
            ctabname       type slis_tabname,   " and table
            ifieldname     type slis_fieldname, " initial column
            quantity(3)    type c,
            qfieldname     type slis_fieldname, " field with quantity unit
            qtabname       type slis_tabname,   " and table
            round          type i,        " round in write statement
            exponent(3)       type c,     " exponent for floats
            key(1)         type c,        " column with key-color
            icon(1)        type c,        " as icon
            symbol(1)      type c,        " as symbol
            checkbox(1)    type c,        " as checkbox
            just(1)        type c,        " (R)ight (L)eft (C)ent.
            lzero(1)       type c,        " leading zero
            no_sign(1)     type c,        " write no-sign
            no_zero(1)     type c,        " write no-zero
            no_convext(1)  type c,
            edit_mask      type slis_edit_mask,                "
            emphasize(4)   type c,        " emphasize
            fix_column(1)   type c,       " Spalte fixieren
            do_sum(1)      type c,        " sum up
            no_out(1)      type c,        " (O)blig.(X)no out
            tech(1)        type c,        " technical field
            outputlen      like dd03p-outputlen,
            offset         type dd03p-outputlen,     " offset
            seltext_l      like dd03p-scrtext_l, " long key word
            seltext_m      like dd03p-scrtext_m, " middle key word
            seltext_s      like dd03p-scrtext_s, " short key word
            ddictxt(1)     type c,        " (S)hort (M)iddle (L)ong
            rollname       like dd03p-rollname,
            datatype       like dd03p-datatype,
            inttype        like dd03p-inttype,
            intlen         like dd03p-intlen,
            lowercase      like dd03p-lowercase,
    *ref_fieldname  like dd03p-fieldname,
            ref_tabname    like dd03p-tabname,
            roundfieldname type slis_fieldname,
            roundtabname   type slis_tabname,
            decimalsfieldname type slis_fieldname,
            decimalstabname   type slis_tabname,
            decimals_out(6)   type c,     " decimals in write statement
            text_fieldname type slis_fieldname,
            reptext_ddic   like dd03p-reptext,   " heading (ddic)
            ddic_outputlen like dd03p-outputlen,
    *key_sel(1)     type c,        " field not obligatory
            no_sum(1)      type c,        " do not sum up
            sp_group(4)    type c,        " group specification
            reprep(1)      type c,        " selection for rep/rep
            input(1)       type c,        " input
            edit(1)        type c,        " internal use only
            hotspot(1)     type c,        " hotspot
      c_pos = 1.
      wa_fieldcat_alv-col_pos = c_pos.
      wa_fieldcat_alv-fieldname = 'CH'.
      wa_fieldcat_alv-tabname   = 'ITAB'.
      wa_fieldcat_alv-outputlen  = 2.
      wa_fieldcat_alv-seltext_l  = ' '.
      wa_fieldcat_alv-no_out     = ' '.
      wa_fieldcat_alv-checkbox = 'X'.
      wa_fieldcat_alv-edit = 'X'.
      wa_fieldcat_alv-input = 'X'.
      APPEND wa_fieldcat_alv TO it_fieldcat_alv.
      CLEAR wa_fieldcat_alv.
      c_pos = c_pos + 1.
      wa_fieldcat_alv-col_pos = c_pos.
      wa_fieldcat_alv-fieldname = 'VBELN'.
      wa_fieldcat_alv-tabname   = 'ITAB'.
      wa_fieldcat_alv-outputlen  = 20.
      wa_fieldcat_alv-seltext_l  = 'Sales Doc'.
      wa_fieldcat_alv-no_out     = ' '.
      wa_fieldcat_alv-hotspot    = 'X'.
      APPEND wa_fieldcat_alv TO it_fieldcat_alv.
      CLEAR wa_fieldcat_alv.
      c_pos = c_pos + 1.
      wa_fieldcat_alv-col_pos = c_pos.
      wa_fieldcat_alv-fieldname = 'POSNR'.
      wa_fieldcat_alv-tabname   = 'ITAB'.
      wa_fieldcat_alv-outputlen  = 6.
      wa_fieldcat_alv-seltext_l  = 'Item'.
      wa_fieldcat_alv-no_out     = ' '.
      APPEND wa_fieldcat_alv TO it_fieldcat_alv.
      CLEAR wa_fieldcat_alv.
      c_pos = c_pos + 1.
      wa_fieldcat_alv-col_pos = c_pos.
      wa_fieldcat_alv-fieldname = 'NETWR'.
      wa_fieldcat_alv-tabname   = 'ITAB'.
      wa_fieldcat_alv-outputlen  = 20.
      wa_fieldcat_alv-seltext_l  = 'Net Price in Doc Curr'.
      wa_fieldcat_alv-no_out     = ' '.
      wa_fieldcat_alv-do_sum = 'X'.
      APPEND wa_fieldcat_alv TO it_fieldcat_alv.
      CLEAR wa_fieldcat_alv.
      c_pos = c_pos + 1.
      wa_fieldcat_alv-col_pos = c_pos.
      wa_fieldcat_alv-fieldname = 'VKORG'.
      wa_fieldcat_alv-tabname   = 'ITAB'.
      wa_fieldcat_alv-outputlen  = 6.
      wa_fieldcat_alv-seltext_l  = 'Sales Org'.
      wa_fieldcat_alv-no_out     = ' '.
      APPEND wa_fieldcat_alv TO it_fieldcat_alv.
      CLEAR wa_fieldcat_alv.
      c_pos = c_pos + 1.
      wa_fieldcat_alv-col_pos = c_pos.
      wa_fieldcat_alv-fieldname = 'MATNR'.
      wa_fieldcat_alv-tabname   = 'ITAB'.
      wa_fieldcat_alv-outputlen  = 20.
      wa_fieldcat_alv-seltext_l  = 'Mat Invoiced'.
      wa_fieldcat_alv-no_out     = ' '.
      APPEND wa_fieldcat_alv TO it_fieldcat_alv.
      CLEAR wa_fieldcat_alv.
      c_pos = c_pos + 1.
      wa_fieldcat_alv-col_pos = c_pos.
      wa_fieldcat_alv-fieldname = 'MEINS'.
      wa_fieldcat_alv-tabname   = 'ITAB'.
      wa_fieldcat_alv-outputlen  = 4.
      wa_fieldcat_alv-seltext_l  = 'UoM'.
      wa_fieldcat_alv-no_out     = ' '.
      APPEND wa_fieldcat_alv TO it_fieldcat_alv.
      CLEAR wa_fieldcat_alv.
    ENDFORM.                    " build_catalog
    *&      Form  build_fieldcat
          Build Field Catalog.
        -->   p_col_pos   : Column Position
        -->   p_fieldname : Field name
        -->   p_tabname   : Table Name
        -->   p_outputlen : Output Length
        -->   p_seltext_l : Field Name
        -->   p_no_out    : No Output flag
    FORM build_fieldcat  USING p_col_pos TYPE sy-curow
                               p_fieldname TYPE slis_fieldname
                               p_tabname   TYPE slis_tabname
                               p_outputlen TYPE dd03p-outputlen
                               p_seltext_l TYPE dd03p-scrtext_l
                               p_no_out    TYPE c
                               p_hotspot     TYPE c.
      wa_fieldcat_alv-col_pos = p_col_pos.
      wa_fieldcat_alv-fieldname = p_fieldname.
      wa_fieldcat_alv-tabname   = p_tabname.
      wa_fieldcat_alv-outputlen  = p_outputlen.
      wa_fieldcat_alv-seltext_l  = p_seltext_l.
      wa_fieldcat_alv-no_out     = p_no_out.
      wa_fieldcat_alv-hotspot    = p_hotspot.
      APPEND wa_fieldcat_alv TO it_fieldcat_alv.
      CLEAR wa_fieldcat_alv.
    ENDFORM.                    " build_fieldcat
    *&      Form  top_of_page
       Top_of_page
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          i_logo                   = 'XANSA_LOGO'
          it_list_commentary       = it_listheader
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               = 'X'
    ENDFORM.                    " build_heading
    *&      Form  get_events
       Events.
    FORM get_events .
      wa_event-name = slis_ev_top_of_page.
      wa_event-form = 'TOP_OF_PAGE'.
      APPEND wa_event TO it_events.
      CLEAR wa_event.
    ENDFORM.                    " get_events
    *&      Form  buil_comment
          text
    FORM buil_comment .
      REFRESH it_listheader.
      CLEAR wa_listheader.
      wa_listheader-typ = 'H'.
      wa_listheader-info = 'DEMO EXAMPLE'.
      APPEND wa_listheader TO it_listheader.
    ENDFORM.                    " buil_comment
    *&      Form  build_layout
          Layout Settings
    FORM build_layout.
      wa_layout-zebra    = 'X'.
    ENDFORM.                    " build_layout
    *&      Form  build_sortinfo
        Sort Information
    FORM build_sortinfo .
    spos like alvdynp-sortpos,
            fieldname type slis_fieldname,
            tabname type slis_fieldname,
           up(1) type c,
           down(1) type c,
           group(2) type c,
           subtot(1) type c,
            up like alvdynp-sortup,
            down like alvdynp-sortdown,
            group like alvdynp-grouplevel,
            subtot like alvdynp-subtotals,
            comp(1) type c,
            expa(1) type c,
            obligatory(1) type c,
      wa_sortinfo-fieldname = 'MEINS'.
      wa_sortinfo-tabname   = 'IT_DATA'.
      wa_sortinfo-subtot   = 'X'.
      APPEND wa_sortinfo TO it_sortinfo.
      CLEAR wa_sortinfo.
    ENDFORM.                    " build_sortinfo
    *&      Form  user_command
        Handle User command
    FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
      SET PARAMETER ID 'AUN' FIELD rs_selfield-value.
      CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    ENDFORM.                    "user_command
    *&      Form  LIST_DISPLAY
         Data in List display
    FORM list_display .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
         i_callback_program             = v_report
      I_CALLBACK_PF_STATUS_SET       = ' '
         i_callback_user_command        = 'USER_COMMAND'
      I_STRUCTURE_NAME               =
         is_layout                      = wa_layout
         it_fieldcat                    = it_fieldcat_alv
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
         it_events                      = it_events
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
      IR_SALV_LIST_ADAPTER           =
      IT_EXCEPT_QINFO                =
      I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        TABLES
          t_outtab                       = itab
    EXCEPTIONS
      PROGRAM_ERROR                  = 1
      OTHERS                         = 2
      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.                    " LIST_DISPLAY
    *&      Form  GRID_DISPLAY
          Data in Grid Display
    FORM grid_display .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
          i_callback_program                = v_report
      I_CALLBACK_PF_STATUS_SET          = ' '
        i_callback_user_command           = 'USER_COMMAND'
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
          is_layout                         = wa_layout
          it_fieldcat                       = it_fieldcat_alv
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
          it_events                         = it_events
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
         TABLES
           t_outtab                          = itab
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
      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.                    " GRID_DISPLAY
    *&      Form  hier_display
        Heirarchical display of Data.
    FORM hier_display .
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
      I_INTERFACE_CHECK              = ' '
         i_callback_program             = v_report
      I_CALLBACK_PF_STATUS_SET       = ' '
         i_callback_user_command        = 'USER_COMMAND'
         is_layout                      = wa_layout
         it_fieldcat                    = it_fieldcat_alv
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
         it_events                      = it_events
      IT_EVENT_EXIT                  =
          i_tabname_header               = 'IT_HEAD'
          i_tabname_item                 = 'IT_ITEM'
      I_STRUCTURE_NAME_HEADER        = 'IT_HEAD'
      I_STRUCTURE_NAME_ITEM          = 'IT_ITEM'
          is_keyinfo                     = wa_keyinfo
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                =
      IR_SALV_HIERSEQ_ADAPTER        =
      IT_EXCEPT_QINFO                =
      I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        TABLES
          t_outtab_header                = it_head
          t_outtab_item                  = it_item
    EXCEPTIONS
      PROGRAM_ERROR                  = 1
      OTHERS                         = 2
      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.                    " hier_display
    *&      Form  set_keyinfo
       Set key information
    FORM set_keyinfo .
      wa_keyinfo-header01 = 'VBELN'.
      wa_keyinfo-item01 = 'VBELN'.
    ENDFORM.                    " set_keyinfo
    *&      Form  BUILD_CATALOG1
          text
    -->  p1        text
    <--  p2        text
    FORM build_catalog1 .
      wa_fieldcat_alv-fieldname = 'VBELN'.
      wa_fieldcat_alv-tabname   = 'IT_HEAD'.
      wa_fieldcat_alv-outputlen  = 20.
      wa_fieldcat_alv-seltext_l  = 'Sales Doc'.
      wa_fieldcat_alv-no_out     = ' '.
      wa_fieldcat_alv-hotspot    = 'X'.
      APPEND wa_fieldcat_alv TO it_fieldcat_alv.
      CLEAR wa_fieldcat_alv.
      wa_fieldcat_alv-fieldname = 'VBELN'.
      wa_fieldcat_alv-tabname   = 'IT_ITEM'.
      wa_fieldcat_alv-outputlen  = 20.
      wa_fieldcat_alv-seltext_l  = 'Sales Doc'.
      wa_fieldcat_alv-no_out     = ' '.
      wa_fieldcat_alv-hotspot    = 'X'.
      APPEND wa_fieldcat_alv TO it_fieldcat_alv.
      CLEAR wa_fieldcat_alv.
      wa_fieldcat_alv-fieldname = 'POSNR'.
      wa_fieldcat_alv-tabname   = 'IT_ITEM'.
      wa_fieldcat_alv-outputlen  = 6.
      wa_fieldcat_alv-seltext_l  = 'Item'.
      wa_fieldcat_alv-no_out     = ' '.
      APPEND wa_fieldcat_alv TO it_fieldcat_alv.
      CLEAR wa_fieldcat_alv.
      wa_fieldcat_alv-fieldname = 'NETWR'.
      wa_fieldcat_alv-tabname   = 'IT_ITEM'.
      wa_fieldcat_alv-outputlen  = 20.
      wa_fieldcat_alv-seltext_l  = 'Net Price in Doc Curr'.
      wa_fieldcat_alv-no_out     = ' '.
      wa_fieldcat_alv-do_sum = 'X'.
      APPEND wa_fieldcat_alv TO it_fieldcat_alv.
      CLEAR wa_fieldcat_alv.
      wa_fieldcat_alv-fieldname = 'MATNR'.
      wa_fieldcat_alv-tabname   = 'IT_ITEM'.
      wa_fieldcat_alv-outputlen  = 20.
      wa_fieldcat_alv-seltext_l  = 'Mat Invoiced'.
      wa_fieldcat_alv-no_out     = ' '.
      APPEND wa_fieldcat_alv TO it_fieldcat_alv.
      CLEAR wa_fieldcat_alv.
      wa_fieldcat_alv-fieldname = 'MEINS'.
      wa_fieldcat_alv-tabname   = 'IT_ITEM'.
      wa_fieldcat_alv-outputlen  = 4.
      wa_fieldcat_alv-seltext_l  = 'UoM'.
      wa_fieldcat_alv-no_out     = ' '.
      APPEND wa_fieldcat_alv TO it_fieldcat_alv.
      CLEAR wa_fieldcat_alv.
    ENDFORM.                    " BUILD_CATALOG1
    *&      Form  BUILD_CATALOG2
          text
    FORM build_catalog2 .
    ENDFORM.                    " BUILD_CATALOG2
    *&      Form  blockd_list
          text
    FORM blockd_list .
    ENDFORM.                    " blockd_list
    I hope this will help u.

  • How to pass values for compound primary keys for updating the record in db.

    i have a entity bean in my ejb with two primary keys to it...eg. roleid,rolename...
    when iam retriving the record i use only one primary key ...so again to modify and update he same record which i retrived is a pbm..
    i cannot set the values for the compoundpk,,,
    but i can do the update for the bean with single primary key..
    i need to know how to pass the values/parameters for the coumpound primary key in my update method...
    thanx in advance...
    Arjun.G

    I istantiated a object for the pk class and assign the values for the primary key fields...
    Arjun.G

  • Logical DB - passing values for parameters

    Hi experts,
    i writing program basing on logical DB. How can i pass default values for parameters, which are defined in a selection screen for this logical DB?
    Thanks
    Juzio

    in my program PNP is used. identify the selection screen fields. and then use it in initialization event,
    report ztest.
    tables: pernr.
    initialization.
    PNPPERNR-LOW = '12455'.
    PNPPERNR-sign = 'I'.
    PNPPERNR-option = 'EQ'.
    append PNPPERNR.
    PNPBEGDA = SY-DATUM.

  • How to pass values for the checkbox

    Hi all,
    We all have seen the functionality of selecting a check box and then click the button and it performs the task(i.e in the hotmail when you select a line/lines by selecting the checkbox for that line and click the delete button those all mails are deleted). we are trying to implement this functionality. I have written the following code for that, but i get the values for the selected box if the box is the first one but if I did not select the first line and select the second line, i get the values for first line as well as for the secondline separated by comma . In other word it concatinates all values. Can I have some pointers?
    <INPUT TYPE="CHECKBOX" NAME="selectedBoxes" UNCHECKED value=<%out.println(" \"" + boxValues + "\" ");
    And also I don't know how to use the oncheck event for the check box...
    Thanks in advance...
    Ameeta

    Thanks Kan,
    But I am littlebit confuse about how does multiple values have been passed. For Example, i have selected 3 check boxes to delete the record. The value for each check box I need is name, event and hours...Each of these record is separated by '*'. I have three sets of values...for three records..
    1) Ameeta*overTime*5.00
    2) Ameeta*holiday*6.00
    3) Ameeta*weekends*8.00
    I have total 5 or 6 records for this person(Ameeta) and I want to delete these listed three...some how if I use the following coding it gives me all records before the last checked box...
    while(rs1.next())
    isEmpty = false;
    eventType = rs1.getString("EVENT_TYPE" ) ; ;
    eventDate = rs1.getString("EVENT_DATE" ) ;
    hours = rs1.getString("HOURS" ) ;
    hash += Double.parseDouble(hours) ;
    boxValues += eventDate + "*" + hours + "*" shortEvents "#";
    userId = rs1.getString("USER_ID" ) ;
    // employeeId = rs1.getString("EMP_ID" ) ;
    confirmFlg = rs1.getString("CONFIRM_FLAG");
    // out.println("\nrecordQuery:\n" + recordQuery ) ;
    %>
    <tr>
    <td colspan=5 width=100>
    <INPUT TYPE="CHECKBOX" NAME="selectedBoxes" value=<%out.println(" \"" + boxValues + "\" "); %>>
    <td width="150"><%=eventDate%></td>
    <td width="150"><%=eventType%></td>
    <td width="150"><%=hours%></td>
    <td width="150"><%=location%></td>
    <td width="150"><%=confirmFlg%></td>
    </tr>
    **************************************In this code basically I am concatinating so it is obvious that I get every thing before the check box..so I did the following change by adding the line below in the code
    while(rs1.next())
    boxValues = "";
    everything else is same....
    but now I get only the last one that is true too because I am asigning it to the null but I don't know how to pass all checked one.........can anybody help me?      
    Thanks in advance...
    Ameeta

  • RRI passing value for hierarchy

    Hello
    I have 2 queries, sender and reciever.
    In my sender query i have fund center in the rows and the hierarchy is active with a vaible entry input(mandatory) variable.
    I have the same settings for the fund center in my reciever query. The variable is also there.
    In RSBBS i have done the settings as type generic for all info objects and selected * as selection type.
    Now I execute my sender query. when i right click on the fund center(not the values appearing) to jump to the second query it then again displays the screen to enter the value for the variable for fund center for second query.
    What settings do i need to do as i do not want to see the variable screen. I want the report to show the values staright away.
    thanks

    Hi Tom,
    I'm just telling some steps for RRI.
    I'm hoping this might give you some insight on your current issue.
    Steps for RRI
    > Generate 2 querys in BEx, using 2 different cubes. 1 is a detailed version, another is a summarized version. Say, one query called TEST1 (Supplier) has a structure as under ( CustID | Material ID ) from the Customer Cube
    > Now, you have to create another query called TEST2 (Receiver),  which is a detailed version. 
    > Like say TEST2 has smtg like [CustID | PurchID | SuppID |Qty | Amt] belonging to Purchase Cube
    Goto RSBBS, Transaction code for creating a RRI
    > Now, include the TEST1 in Supplieru2019s Name
    > Now create a new request for RRI below, and use the query/report  called TEST2 under Reportu2019s Name, which is the Receiver.
    > Thatu2019s all! Itu2019s done. Now go to BEx, and execute the query TEST1, so  what we see is the outcome. We can navigate from cube 1
    (Customers) to cube 2 (Purchase).
    > Right click CustID in TEST1 Query. You can see the Goto TEST2. 
    > Now details of the purchases made by the customer is available in TEST2 Query of the Purchase Cube 
    Thanks,
    Arun Bala G
    Edited by: Arun Bala G on Jan 11, 2010 2:57 PM

  • Correct format for a prepared statement.

    Statement myStmt = myCon.createStatement();
    String sqlQuery = "SELECT * FROM customer WHERE custName='" + name + "'";
    ResultSet mRs = myStmt.executeQuery(sqlQuery);
    String sqlQuery = "SELECT * FROM customer WHERE custName= ? ";
    PreparedStatement myStmt = myCon.prepareStatement(sqlQuery);
    myStmt.setString(1, name);
    ResultSet mRs = myStmt.executeQuery(sqlQuery);Is this correct to change the statement into a prepared statement? Because it doen't work, been looking at the prepared statement API and managed to convert my update statement.

    >
    String sqlQuery = "SELECT * FROM customer WHERE
    custName= ? ";
    PreparedStatement myStmt =
    myCon.prepareStatement(sqlQuery);
    myStmt.setString(1, name);
    ResultSet mRs = myStmt.executeQuery(sqlQuery);Is this correct to change the statement into a
    prepared statement? Because it doen't work, been
    looking at the prepared statement API and managed to
    convert my update statement.Try running the java.sql.PreparedStatement.executeQuery() method that doesn't take any arguments:
    ResultSet mRs = myStmt.executeQuery();MOD
    ResultSet mRs = myStmt.executeQuery(sqlQuery);

  • Passing values for chekbox

    Hi experts,
    I have have hot spot for one field in o/p.
    when i click that it leads to transaction fd32
    in fd32 first screen contains credit control area,credit account and check boxes i had passed parameters for credit control area and credit accout reg checkboxes ihave to enable all the cheboxes and skip to second screen by default hw to enabele all the check boxes
    when i keep fd32 in rec i am not getting second screen
    to use bdc.
    How can i eable all the check boxes?
    Thanks,
    shankar.

    Hello Shankar,
    I think for this requiremnt u have to go for BDC recording and call the Call the Transaction.
    If useful reward.
    Vasanth

  • BULKING and FORALL statement does not pass values to non DML statements.

    Hi
    I've got million rows that i need to manapulate and insert into various procedures depending on the bussiness rule to be applied, but my dilemma is that the BULIKNG with a combination of a FORALL statement its not compatible(only considers straightforward DML calls) or the the FORALL does not like other SQL statements or calls as it prefers only DML's.
    Below is code fragment that is problamatic as the compiler keeps sending me this error: PLS-00201: identifier 'INDX' must be declared
    I want to manupulate data on the implicity cursor and call a procedure to do other stuff which don't use INSERT/DELETE or UPDATE statements.
    Declare
    TYPE tab_person_id is of table of number(15);
    l_person_id tab_person_id;
    BEGIN
    SELECT person_id
    BULK COLLECT INTO l_person_id
    FROM person_details; /*-Million records-*/
    FORALL indx IN l_tdtl.FIRST..l_tdtl.LAST
    pj_pkg.ins_intf
    (p_user => p_user,
    p_typ_cd => '00',
    p_person_id => l_person(indx)
    Commit;
    END;
    How do I pass this value 'l_person(indx)' on the package procudure ?
    Thanks
    Amos

    @prabodh:
    SQL> declare
      2  TYPE tab_person_id is of table of number(15) index by pls_integer;
      3  begin
      4  null;
      5  end;
      6  /
    TYPE tab_person_id is of table of number(15) index by pls_integer;
    ERROR at line 2:
    ORA-06550: line 2, column 23:
    PLS-00103: Encountered the symbol "OF" when expecting one of the following:
    ( array limited new private range record VARRAY_ char_base
    number_base decimal date_base clob_base blob_base bfile_base
    table ref object fixed varying opaque sparse
    The symbol "OF" was ignored.Check What you are posting.
    @ qwestion: What is your Database Version? It is a implementation restriction.

  • Passing values for Table in Adaptive RFC model

    Hi ,
    I am new to WebDynpro ,I have a requirement I need to pass a table for the back end BAPI, the table has two columns say (column1 and column2), before calling the BAPI I need to fill values in the column1 and the when the BAPI returns it should fill the column2 values, Is this possible to do, If so do I need to call invalidate for the values to get reflected after the BAPI returns??
    Can some one send me the sample code as to how to do this??
    Regards,
    emrin.

    Hi,
    After creating model and context mapping to table,
    u write the following code in component controller,
    WD Doinit();
    Bapi_Flight_Getlist_Input bap=new Bapi_Flight_Getlist_Input();
        wdContext.nodeBapi_Flight_Getlist_Input().bind(bap);
        try{
        wdContext.nodeBapi_Flight_Getlist_Input).currentBapi_Flight_Getlist_InputElement().modelObject().execute();
             wdContext.nodeOutput().invalidate();
        catch(Exception e)
             e.getStackTrace();

  • Why does getdate() function return same time value for multiple select statements executed sequentially

    When I run the following code
    set nocount on
    declare @i table(id int identity(1,1) primary key, sDate datetime)
    while((select count(*) from @i)<10000)
    begin
    insert into @i(sDate) select getdate()
    end
    select top 5 sDate, count(id) selectCalls
    from @i
    group by sDate
    order by count(id) desc
    I get the following results. 
    sDate                   selectCalls
    2014-07-30 14:50:27.510 406
    2014-07-30 14:50:27.527 274
    2014-07-30 14:50:27.540 219
    2014-07-30 14:50:27.557 195
    2014-07-30 14:50:27.573 170
    As you can see the select getdate() function returned same time up to the milisecon 406 time for the first date value.  This started happening when we moved our applications to a faster server with four processors.  Is this correct or am I
    going crazy?
    Please let me know
    Bilal

    Observe that adding 2 ms is accurate only with datetime2.  As noted above, datetime does not have ms resolution:
    set nocount on
    declare @d datetime, @i int, @d2 datetime2
    select @d = getdate(), @i = 0, @d2 = sysdatetime()
    while(@i<10)
    begin
    select @d2, @d, current_timestamp, getdate(), sysdatetime()
    select @d = dateadd(ms,2,@d), @i = @i+1, @d2=dateadd(ms,2,@d2)
    end
    2014-08-09 08:36:11.1700395 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1720395 2014-08-09 08:36:11.173 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1740395 2014-08-09 08:36:11.177 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1760395 2014-08-09 08:36:11.180 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1780395 2014-08-09 08:36:11.183 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1800395 2014-08-09 08:36:11.187 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    DATE/TIME functions:
    http://www.sqlusa.com/bestpractices/datetimeconversion/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

Maybe you are looking for