How to execute immediately a query in a form

Hi,
I've got a form which opens another form on which I have created a data block based on a FROM clause query where the where clause has a column joined a GLOBAL variable initialized in the first form.
How can I get the second form execute immediately the FROM clause query when called from the first form?
I've tried to insert in the second form called a trigger WHEN-NEW-FORM-INSTANCE where I have the following code.
BEGIN
GO_BLOCK('my_block');
EXECUTE_QUERY;
END;
I thougth that the EXECUTE_QUERY executed by default the FROM clause query I've inserted in the Query Data Source Name of the Data Block but I don't see anything when the second form is called by the first form, just the message "FRM-50505 unable to perform query" I've tried to perform the query inserted in the Query Data Source Name executing it directly on the DB and it works
Thanks!
Edited by: Mark1970 on 30-mar-2012 3.07

check from menu or display error to see why do you obtain an error

Similar Messages

  • How to execute an SQL query present in a string inside an ABAP program?

    hello,
    How to execute an SQL query present in a string inside an ABAP program

    Raut,
    You can execute Native SQl statements.
    Ex: To use a Native SQL statement, you must precede it with the EXEC SQL statement, and follow it with the ENDEXEC statement as follows:
    EXEC SQL [PERFORMING <form>].
      <Native SQL statement>
    ENDEXEC.
    There is no period after Native SQL statements. Furthermore, using inverted commas (") or an asterisk (*) at the beginning of a line in a native SQL statement does not introduce a comment as it would in normal ABAP syntax. You need to know whether table and field names are case-sensitive in your chosen database.
    In Native SQL statements, the data is transported between the database table and the ABAP program using host variables. These are declared in the ABAP program, and preceded in the Native SQL statement by a colon (:). You can use elementary structures as host variables. Exceptionally, structures in an INTO clause are treated as though all of their fields were listed individually.
    If the selection in a Native SQL SELECT statement is a table, you can pass it to ABAP line by line using the PERFORMING addition. The program calls a subroutine <form> for each line read. You can process the data further within the subroutine.
    As in Open SQL, after the ENDEXEC statement, SY-DBCNT contains the number of lines processed. In nearly all cases, SY-SUBRC contains the value 0 after the ENDEXEC statement. Cursor operations form an exception: After FETCH, SY-SUBRC is 4 if no more records could be read. This also applies when you read a result set using EXEC SQL PERFORMING.
    EXEC SQL PERFORMING loop_output.
      SELECT connid, cityfrom, cityto
      INTO   :wa
      FROM   spfli
      WHERE  carrid = :c1
    ENDEXEC.
    Pls. Mark If useful

  • How to execute this SQL Query in ABAP Program.

    Hi,
    I have a string which is the SQL Query.
    How to execute this sql Query (SQL_STR) in ABAP Program.
    Code:-
    DATA: SQL_STR type string.
    SQL_STR = 'select * from spfli.'.
    Thanks in Advance,
    Vinay

    Hi Vinay
    Here is a sample to dynamically generate a subroutine-pool having your SQL and calling it.
    REPORT dynamic_sql_example .
    DATA: BEGIN OF gt_itab OCCURS 1 ,
    line(80) TYPE c ,
    END OF gt_itab .
    DATA gt_restab TYPE .... .
    DATA gv_name(30) TYPE c .
    DATA gv_err(120) TYPE c .
    START-OF-SELECTION .
    gt_itab-line = 'REPORT generated_sql .' .
    APPEND gt_itab .
    gt_itab-line = 'FORM exec_sql CHANGING et_table . ' .
    APPEND gt_itab .
    gt_itab-line = SQL_STR .
    APPEND gt_itab .
    gt_itab-line = 'ENDFORM.' .
    APPEND gt_itab .
    GENERATE SUBROUTINE POOL gt_itab NAME gv_name MESSAGE gv_err .
    PERFORM exec_sql IN PROGRAM (gv_name) CHANGING gt_restab
    IF FOUND .
    WRITE:/ gv_err .
    LOOP AT gt_result .
    WRITE:/ .... .
    ENDLOOP .
    *--Serdar

  • How to execute a sql query in VO????

    Hi every body.
    Can you show me the way to execute a sql query in VO.
    For example: I have a viewobject1, and I add a new method void execSQL() before the last '}' of the java file of viewobject1 like this:
    public void execSQL() {
    String strSql = "Select sysdate from dual";
    I want to execute strSql query and return a Resultset, how can I perform ???
    Thanks a lot.

    The executeQuery method in ViewObjectImpl does not return a ResultSet.
    ViewObjectImpl voImpl;
    voImpl.setQuery(strSql);
    voImpl.executeQuery();

  • How to execute a BI query/view from a web dynpro application?

    Hi all,
    I am trying to connect to a BI system from a Web Dynpro application. I have to execute a view/query and process the output in my application. Please guide me about how to establish the connection to the BI system from my web dynpro application and then execute the query/view.
    I have tried executing/modelling the BI query/view using Visual Composer but I get an error saying 'QueryView Instantiation failed' when I try to drag the view/query on to the design board.
    Please guide me and help me achieve this.
    Thanks & Regards,
    Kishan

    Hi Kishan,
    Define system for BI in portal and define JCo destination, then from WDJ application use can query BI.
    Create the Technical System and connect with JCO Destinations
    or
    Connecting through the BI Connecters (ex: XMLA Connecter)
    Refer below link:-
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60f35908-ecd4-2910-6c89-e75e1054d9d1?quicklink=index&overridelayout=true
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/60f35908-ecd4-2910-6c89-e75e1054d9d1
    In this document you will get details related to connector and other admin activity.
    Hope this may help you.
    Deepak!!!

  • How to execute a update query when the particular date changes

    hi all,
    i am using date base 11.1.0.6.0,
    i am trying a small update query it should fire when particular date changes in year.
    i think for trigger but i didn't get how to execute it.
    Regards,
    Pavan

    Hi, Pavan,
    Use dbms_scheduler to run a procedure at a given time (or at repeatedly, at given times).
    A trigger is good for re-acting to certain actions in the database, someone INSERTing a row in a given table, for example. Nothing will necessarily be happening when you want your procedure to run, so a trigger is not good in this case.

  • How to execute Oracle Spatial Query

    I'd like to return a set of SDO_GEOMETRY columns of MDSYS.SDO_GEOM.SDO_BUFFER(geom, dim, distance) Spatial Function by MDSYS.SDO_WITHIN_DISTANCE(T.column,aGeom,params) Spatial Operator.
    Does anyone have experience doing this? Is there a better way to return an SDO_GEOMETRY column of MDSYS.SDO_GEOM.SDO_BUFFER(geom, dim, distance) Spatial Function.
    Assume I have a table "my_table" defined as
    STANUMBER VARCHAR2(5)
    STANAME VARCHAR2(18)
    TYPE NUMBER(2)
    LAYER NUMBER
    STAPROVINCE VARCHAR2(6)
    STACOUNTY VARCHAR2(23)
    STALATITUDE NUMBER
    STALONGITUDE NUMBER
    STANUMBER_2 VARCHAR2(5)
    STANAME_2 VARCHAR2(18)
    TYPE_2 NUMBER(2)
    LAYER_2 NUMBER
    STAPROVINCE_2 VARCHAR2(6)
    STACOUNTY_2 VARCHAR2(23)
    GEOLOC MDSYS.SDO_GEOMETRY
    --use the MDSYS.SDO_GEOM.SDO_BUFFER(geom, dim, distance) Spatial Function.
    select MDSYS.SDO_GEOM.SDO_BUFFER(geoloc,
    (select diminfo from user_sdo_geom_metadata m where
    m.table_name='STA_QZT1' and m.column_name='GEOLOC'),10)
    FROM STA_QZT1 a WHERE a.STANUMBER=12345;
    --The right result as follwing:
    MDSYS.SDO_GEOM.SDO_BUFFER(GEOLOC,(SELECTDIMINFOFROMUSER_SDO_GEOM_METADATAMWHEREM
    SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1005, 6, 1, 2, 2, 5, 2, 1,
    7, 2, 2, 11, 2, 1, 13, 2, 2, 17, 2, 1), SDO_ORDINATE_ARRAY(83.171677, 57.508809
    4, 72.4970097, 48.2324159, 81.7734032, 37.5577486, 82.6298628, 37.4977234, 94.05
    59481, 34.5268537, 100.350233, 44.5150204, 100.130743, 47.6855154, 97.2287, 54.0
    629335, 90.853757, 56.9704094, 83.171677, 57.5088094))
    --use the MDSYS.SDO_WITHIN_DISTANCE(T.column,aGeom,params) Spatial Operator.
    select s.stanumber from sta_qzt1 s where
    MDSYS.SDO_WITHIN_DISTANCE(s.geoloc,MDSYS.SDO_GEOMETRY(2003, 8192, NULL,
    MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 1), MDSYS.SDO_ORDINATE_ARRAY(125.923454,
    57.457314, 121.5189, 51.845055, 126.989075, 48.506115, 133.38278, 55.04191,
    125.923454, 57.457314)),'distance = 0' )= 'TRUE';
    --The right result as follwing:
    STANU
    11110
    However, joint to use the above function to execute a buffer query(cannot work) at PL/SQL:
    select s.stanumber from sta_qzt1 s where
    (select mdsys.sdo_geom.sdo_buffer(geoloc,
    (select diminfo from user_sdo_geom_metadata m where m.table_name='STA_QZT1'
    and m.column_name='GEOLOC'),10)
    FROM STA_QZT1 a WHERE a.STANUMBER=12345),
    'distance = 0' )= 'TRUE';
    PL/SQL give out the error information as following:
    ERROR at line 5:
    ORA-00936: lack of expression
    null

    Jack,
    This should work:
    select MDSYS.SDO_GEOM.SDO_BUFFER(geoloc,
    (select diminfo from user_sdo_geom_metadata m where
    m.table_name='STA_QZT1' and m.column_name='GEOLOC'),10)
    from sta_qzt1 s where MDSYS.SDO_WITHIN_DISTANCE(s.geoloc,
    MDSYS.SDO_GEOMETRY(2003, 8192, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 1), MDSYS.SDO_ORDINATE_ARRAY(125.923454,
    57.457314, 121.5189, 51.845055, 126.989075, 48.506115, 133.38278, 55.04191, 125.923454, 57.457314)),
    'distance = 0' )= 'TRUE';

  • How to check the source query of tabular form ....

    Hi All ,
    is there any way to change the source query of tabular form ......
    ya ... i could see it in the source but it is normal sql query ....
    where as to generate the addrow functionality the sql query must be
    Select empno , ADD_ITEM.TEXT(1,empno), ename ,ADD_ITEM.TEXT(2,ename)................
    then where can i find this query .?
    i could see that ADD button is calling ADDROW process and which inreturn calling ADD function ....
    can any one tell me , where to see the code for this ADD function ....
    as i checked it in db ..... it is not there at all.

    You can have a look here for the manual tabular forms:
    http://apex.oracle.com/pls/otn/f?p=31517:170
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • How to execute a SQL  Query in Ms-Access

    Hi,
    I've a query which fetches the data from the tables based on daily transactions.
    I mean, the data gets updated daily basis.
    Now, i want to send the user a Ms-access work sheet with the query written, so that when ever the query is executed, it would fetch the records (with latest updates).
    I found some documents in google to, how to write sql query in ms-access.
    How ever, i'm unable to find the connection setup.
    how do i connect to oracle database using ms-access??
    Can any one please help me regarding this.
    Thanks,
    Santhosh

    You can try this tutorials
    http://www.reo.gov/gis/tools/infobase/LinkAccessToOracle.pdf
    Basically steps include,
    Install and configure Oracle client
    Configure ODBC DSN using correct TNS name configured in first step
    Link the table from Msaccess, make sure you linked the table not import it.

  • How to execute a select query stored in variable

    Hello  helpers ,
    I have some "select queries" stored in the database . Now I can derive this query in some variable . How do I execute this query from the variable .
    example :
    Data Query type char50 .
    QueryVar = 'Select MATNR from MBEW where BWKEY = '0001' . '
    How do I execute this Query stoored in variable QueryVar in ABAP program ?
    Thanks a lot for helping .
    Regards
    Shashank

    Shashank,
    It is also possible to use (column_syntax) and (dbtab_syntax) together with (cond_syntax) when using SELECT statements in ABAP. For more info on (column_syntax) and (dbtab_syntax) just have a quick look at ABAP Keyword documention on SELECT statement (hit F1 on SELECT then scroll down to Select->Select result->Select Columns....)
    So in your case, you need to separate out (split) the value in 'wa_itab-query' into other variables or append into separate internal tables using common keys etc. - then looping at those tables with the common key (READ TABLE WITH KEY....) use the following syntax at the time of triggering the SELECT query:
    SELECT (column_syntax)
           FROM (dbtab_syntax)
           WHERE (cond_syntax).
    Also worth a look at this example below:
    PARAMETERS: p_cityfr TYPE spfli-cityfrom,
                p_cityto TYPE spfli-cityto.
    DATA: BEGIN OF wa,
             fldate TYPE sflight-fldate,
             carrname TYPE scarr-carrname,
             connid   TYPE spfli-connid,
           END OF wa.
    DATA itab LIKE SORTED TABLE OF wa
                   WITH UNIQUE KEY fldate carrname connid.
    DATA: column_syntax TYPE string,
          dbtab_syntax TYPE string.
    column_syntax = `c~carrname p~connid f~fldate`.
    dbtab_syntax = `( ( scarr AS c `
      & ` INNER JOIN spfli AS p ON p~carrid  = c~carrid`
      & ` AND p~cityfrom = p_cityfr`
      & ` AND p~cityto   = p_cityto )`
      & ` INNER JOIN sflight AS f ON f~carrid = p~carrid `
      & ` AND f~connid = p~connid )`.
    SELECT (column_syntax)
           FROM (dbtab_syntax)
           INTO CORRESPONDING FIELDS OF TABLE itab.
    LOOP AT itab INTO wa.
      WRITE: / wa-fldate, wa-carrname, wa-connid.
    ENDLOOP.
    Hope this helps.
    Cheers,
    Sougata.

  • How to execute multiple sql query in one time?

    HI
    I'm trying to convert my sql project In Oracle. In sql i could run multiple select statement/query in once and they return in multiple table result respectively. but in oracle its not executed.
    like:
    sqlQry := "Select * from abc; select * from qwe; select * from kkk; select * from xyz"
    its return 4 table abc, qwe,kkk,xyz to my dataset result
    how it is possible in oracle 10g

    Saten Chamoli wrote:
    I'm trying to convert my sql project In Oracle. In sql i could run multiple select statement/query in once and they return in multiple table result respectively. but in oracle its not executed.
    like:
    sqlQry := "Select * from abc; select * from qwe; select * from kkk; select * from xyz"
    its return 4 table abc, qwe,kkk,xyz to my dataset result That is pretty much a hack - there are no ANSI SQL standards supporting this syntax. It makes no sense either.
    If you want to combine 4 data sets, there are the UNION and UNION ALL set commands.
    If you want to create 4 cursors with a single call, then use the following (anonymous PL/SQL block) call:
    begin
      open :c1 for select * from abc;
      open :c2 for select * from qwe;
      open :c3 for select * from kkk;
      open :c4 for select * from xyz;
    end;Bind 4 client cursor variables to the ref cursors c1 to c4 and make the call to Oracle.
    And I suggest that you read up on Oracle concepts and fundamentals as your approach with you "sql project" shows ignorance in this regard.

  • How to execute SQL SELECT QUERY using VB in FDMEE

    Hi Experts,
    We are struggling with converting some of the FDM VB Scripts to FDMEE. While in FDM it was possible to simply create a RS Object, it doesnt seem to work in FDMEE. Can you please help me with some code samples that will help me execute SELECT Query and taking the output of the Query to Appropriate Variables.
    Also it seems that the Accelerators in erstwhile FDM are no longer available in FDMEE. So we have to re-write our entire code all over again
    Thanks

    There are plenty of code examples in the FDMEE guide and al of the API methods are documented for both Visual Basic and Jython. Personally, I think, if you are having to re-factor your code because you have migrated from FDM to FDMEE I would look at doing it in Jython not the VB API. Jython is the scripting language that will be the mainstream choice going forward and athough the VB API is present to ease the move from FDM to FDMEE I wouldn't be sure how long it will be supported and you therefore may have to perform another code migration not too far down the line. Jython is a very powerful and easy to use if you spend a bit of time familiarizing yourself with the syntax and also opens up the opportunity to leverage the myriad of Java classes out there. Also all of your import scripts have to be in Jython with no VB alternative.
    One other piece of advice is do not try and replicate allyour old code line for line. Look at what you were trying to achieve, assess whether it is still relevant or can it be faciliated by the new extended out of the box constructs and functionality FDMEE offers over classic FDM.

  • How to execute PL/SQL query based on given input parameter

    Hi all,
    I have a pl/sql code which is in Region source. It extracts data from database. I want to execute the code based on input I give. I have to give date as a input parameter.
    e.g.
    If I give date1 as a parameter, then following code should executed
    select col1, col2,..... from Table where date1 between '01-jan-2010' and '31-jan-2010'
    If I give date2 as a parameter, then following code should executed
    select col1, col2,..... from Table where date2 between '01-jan-2010' and '31-jan-2010'
    Your help is very much appreciated.
    Leo

    Check the datatemplate,lexicals and beforeTrigger for this in documentation.
    check this
    Lexical reference issue in EBS

  • How can I write this query In parameterize form so That I can prevent sql Injection

    String strQry = "INSERT INTO tblVoucherType (VhrTypeCode,moduleCode,transCCode,"
    + "voucherType,OrderNumber,active,AccountId) "
    + " values('" + txtVhrCode.Text + "','" + ddlModule.SelectedValue.ToString() + "',"
    + "'" + ddlTrans.SelectedValue.ToString() + "','" + txtVhrName.Text + "','" + btnRadio.SelectedValue + "'"
    + ", '" + status.Checked + "', '" + txtAccount.Text + "')";

    Basically it will look like:
    String strQry = "INSERT INTO tblVoucherType (VhrTypeCode,moduleCode,transCCode, ...)"
    + " values(@VhrCode, @moduleCode, @transCCode, ....)";
    sqlCommand.Parameters.AddWithValue("@VhrCode", txtVhrCode.Text );
    sqlCommand.Parameters.AddWithValue("@moduleCode", ddlModule.SelectedValue.ToString() );
    sqlCommand.Parameters.AddWithValue("@transCCode", ddlTrans.SelectedValue.ToString() );
    .. and so on
    sqlCommand.ExecuteNonQuery();
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Please help on how Bex execute the query designed in query designer.

    Hi All,
    Want to know how bex execute/interpret  the query when the query is execute in analyzer.
    I mean which part of the query is executed first, like  filter,RKF or CKF etc.
    Want to do step by step analysis .Please suggest on this.
    Thanks & Regards
    Sameer Khan

    HI,
    When u execute the query...It will fetch the Global filters data first ....means filters on Default values....then restrictions on Char Restriction pannnel....Then calculate the RKF and CKF,s....Conditions and Exeptions etc.......
    Thanks

