Reply to vj (qery on the inner joins v/s performane test)

this is ravi shiva's friend.
hi vj,
         u r working for intelli group....and i had met u twice. by the way give u r contact number i want to speak to u personally.
          here is the code... 
REPORT  rv_sid_purchase_order_status NO STANDARD PAGE HEADING MESSAGE-ID zrv_message_cl LINE-COUNT 65 LINE-SIZE 110 .
This include contains declarations
INCLUDE zrv_sid_purchase_order_t.
This include contains code for the performs
INCLUDE zrv_sid_purchase_order_f.
                      Initialization
INITIALIZATION.
This perform will initialize the values.
  PERFORM f_initilaize.
This perform will initialize the field catalog.
  PERFORM f_e01_fieldcat_init USING gt_fieldcat[].
                     Start-Of-Selection
START-OF-SELECTION.
This perform will read the values from the database.
  PERFORM f_selection.
This perform will call the function module to display the values on the list.
  PERFORM f_display.
          End-Of-Selection
END-OF-SELECTION.
*&  Include           ZRV_SID_PURCHASE_ORDER_T                         *
           T a b l e s   D e c l a r a t i o n s                     *
TABLES: ekko,ekpo,ekbe,ekkn,mkpf.
           Type Pools  D e c l a r a t i o n s                       *
TYPE-POOLS: slis.
      Selection Screen Declaration
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-100.
SELECT-OPTIONS: ebeln FOR ekko-ebeln,
                aedat FOR ekko-aedat.
SELECTION-SCREEN END OF BLOCK b1.
           V a r i  a b l e s                                        *
DATA : gt_fieldcat         TYPE  slis_t_fieldcat_alv,
       g_repid             LIKE  sy-repid,
       gs_keyinfo          TYPE  slis_keyinfo_alv,
       g_tabname_header    TYPE  slis_tabname,
       g_tabname_item      TYPE  slis_tabname,
       ls_layout           TYPE  slis_layout_alv,
       gt_list_top_of_page TYPE  slis_t_listheader.
           I n t e r n a l  T a b l e s                               *
DATA: BEGIN OF itab OCCURS 0,
       ebeln LIKE ekko-ebeln,
       lifnr LIKE ekko-lifnr,
       aedat LIKE ekko-aedat,
       submi LIKE ekko-submi,
       name1 LIKE lfa1-name1,
       netwr LIKE erev-netwr,
      END OF itab.
DATA: BEGIN OF jtab OCCURS 0,
       ebeln      LIKE  ekpo-ebeln,
       ebelp      LIKE  ekpo-ebelp,
       aedat      LIKE  ekpo-aedat,
       txz01      LIKE  ekpo-txz01,
       menge1     LIKE  ekpo-menge,
       menge2     LIKE  ekbe-menge,
       effwr1     LIKE  ekpo-effwr,
       mwskz1     LIKE  ekpo-mwskz,
       ps_psp_pnr LIKE  ekkn-ps_psp_pnr,
       bewtp1     LIKE  ekbe-bewtp,
       belnr1     LIKE  ekbe-belnr,
       dmbtt      LIKE  ekbe-dmbtr,
       mblnr1     LIKE  mkpf-mblnr,
       bldat1     LIKE  mkpf-bldat,
       xblnr1     LIKE  mkpf-xblnr,
       frbnr      LIKE  mkpf-frbnr,
      END OF jtab.
*&  Include           ZRV_SID_PURCHASE_ORDER_F                         *
FORM f_initilaize .
  g_repid = sy-repid.
  g_tabname_header            = 'itab'.
  g_tabname_item              = 'jtab'.
  CLEAR gs_keyinfo.
  gs_keyinfo-header01         = 'EBELN'.
  gs_keyinfo-item01           = 'EBELN'.
  gs_keyinfo-header02         = space.
  gs_keyinfo-item02           = 'EBELP'.
  ls_layout-group_change_edit = 'X'.
  ls_layout-colwidth_optimize = 'X'.
  ls_layout-zebra             = 'X'.
  ls_layout-detail_popup      = 'X'.
  ls_layout-get_selinfos      = 'X'.
  ls_layout-window_titlebar   = 'PURCHASE ORDER STATUS'.
  ls_layout-no_keyfix         = 'X'.
ENDFORM.                    " f_INITILAIZE
*&      Form  f_e01_fieldcat_init
      text
     -->E01_LT_FIELtext
