About inner join problem

Hi Friends,
I have given the innerjoin between BKPF & BSEG tables,
And i am fetching BUKRS, BELNR,GJAHR, BLART,BLDAT,BUDAT  fields from BKPF and BUZEi from BSEG table, but it is showing error as u cannot create inner join for BSEG table,
Kindly help me on this .
Thanks & Regards,

Hi,
I using the code like this,
It displaying the output without displaying any data in BUZEI field,  Even i have given the field name in the field catalog.
Could u plz help me on this,
Waiting for ur reply.
TYPES  : BEGIN OF T_BKPF,
        BUKRS TYPE BKPF-BUKRS,
        BELNR TYPE BKPF-BELNR,
        GJAHR TYPE BKPF-GJAHR,
        BLART TYPE BKPF-BLART,
        BLDAT TYPE BKPF-BLDAT,
        BUDAT TYPE BKPF-BUDAT,
        BUZEI TYPE BSEG-BUZEI,
        END OF T_BKPF.
types: begin of t_bseg,
       BUKRS TYPE BSEG-BUKRS,
       BELNR TYPE BSEG-BELNR,
       GJAHR TYPE BSEG-GJAHR,
       end of t_bseg.
DATA : it_bkpf TYPE STANDARD TABLE OF t_bkpf with header line,
      wa_bkpf TYPE t_bkpf,
       it_bseg type standard table of t_bseg.
      wa_bseg type t_bseg.
select bukrs belnr gjahr from bseg into table it_bseg.
perform data_retrieval_bseg.
perform data_retrieval.
form data_retrieval_bseg .
  select buzei from bseg into table it_bkpf.
endform.                    " data_retrieval_bseg
*&      Form  DATA_RETRIEVAL
form data_retrieval.
IF it_bseg[] IS NOT INITIAL.
   select bukrs belnr gjahr blart bldat budat from bkpf into
     table it_bkpf for all entries in it_bseg
     where bukrs = it_bseg-bukrs
     and belnr = it_bseg-belnr
     and gjahr = it_bseg-gjahr.
     endif.
endform.