Maybe you are looking for

  • Embed Video in Acrobat 8.1. Standard

    I have Adobe Acrobat 8.1. Standard and I want to embed a video. I've seen plenty of tutorial videos on doing it in version 7... but I'm unable to figure out how to do it in 8.1. Adobe Acrobat 8.1 Standard for Windows. In my menu Tools --> Advanced Ed

  • What's with Aperture full screen mode and Books?

    That is, what the heck Apple, why no full screen book layout?  I've used Lightroom from its beginning, and I'm quite happy with if for what it does, which of course doesn't include books.  I first tried iPhoto, which has really nice full screen book

  • Finally made the 800 club!! To app spree or not to app spree...

    So I've been waiting for my NFCU payoff to post after my credit card debt was consolidated onto a low interest personal loan. I've been saving up the CreditCheckTotal $1 trial until I noticed the balance was paid so I didn't have to wait for myFico t

  • Problem Importing Pictures

    Used iPhoto for over 5000 pictures.  Now it's saying there's an unrecognized format or error downloading an image everytime i try to import.  Does anyone have any suggestions?  I've done nothing different and I am using a Iphone 5

  • Thinkvantage update INSTALL seems to be frozen

    Ouch.  New machine. X100e Win7 Pro 32-bit model 3508CTO.  Did the setup, connected to home wireless, did the Windows patching, started Thinkvantage. So far so good. Thinkvantage tells me that I need to do an update for Thinkvantage itself.  OK, no pr