FORM f_e01_fieldcat_init  USING  e01_lt_fieldcat TYPE slis_t_fieldcat_alv.
  DATA: ls_fieldcat TYPE slis_fieldcat_alv.
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = 'SUBMI'.
  ls_fieldcat-tabname       = g_tabname_header.
  ls_fieldcat-ref_fieldname = 'SUBMI'.
  ls_fieldcat-ref_tabname   = 'EKKO'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-no_sum        = 'X'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = 'EBELN'.
  ls_fieldcat-tabname       = g_tabname_header.
  ls_fieldcat-ref_fieldname = 'EBELN'.
  ls_fieldcat-ref_tabname   = 'EKPO'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-no_sum        = 'X'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = 'LIFNR'.
  ls_fieldcat-tabname       = g_tabname_header.
  ls_fieldcat-ref_fieldname = 'LIFNR'.
  ls_fieldcat-ref_tabname   = 'EKKO'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-no_sum        = 'X'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = 'NAME1'.
  ls_fieldcat-tabname       = g_tabname_header.
  ls_fieldcat-ref_fieldname = 'NAME1'.
  ls_fieldcat-ref_tabname   = 'LFA1'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-no_sum        = 'X'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = 'NETWR'.
  ls_fieldcat-tabname       = g_tabname_header.
  ls_fieldcat-ref_fieldname = 'NETWR'.
  ls_fieldcat-ref_tabname   = 'EREV'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-do_sum        = 'X'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = 'EBELP'.
  ls_fieldcat-tabname       = g_tabname_item.
  ls_fieldcat-ref_fieldname = 'EBELP'.
  ls_fieldcat-ref_tabname   = 'EKPO'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-no_sum        = 'X'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = 'TXZ01'.
  ls_fieldcat-tabname       = g_tabname_item.
  ls_fieldcat-ref_fieldname = 'TXZ01'.
  ls_fieldcat-ref_tabname   = 'EKPO'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-no_sum        = 'X'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
  CLEAR ls_fieldcat.
  ls_fieldcat-just = 'L'.
  ls_fieldcat-fieldname     = 'MWSKZ1'.
  ls_fieldcat-seltext_l     = 'Tax code'.
  ls_fieldcat-tabname       = g_tabname_item.
  ls_fieldcat-ref_fieldname = 'MWSKZ1'.
  ls_fieldcat-ref_tabname   = 'EKPO'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-no_sum        = 'X'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
  CLEAR ls_fieldcat.
  ls_fieldcat-just          = 'L'.
  ls_fieldcat-fieldname     = 'PS_PSP_PNR'.
  ls_fieldcat-tabname       = g_tabname_item.
  ls_fieldcat-ref_fieldname = 'PS_PSP_PNR'.
  ls_fieldcat-ref_tabname   = 'EKKN'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-no_sum        = 'X'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = 'MENGE1'.
  ls_fieldcat-tabname       = g_tabname_item.
  ls_fieldcat-seltext_l     = 'Po quantity'.
  ls_fieldcat-ref_fieldname = 'MENGE1'.
  ls_fieldcat-ref_tabname   = 'EKPO'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-no_sum        = 'MENGE1'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = 'EFFWR1'.
  ls_fieldcat-tabname       = g_tabname_item.
  ls_fieldcat-seltext_l     = 'Po value'.
  ls_fieldcat-ref_fieldname = 'EFFWR1'.
  ls_fieldcat-ref_tabname   = 'EKPO'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-no_sum        = 'X'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = 'BEWTP1'.
  ls_fieldcat-tabname       = g_tabname_item.
  ls_fieldcat-seltext_l     = 'Cat'.
  ls_fieldcat-ref_fieldname = 'BEWTP1'.
  ls_fieldcat-ref_tabname   = 'EKBE'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-no_sum        = 'X'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = 'BELNR1'.
  ls_fieldcat-tabname       = g_tabname_item.
  ls_fieldcat-seltext_l     = 'GR/IR MDoc'.
  ls_fieldcat-ref_fieldname = 'BELNR1'.
  ls_fieldcat-ref_tabname   = 'EKBE'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-no_sum        = 'X'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = 'MENGE2'.
  ls_fieldcat-seltext_l     = 'GR/IR quantity'.
  ls_fieldcat-tabname       = g_tabname_item.
  ls_fieldcat-ref_fieldname = 'MENGE2'.
  ls_fieldcat-ref_tabname   = 'EKBE'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-no_sum        = 'X'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
  CLEAR ls_fieldcat.
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = 'MBLNR1'.
  ls_fieldcat-tabname       = g_tabname_item.
  ls_fieldcat-seltext_l     = 'GR No'.
  ls_fieldcat-ref_fieldname = 'MBLNR1'.
  ls_fieldcat-ref_tabname   = 'MKPF'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-no_sum        = 'X'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = 'BLDAT1'.
  ls_fieldcat-tabname       = g_tabname_item.
  ls_fieldcat-seltext_l     = 'GR Date'.
  ls_fieldcat-ref_fieldname = 'BLDAT1'.
  ls_fieldcat-ref_tabname   = 'MKPF'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-no_sum        = 'X'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = 'FRBNR'.
  ls_fieldcat-tabname       = g_tabname_item.
  ls_fieldcat-ref_fieldname = 'FRBNR'.
  ls_fieldcat-ref_tabname   = 'MKPF'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-no_sum        = 'X'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = 'XBLNR1'.
  ls_fieldcat-tabname       = g_tabname_item.
  ls_fieldcat-seltext_l     = 'Invoice No in GR'.
  ls_fieldcat-ref_fieldname = 'XBLNR1'.
  ls_fieldcat-ref_tabname   = 'MKPF'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-no_sum        = 'X'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = 'DMBTT'.
  ls_fieldcat-seltext_l     = 'Invoice value W/O tax'.
  ls_fieldcat-tabname       = g_tabname_item.
  ls_fieldcat-ref_fieldname = 'DMBTT'.
  ls_fieldcat-ref_tabname   = 'EKBE'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-no_out        = 'X'.
  ls_fieldcat-no_sum        = 'X'.
  ls_fieldcat-sp_group      = 'A'.
  APPEND ls_fieldcat TO e01_lt_fieldcat.