Similar Messages

  • About inner join in abap

    hi
        i am new to sap , i dont no about inner join in abap coding
    plz send me some notes or coding.
                            thank u.
                                                              your regrads
                                                                    divya.

    hi
    use this links
    INNER JOIN  and OUTER JOINhttp://help.sap.com/erp2005_ehp_03/helpdata/EN/cf/21ec77446011d189700000e8322d00/frameset.htm
    JOINED TABLES
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/0f/49bd6a5d5049edba7b3afe6c7956e3/frameset.htm
    u will find all thins related to joins with example and how to use it
    Cheers
    Snehi
    Edited by: snehi chouhan on Jul 25, 2008 9:45 AM

  • Report - INNER JOIN Problem

    Hi,
    In my report List of Block Customer's, INNER JOIN is not working..
    Code:----
    SELECT DISTINCT M1KUNNR M1KTOKD M1NAME1 M1CASSD M1AUFSD M1LIFSD M1~FAKSD INTO CORRESPONDING FIELDS OF TABLE ITAB
                        FROM KNA1 AS M1 INNER JOIN KNVV AS M2 ON M1KUNNR = M2KUNNR
                                               WHERE M1~KTOKD IN ('0001' , 'KTOKD')
                                                AND M1~CASSD EQ 'X'
                                                 OR M1~AUFSD NE ''
                                                 OR M1~LIFSD NE ''
                                                 OR M1~FAKSD NE ''
                                                 OR (M2~AUFSD NE ''
                                                 OR M2~LIFSD NE ''
                                                 OR M2~FAKSD NE ''
                                                 OR M2~CASSD EQ 'X'.
    Here, condition on 0001 is not matching..
    Plz tell me, what is the problem in it..
    Thanks
    Edited by: Prince Kumar on Oct 20, 2008 9:37 AM

    hi,
    please use " FOR ALL ENTRIES " as it is better performance wise also rather then inner joins
    and for syntax refer this code:
    Exporting all flight data for a specified departure city. The relevant airlines and flight numbers are first put in an internal table entry_tab, which is evaluated in the WHERE condition of the subsquent SELECT statement.
    PARAMETERS p_city TYPE spfli-cityfrom.
    TYPES: BEGIN OF entry_tab_type,
             carrid TYPE spfli-carrid,
             connid TYPE spfli-connid,
           END OF entry_tab_type.
    DATA: entry_tab   TYPE TABLE OF entry_tab_type,
          sflight_tab TYPE SORTED TABLE OF sflight
                           WITH UNIQUE KEY carrid connid fldate.
    SELECT carrid connid
           FROM spfli
           INTO CORRESPONDING FIELDS OF TABLE entry_tab
           WHERE cityfrom = p_city.
    SELECT carrid connid fldate
           FROM sflight
           INTO CORRESPONDING FIELDS OF TABLE sflight_tab
           FOR ALL ENTRIES IN entry_tab
           WHERE carrid = entry_tab-carrid AND
                 connid = entry_tab-connid.
    thanks and regards
    RAHUL

  • Inner Join problem

    Hello guys,
    I have a problem in my select query. My query is turning empty. there isnt problem before without adding vbak table.Where is  problem?
    select  matnr fkdat matkl lfimg v~auart from lips
                inner join likp
                on LIKP~VBELN = LIPS~VBELN
                join vbak as v
                on likp~vbeln = v~vbeln
           into CORRESPONDING FIELDS OF TABLE itab_material
           where  LIPS~LFIMG ne 0 and likp~VKORG eq 'O001' and likp~WADAT_IST eq itab_plaka-fkdat.
    Thank you.,
    Regards,
    B.Y.

    Hi Bekir,
    In LIPS table, the 'VBELN' it`s not sales order number, it`s delivery order number,
    you need find out the sales order number from 'VBFA' by delivery order number.
    so your query should like this:
       select  lips~matnr fkdat matkl lfimg v~auart from lips
                inner join likp
                on LIKP~VBELN = LIPS~VBELN
                inner join vbfa
                on vbfa~vbeln = LIPS~VBELN
                inner join vbak as v
                on v~vbeln = vbfa~vbelv      
           into CORRESPONDING FIELDS OF TABLE itab_material
           where  LIPS~LFIMG ne 0 and likp~VKORG eq 'O001' and likp~WADAT_IST eq itab_plaka-fkdat.
    regards,
    Archer

  • Help with Inner join problem

    The following query works fine as long as there is a value in the subID field, which is at the end of the inner join statement. If the subID is blank then no data is output, even though it is there. Try as I may, I can not get the right solution in the where statement to get the data to show without the subID. What am I missing?
    <cfquery name="getInfo" datasource="#application.database#">
    select page_id, pageName, pages.content, pages.cat_id, pages.seo_title,pages.seo_desc,pages.seo_words,pages.h1_title,pages.pic,pages.brochure,pa ges.video,catagories.catagory,subcat.subID,subcat.sub_category
    from (pages INNER JOIN catagories ON pages.cat_id = catagories.cat_id) INNER JOIN subcat ON pages.subID = subcat.subID
    where pages.page_id = #page_id#
    </cfquery>

    Rick,
    Looks like you need a LEFT OUTER join to the "subcat" table, so that all records for "pages" and "catagories" are returned even if no matching "subcat" records exist.  INNER joins will only return selected records when the tables on both sides of the join statement have matching values, while a LEFT OUTER (sometimes also known simply as a LEFT join) join will return *all* selected records from the table(s) on the left side of the join statement regardless of whether there are matching records from the table on the right side of the join statement.  When there are no matching records from the table on the right side of the join statement, any columns in your SELECT clause that are from the table on the right side of the join statement will contain NULLs.
    HTH,
    -Carl V.

  • INNER JOIN PROBLEM IN Microsoft SQL Server 2008 R2 Report Builder 3.0

    SELECT
    ,maximo_tbl_matrectrans.ponum
    ,maximo_tbl_po.description AS [maximo_tbl_po description]
    ,maximo_tbl_matrectrans.polinenum
    ,maximo_tbl_matrectrans.itemnum
    ,maximo_tbl_item.description AS [maximo_tbl_item description]
    FROM
    maximo_tbl_matrectran
    INNER JOIN maximo_tbl_po
    ON maximo_tbl_matrectrans.ponum = maximo_tbl_po.ponum
    INNER JOIN maximo_tbl_item
    ON maximo_tbl_matrectrans.itemnum = maximo_tbl_item.itemnum
    can you advise below picture in itemnum in show one value more time
    ponum polinenum maximo_tbl_a_po_description itemnum maximo_tbl_a_item_description
    D33-1021425 5 ASL REORDER HAZMAT 91G8110000071 DRUM, PLASTIC
    D33-1021425 5 ASL REORDER HAZMAT 91G8110000071 DRUM, PLASTIC
    D33-1020817 2 ASL REPLENISHMENT, D 91G6685000371 THERMOSTAT
    D33-1020817 2 ASL REPLENISHMENT, D 91G6685000371 THERMOSTAT
    D33-1020817 2 ASL REPLENISHMENT, D 91G6685000371 THERMOSTAT
    D33-1021365 2 ASL - D33DFAC STOCK 91G3920000081 CART, BIG WHEEL
    D33-1021365 2 ASL - D33DFAC STOCK 91G3920000081 CART, BIG WHEEL
    D33-1021425 5 ASL REORDER HAZMAT 91G8110000071 DRUM, PLASTIC
    D33-1020817 1 ASL REPLENISHMENT, D 91G5330002011 SEAL, THERMOSTAT
    D33-1022346 2 ASL STOCK REORDER E 92G6145000998 CABLE, POWER,
    D33-1022346 2 ASL STOCK REORDER E 92G6145000998 CABLE, POWER,
    D33-1020817 1 ASL REPLENISHMENT, D 91G5330002011 SEAL, THERMOSTAT
    D33-1020817 1 ASL REPLENISHMENT, D 91G5330002011 SEAL, THERMOSTAT
    D33-1022346 2 ASL STOCK REORDER E 92G6145000998 CABLE, POWER,
    but original we need..
    ponum polinenum maximo_tbl_a_po_description itemnum maximo_tbl_a_item_description
    D33-1021425 5 ASL REORDER HAZMAT 91G8110000071 DRUM, PLASTIC
    D33-1020817 2 ASL REPLENISHMENT, D 91G6685000371 THERMOSTAT
    D33-1021365 2 ASL - D33DFAC STOCK 91G3920000081 CART, BIG WHEEL
    D33-1020817 1 ASL REPLENISHMENT, D 91G5330002011 SEAL, THERMOSTAT
    D33-1022346 2 ASL STOCK REORDER E 92G6145000998 CABLE, POWER,

    Try below:
    SELECT DISTINCT
    maximo_tbl_matrectrans.ponum
    ,maximo_tbl_po.description AS [maximo_tbl_po description]
    ,maximo_tbl_matrectrans.polinenum
    ,maximo_tbl_matrectrans.itemnum
    ,maximo_tbl_item.description AS [maximo_tbl_item description]
    FROM
    maximo_tbl_matrectran
    INNER JOIN maximo_tbl_po
    ON maximo_tbl_matrectrans.ponum = maximo_tbl_po.ponum
    INNER JOIN maximo_tbl_item
    ON maximo_tbl_matrectrans.itemnum = maximo_tbl_item.itemnum
    -Vaibhav Chaudhari

  • Perform an Inner Join in Oracle 8

    We have to make our application (that runs with Oracle 9i) backward compatible with Oracle 8.
    There are certain SQL statements that were introduced in Oracle 9i, such as Inner Join (Oracle 9i now allows more of the ANSI standard SQL that MS SQL also uses)
    Does anyone know of the other differences I should look out for, or any documentation that lists the new 9i differences that we may already be using.
    I have trawled through lots of OTN documentation, but not been able to find anything that highlights even the Inner Join problem.
    If there are any documents that also suggest a solution, that would be even better.
    Thanks in advance for any help/suggestion
    Mark

    You have a parameter called "COMPATIBLE", and if you set to, for example 8.1.7 in your 9i database, then your application should be compatible with 8.1.7. It is that easy!
    Of course, by doing so, you renounce to use the 9i features.
    There is a book called "New Features" in the book list in your oracle documentation.
    Regards
    Laurent Schneider

  • Problem in Accession inner join with [Microsoft][SQLServer 2000 Driver

    Hi
    Can you tell me what can be cause my sql statement is correct gives result but
    if i used below statement in my JSP ,cause error
    1)
    ps1=connection.prepareStatement("select RQM_IN_RQSTN_ID_PK,RQD_IN_ITM_ID_FKPK,RQD_VC_ITM_DSCRPTN,RQD_IN_STTS_ID_FK,C.SMT_VC_STTS_NM,a.RQM_DT_PRPSD_DLVRY_DT"+
    "from PAS_RQM_RQSTN_MSTR a "+
    "inner join PAS_RQD_RQSTN_DTLS b on a.RQM_IN_RQSTN_ID_PK = b.RQD_IN_RQSTN_ID_FKPK and RQD_IN_STTS_ID_FK = 4"+
    "INNER JOIN PAS_SMT_STTS_MSTR C ON C.SMT_IN_STTS_ID_PK=B.RQD_IN_STTS_ID_FK" +
    "where a.RQM_VC_DTRTMNT_INVLV='Technology' ");
    2) Error Generate
    java.sql.SQLException
    [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Line 1: Incorrect syntax near 'a'.
    What can be the cause
    Thanks

    ps1=connection.prepareStatement("select
    RQM_IN_RQSTN_ID_PK,RQD_IN_ITM_ID_FKPK,RQD_VC_ITM_DSCRP
    TN,RQD_IN_STTS_ID_FK,C.SMT_VC_STTS_NM,a.RQM_DT_PRPSD_D
    LVRY_DT"+
    "from PAS_RQM_RQSTN_MSTR a "+
    "inner join PAS_RQD_RQSTN_DTLS b on
    a.RQM_IN_RQSTN_ID_PK = b.RQD_IN_RQSTN_ID_FKPK and
    RQD_IN_STTS_ID_FK = 4"+
    "INNER JOIN PAS_SMT_STTS_MSTR C ON
    C.SMT_IN_STTS_ID_PK=B.RQD_IN_STTS_ID_FK" +
    "where a.RQM_VC_DTRTMNT_INVLV='Technology' ");This is a problem due to not providing spaces where they are needed. See the places where I have highlighted.
    A better way is to generate the String first [use StringBuffer as a good practice for appending instead of String "+"] and print it out to check if it is correct.
    ***Annie***

  • Problem with a query inner-join

    Hello;
    I'm trying to innerjoin these 2 tables in my query for a page that will allow you to add / edit records. Right now, it's telling me I have a data mismatch. I don't see where I went wrong. Can someone help me out?
    This is my code:
    <cfparam name="url.CategoryID" type="integer" default="0">
    <cfparam name="subID" type="integer" default="#url.CategoryID#">
    <cfparam name="subName" default="">
    <cfparam name="CategoryID" default="">
    <cfparam name="Name" default="">
    <cfif url.CategoryID GT 0>
    <cfquery name="categRec" dataSource="#APPLICATION.dataSource#">
    SELECT merchSubCat.subName, merchSubCat.subID, Categories.CategoryID, Categories.Name
    FROM merchSubCat
    INNER JOIN Categories
        ON merchSubCat.CategoryID = Categories.CategoryID
    WHERE merchSubCat.subID = <cfqueryparam value="#url.CategoryID#" cfsqltype="cf_sql_integer">
    </cfquery>
    <!--- if the record was found, store the values --->
    <cfif categRec.RecordCount EQ 1>
    <cfset CategoryID = categRec.subID>
    <cfset subName = categRec.subName>
    <cfset CategoryID = categRec.CategoryID>
    <cfset Name = categRec.Name>
    </cfif>
    </cfif>
    this is my error:
    Error Executing Database Query.
    [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Type mismatch in expression.
    The error occurred in C:\Websites\187914kg3\admin\cms\merchant\merchSub-edit.cfm: line 16
    14 : INNER JOIN Categories
    15 :     ON merchSubCat.CategoryID = Categories.CategoryID
    16 : WHERE merchSubCat.subID = <cfqueryparam value="#url.CategoryID#" cfsqltype="cf_sql_integer">
    17 : </cfquery>
    18 :
    I don't see what I did wrong, can another pair of eyes see where I missed something?
    Thank you

    I changed it to number, and it works now.
    I have one other problem.. I'm trying to use a drop down menu in this form to edit a record. I want the drop down to show what is being used in the database when you go to edit a record. It runs on one query, to populate the select, but it pulls info from another and this isn't working. Actually, it's the innerjoin I just made.. can you help me?
    <!--- query that runs the select --->
    <cfquery name="catList" datasource="#APPLICATION.dataSource#">
    SELECT DISTINCT merchCategory.CategoryID, merchCategory.CatName AS cat_name
    FROM merchCategory
    ORDER BY CatName
    </cfquery>
    <cfselect enabled="No" name="CategoryID" size="1" class="smallText" multiple="no" query="catList" value="CategoryID" display="cat_name" queryPosition="below" selected="#categRec.Name#">
                      <option value="">--Select a Category--</option>
                  </cfselect>
    As you see, in the selected part of the tag, I'm trying to pull info from the other query we just fixed. I know this is wrong, how do I do this?

  • Performance problem with inner join

    Hi
    With this Query
    SELECT *
    FROM TABLE1
    INNER JOIN TABLE2
    ON TABLE1.Col1 = TABLE2.Col2 AND TABLE1.Col2 = TABLE2.Col2
    WHERE TABLE1.Col3 = 'AB' AND
    TABLE2.Col4 = 'ZZ';
    TABLE1 have 6,000,000 of records
    TABLE2 have 9,000,000 of records
    when I run this query the result take 30 secs
    If I change the Optimizer_mode for 'RULE'
    the result take 4 secs
    All statistics is ok
    Primary Key exists for TABLE1 and TABLE2 base-on Col1 and Col2
    And index on Table1.Col3,Table1.Col4
    somebody can help me ?

    Analyze tables compute statistics
    and analyze index compute statistics
    I join explain plan
    STATEMENT_ID TIMESTAMP REMARKS OPERATION OPTIONS OBJECT_NODE OBJECT_OWNER OBJECT_NAME OBJECT_INSTANCE OBJECT_TYPE OPTIMIZER SEARCH_COLUMNS ID PARENT_ID POSITION COST CARDINALITY BYTES
    OTHER_TAG PARTITION_START PARTITION_STOP PARTITION_ID OTHER DISTRIBUTION CPU_COST IO_COST TEMP_SPACE
    WithRule1 2004-01-19 16:28:43 SELECT STATEMENT RULE 0
    WithRule1 2004-01-19 16:28:43 SORT AGGREGATE 1 0 1
    WithRule1 2004-01-19 16:28:43 NESTED LOOPS 2 1 1
    WithRule1 2004-01-19 16:28:43 TABLE ACCESS BY INDEX ROWID MICRODEV T088_INSC 1 ANALYZED 3 2 1
    WithRule1 2004-01-19 16:28:43 INDEX RANGE SCAN MICRODEV IX4_T088_INSC NON-UNIQUE ANALYZED 2 4 3 1
    WithRule1 2004-01-19 16:28:43 TABLE ACCESS BY INDEX ROWID MICRODEV T090_CPOS_DEM 2 ANALYZED 5 2 2
    WithRule1 2004-01-19 16:28:43 INDEX UNIQUE SCAN MICRODEV PK_T090_CPOS_DEM UNIQUE ANALYZED 2 6 5 1
    7 rows selected.
    STATEMENT_ID TIMESTAMP REMARKS OPERATION OPTIONS OBJECT_NODE OBJECT_OWNER OBJECT_NAME OBJECT_INSTANCE OBJECT_TYPE OPTIMIZER SEARCH_COLUMNS ID PARENT_ID POSITION COST CARDINALITY BYTES
    OTHER_TAG PARTITION_START PARTITION_STOP PARTITION_ID OTHER DISTRIBUTION CPU_COST IO_COST TEMP_SPACE
    WithChoose1 2004-01-19 16:29:37 SELECT STATEMENT CHOOSE 0 21680 21680 1 40
    21680
    WithChoose1 2004-01-19 16:29:37 SORT AGGREGATE 1 0 1 1 40
    WithChoose1 2004-01-19 16:29:37 HASH JOIN 2 1 1 21680 59050 2362000
    21680 3875000
    WithChoose1 2004-01-19 16:29:37 TABLE ACCESS BY INDEX ROWID MICRODEV T088_INSC 1 ANALYZED 3 2 1 7031 96727 2708356
    7031
    WithChoose1 2004-01-19 16:29:37 INDEX RANGE SCAN MICRODEV IX4_T088_INSC NON-UNIQUE ANALYZED 2 4 3 1 232 96727
    232
    WithChoose1 2004-01-19 16:29:37 TABLE ACCESS FULL MICRODEV T090_CPOS_DEM 2 ANALYZED 5 2 2 11224 5662693 67952316
    11224
    6 rows selected.

  • Problem in  Inner join

    Hi All,
    selection screen
    select-options:  vkorg for vbak-vkorg obligatory.  " Sales Org
    select-options:  erdat for vbak-erdat. " Creation Date
    select-options:  auart for vbak-auart. " Order type
    select-options:  knkli for vbak-knkli. " Customer Account
    Start-of-selection.
      select a~bstnk
             a~vbeln
             b~kdmat
             b~matnr
             b~werks
             b~posnr
             b~kwmeng
             into corresponding fields of table itab
             from  vbap as b inner join vbak as a on avbeln = bvbeln
           where vkorg in vkorg
           and auart in auart and knkli in knkli and erdat in erdat.
    Error (During Ctrl F2)
    The column name "ERDAT" has two meanings. ABAP/4 Open SQL Statement.
    Kindly let me know what is this error msg.
    Thanks
    S

    Hi,
    There are conflicting names for erdat.
    You have given the select-option name aslo as erdat.
    change it to some other name say s_erdat.
    select-options: s_erdat for vbak-erdat. " Creation Date
    change the same in select also
    Start-of-selection.
    select a~bstnk
    a~vbeln
    b~kdmat
    b~matnr
    b~werks
    b~posnr
    b~kwmeng
    into corresponding fields of table itab
    from vbap as b inner join vbak as a on avbeln = bvbeln
    where vkorg in vkorg
    and auart in auart and knkli in knkli and erdat in s_erdat.
    Hope it helps.
    Reward if useful
    Regards,
    Saumya

  • About a question using Update ... inner join ?

    select *
    FROM a
    INNER JOIN b ON a.ProductID=b.ProductID
    WHERE a.HeadID='000246'
    this statement is ok ;
    But the following statement does not work ! Why ?
    UPDATE a SET
    a.Quantity=a.PurchaseQuantity/b.ConversionGene
    FROM a
    INNER JOIN b ON a.ProductID=b.ProductID
    WHERE a.HeadID='000246'

    "Because Oracle syntactically does not support that type of construct..." Is a correct statement, but not because "It expects only one table in UPDATE statement". The synatax for an updateable join in Oracle requires a "proper" in-line view to be updated.
    As long as the table joined (in my example t1) has a declared unique constraint on the columns used to join by (in my example id), you can do it like:
    SQL> SELECT * FROM t;
            ID DESCR
             1 One
             2 Two
             3 Three
    SQL> SELECT * FROM t1;
            ID DESCR2
             1 Un
             2 Deux
    SQL> UPDATE (SELECT t.descr, t1.descr2
      2          FROM t
      3             JOIN t1 ON t.id = t1.id)
      4  SET descr = descr2;
    2 rows updated.
    SQL> SELECT * FROM t;
            ID DESCR
             1 Un
             2 Deux
             3 ThreeTTFN
    John

  • Problem when doing inner join for three tables....

    DATA: V3 TYPE VBAP-MAKTL.
    SELECT single vbap~matkl into V3
           from VBAP
           inner join VBFA
           inner join LIPS
              on LIPSPOSNR = VBFAPOSNN
              and vbapvbeln = vbfavbelv
               and vbapposnr = vbfaposnv
                 where LIPSVBELN = VBFAVBELN = '0080000834'
                 and vbfa~vbtyp_n = 'J'
                 and LIPS~J_3ASIZE = '0884'.
    Error: Wrong expression "INNER" in from clause...

    Hello Tushar,
      Why you are using the 3 table inner join. If the volume of data is big then this statement will give to time out. Use "for all entries" statement to select the data from the table.
    Like
    select field1 field2 from LIPS into i_lips
        where LIPS~J_3ASIZE = '0884'.
    select f3 f4 from vbfa into i_vbfa for all entries in i_lips where field1 = i_lips-field1 and so on
    and 
    use same to select data from VBAP.
    Hope this will help

  • Inner Join performance problem.

    Hi,
    I wrote a select statement using inner join on table VBRK , VBUK, VBAP and VBRP.
    This select statement is working fine from last two years, but suddenly to execute this select statement
    taking lot of time and program going to dump.
    But same select statement is working in development and quality systems and not working in production system. Based on given selection we check the tables in production we found only 10 records, but to fetch these 10 records also it will taking lot of time and going to dump.
    can anyone please advise on the same.
    Thanks in advance.

    Hi,
    Please:
    1. Create DB view instead of inner join
    2. Use the primary key of the base table (the first or main table in your view) in your where clause
    3. If not possible, then you need to create secondary index in your base table that match with your where clause fields.
    4. Try to use positive relationship operator, like EQ instead NE, GT, etc.
    Hope it helps.
    Lim...

  • Select query join problem

    hey guys,
    i've used a select query to get details from KNA1, KNVV, ADRC, KNVP, pa0002. tables by joining. but i'm getting only about 170 records. there are more than 3000 records in the database. for each tables. here is my select query
    SELECT KNA1KUNNR KNA1NAME1 KNA1NAME2 ADRCSTR_SUPPL1 ADRCSTR_SUPPL2 ADRCSTR_SUPPL3 ADRCCITY1 KNVVVWERK KNVPPERNR PA0002VORNA PA0002NACHN KNVVVKBUR KNVVKDGRP KNA1STCD1 KNA1~STCEG
        INTO CORRESPONDING FIELDS OF TABLE IT_FINAL FROM KNA1
        INNER JOIN KNVV ON KNA1KUNNR = KNVVKUNNR
        INNER JOIN ADRC ON KNA1ADRNR = ADRCADDRNUMBER
        INNER JOIN KNVP ON KNA1KUNNR = KNVPKUNNR
        INNER JOIN PA0002 ON KNVPPERNR = PA0002PERNR
        WHERE KNA1KUNNR IN S_KUNNR AND KNVVVWERK in P_VWERK AND PA0002PERNR IN S_PERNR AND KNVVVKBUR IN S_VKBUR AND KNVV~KDGRP IN S_KDGRP.
    can anyone tell me the problem in the above query.
    thanks.

    Hi
    you are using tables KNA1, KNVV, ADRC, KNVP, pa0002.
    Create internal table for each table mentioned above with all the primary keys and find the links between them
    then select data in one table and select data from another table into your internal table for all the entries exists in firs internal table.
    go for below links.
    http://www.sapdev.co.uk/abap/commands/select_forallentries.htm
    http://wiki.sdn.sap.com/wiki/display/ABAP/FORALLENTRIES-Home+page
    http://help.sap.com/abapdocu_70/en/ABENWHERE_LOGEXP_ITAB.htm
    Thanks
    lalit

Maybe you are looking for

  • How do I write an excel file and check what the next empty column would be to put the data in?

    I have somehow managed to write the portion of labview that prompts the user for a name. It checks a file to see if they are a new user or not and then assigns a number if they are. The program then acquires data that is to be put into a spreadsheet.

  • Not able to login from front-end

    Hi, My application was running on https previously.Now I have configured it to run on http. I executed AutoConfig after making changes to the context file. It comlpeted successfully. But when I tried to open the login page it showed 500 internal serv

  • Computer to TV hookup

    I bought a (Belkin) Mini DisplayPort to (Belkin) HDMI Adapter the other day to connect my computer to my tv. For some reason even with the VG cord to do the audio part, it still wont come out from the TV speakers. How do I fix this?

  • Read Routing and work center details from transfer order

    Hello I am using transaction LT31 to print a form for the transfer order. The customer wants me to print a field that is in the work center details of the routing for this material and plant. I can see this data with transaction CA02 where i enter ma

  • Problems with NSU

    When I start the application it sticks at Starting Application. I have cleaned my registry, downloaded and installed new copies of NSU and PC Suite and I have restarted my computer numerous times. I have disabled all Firewalls and AV programs and att