CREATE VIEW in ABAP (Open SQL or Native SQL)

Hi all you experts!
I want to create a VIEW in ABAP. I have created Table Views using ABAP Dictionary (in transaction SE11), I don't have any problem with them.
But, what I need is to create a dynamic view, I mean, a view that can be created/replaced (or modified) at runtime. Is this possible with SAP Open SQL, I don't think so... that is why I tried to created using native SQL but it is not working.
Here is the code:
  EXEC SQL.
    CREATE VIEW [ZMXRFIV_GLPCA]
      AS SELECT
         T1.GL_SIRID,
         T1.POPER,
         T1.RBUKRS,
         T1.RPRCTR,
         T1.RACCT,
         T1.HSL
      FROM
         GLPCA T1
      INNER JOIN
         SKA1 T2
      ON
         T1.RACCT = T2.SAKNR
      WHERE
        T1.RVERS      =  '000'
        AND T1.RYEAR  =  '2008'
        AND T1.KOKRS  =  'PI01'
        AND T2.KTOPL  =  'PI00'
        AND T2.XBILK  <> 'X'.
  ENDEXEC.
I have tried using quotes (") for the view name, parenthesis and even using only the name but this make no difference.
Do any of you experts have any idea?
PS: After creating the view I need to do a SELECT INTO TABLE to that view and finally delete this view and continue working with the data on the internal table.

Hi ,
oh yes it is an object (well, how the database should handle it in any context if it wasn't)
i.e. for ORACLE you would have several thousands of them:
select count(*) from dba_objects where object_type ='VIEW'
If you avoid some kind of foreground processing (i.e. pull the data over the network) and handle the processing inside the database it can improve somehow performance a little (i.e. using the retieved rows of the view to stuff into a database table directly). But his may not always possible...
bye
yk

Similar Messages

  • Creating Views with DI APIs DoQuery-Method in SQL 2005

    Hi @All,
    I've had the following (solved) problem:
    The DB installer of one of our AddOns is also creating a bunsh of views for our UDTs. The installer always executes the following two statements for each view:
    IF OBJECT_ID ('[dbo].[@NSP_EXAMPLE_VIEW]', 'V' ) IS NOT NULL
        DROP VIEW  [dbo].[@NSP_EXAMPLE_VIEW];
    CREATE VIEW [dbo].[@NSP_EXAMPLE_VIEW] AS
    SELECT
         T0.U_Field3,
         T1.U_Field1,
    FROM
         [dbo].[@NSP_A] T0 INNER JOIN
         [dbo].[@NSP_B] T1 ON
         T0.U_Key=T1.U_Key  AND
         T0.U_CostNo=T1.U_CostNo;
    This has worked fine for the first 3 views we need. Then came the 4th view and we get an exception from the doQuery. I had to change the SQL-2005 compatibility level back to 80 to create the 4th view because of an incompatible "FOR BROWSE"-statement.
    When it was created under level 80 I saw the problem: ONLY the 4th view was extended with the "FOR BROWSE"-Statement by DI-API. I didn't see any difference in the 4th VIEW-statement which could be the reason that only this one gets the "FOR BROWSE"
    Anyway! Big thanks to  John Mackin and the users of this thread:
    [Formatted search;
    Adding an SQL-comment "--FOR BROWSE" at the end of the VIEW-creation statement has solved the problem.
    (I hope the DI-API query parser will not change this behaviour in the future :-o )
    Cheers,
    Roland

    Thanks for the replies, but casting gave me the original 'General Error' as well.
    I tried to make a stored procedure out of it. I used this page as a guide:
    http://www.davidhayden.com/blog/dave/archive/2005/12/30/2652.aspx
    The stored procedure looks like this:
    set ANSI_NULLS ON
    set QUOTED_IDENTIFIER ON
    go
    CREATE PROCEDURE [dbo].[TestItems]
        @PageIndex INT,
        @PageSize INT
    AS
    BEGIN
    WITH tmpItems AS (
    SELECT ROW_NUMBER() OVER (ORDER BY ItemCode DESC)AS Row, ItemCode, ItemName
    FROM OITM)
    SELECT ItemCode, ItemName
    FROM tmpItems
    WHERE Row between (@PageIndex - 1) * @PageSize + 1 and @PageIndex*@PageSize
    END
    I am able to call this stored procedure like this:
    exec TestItems 10, 10  -- (returns item 91 to 100).
    This solution meets my immediate requirements, but I don't like the fact that I added the stored procedure to the administration itself. Is it possible to add the stored procedure to a different database and still use the DI server?
    Thanks for your time!
    Vincent

  • Performance: Open SQL vs. Native SQL (Oracle)

    Hi everybody,
    I have an interesting issue here. For a DB selection I use an Open SQL query from a table view into an internal table. It works fine, but the performance is not very well. The SELECT uses LIKE and wildcards (%) to search for customer master data (names and address fields).
    Because of the bad performance I made some tests in transaction DB02 with native SQL, but exactly the same SELECT structure. It looks like this:
      SELECT *
        FROM zzrm_cust_s_hlp
       WHERE client = 100
         AND mc_name1      LIKE '<name>%'
         AND mc_name2      LIKE '<name>%'
         AND valid_from    <= <timestamp>
         AND valid_to      >= <timestamp>
    Ok, now I tried exactly the same SELECT statement with the same data to search for (<name> and <timestamp) with Open SQL and Native SQL. The Difference is quite suprising, the Native SQL query is about 5-10 times faster (arount 1 sec) than the Open SQL query (around 5-10 sec). Even with the LIKE keywords and the wildcards.
    Any ideas what could be the problem with the Open SQL query?
    And: what can I do to achive the same performance as with the Native SQL query?
    Kind regards and thanks in advance for any help,
    Matthias

    Ok, here is the the SQL explaination from the DB02 query:
    SELECT STATEMENT ( Estimated Costs = 194 , Estimated #Rows = 1 )
           9 COUNT STOPKEY
             Filter Predicates
               8 NESTED LOOPS
                 ( Estim. Costs = 193 , Estim. #Rows = 1 )
                 Estim. CPU-Costs = 1,665,938 Estim. IO-Costs = 193
                   5 NESTED LOOPS
                     ( Estim. Costs = 144 , Estim. #Rows = 98 )
                     Estim. CPU-Costs = 1,162,148 Estim. IO-Costs = 144
                       2 TABLE ACCESS BY INDEX ROWID BUT000
                         ( Estim. Costs = 51 , Estim. #Rows = 93 )
                         Estim. CPU-Costs = 468,764 Estim. IO-Costs = 51
                         Filter Predicates
                           1 INDEX SKIP SCAN BUT000~NAM
                             ( Estim. Costs = 6 , Estim. #Rows = 93 )
                             Search Columns: 1
                             Estim. CPU-Costs = 59,542 Estim. IO-Costs = 6
                             Access Predicates Filter Predicates
                       4 TABLE ACCESS BY INDEX ROWID BUT020
                         ( Estim. Costs = 1 , Estim. #Rows = 1 )
                         Estim. CPU-Costs = 7,456 Estim. IO-Costs = 1
                         Filter Predicates
                           3 INDEX RANGE SCAN BUT020~0
                             ( Estim. Costs = 1 , Estim. #Rows = 1 )
                             Search Columns: 2
                             Estim. CPU-Costs = 3,661 Estim. IO-Costs = 1
                             Access Predicates
                   7 TABLE ACCESS BY INDEX ROWID ADRC
                     ( Estim. Costs = 1 , Estim. #Rows = 1 )
                     Estim. CPU-Costs = 5,141 Estim. IO-Costs = 1
                     Filter Predicates
                       6 INDEX UNIQUE SCAN ADRC~0
                         Search Columns: 4
                         Estim. CPU-Costs = 525 Estim. IO-Costs = 0
                         Access Predicates
    And this is the one from the Open SQL query in ABAP:
    SELECT STATEMENT ( Estimated Costs = 15,711 , Estimated #Rows = 29 )
           7 NESTED LOOPS
             ( Estim. Costs = 15,710 , Estim. #Rows = 29 )
             Estim. CPU-Costs = 3,021,708,117 Estim. IO-Costs = 15,482
               4 NESTED LOOPS
                 ( Estim. Costs = 15,411 , Estim. #Rows = 598 )
                 Estim. CPU-Costs = 3,018,711,707 Estim. IO-Costs = 15,183
                   1 TABLE ACCESS FULL BUT020
                     ( Estim. Costs = 9,431 , Estim. #Rows = 11,951 )
                     Estim. CPU-Costs = 2,959,067,612 Estim. IO-Costs = 9,207
                     Filter Predicates
                   3 TABLE ACCESS BY INDEX ROWID ADRC
                     ( Estim. Costs = 1 , Estim. #Rows = 1 )
                     Estim. CPU-Costs = 4,991 Estim. IO-Costs = 1
                     Filter Predicates
                       2 INDEX UNIQUE SCAN ADRC~0
                         Search Columns: 4
                         Estim. CPU-Costs = 525 Estim. IO-Costs = 0
                         Access Predicates
               6 TABLE ACCESS BY INDEX ROWID BUT000
                 ( Estim. Costs = 1 , Estim. #Rows = 1 )
                 Estim. CPU-Costs = 5,011 Estim. IO-Costs = 1
                 Filter Predicates
                   5 INDEX UNIQUE SCAN BUT000~0
                     Search Columns: 2
                     Estim. CPU-Costs = 525 Estim. IO-Costs = 0
                     Access Predicates
    Of course I can see the difference.
    But since the statements are identical, I don't understand why this difference exists
    Thanks for your help!
    Kind regards, Matthias

  • SELECT ROWID using ABAP without Native SQL ?

    Hi All,
    is that possible to query Oracle ROWID from ABAP without using Native SQL ? Please advise.
    Thank You and Best Regards
    FL

    Since this is usually not relevant for application programming and also database specific, I'm fairly sure this information hidden by the DBI and you cannot access it via Open SQL, so native SQL seems to be your only choice.
    Thomas

  • With As subquery block in create view statement or In pl/sql block

    Hi All,
    Can I use the With as subquery block in create view statement??
    or in pl/sql
    -Thanks
    Edited by: xwo0owx on Mar 31, 2011 11:23 AM
    Edited by: xwo0owx on Mar 31, 2011 11:23 AM

    Hi, Mike,
    Dird wrote:
    Then why do I get an error? :s create view mike_test_view as    
    with carriers as(
    SELECT DISTINCT T0.CARRIER_SHORT_NAME carrier_name,
    T1.COMP_ID            carrier_id
    FROM CS2_CARRIER T0, USER_FUNCTION_QUALIFIER T2, CS2_COMP_SERV_PROV_PROF T1
    WHERE (((T1.SERV_PROV_ID = T2.QUALIFIER_VALUE) AND
    ((T2.FUNCTION_CODE = 'DOC_CCM') AND
    (T2.QUALIFIER_CODE = 'CARRIER_LIST'))) AND
    (T1.SERV_PROV_ID = T0.SERV_PROV_ID))
    ORDER BY T0.CARRIER_SHORT_NAME)
    select *
    from carriers c;ORA-00942: table or view does not exist -- carriers
    If I run every line but the create (just execute the query) it runs fine. It also works fine in a PL/SQL procedure.SQL*Plus abhors a vacuum.
    The default in SQL*Plus is that you can not have a completely blank line (that is, a line containing only white space) in the middle of a SQL statement. (Blank lines are okay in PL/SQL, including SQL statements embedded in PL/SQL.)
    If you want some space between the end of the WITH clause and the beginning of the main query (or anywhere else, for that matter), you can put comments there. For example:
          ORDER BY T0.CARRIER_SHORT_NAME)
         select *
           from carriers c;Now that line isn't just whitespace; it has the comment sign, and that's enough for SQL*Plus.
    You can allow completely blank lines with the SQL*Plus command:
    SET   SQLBLANKLINES  ON

  • Open VS. Native

    Hi,
    I need a list of advantages and disadvantages of Native/Open SQL.
    Thanks.

    hi
    Types of SQL’s
    Native SQL
    Open SQL
    Open SQL commands
    SELECT
    INSERT
    UPDATE
    MODIFY
    DELETE
    OPEN CURSOR, FETCH,  CLOSE CURSOR
    Open SQL – Return codes
    Sy-subrc
         - Return value after specific ABAP/4 statements
    Sy-dbcnt
         - DB operations: Number of elements in the edited dataset
    Native SQL
    EXEC SQL [PERFORMING  ENDEXEC.
    regards
    vijay
    reward points if helpful

  • Use of native SQL-select statment

    hi,
    in my z-abap i use a native sql, saying the following:
    EXEC SQL.
      select agzdau into :gf_agzdau from APZD08/AG
                    where AGMAID = '77732' and
                          AGJAHR = 2008 and
                          AGMON  = 09 and
                          AGSPAL = 'ZASALD'
                          %_HINTS AS400 'HARD_CLOSE'
    ENDEXEC.
    before that i make a connection to the server where the table is stored.
    APZD08 is the library and AG is the filename (on a AS/400-machine)
    BUT: the file is not always in APZD08-lib, it depends on the employee.
    how can i make the lib-name and file flexible:
    i have tried it with
    select...............from :gf_file
    and i have put a value for gf_file before.
    but with that i got an SQL-error -104 when executing.
    i can't use a hostvariable there it seems.
    any ideas ?
    reg, Martin

    Hi.
    I would use ADBC instead of EXEC SQL. Then you can concatenate the SQL statement in the way you want it. But in that case you should use host variables in the where condition to get better performance.
    So something like the following (untested, no syntax check yet, pseudo code...):
    DATA: p_con_name   TYPE dbcon-con_name,
          p_con_ref    TYPE REF TO cl_sql_connection,
          p_stmnt      TYPE REF TO cl_sql_statement,
          p_result_set TYPE REF TO cl_sql_result_set,
          query        TYPE string.
    p_con_ref = cl_sql_connection=>get_connection( 'YOURCON' ).
    LOOP AT it_employees
    * CASE your logic
    CONCATENATE 'select agzdau from '  table_name
                'where  AGMAID = ? and AGJAHR = ?'
           INTO statement SEPARATED BY SPACE.
    * ENDCASE
    TRY.
      p_stmnt = p_con_ref->create_statement( ).
      GET REFERENCE OF p_agamaid INTO p_paramref.
      p_stmnt->set_param( p_paramref ).
      GET REFERENCE OF p_agjahr INTO p_paramref.
      p_stmnt->set_param( p_paramref ).
      p_result_set = p_stmnt->execute_query( query ).
      GET REFERENCE OF gf_agzdau INTO p_resultref.
      p_result_set->set_param( p_resultref ).
      p_result_set->next( ).
      CATCH CX_SQL_EXCEPTION.
    * error handling needed!
      ENDTRY.
    ENDLOOP.
    p_con_ref->close( ).
    Oh, I was assuming that there is only one result. If there can be more (and better style anyway) do a while-loop until next( ) is different from zero.
    Best regards,
    Jan

  • Convert OpenSQL to Native SQL

    Does someone know of a function module that will accept a SQL statement in OpenSQL format, and convert it to Native SQL (Oracle) format?
    We cannot turn on a trace in our system.
    Thanks.

    Check these threads ...
    Converting OPEN SQL to NATIVE SQL
    Open SQL to Native SQL conversion
    Regards,
    Santosh
    Message was edited by: Santosh Kumar P

  • Invalid column Index error - While consuming Calculation view via Native SQL

    Hi Experts,
    I am trying to consume a Calculation view (sql script one) , which has input parameters, via Native SQL in a ABAP program .
    Code snippet for the same would be as follows , Upon execution, it throws an error "Invalid Column Index (8) error " . Can anyone help what could be the issue here ?
    Thanks in Advance,
    Suma
    REPORT ZTEST_HANA2.
    *Report to consume Calculation view (script based) from ABAP
    PARAMETERS: ip_docnr type BELNR_D,
                ip_gjahr type GJAHR,
                ip_bukrs type BUKRS,
                ip_blgr type FAGL_RLDNR.
       DATA: LO_SQL_STMT TYPE REF TO CL_SQL_STATEMENT,
              LO_CONN     TYPE REF TO CL_SQL_CONNECTION,
              LO_RESULT   TYPE REF TO CL_SQL_RESULT_SET,
              LV_SQL      TYPE STRING,
              LR_DATA     TYPE REF TO DATA.
        DATA: LX_SQL_EXC           TYPE REF TO CX_SQL_EXCEPTION,
              LT_SEPMAPPS_CLSDINV  TYPE TABLE OF SEPMAPPS_CLSDINV,
              LV_TEXT              TYPE STRING.
        TRY.
    lv_sql = |SELECT * FROM "_SYS_BIC"."DEMO-ABAP/CA_GET_FI_DATA" | &&
                     |WITH PARAMETERS ('placeholder'= ('$$p_DOCNR$$','{ ip_docnr }'),| &&
                      |'placeholder'=('$$p_GJAHR$$','{ ip_gjahr }')| &&
                      |,'placeholder'= ('$$S_BUKRS$$','{ ip_bukrs }')| &&
                      |,'placeholder'= ('$$p_base_ledger$$','{ ip_blgr }') )| .
             LO_CONN = CL_SQL_CONNECTION=>GET_CONNECTION( ).
             "Create an SQL statement to be executed via the connection
              LO_SQL_STMT = LO_CONN->CREATE_STATEMENT( ).
             "Execute the native SQL query
             LO_RESULT = LO_SQL_STMT->EXECUTE_QUERY( LV_SQL ).
             "Read the result into the internal table lt_sepmapps_clsdinv
             GET REFERENCE OF LT_SEPMAPPS_CLSDINV INTO LR_DATA.
             LO_RESULT->SET_PARAM_TABLE( LR_DATA ).
             LO_RESULT->NEXT_PACKAGE( ).
             LO_RESULT->CLOSE( ).
             LO_CONN->CLOSE( ).
        CATCH CX_SQL_EXCEPTION INTO LX_SQL_EXC.
             LV_TEXT = LX_SQL_EXC->GET_TEXT( ).
             MESSAGE LV_TEXT TYPE 'E'.
        ENDTRY.

    Hi Suma,
    Post the SQL you success run directly on Studio together with error message (even if is the Invalid column index error).
    Check there if the parameters case is working properly... Is it really this confusing options:
    p_GJAHR
    S_BUKRS
    p_base_ledger
    Why not all lower or all upper? Anyhow you must test and find which option works according your modeling
    Regards, Fernando Da Rós

  • Need Help : Native SQL ABAP dump "DBIF_DSQL2_SQL_ERROR" on procedure "APS_ORDER_CHANGE".

    Hi All,
    We are facing an issue and want to check if you have seen it in past and can help us in resolving it. Any input will be greatly appreciated.
    Issue:
    While executing product heuristic on few product/location combinations in product view, we encounter native SQL ABAP dump “DBIF_DSQL2_SQL_ERROR” on
    procedure “APS_ORDER_CHANGE”.
    We were debugging for one particular product/location combination, this combination has 2 planned orders, and the Internal order number of these planned orders are
    given as input to this procedure “APS_ORDER_CHANGE”. These 2 internal order numbers are the only inputs given to this procedure.
    When we try to delete those planned orders we again encounter same ABAP dump. There are many product/location having the same issue.
    We also checked variable duration maintained on the PPM of this product/location, and was fine.
    For more deatils : Please check the attached document of downloaded ABAP Dump.
    Thanks and Regards,
    Pritesh Jain

    Hi Pritesh.
    What liveCache version/build/patch are you on? What is the database error text shown in this dump?
    If it is exactly the one below
    Database error text........: "POS(1) Work rolled back: tExcept 30730 in
    APS_ORDER_CHAN"
    You can try running report SLCA_EMERGENCY_SWITCH, then turning off the option "Verify that all input table records have been read" and saving the results. If that solves the issue, you can use this as a workaround until the next time you upgrade your liveCache build.
    To get a clear root cause, you may need to create an OSS incident under BC-DB-LCA component providing a reproducible example.
    Regards,
    Tiago

  • ABAP Open SQl or EXEC SQL

    1.     I want to do following:
    Select material_no  from mara where material_type in (u2018XXXu2019, u2018YYYu2019, u2018ZZZu2019)
    Where material_no, mateial_type will re replaced by the actual field names.
    Is it possible to do that in OPEN SQL or do I have to use native SQL u2013 EXCE SQL in my case Oracle SQL.
    2.     I have to refer to material type in (u2018XXXu2019, u2018YYYu2019, u2018ZZZu2019) in several sql querie in ABAP, so is it possible to move this code an ABAP function e.g., allowed_mattypes which will true or false
    , so I say
    Where allowed_mattypes(materail_type) = true.
    Once again can it be done in OPEN SQL or in EXEV SQL.
    3. Is there any disadvantage to using EXEC SQL; I know my database Oracle is not going to change and I am qite familiar with EZEC SQL.
    THnaks a lot

    Hi ,
    oh yes it is an object (well, how the database should handle it in any context if it wasn't)
    i.e. for ORACLE you would have several thousands of them:
    select count(*) from dba_objects where object_type ='VIEW'
    If you avoid some kind of foreground processing (i.e. pull the data over the network) and handle the processing inside the database it can improve somehow performance a little (i.e. using the retieved rows of the view to stuff into a database table directly). But his may not always possible...
    bye
    yk

  • Open & Native SQL

    Hai all !
      Can anybody give me the exact Difference between Open SQL & Native SQL.
    Thanks in Advance,
    Swapna.

    Hii!
       Open SQL is basically SAP specific Structured Query language.Open SQL consists of a set of ABAP statements that perform operations on the central database in the R/3 System. The results of the operations and any error messages are independent of the database system in use. Open SQL thus provides a uniform syntax and semantics for all of the database systems supported by SAP. ABAP programs that only use Open SQL statements will work in any R/3 System, regardless of the database system in use. Open SQL statements can only work with database tables that have been created in the ABAP Dictionary.
    Native SQL is basically a database specific language.
    Open SQL allows you to access database tables declared in the ABAP Dictionary regardless of the database platform that you R/3 System is using. Native SQL allows you to use database-specific SQL statements in an ABAP program. This means that you can use database tables that are not administered by the ABAP Dictionary, and therefore integrate data that is not part of the R/3 System.
    As a rule, an ABAP program containing database-specific SQL statements will not run under different database systems. If your program will be used on more than one database platform, only use Open SQL statements.
    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.

  • Open an native sql

    1) what is open sql an wat is native sql an wt is the diference between these to.....

    Hi Satish,
    The difference is:
    OPEN SQL - Open SQL consists of a set of ABAP statements that perform operations on the central database in the R/3 System. The results of the operations and any error messages are independent of the database system in use. Open SQL thus provides a uniform syntax and semantics for all of the database systems supported by SAP. ABAP programs that only use Open SQL statements will work in any R/3 System, regardless of the database system in use. Open SQL statements can only work with database tables that have been created in the ABAP Dictionary.
    NATIVE SQL - Open SQL allows you to access database tables declared in the ABAP Dictionary regardless of the database platform that you R/3 System is using. Native SQL allows you to use database-specific SQL statements in an ABAP program. This means that you can use database tables that are not administered by the ABAP Dictionary, and therefore integrate data that is not part of the R/3 System.
    Plz Reward if useful,
    Mahi.

  • Passing data from abap-program to mssql database table thro native sql

    Hi,
    To pass the data from abap-program to mssql server,i have created database connection through dbco t.code.
    now i am trying to get connection thro native sql but am not able to get it .Am working in ECC 5.0.
    Could anyone help me on this.Did i miss anything?
    i have tried Native-sql like this.
    DATA: CON_NAME LIKE DBCON-CON_NAME VALUE 'BIW'.
    EXEC SQL.
      CONNECT TO :con_name AS 'C1'
    ENDEXEC.
    Thanks in advance.

    Hi,
    Trying to do the same here, only using Oracle DB.
    DATA:     dbc TYPE DBCON_NAME VALUE 'BI'
    TRY.
      EXEC SQL.
        CONNECT TO :dbc
      ENDEXEC.
      IF sy-subrc NE 0.
        RAISE EXCEPTION TYPE cx_sy_native_sql_error.
      ENDIF.
    CATCH cx_sy_native_sql_error INTO oref_native_sql_error.
      sql_emsg = oref_native_sql_error->get_text( ).
      MESSAGE sql_emsg TYPE 'I'.
    ENDTRY.
    I keep getting the message 'Native SQL exception has occured' (because of the RAISE statement, I wonder how we can get a meaningfull error description).
    Of course this can be a result of a number of network issues, so I'm trying to resolve this together with my BC admin.
    I suggest the same to you..
    In the meantime, if anyone can help out, it will be appreciated.
    Regards,
    SD

  • Cross Join in ABAP Open SQL

    Hi guys!
    I need to implement a CROSS JOIN (cartesian product) based on two tables. To my understanding there is no construct to implement a cross join in OPEN SQL. So the question is first is this correct? And secondly in which way would you then implement a cross join of two tables with the constructs at hand in ABAP?
    I have come up with the following solution of cross joining two tables, but would like to know if there is a better (not so ugly way).
    Example:
    SELECT * FROM tab1 AS t1 JOIN tab2 AS t2 ON t1mandt = t2mandt INTO CORRESPONDING FIELDS OF itab.
    Note that this only works if the tables tab1 and tab2 is client dependent.
    Regards,
    Christian

    Christian,
      There's no cross join construct in abap. Join statement results in a cartesin product rarely because of completely obsolete statistics missing selection or join conditions.
    Try the following join to get result similar to cartesian product
    select tab1location tab2matnr into itab
      from tab1 join tab2 on tab1location ne tab2matnr.
    if you really want to implement cross join, use native sql, try the following code,
    beware of cartesian products, Basis folks doesn't like em....
    data: begin of itab occurs 0,
      loc like tab1-sloc
      matnr like tab2-matnr,
    end of itab.
    exec sql performing append_itab.
      select a.loc, b.matnr
        into :itab
        from tab1 a
        cross join tab2 b
    endexec.
    form append_itab.
      append itab.
    endform.               
    Regards
    Sridhar.

Maybe you are looking for

  • Execute a script on a remote machine - possible?

    I am sorry if this sounds silly - what I would like to know is if its possible for a java program executing on one machine to execute a shell script that resides on another machine. That script in turn invokes a java program which does some other stu

  • Iphone not compatible with Samsung LCD TV

    Hi, I have an Iphone4 and a Samsung 6000 series LCD TV. I've tried tv out through an Iphone dock to the tvs AV input .... ie the three phonos into a single jack av lead. The iphone says playing to tv but the tv says "no device found". I rang Samsung

  • UME not working

    Hi guys, I have scrapped the old installation and started from scratch. did a complete OS format. Now when i configure UME , the first test works , but the authentication test for users does not work. Just for clarity , when i put j2ee-j2e and do the

  • Lightroom 6 high CPU usage

    Anyone else seeing very high (300-400%) CPU usage in Lightroom 6 - when it's apparently not doing anything?

  • Hi, Plz help me on my iphone 4S

    Hi, I bought an locked AT&T Iphone 4S from US and currently i am in INDIA. I got it unlocked through gevy sim and it worked fine. After few days i got "usb cable connecting to Itunes" symbol. I showed the same to some iphone engineer nearby my locati