ENDFORM.                    " f_e01_fieldcat_init
*&      Form  f_selection
      text
FORM f_selection .
  SELECT   ekko~ebeln
           ekko~lifnr
           ekko~aedat
           ekko~submi
           lfa1~name1
           erev~netwr
                           FROM ekko  INNER JOIN lfa1 ON ( ekkolifnr = lfa1lifnr )
                                      INNER JOIN erev ON ( ekkoebeln = erevedokn )
                                      INTO TABLE itab WHERE ekko~ebeln IN ebeln AND
                                                            ekko~aedat IN aedat AND
                                                            bsart <> 'AN'.
  SELECT
         ekpo~ebeln
         ekpo~ebelp
         ekpo~aedat
         ekpo~txz01
         ekpo~menge
         ekbe~menge
         ekpo~effwr
         ekpo~mwskz
         ekkn~ps_psp_pnr
         ekbe~bewtp
         ekbe~belnr
         ekbe~dmbtr
         mkpf~mblnr
         mkpf~bldat
         mkpf~xblnr
         mkpf~frbnr
                        FROM  ekpo INNER JOIN ekkn      ON ( ekpoebeln = ekknebeln
                                                                       AND
                                                             ekknebelp = ekpoebelp )
                                   INNER JOIN ekbe      ON ( ekknebeln = ekbeebeln
                                                                       AND
                                                             ekknebelp = ekbeebelp )
                                   LEFT OUTER JOIN mkpf ON ( ekbebelnr = mkpfmblnr )
                                   INTO TABLE jtab FOR ALL ENTRIES IN itab WHERE ekpo~ebeln = itab-ebeln AND
                                                                                ekpo~aedat = itab-aedat.
ENDFORM.                    " f_selection
*&      Form  f_display
      text
FORM f_display .
  CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
    EXPORTING
      i_callback_program = g_repid
      it_fieldcat        = gt_fieldcat[]
      i_tabname_header   = g_tabname_header
      i_tabname_item     = g_tabname_item
      is_keyinfo         = gs_keyinfo
      is_layout          = ls_layout
    TABLES
      t_outtab_header    = itab
      t_outtab_item      = jtab.
ENDFORM.                    " f_display

Hi Ravi,
1. To check performance of a report we use the perfromance trace. The transaction code is ST05.
You can also refer the link :
     http://help.sap.com/saphelp_erp2005/helpdata/en/8a/3b834014d26f1de10000000a1550b0/content.htm
2.  Also we can do the run time analysis of the code uising transaction code SE30.
3. To do a general check on the code , you can use the SAP Code Inspector. The transaction code for this is SCI. This will defentely give you a detailed analysis of the program.
4 . To have a general idea about the performance tuning of a report , you should refer the link :
   http://www.sapgenie.com/abap/performance.htm.
Hope this solves yopur query.
Regards,
Kunal.

Similar Messages

  • How to  Join two tables using the Inner Join

    Hi All,
    I have two tables i.e table1 and table2 as i have created two otds and my present requirement is to join this two tables and get the results and using this i need to do some logic and update another table3.
    can some one help me out how to go for the above req.
    Thanks in Advance
    Srikanth

    The best efficient way to use inner join is create two input otds,use there otd's in create a collaboration usinf etl.
    after selecting two input otd's create a inner join statement and map it to out put otd.
    while using the etl the performance of the over all integration is increased 20 time of the normal integration.
    Hopes this will helps,,
    Thanks,
    Papa Rao.

  • Issue with the inner join on EKKO and EKPO.

    Dear All,
    The report using this join takes a long time to execute.
    Does this inner join have an issue?
    Do i need to code this in a different way for lesser execution time?
    Please give me your inputs.
    SELECT
            a~ebeln
            b~ebelp
            a~bukrs
            a~bstyp
            a~bsart
            a~ekorg
            a~ekgrp
            a~kdatb
            a~kdate
            FROM ekko AS a JOIN ekpo AS b
            ON aebeln = bebeln
            INTO TABLE t_ekpo
            WHERE
            a~bukrs EQ p_bukrs
            AND a~bstyp EQ c_k
            AND a~bsart IN s_bsart
            AND a~ekorg IN s_ekorg
            AND a~ekgrp IN s_ekgrp
            AND a~kdate GE s_fdate-low
            AND a~loekz EQ space
            AND b~loekz EQ space.
    Regards,
    SuryaD.

    Index EKKO~D consists top-down of BSTYP and BEDAT. BSTYP is already an EQ-condition in your selection, but not very selective (many rows with the same value). So including BEDAT should help in efficiently reducing the data that needs to be scanned for finding the relevant rows. However, just a new optional S_BEDAT select option that can be left empty by the user would not help, you must force a narrow selection (one month, one week, even one day? the less the better).
    This is just a quick guess from my side, there might be other options that occur to you once you have analysed the available indexes. Sometimes alternative tables could be the solution, and even less sometimes introducing a new secondary index for a standard table might be the last option (takes up space and adds processing time to insert/update/delete operations).
    Thomas

  • Please tell me the  Three table INNER JOIN Sql statement

    Hi experts,
      I got requirement like by using INNER JOIN i have to write the code in MY program i.e using 3 tables VBAK VBAP and VBUK.And the common field is VBELN .SO please give the  INNER JOIN SQL statement for above three tables...
    vbak-vbeln,erdat
    vbap-vbeln,posnr
    vbuk-vbeln,RFSTK
    Thanks in Advance

    hi guglani  please see my total code b.caus DATA is not extracting...once see the code  correct error.
    DATA:V_VBELN TYPE VBAK-VBELN.      "VBAK,VBAP AND VBUK
    SELECT-OPTIONS SORDER FOR V_VBELN.
    TYPES:BEGIN OF T_VBAK,
         VBELN TYPE VBELN_VA,
         ERDAT TYPE ERDAT,
      END OF T_VBAK.
    TYPES:BEGIN OF T_VBAP,
           VBELN TYPE VBELN_VA,
            POSNR TYPE POSNR_VA,
      END OF T_VBAP.
    TYPES:BEGIN OF T_VBUK,
        VBELN TYPE VBELN,
      RFSTK TYPE RFSTK,
      END OF T_VBUK.
    TYPES:BEGIN OF FS,
       VBELN TYPE VBELN_VA,
         ERDAT TYPE ERDAT,
    POSNR TYPE POSNR_VA,
      RFSTK TYPE RFSTK,
      END OF FS.
    DATA:WA1 TYPE T_VBAK,
         WA2 TYPE T_VBAP,
         WA3 TYPE T_VBUK,
         WA TYPE FS.
    DATA:ITAB1 TYPE TABLE OF T_VBAK,
          ITAB2 TYPE TABLE OF T_VBAP,
          ITAB3 TYPE TABLE OF T_VBUK,
          ITAB TYPE TABLE OF FS.
    select a~vbeln a~erdat b~posnr c~rfstk
           from vbak as a inner join vbAP as b on a~vbeln = b~vbeln
                          inner join vbuk as c on a~vbeln = c~vbeln
    into table itab
    where A~vbeln eq SORDER.
    IF NOT ITAB IS INITIAL.
      SORT ITAB BY VBELN.
    ENDIF.
    LOOP AT ITAB INTO WA.
       WRITE:/ WA-VBELN,WA-ERDAT,WA-rfstk.
       ENDLOOP.
       CLEAR WA.
       REFRESH ITAB.

  • Inner Join of 3 tables is correct or not?

    Hi Guys ,
                 I have a requirement where i have to join 3 tables i  dont know whether the inner Join which i wrote for 3 tables is correct or not.I am not getting any Syntax error but whether the logci below which i wrote gets all the records or not.
    The Requirement is
    "c.     Select the BOL Number entered in the screen and query the table LIKP with the BOL number in the field LIKP-BOLNR.  Gather the list of ALL delivery documents (LIKP-VBELN) that is outputted.
    d.     Query the list of the delivery documents obtained into the table VBFA in the field VBFA- VBELV.  From the output that is displayed, select the Follow-On Document Field (VBFA-VBELN) for that item whose Subsequent Document Category (VBFA- VBTYP_N) is R and the Movement Type (VBFA- BWART) is 641.  Get the Follow-On document number for each of the above Delivery Document number.
    e.     Query the table EKBE with the Follow On document obtained above in the field Material Document (EKBE- BELNR).  Perform this activity for each of the follow on document obtained above.  Get the resultant Purchase Order (EKBE-EBELN) and Item Number (EKBE-EBELP) from the query.  After querying will all the Follow-On Documents, get the unique list of PO number and Item Number.
    The logic which i wrote is
                    Begin of t_PoolSTO_out,
                  BOLNR type LIKP-BOLNR,
                  EBELN type EKBE-EBELN,
                  EBELP type EKBE-EBELP,
                  VBELN type LIKP-VBELN,
                  VBELNV type VBFA-VBELN,
             End of t_PoolSTO_out.
          Data: i_PoolSTO type Standard table of t_PoolSTO_out.
      Select
            a~BOLNR
            c~EBELN
            c~EBELP
            a~VBELN
            b~VBELN
            from LIKP as a
            Inner Join VBFA as b on aVBELN = bVBELV
            Inner Join EKBE as c on bVBELN = cBELNR
            into Table i_PoolSTO
            Where a~BOLNR in S_LBLNE and
                  b~VBTYP_N = 'R' and
                  b~BWART = '641'.
              My doubt is whether the logic works or not i Mean does i getall the rrecords based on the requirement.?
                      If not please tell any alternative logic?
    Thanks,
    Gopi Anne.

    Hi Gopi,
    Your code is Good.
    But try to avoid Inner join with more number of Tables ...because this is a performance issue..
    try to use..
    select (primary key fields mainly,other fields) from LIKP into itab where bolnr in p_bolnr(paramater).
    next try to use for all entries option..
    select (primary key fields mainly,other fields) from VBFA for all entries in itab where (give the condition)....
    simillarly do for the other select ....ok this will try to reduce the performance issue....
    <b><REMOVED BY MODERATOR></b>
    Message was edited by:
            Alvaro Tejada Galindo

  • How to inner join attribuet from user with system resource on sccm 2012 query

    Hi , I am using SCCM 2012. Trying to create a WQL query to get list of computers with department name and netbios names,etc. these are in USER  and SYSTEM RESOURCE  object type seperately. The query wizard doesn't allow me to choose sytem
    resource and USER attribute at same time. In JOIN, the inner join also doesn't have SYSTEM RESOURCE attribute class for me to join it with USER attribute class. Any way to resolve this issue so that I can get a query as mentioned?
    I tried the wql below and pasted to my test query, it gave an error. I guess it's because that wql is on sccm2007.
    Please advise,thanks!
    http://social.technet.microsoft.com/Forums/en-US/8c47f069-5390-45bd-a619-5f5498947baa/sccm-query-which-joins-system-resource-and-user-resource?forum=configmgrgeneral
    http://social.technet.microsoft.com/Forums/en-US/8c47f069-5390-45bd-a619-5f5498947baa/sccm-query-which-joins-system-resource-and-user-resource?forum=configmgrgeneral
    Thanks and best regards, -- KF

    Hi,
    Try the suggestion by Garth Jones or post a new thread at
    http://social.technet.microsoft.com/Forums/en-US/home?forum=ITCG
    I am not familiar with WQL, maybe you could get better help at the forum above.
    Juke Chou
    TechNet Community Support

  • Inner join on four tables

    hi all,
    i am facing the problem with the inner join in the select query for 4 tables.
    can i use the inner join for tables in SAP 6.0 version,
    it is going to dump.
    here is my code
    SELECT DISTINCT apernr abegda aendda awagetype aamount acurrency
            altrctry brufnm banred bvorna bnachn cgroupcode d~vdsk1
    FROM pa9011 AS a INNER JOIN pa0002 AS b ON bpernr = apernr
                      INNER JOIN pa9013 AS c ON cpernr = bpernr
                      inner join pa0001 as d on dpernr = cpernr
                      INTO CORRESPONDING FIELDS OF TABLE it_bonus
    WHERE a~pernr IN s_pernr AND
           a~begda IN s_date AND
           a~subty EQ s_subty AND
           a~wagetype EQ wa_perbonus AND
           a~ltrctry = gc_ind AND
           a~amount > 0 AND
           b~endda = '99991231' AND
           c~groupcode IN s_loc AND
           c~endda = '99991231' and
           d~endda = '99991231'
        ORDER BY a~pernr.

    hi this is the dump ,
    In a SELECT access, the read file could not be placed in the target
    field provided.
    Either the conversion is not supported for the type of the target field,
    the target field is too small to include the value, or the data does not
    have the format required for the target field.

  • Confusion in Select query having a inner join on single table

    Hi,
    I was going through coding and came a accross a select query which has a inner join on a single table. I am getting confused while analysing this . Please someone can help me analysing this query.
    select
            m~MATERIAL
            s~NUMERATOR s~DENOMINTR
            m~GROSS_WT  m~UNIT_OF_WT
          into table itab
          from ( table1as s
           inner join table1 as m
           on  m~MATERIAL = s~MATERIAL
          and m~MAT_UNIT = 'CS'
          and m~SOURSYSTEM = s~SOURSYSTEM )
          where s~MAT_UNIT = 'EA'
             and s~SOURSYSTEM = 'LD'
             and s~OBJVERS = 'A'
             and s~MATERIAL IN ( Select mat_sales
                from Table2  group by mat_sales ).
    Thank you
    Kusuma

    I don't see any use of the INNER JOIN here.
    But what's the meaning of the last selection clause?
    s~MATERIAL IN ( Select mat_sales
                from Table2  group by mat_sales ).
    Is that native SQL or something?
    Pushpraj

  • Are inner join and equijoin are same....?

    are inner join and equijoin are same....?

    WhiteHat wrote:
    interesting it says that - an equi join is a type of inner join but you can't really say they are the same thing.Simply said it it like this:
    Equi join means compare two tables where a value is in each table using an equal sign.
    An inner join means: We use the INNER JOIN keyword and have a join condition between the two tables.
    example1
    select *
    from emp
    inner join dept on emp.dept_no = dept.dept_no;This example is an inner join and also an equi join.
    example2
    select *
    from emp
    inner join dept on emp.dept_no >= dept.dept_no;This example is an inner join which is NOT an equi join.
    How to interpret the outcome is a different story (in this case it doesn't make much sense). However the syntax is correct and it is an inner join. But since it doesn't use the equal operator it is an non-equi join.

  • Program without inner join..

    hi frds...
    i need help in the programming without using the inner join and views,
    i want to take  data from 2  different table without join and views, give some sample codes or links
    it will help to us.
    by
    pari..
    Edited by: Alvaro Tejada Galindo on Feb 22, 2008 12:18 PM

    Hi pari,
             This is the sample code 'for all entries'
    in alv report.
    TYPE-POOLS:SLIS.
    DATA:BODY TYPE SLIS_T_FIELDCAT_ALV,
         HEADER TYPE SLIS_FIELDCAT_ALV.
    DATA:BEGIN OF ITAB OCCURS 0,
         MATNR LIKE MARA-MATNR,
         ERSDA LIKE MARA-ERSDA,
         MEINS LIKE MARA-MEINS,
         END OF ITAB.
    DATA:BEGIN OF ITAB1 OCCURS 0,
         MATNR LIKE MAKT-MATNR,
         MAKTX LIKE MAKT-MAKTX,
         END OF ITAB1.
    DATA:BEGIN OF ITAB2 OCCURS 0,
         MATNR LIKE MARA-MATNR,
         ERSDA LIKE MARA-ERSDA,
         MEINS LIKE MARA-MEINS,
         MAKTX LIKE MAKT-MAKTX,
        END OF ITAB2.
    SELECT-OPTIONS:SMATNR FOR ITAB-MATNR.
    PERFORM FETCH_MARA.
    PERFORM FETCH_MAKT.
    PERFORM READ.
    PERFORM FIELDCATALOG.
    PERFORM ALVDISPLAY.
    *&      Form  FETCH_MARA
    form FETCH_MARA .
    SELECT MATNR ERSDA MEINS FROM MARA INTO TABLE ITAB WHERE MATNR IN SMATNR
    endform.                    " FETCH_MARA
    *&      Form  FETCH_MAKT
    form FETCH_MAKT .
    IF ITAB[] IS NOT INITIAL.
    SELECT MATNR MAKTX FROM MAKT INTO TABLE ITAB1 FOR ALL ENTRIES IN ITAB
    WHERE MATNR = ITAB-MATNR.
    ENDIF.
    endform.                    " FETCH_MAKT
    FORM READ.
    LOOP AT ITAB.
    READ TABLE ITAB1 WITH KEY MATNR = ITAB-MATNR.
    IF SY-SUBRC = 0.
    MOVE ITAB-MATNR TO ITAB2-MATNR.
    MOVE ITAB-ERSDA TO ITAB2-ERSDA.
    MOVE ITAB-MEINS TO ITAB2-MEINS.
    MOVE ITAB1-MAKTX TO ITAB2-MAKTX.
    ENDIF.
    APPEND ITAB2.
    ENDLOOP.
    ENDFORM.
    *&      Form  FIELDCATALOG
          text
    -->  p1        text
    <--  p2        text
    form FIELDCATALOG .
    HEADER-COL_POS = '1'.
    HEADER-SELTEXT_L = 'MATNR1'.
    HEADER-TABNAME = 'ITAB2'.
    HEADER-FIELDNAME = 'MATNR'.
    APPEND HEADER TO BODY.
    CLEAR HEADER.
    HEADER-COL_POS = '2'.
    HEADER-SELTEXT_L = 'ERSDA'.
    HEADER-TABNAME = 'ITAB2'.
    HEADER-FIELDNAME = 'ERSDA'.
    APPEND HEADER TO BODY.
    CLEAR HEADER.
    HEADER-COL_POS = '3'.
    HEADER-SELTEXT_L = 'MEINS'.
    HEADER-TABNAME = 'ITAB2'.
    HEADER-FIELDNAME = 'MEINS'.
    APPEND HEADER TO BODY.
    CLEAR HEADER.
    HEADER-COL_POS = '4'.
    HEADER-SELTEXT_L = 'MAKTX'.
    HEADER-TABNAME = 'ITAB2'.
    HEADER-FIELDNAME = 'MAKTX'.
    APPEND HEADER TO BODY.
    CLEAR HEADER.
    endform.                    " FIELDCATALOG
    *&      Form  ALVDISPLAY
    form ALVDISPLAY .
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
       I_CALLBACK_PROGRAM             = 'ZALVREPORT'
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
      I_STRUCTURE_NAME               =
      IS_LAYOUT                      =
       IT_FIELDCAT                    = BODY
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
      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
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
      TABLES
        t_outtab                       = ITAB2
    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.

  • Inner join query used with 7 Database tables

    HI All,
    In a report they used the Inner join Query with 6 Data base table..now there is a performance issue with at query.
    its taking so much of time to trigger that query. Please help how to avoid that performance issue for that.
    In that 2 database tables containing lakhs of records..
    According to my knowledge it can be avoided by using secondary indexs for those 2 database tables..
    and by replacing the Inner join Query with FOR ALL ENTRIES statement.
    i want how to use the logic by using FORALL ENTRIES statement for this..
    So, please give you proper suggestion to avoid this issue..
    Thanking you.
    Moderator message: Please Read before Posting in the Performance and Tuning Forum
    Edited by: Thomas Zloch on Oct 16, 2011 10:27 PM

    Hi,
    And what do you mean with "they used"? If "SAP used" then yo will need to ask a SAP for note
    FOR ALL ENTRIES is quite good described in help. Please search forum also.
    Without query it won't be possible to tell how it can be optimized, however you can try to use SE30/SAT and ST05. Maybe it will help you.
    BR
    Marcin Cholewczuk

  • Need help with inner join and distinct rows

    Hey Guys,
    i have
    1) BaseEnv Table 
    2) Link Table
    3) BaseData Table
    Link table has three columns Id,BaseEnvId,BaseDataId 
    the BaseEnvID is unique in the table where as BaseDataId can be repeated i.e multile rows of BaseEnv Table can point to same BaseData  table row
    Now i want to do  BaseEnvTable inner join Link Table inner join BaseData Table and select 5 columsn ; Name,SyncName,Version,PPO,DOM  from the BaseData table.. the problem is that after i do the inner join I get duplciate records..
    i want to eliminate the duplicate records , can any one help me here

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
    use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. Now we have to guess and type, guess and type, etc. because of your bad manners. 
    CREATE TABLE Base_Env
    (base_env_id CHAR(10) NOT NULL PRIMARY KEY,
    Think about the name Base_Data; do you have lots of tables without data? Silly, unh? 
    CREATE TABLE Base_Data
    (base_data_id CHAR(10) NOT NULL PRIMARY KEY,
    Your Links table is wrong in concept and implementation. The term “link” refers to a pointer chain structure used in network databases and makes no sense in RDBMS. There is no generic, magic, universal “id” in RDBMS! People that do this are called “id-iots”
    in SQL slang. 
    We can model a particular relationship in a table by referencing the keys in other tables. But we need to know if the relationship is 1:1, 1:m, or n:m. This is the membership of the relationship. Your narrative implies this: 
    CREATE TABLE Links
    (base_env_id CHAR(10) NOT NULL UNIQUE
       REFERENCES Base_Env (base_env_id),
     base_data_id CHAR(10) NOT NULL
       REFERENCES Base_Data (base_data_id));
    >> The base_env_id is unique in the table where as base_data_id can be repeated I.e multiple rows of Base_Env Table can point [sic] to same Base_Data table row. <<
    Again, RDBMS has no pointers! We have referenced an referencing tables. This is a fundamental concept. 
    That narrative you posted has no ON clauses! And the narrative is also wrong. There is no generic “name”, etc. What tables were used in your non-query? Replace the ?? in this skeleton: 
    SELECT ??.something_name, ??.sync_name, ??.something_version, 
           ??.ppo, ??.dom
    FROM Base_Env AS E, Links AS L, Base_Data AS D
    WHERE ?????????;
    >> I want to eliminate the duplicate records [sic], can any one help me here?<<
    Where is the sample data? Where is the results? Please read a book on RDBMS so you can post correct SQL and try again. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • 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.

  • Help with inner join PLEASE IGNORE

    Hi I was doing a select with a subquery but I need that the where clause check to values so I couldn't get it so I decided to create a INNER JOIN
    Before
    insert into BPMTEMP (select * from ODS_VIEWER.BAN_EVENTOS_CONFIRMACION@DBLINK1 where id_solicitud and accion not in (select (id_solicitud, accion) from ODS_VIEWER.BAN_CONFIRMA_RESPUESTA@DBLINK1) and rownum <=200);but the problem with the inner join is that it doesn't accept me the external database source
    insert into BPMTEMP (select ODS_VIEWER.BAN_EVENTOS_CONFIRMACION@DBLINK1.*, ODS_VIEWER.BAN_CONFIRMA_RESPUESTA@DBLINK1.*
    from ODS_VIEWER.BAN_EVENTOS_CONFIRMACION@DBLINK1
    INNER JOIN ODS_VIEWER.BAN_CONFIRMA_RESPUESTA@DBLINK1
    ON [email protected]_solicitud = [email protected]_solicitud
    ON [email protected] = [email protected]
    AND rownum <=200); it shows an:
    ORA-02084:
         database name is missing a component
    Cause:      supplied database name cannot contain a leading '.', trailing '.' or '@', or two '.' or '@' in a row.
    how can I solve this????
    thanks for your help
    Edited by: Diego Guillen on 29/12/2009 11:14 AM

    Hi
    Please remove the @dblink stuff in the column descrptions or use a table alias. This should help.
    drop database link lokal;
    create database link lokal
       CONNECT TO whateveruserineed IDENTIFIED BY whateverthing
       USING 'lokal11g';
    select HR.COUNTRIES.*  from HR.COUNTRIES@lokal;
    select x.* from HR.COUNTRIES@lokal x;And as Dan Morgans says, pls. post you ? in the right forum next time :-))
    Mette

  • Inner join query

    Hi all,
    I want to query a inner join via some tools in sap GUI. till now, i could not query a inner join between two tables via SE11. can someone tell are there some other ways to achieve this?
    any response will be awarded!
    thanks and regards,
    samson

    hi samson,
    Proper use of Inner Join
    When multiple SAP tables are logically joined, it is always advisable to use inner join to read the data from them. This certainly reduces the load on the network.
    Let us take an example of 2 tables, zairln and zflight. The table zairln has the field airln, which is the airline code and the field lnnam, which is the name of the airline. The table zflight has the field airln, the airline code and other fields which hold the details of the flights that an airline operates.
    Since these 2 tables a re logically joined by the airln field, it is advisable to use the inner join.
                 Select aairln alnnam bfligh bcntry into table int_airdet
    example 2:--
    Inner join: If you have common fields between 2 or more tables, its betterto use Inner join.
    Check the below example:
    VBAK & VBAP table has common fields, hence we can use inner join.
    SELECT akunnr avbeln anetwr abnddt a~knumv
    avkbur aerdat avdatu aaugru
    aktext bmatnr barktx bkwmeng b~kzwi6
    bvolum bposnr b~kdmat
    INTO CORRESPONDING FIELDS OF TABLE g_t_quot
    FROM vbak AS a INNER JOIN vbap AS b
    ON avbeln = bvbeln
    WHERE a~vbeln IN so_vbeln
    AND a~trvog ='2'
    AND a~vkorg IN so_vkorg
    AND a~vtweg IN so_vtweg
    AND a~vkbur IN so_vkbur
    AND a~audat IN so_audat
    AND a~kunnr IN so_kunag.
    FOR ALL ENTRIES:
    If you get some data into one internal table and if you want to fetch data from other table based on it, use FOR ALL ENTRIES.
    g_t_quot is an internal table.
    SELECT spras augru bezei FROM tvaut INTO TABLE g_t_tvaut
    FOR ALL ENTRIES IN g_t_quot
    WHERE augru = g_t_quot-augru AND spras = sy-langu.
                From zairln as a inner join zflight as b on aairln = bairln.
    In order to restrict the data as per the selection criteria, a where clause can be added to the above inner join.

Maybe you are looking for

  • Physical Memory Upgrade [SAP, Oracle parameter changes]

    Hello Guru, Good day! I'm not sure if I'm in the correct forum, please bare with me if I'm not. We are actually planning to increase our Production [Physical Memory] server from its current size 15360GB including [oracle, SAP & OS] to 44GB memory.  D

  • Ways to handle large volume data (file size = 60MB) in PI 7.0 file to file

    Hi, In a file to file scenario (flat file to xml file), the flat file is getting picked up by FCC and then send to XI. In xi its performing message mapping and then XSL transformation in a sequence. The scenario is working fine for small files (size

  • Cutting video into a seperate layers

    Hi I'm quiet new to motion and am stuck trying to get a effect I want. I have some footage of a sports man slowly turning round and I want a glow/flash of light to come from behind his name on the back of his shirt. I've managed to get a good mask on

  • Generate Quartely report

    Hi, Requirement is---- I selection -screen if i give current month(6, 2008) and year then Alv block report should contain the records of  5 month,4 month and 3 month like quartely with each customer howz quartely loan has finished with respective to

  • Printing to HP LaserJet 4000 Series

    I have a HP LaserJet 4000 TN and wish to print to it from my G5. I added a printer and included the HP ip address. The HP has an ethernet port so I am going out of ethernet port on the back of my G5. However, it can't find the printer.The printer has