Sinlge select query in different schemas for same table(Indentical Structu)

Scenario :
Table XYZ is created in Schema A
After an year, the old data from the previous year would be moved to different schema. However in the other schema the same table name would be used.
For eg
Schema A contains table XYZ with data of 2012 yr
Schema B contains table XYZ with data of 2011 yr
Table XYZ in both the schemas have identical structure.
So can we fire a single select query to read the data from both the tables in effective way.
Eg select * from XYZ where date range between 15-Oct-2011 to 15-Mar-2012.
However the data resides in 2 different schema altogether.

Thanks for the reply
Creating an view is an option.
But my problem, there is ORM layer(either Hibernate or Eclipse Top Link) between the application and the database.
So the queries would be formed by the ORM layer and are not hand generated.
So i cannot use view.
So is there any option that would allow me to use single query on different schema's ?

Similar Messages

  • Sinlge select query in diff schemas for same table(Indentical Structure)

    Scenario :
    Table XYZ is created in Schema A
    After an year, the old data from the previous year would be moved to different schema. However in the other schema the same table name would be used.
    For eg
    Schema A contains table XYZ with data of 2012 yr
    Schema B contains table XYZ with data of 2011 yr
    Table XYZ in both the schemas have identical structure.
    So can we fire a single select query to read the data from both the tables in effective way.
    Eg select * from XYZ where date range between 15-Oct-2011 to 15-Mar-2012.
    However the data resides in 2 different schema altogether.
    Creating an view is an option.
    But my problem, there is ORM layer(either Hibernate or Eclipse Top Link) between the application and the database.
    So the queries would be formed by the ORM layer and are not hand generated.
    So i cannot use view.
    So is there any option that would allow me to use single query on different schema's ?

    Hi,
    970773 wrote:
    Scenario :
    Table XYZ is created in Schema A
    After an year, the old data from the previous year would be moved to different schema. However in the other schema the same table name would be used.
    For eg
    Schema A contains table XYZ with data of 2012 yr
    Schema B contains table XYZ with data of 2011 yr
    Table XYZ in both the schemas have identical structure.
    So can we fire a single select query to read the data from both the tables in effective way.That depends on what you mean by "effective".
    Eg select * from XYZ where date range between 15-Oct-2011 to 15-Mar-2012.
    However the data resides in 2 different schema altogether.You can do a UNION, so the data from the two years appears together. The number of actual tables may make the query slower, but it won;t change the results.
    Given that you have 2 tables, the fact that they are in different schemas doesn't matter. Just make sure the user running the query has SELECT privileges on both of them.
    Creating an view is an option.Is it? You seem to say it is not, below.
    But my problem, there is ORM layer(either Hibernate or Eclipse Top Link) between the application and the database.
    So the queries would be formed by the ORM layer and are not hand generated.
    So i cannot use view.So creating a view is not an option. Or is it?
    So is there any option that would allow me to use single query on different schema's ?Anything that you can do with a view, you can do with sub-queries. A view is merely a convenience; it just saves a sub-query, so you don't have to re-code it every time you use it. Assuming you have privilges to query the base tables, you can always avoid using a view by repeating the query that defines the view in your own query. It will not be any slower

  • Different Schemas in different environments for same tables used in a Universe

    Hi,
    I have a Universe in Development where I have tables pointed to a schema (DW) in DEV but in TEST/INT I have the same tables under a different schema (TESTDW). So when I promote the Universe & reports from DEV to TEST, I will be getting errors as the schema is incorrect. So we need to find a way so that we can define the schema globally instead of having it at the individual table.
    I know we can repoint the schemas, etc but i need to avoid extra work in other environments.
    Known Solutions: Promote the reports to TEST, then select all the tables & change the schema by Right Clicking the selected tables and selecting Change Qualifier/Owner.
    One of the few reasons, I don't want to follow this route, because I have lot of derived tables which I need to change it manually by editing the SQL Statement,  &  also If I add new tables or columns again in future & promote them to TEST, then again I have to change the schema.
    Did anyone faced this kind of issue?Is there any other way that we can use like Begin_Sql , etc?
    (FYI, I am using BO4.0 SP5)

    Mark, Thanks a lot for your concern. We actually have same schema name across all 3 environments but there is a huge project going on in my company which is kind of hard to explain, so our team has decided to go ahead with a different names for schemas as 2 different teams will be working on paralelly on these schemas & they will combine them after a year or so. (I know this is not a solution)
    Thanks Swapnil for Synonyms solution. Your solution might have worked, if we were using BO 4.1 SP5 but unfortunately we are using BO 4.0 and in this version I can't view any synonym tables in the universe.

  • How to alter Select Query while altering selectionscreen for same output?

    Hi,
    i have to change the selection screen fields with some new fields , but i dont know how to change the selection query accordingly, because i need the same output with the same fields but with a different set of fields in the selection screen.
    The original code is
    TYPES: BEGIN OF ty_output,
           mblnr TYPE mseg-mblnr,
           mjahr TYPE mseg-mjahr,
           zeile TYPE mseg-zeile,
           bwart TYPE mseg-bwart,
           werks TYPE mseg-werks,
           lgort TYPE mseg-lgort,
           ebeln TYPE mseg-ebeln,
           ebelp TYPE mseg-ebelp,
           lfbnr TYPE mseg-lfbnr,
           lfpos TYPE mseg-lfpos,
           sjahr TYPE mseg-sjahr,
           dmbtr TYPE mseg-dmbtr,
           menge TYPE mseg-menge,
           matnr TYPE mseg-matnr,
           mtart TYPE mara-mtart,
           matkl TYPE mara-matkl,
           bismt TYPE mara-bismt,
           meins TYPE mara-meins,
           bedat TYPE ekko-bedat,
           waers TYPE ekko-waers,
           wkurs TYPE ekko-wkurs,
           verkf TYPE ekko-verkf,
          EFFWR TYPE EKPO-EFFWR,
           tax TYPE ekpo-effwr,
           maktx TYPE makt-maktx,
           budat TYPE mkpf-budat,
           usnam TYPE mkpf-usnam,
           m_menge TYPE ekpo-menge,
           ablad TYPE mseg-ablad,
           wempf TYPE mseg-wempf,
           END OF ty_output.
    TYPES: BEGIN OF ty_mseg_103,
           mblnr TYPE mseg-mblnr,
           mjahr TYPE mseg-mjahr,
           zeile TYPE mseg-zeile,
           bwart TYPE mseg-bwart,
           werks TYPE mseg-werks,
           lgort TYPE mseg-lgort,
           ebeln TYPE mseg-ebeln,
           ebelp TYPE mseg-ebelp,
           lfbnr TYPE mseg-lfbnr,
           lfpos TYPE mseg-lfpos,
           sjahr TYPE mseg-sjahr,
           dmbtr TYPE mseg-dmbtr,
           menge TYPE mseg-menge,
           matnr TYPE mseg-matnr,
           mtart TYPE mara-mtart,
           matkl TYPE mara-matkl,
           bismt TYPE mara-bismt,
           meins TYPE mara-meins,
           bedat TYPE ekko-bedat,
           waers TYPE ekko-waers,
           wkurs TYPE ekko-wkurs,
           verkf TYPE ekko-verkf,
          EFFWR TYPE EKPO-EFFWR,
           tax TYPE ekpo-effwr,
           maktx TYPE makt-maktx,
           budat TYPE mkpf-budat,
           usnam TYPE mkpf-usnam,
           m_menge TYPE ekpo-menge,
           ablad TYPE mseg-ablad,
           wempf TYPE mseg-wempf,
           END OF ty_mseg_103.
    TYPES: BEGIN OF ty_mseg_105,
           mblnr TYPE mseg-mblnr,
           mjahr TYPE mseg-mjahr,
           zeile TYPE mseg-zeile,
           bwart TYPE mseg-bwart,
           werks TYPE mseg-werks,
           lgort TYPE mseg-lgort,
           ebeln TYPE mseg-ebeln,
           ebelp TYPE mseg-ebelp,
           lfbnr TYPE mseg-lfbnr,
           lfpos TYPE mseg-lfpos,
           sjahr TYPE mseg-sjahr,
           dmbtr TYPE mseg-dmbtr,
           menge TYPE mseg-menge,
           matnr TYPE mseg-matnr,
           mtart TYPE mara-mtart,
           matkl TYPE mara-matkl,
           bismt TYPE mara-bismt,
           meins TYPE mara-meins,
           bedat TYPE ekko-bedat,
           waers TYPE ekko-waers,
           wkurs TYPE ekko-wkurs,
           verkf TYPE ekko-verkf,
           effwr TYPE ekpo-effwr,
           tax TYPE ekpo-effwr,
           maktx TYPE makt-maktx,
           budat TYPE mkpf-budat,
           ablad TYPE mseg-ablad,
           wempf TYPE mseg-wempf,
           END OF ty_mseg_105.
    DATA: Begin with W_                                                 *
    DATA : it_fcat TYPE slis_t_fieldcat_alv. " alv field catalog
    DATA  : listhead TYPE slis_t_listheader WITH HEADER LINE.
    DATA: event TYPE slis_t_event WITH HEADER LINE.
    INTERNAL TABLES: Begin with IT_                                     *
    DATA : it_output TYPE STANDARD TABLE OF ty_output WITH KEY mblnr mjahr,
           it_mseg_103 TYPE STANDARD TABLE OF ty_mseg_103,
           it_mseg_105 TYPE STANDARD TABLE OF ty_mseg_103,
           it_mseg_106 TYPE STANDARD TABLE OF ty_mseg_103,          " LNTDEV1 ADDED
           it_mara TYPE STANDARD TABLE OF ty_mara,
           it_ekko TYPE STANDARD TABLE OF ty_ekko,
           it_ekpo TYPE STANDARD TABLE OF ty_ekpo,
           it_makt TYPE STANDARD TABLE OF ty_makt,
           it_mkpf TYPE STANDARD TABLE OF ty_mkpf WITH KEY mblnr.
    WORKAREAS: Begin with WA_                                           *
    DATA : wa_fcat LIKE LINE OF it_fcat.
    DATA : wa_output LIKE LINE OF it_output,
           wa_mara LIKE LINE OF it_mara,
           wa_ekko LIKE LINE OF it_ekko,
           wa_ekpo LIKE LINE OF it_ekpo,
           wa_makt LIKE LINE OF it_makt,
           wa_mkpf LIKE LINE OF it_mkpf,
           wa_mseg_103 LIKE LINE OF it_mseg_103,
           wa_mseg_105 LIKE LINE OF it_mseg_105,
           wa_mseg_106 LIKE LINE OF it_mseg_106.                        " LNTDEV1 ADDED
    DATA : w_menge LIKE ekpo-menge.
    FIELD-SYMBOLS: Begin with FS_                                       *
    PARAMETERS: Begin with PR_                                          *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETERS  : pr_werks LIKE mseg-werks OBLIGATORY.
    SELECT-OPTIONS : so_budat FOR mkpf-budat.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECT-OPTIONS: Begin with SO_                                      *
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
    SELECT-OPTIONS : so_mtart FOR mara-mtart.
    SELECT-OPTIONS : so_matkl FOR mara-matkl.
    SELECT-OPTIONS : so_matnr FOR mara-matnr.
    SELECT-OPTIONS : so_bismt FOR mara-bismt.
    SELECT-OPTIONS : so_ebeln FOR mseg-ebeln.
    SELECT-OPTIONS : so_verkf FOR ekko-verkf.
    SELECT-OPTIONS : so_bedat FOR ekko-bedat.
    SELECT-OPTIONS : so_mblnr FOR mseg-mblnr.
    SELECTION-SCREEN END OF BLOCK b2.
    *AT SELECTION-SCREEN.
    *SO_BUDAT-HIGH = SO_BUDAT-HIGH + 1.
    Query for getting all the Document Segment: Material data from MSEG *
    Table which having Movement Types 103 and put into it_mseg table,   *
    Filtering by reference document and material document number        *
    Filtering by selection criteria (Material Docu No, Purchase order   *
    and Plant)                                                          *
    START-OF-SELECTION.
      SELECT pmblnr smblnr p~mjahr zeile bwart lfbnr werks lgort ebeln
             ebelp lfpos sjahr dmbtr usnam menge sbudat pmatnr q~mtart
             pablad pwempf
             FROM mseg AS p INNER JOIN mara AS q
               ON pmatnr = qmatnr
               JOIN mkpf AS s ON smblnr EQ pmblnr
               INTO CORRESPONDING FIELDS OF
             TABLE it_mseg_103
             WHERE bwart EQ 103
             AND p~matnr IN so_matnr
             AND werks EQ pr_werks
             AND ebeln IN so_ebeln
             AND q~mtart IN so_mtart
             AND p~mblnr IN so_mblnr
             AND s~budat IN so_budat.
      IF sy-subrc = 0.
      ENDIF.
      SELECT pmblnr smblnr p~mjahr zeile bwart lfbnr werks lgort ebeln
             ebelp lfpos sjahr dmbtr usnam menge sbudat pmatnr q~mtart
             pablad pwempf
             FROM mseg AS p INNER JOIN mara AS q
               ON pmatnr = qmatnr
               JOIN mkpf AS s ON smblnr EQ pmblnr
               INTO CORRESPONDING FIELDS OF
             TABLE it_mseg_105
          WHERE bwart EQ 105 OR bwart EQ 104 OR bwart EQ 124 OR bwart EQ 124
             AND p~matnr IN so_matnr
             AND werks EQ pr_werks
             AND ebeln IN so_ebeln
             AND q~mtart IN so_mtart
             AND p~mblnr IN so_mblnr
             AND s~budat IN so_budat.
      IF sy-subrc = 0.
      ENDIF.
      LOOP AT IT_MSEG_103 INTO WA_MSEG_103.
        READ TABLE IT_MSEG_105 INTO WA_MSEG_105 WITH KEY LFBNR =
                                               WA_MSEG_103-MBLNR.
          IF SY-SUBRC <> 0.
            APPEND WA_MSEG_103 TO IT_OUTPUT.
          ENDIF.
       ENDLOOP.
      SELECT pmblnr smblnr p~mjahr zeile bwart lfbnr werks lgort ebeln  
             ebelp lfpos sjahr dmbtr usnam menge sbudat pmatnr q~mtart
             pablad pwempf
             FROM mseg AS p INNER JOIN mara AS q
               ON pmatnr = qmatnr
               JOIN mkpf AS s ON smblnr EQ pmblnr
               INTO CORRESPONDING FIELDS OF
             TABLE it_mseg_106
             WHERE bwart EQ 106
             AND p~matnr IN so_matnr
             AND werks EQ pr_werks
             AND ebeln IN so_ebeln
             AND q~mtart IN so_mtart
             AND p~mblnr IN so_mblnr
             AND s~budat IN so_budat.
      LOOP AT it_mseg_103 INTO wa_mseg_103.
        READ TABLE it_mseg_106 INTO wa_mseg_106 WITH KEY
                                           lfbnr = wa_mseg_103-mblnr.
        IF sy-subrc = 0.
          APPEND wa_mseg_106 TO it_output.
          clear wa_mseg_106.
        ENDIF.
      ENDLOOP.                        
    Present selection criteria is
    1. Plant
    2. Posting Date
    3. Material Type
    4. Material Group
    5. Material No.
    6. Old Material No.
    7. PO Order No.
    8. Old PO No.
    9. PO Date
    10. Material Document No.
    New selection criteria is
    1. PO no.
    2. PO date
    3. PO value (Ex: >=10000 <=50000)
    4. Purch org
    5. Doc type
    6. Vendor
    7. Material
    8. Account assignment category
    9. Order

    Hi,
    i have to change the selection screen fields with some new fields , but i dont know how to change the selection query accordingly, because i need the same output with the same fields but with a different set of fields in the selection screen.
    The original code is
    TYPES: BEGIN OF ty_output, mblnr TYPE mseg-mblnr, mjahr TYPE mseg-mjahr, zeile TYPE mseg-zeile, bwart TYPE mseg-bwart, werks TYPE mseg-werks, lgort TYPE mseg-lgort, ebeln TYPE mseg-ebeln, ebelp TYPE mseg-ebelp, lfbnr TYPE mseg-lfbnr, lfpos TYPE mseg-lfpos, sjahr TYPE mseg-sjahr, dmbtr TYPE mseg-dmbtr, menge TYPE mseg-menge, matnr TYPE mseg-matnr, mtart TYPE mara-mtart, matkl TYPE mara-matkl, bismt TYPE mara-bismt, meins TYPE mara-meins, bedat TYPE ekko-bedat, waers TYPE ekko-waers, wkurs TYPE ekko-wkurs, verkf TYPE ekko-verkf, * EFFWR TYPE EKPO-EFFWR, tax TYPE ekpo-effwr, maktx TYPE makt-maktx, budat TYPE mkpf-budat, usnam TYPE mkpf-usnam, m_menge TYPE ekpo-menge, ablad TYPE mseg-ablad, wempf TYPE mseg-wempf, END OF ty_output. TYPES: BEGIN OF ty_mseg_103, mblnr TYPE mseg-mblnr, mjahr TYPE mseg-mjahr, zeile TYPE mseg-zeile, bwart TYPE mseg-bwart, werks TYPE mseg-werks, lgort TYPE mseg-lgort, ebeln TYPE mseg-ebeln, ebelp TYPE mseg-ebelp, lfbnr TYPE mseg-lfbnr, lfpos TYPE mseg-lfpos, sjahr TYPE mseg-sjahr, dmbtr TYPE mseg-dmbtr, menge TYPE mseg-menge, matnr TYPE mseg-matnr, mtart TYPE mara-mtart, matkl TYPE mara-matkl, bismt TYPE mara-bismt, meins TYPE mara-meins, bedat TYPE ekko-bedat, waers TYPE ekko-waers, wkurs TYPE ekko-wkurs, verkf TYPE ekko-verkf, * EFFWR TYPE EKPO-EFFWR, tax TYPE ekpo-effwr, maktx TYPE makt-maktx, budat TYPE mkpf-budat, usnam TYPE mkpf-usnam, m_menge TYPE ekpo-menge, ablad TYPE mseg-ablad, wempf TYPE mseg-wempf, END OF ty_mseg_103. TYPES: BEGIN OF ty_mseg_105, mblnr TYPE mseg-mblnr, mjahr TYPE mseg-mjahr, zeile TYPE mseg-zeile, bwart TYPE mseg-bwart, werks TYPE mseg-werks, lgort TYPE mseg-lgort, ebeln TYPE mseg-ebeln, ebelp TYPE mseg-ebelp, lfbnr TYPE mseg-lfbnr, lfpos TYPE mseg-lfpos, sjahr TYPE mseg-sjahr, dmbtr TYPE mseg-dmbtr, menge TYPE mseg-menge, matnr TYPE mseg-matnr, mtart TYPE mara-mtart, matkl TYPE mara-matkl, bismt TYPE mara-bismt, meins TYPE mara-meins, bedat TYPE ekko-bedat, waers TYPE ekko-waers, wkurs TYPE ekko-wkurs, verkf TYPE ekko-verkf, effwr TYPE ekpo-effwr, tax TYPE ekpo-effwr, maktx TYPE makt-maktx, budat TYPE mkpf-budat, ablad TYPE mseg-ablad, wempf TYPE mseg-wempf, END OF ty_mseg_105. *----------------------------------------------------------------------* * DATA: Begin with W_ * *----------------------------------------------------------------------* DATA : it_fcat TYPE slis_t_fieldcat_alv. " alv field catalog DATA : listhead TYPE slis_t_listheader WITH HEADER LINE. DATA: event TYPE slis_t_event WITH HEADER LINE. *----------------------------------------------------------------------* * INTERNAL TABLES: Begin with IT_ * *----------------------------------------------------------------------* DATA : it_output TYPE STANDARD TABLE OF ty_output WITH KEY mblnr mjahr, it_mseg_103 TYPE STANDARD TABLE OF ty_mseg_103, it_mseg_105 TYPE STANDARD TABLE OF ty_mseg_103, it_mseg_106 TYPE STANDARD TABLE OF ty_mseg_103, " LNTDEV1 ADDED it_mara TYPE STANDARD TABLE OF ty_mara, it_ekko TYPE STANDARD TABLE OF ty_ekko, it_ekpo TYPE STANDARD TABLE OF ty_ekpo, it_makt TYPE STANDARD TABLE OF ty_makt, it_mkpf TYPE STANDARD TABLE OF ty_mkpf WITH KEY mblnr. *----------------------------------------------------------------------* * WORKAREAS: Begin with WA_ * *----------------------------------------------------------------------* DATA : wa_fcat LIKE LINE OF it_fcat. DATA : wa_output LIKE LINE OF it_output, wa_mara LIKE LINE OF it_mara, wa_ekko LIKE LINE OF it_ekko, wa_ekpo LIKE LINE OF it_ekpo, wa_makt LIKE LINE OF it_makt, wa_mkpf LIKE LINE OF it_mkpf, wa_mseg_103 LIKE LINE OF it_mseg_103, wa_mseg_105 LIKE LINE OF it_mseg_105, wa_mseg_106 LIKE LINE OF it_mseg_106. " LNTDEV1 ADDED DATA : w_menge LIKE ekpo-menge. *----------------------------------------------------------------------* * FIELD-SYMBOLS: Begin with FS_ * *----------------------------------------------------------------------* *----------------------------------------------------------------------* * PARAMETERS: Begin with PR_ * *----------------------------------------------------------------------* SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME. PARAMETERS : pr_werks LIKE mseg-werks OBLIGATORY. SELECT-OPTIONS : so_budat FOR mkpf-budat. SELECTION-SCREEN END OF BLOCK b1. *----------------------------------------------------------------------* * SELECT-OPTIONS: Begin with SO_ * *----------------------------------------------------------------------* SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME. SELECT-OPTIONS : so_mtart FOR mara-mtart. SELECT-OPTIONS : so_matkl FOR mara-matkl. SELECT-OPTIONS : so_matnr FOR mara-matnr. SELECT-OPTIONS : so_bismt FOR mara-bismt. SELECT-OPTIONS : so_ebeln FOR mseg-ebeln. SELECT-OPTIONS : so_verkf FOR ekko-verkf. SELECT-OPTIONS : so_bedat FOR ekko-bedat. SELECT-OPTIONS : so_mblnr FOR mseg-mblnr. SELECTION-SCREEN END OF BLOCK b2. *AT SELECTION-SCREEN. * *SO_BUDAT-HIGH = SO_BUDAT-HIGH + 1. *---------------------------------------------------------------------* * Query for getting all the Document Segment: Material data from MSEG * * Table which having Movement Types 103 and put into it_mseg table, * * Filtering by reference document and material document number * * Filtering by selection criteria (Material Docu No, Purchase order * * and Plant) * *---------------------------------------------------------------------* *---------------------------------------------------------------------* START-OF-SELECTION. *---------------------------------------------------------------------* SELECT p~mblnr s~mblnr p~mjahr zeile bwart lfbnr werks lgort ebeln ebelp lfpos sjahr dmbtr usnam menge s~budat p~matnr q~mtart p~ablad p~wempf FROM mseg AS p INNER JOIN mara AS q ON p~matnr = q~matnr JOIN mkpf AS s ON s~mblnr EQ p~mblnr INTO CORRESPONDING FIELDS OF TABLE it_mseg_103 WHERE bwart EQ 103 AND p~matnr IN so_matnr AND werks EQ pr_werks AND ebeln IN so_ebeln AND q~mtart IN so_mtart AND p~mblnr IN so_mblnr AND s~budat IN so_budat. ** IF sy-subrc = 0. ENDIF. SELECT p~mblnr s~mblnr p~mjahr zeile bwart lfbnr werks lgort ebeln ebelp lfpos sjahr dmbtr usnam menge s~budat p~matnr q~mtart p~ablad p~wempf FROM mseg AS p INNER JOIN mara AS q ON p~matnr = q~matnr JOIN mkpf AS s ON s~mblnr EQ p~mblnr INTO CORRESPONDING FIELDS OF TABLE it_mseg_105 WHERE bwart EQ 105 OR bwart EQ 104 OR bwart EQ 124 OR bwart EQ 124 AND p~matnr IN so_matnr AND werks EQ pr_werks AND ebeln IN so_ebeln AND q~mtart IN so_mtart AND p~mblnr IN so_mblnr AND s~budat IN so_budat. IF sy-subrc = 0. ENDIF. LOOP AT IT_MSEG_103 INTO WA_MSEG_103. READ TABLE IT_MSEG_105 INTO WA_MSEG_105 WITH KEY LFBNR = WA_MSEG_103-MBLNR. IF SY-SUBRC 0. APPEND WA_MSEG_103 TO IT_OUTPUT. ENDIF. ENDLOOP. SELECT p~mblnr s~mblnr p~mjahr zeile bwart lfbnr werks lgort ebeln ebelp lfpos sjahr dmbtr usnam menge s~budat p~matnr q~mtart p~ablad p~wempf FROM mseg AS p INNER JOIN mara AS q ON p~matnr = q~matnr JOIN mkpf AS s ON s~mblnr EQ p~mblnr INTO CORRESPONDING FIELDS OF TABLE it_mseg_106 WHERE bwart EQ 106 AND p~matnr IN so_matnr AND werks EQ pr_werks AND ebeln IN so_ebeln AND q~mtart IN so_mtart AND p~mblnr IN so_mblnr AND s~budat IN so_budat. LOOP AT it_mseg_103 INTO wa_mseg_103. READ TABLE it_mseg_106 INTO wa_mseg_106 WITH KEY lfbnr = wa_mseg_103-mblnr. IF sy-subrc = 0. APPEND wa_mseg_106 TO it_output. clear wa_mseg_106. ENDIF. ENDLOOP.
    Present selection criteria is 1. Plant 2. Posting Date 3. Material Type 4. Material Group 5. Material No. 6. Old Material No. 7. PO Order No. 8. Old PO No. 9. PO Date 10. Material Document No. New selection criteria is 1. PO no. 2. PO date 3. PO value (Ex: >=10000 <=50000) 4. Purch org 5. Doc type 6. Vendor 7. Material 8. Account assignment category 9. Order
    I hope the code is readable now.
    Thanks in advance.

  • Simple SELECT query to generate  INSERT for a table

    Hi,
    I am looking for a SELECT query which generates INSERT statements for a table.Please guide.
    Thanks
    PG.

    Like this?
    SQL> SELECT * from kons;
         COL1      COL2
            1         1
            2         2
    SQL> SELECT 'INSERT INTO kons VALUES('||col1||','||col2||');' statement FROM kons;
    STATEMENT
    INSERT INTO kons VALUES(1,1);
    INSERT INTO kons VALUES(2,2);
    SQL> If you have character and / or date columns you will have to change my example,
    but you might get the idea from it.
    You can spool the result to a file.
    Regards,
    Guido
    Edit: ';' added to end of statement...

  • Different View for same document library on a Wiki Page

    Hi,
    I am developing a Provided hosted app which have a functionality to create a document library with two Views. Also we need to show this document library in a wiki page with two different views.
    I am using CSOM (C#). I am able to create the document library and the two views programmatically. But when I add the document library in the wiki page the default view (All Documents) is shown for both the web parts. There is an hidden view created with
    the WebPartDefinition from the xml provided through code. 
    Through CSOM we are able make a View as default with the link below.
    http://sharepoint.stackexchange.com/questions/90433/add-document-library-xsltlistviewwebpart-using-csom-or-web-services
    In my case both the webparts will get the same view, where I need different view for same document library in a wiki page.
    Also I tried to update the web parts with the following code.
    string viewString = @"<View Name='{0}' MobileView='TRUE' Type='HTML' Url='/SitePages/Home.aspx' Level='1' BaseViewID='1' ContentTypeID='0x' ImageUrl='/_layouts/15/images/dlicon.png?rev=23' >
    <Query><Where><Eq><FieldRef Name='KeyDocument'/><Value Type='Boolean'>1</Value></Eq></Where></Query>
    <ViewFields><FieldRef Name='FileLeafRef'/><FieldRef Name='DocumentOwner'/><FieldRef Name='Modified'/>
    <FieldRef Name='_UIVersionString'/><FieldRef Name='Editor'/></ViewFields>
    <RowLimit Paged='TRUE'>30</RowLimit><JSLink>clienttemplates.js</JSLink><XslLink Default='TRUE'>main.xsl</XslLink>
    <Toolbar Type='Standard'/></View>";
    WebPartDefinition wpd = wpfound.FirstOrDefault();
    string formattedstring = String.Format(viewString, wpd.Id);
    wpd.WebPart.Properties["XmlDefinition"] = formattedstring;
    wpd.SaveWebPartChanges();
    web.Context.ExecuteQuery();
    I created two views (viewString) as shown above.
    The above code did not throw error, but it did not update the web part.
    Please advise how to move forward.

    Hi Samir,
    When we click outside of the list view webpart on a webpart page (or allitems.aspx page) with containing multiple webparts, the list view webpart will lose the focus, and the selected items will be deselected, this is by design.
    You can look at the following article with using the approach/workaround of Javascript to prevent the specified list view webpart from losing focus.
    http://sharepoint.stackexchange.com/questions/44360/list-view-loses-focus-when-additional-webpart-added-to-page
    //Set focus on our list web part
    var webPart = document.getElementById('WebPartWPQ1');
    WpClick({target: webPart});
    //Prevent it from losing focus
    SP.Ribbon.WebPartComponent.$3_1.deselectWebPartAndZone = function() { };
    Thanks
    Daniel Yang
    TechNet Community Support

  • Select query from 2 schema & database

    Hi,
    what privileges should i give to execute select query from 2 schema & database in oracle
    thanks

    Hi,
    not so clear, if you are looking for this
    -- for other schema access
    GRANT SELECT ON <scheman_name>.<table_name> TO <schema_name>;
    or create the synonym
    --for other database access you need to create db link                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to Maintain two different prices for same material in different qty?

    Dear all,
    How to maintain two different prices for same material in different batch quantities in purchase order(ie.,info record)?
    (Vendor is supplying quantities in 2 different batches & also in different prices)
    Expecting valuable reply.
    Jeyakanthan

    In a PO you can create 2 items, and each item can be maintained with a different price in the conditions.
    In info record it is not possible to have different prices for the same period, except for scales.
    so if you have a price of e.g. 2 USD for 1000 kg and 1,90 USD for 2000 kg then you can maintain this in scales, but you still have to have 2 items in the PO so that each one can individually find its price.
    Alternative you can create contracts (as well with more than one item) to reflect the different prices and batches.

  • How to make Different Price for same product in one Sale Order

    How can i customizing my system?
    I need to sale for different price same product A in one sale order. And price condition type cant be manually. i can separate them by position. for ex. in first position: product A is one price and in 2nd product A with discount. i tried to do it by changing a price group for 2nd position to determinate a discount condition but it generates invoice split.
    Someone have any suggestions?

    Hi
    you can have it automatically determined after some custo and using userexit_pricing_prepare_tkomp in MV45AFZZ and RV60AFZZ.
    The idea is to use ítem category field (PSTYV) as a part of pricing data to determine different prices for same material by changing manually ítem category when creating a sales order
    - you'll need to create a new ítem category copied from the one you´re using and do all assignments
    - add field PSTYV, if not there, to pricing field catalog. This thread has an example on how to and coding required for userexits
    http://scn.sap.com/thread/1693234
    - Adjust your pricing sequence as per new table
    - Maintain specific prices in new table for materials with this new ítem category
    Finally, when creating a sales order change, when required, default ítem category by new one to get specific price for material.
    Regards,
    JM

  • Folder is empty on second computer. I have installed adobe CC on two different computers for same account so I can work at two different places. I uploaded files to it yesterday and I can't find it on the CC folder on second computer. What can I do?

    I have installed adobe CC on two different computers for same account so I can work at two different places. I uploaded files to it yesterday and I can't find it on the CC folder on second computer. What can I do?

    Hi DeafScientist,
    Please try the below mentioned links.
    Creative Cloud Help | Browse, sync, and manage assets
    Error: "Unable to sync files"
    Creative Cloud File Sync | Known issues
    Kindly revert if you are unable to sync files.
    Thanks,
    Atul Saini

  • Engineering and Manufacturing Org has different name for same item

    Dear All,
    I have an Engineering department generally Create items and configure bills, routings then, transfer all to Manufacturing org.
    My client has typical requirement as follows...
    Engineering and manufacturing department has different name for same item.
    Eg: Item A in Manufacturing org may be called as Item AA in Engg org. I have to maintain 2 names for same item. How to map this requirement in R12.
    Regards,
    Saravanan

    Can oyu not make it an organization level item and specify the proce there instead of keeping it a master level item?
    Regards,
    Utsav.

  • Generating an XML schema for a TABLE

    Hi,
    I know I can easily export DATA into an XML file, but Sql Developer can also generate an XML schema for a table LAYOUT. Does anyone know how this is done?
    I did it some time ago and have been unable to do it again.
    Thanks

    Hi Thanks for the response. Yes, what you say is the type of thing I mean. The snippet below was actually created using SqlDeveloper, but I just can't seem to be able to do it again :-(
    <?xml version='1.0' encoding='Cp1252' ?>
    <results>
         <row>
              <Column_Name><![CDATA[AD_UNIT_ID]]></Column_Name>
              <Data_Type><![CDATA[NUMBER(5,0)]]></Data_Type>
              <Nullable><![CDATA[Yes]]></Nullable>
              <Data_Default><![CDATA[]]></Data_Default>
              <COLUMN_ID><![CDATA[1]]></COLUMN_ID>
              <Primary_Key><![CDATA[]]></Primary_Key>
              <COMMENTS><![CDATA[]]></COMMENTS>
         </row>
         <row>
              <Column_Name><![CDATA[AD_UNIT_NAME]]></Column_Name>
              <Data_Type><![CDATA[CHAR(30 CHAR)]]></Data_Type>
              <Nullable><![CDATA[Yes]]></Nullable>
              <Data_Default><![CDATA[]]></Data_Default>
              <COLUMN_ID><![CDATA[2]]></COLUMN_ID>
              <Primary_Key><![CDATA[]]></Primary_Key>
              <COMMENTS><![CDATA[]]></COMMENTS>

  • PreparedStatement & regular Statement - different results for same select

    I was wondering if someone could either
    i) try this out for me to confirm my results or
    ii) let me know what I am doing wrong
    I'm one of the developers on a product and am currently investigating localization for the Thai language...just checking to see that Java and Swing have no problems with it. The only bewildering thing which has happened is noticing that some values which are fetched from the database display in Thai perfectly and other values display as a garble. Sometimes the exact same column is displayed correctly in one part of the program but is not OK in another part. I think I've figured out what it going on and suspect a bug in Oracle's JDBC:
    Some selects were configured as PreparedStatements and those return the Thai properly. The more common case however was for programmers to use a simple Statement object for their select and it is in those that the multi-byte strings don't get returned properly.
    The following code shows the problem that I am experiencing. I am basically executing the exact same select in 2 different ways and they are both giving different results as long as the column being queried contains a Thai character. If someone could grab and check it out and let me know if they see the same thing, I'd appreciate it. Just change the column/table name and the username/password/databaseIP to get it to run.
    <code>
    import java.sql.*;
    public class SelectTest {
    public static void main(String[] args) {
    try {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection( "jdbc:oracle:thin:@10.4.31.168:1524:ora8",
    "dms_girouard",
    "girouard");
    String sqlCommand = "select C0620_Title from T0620_SwSheet";
    Statement statement = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    ResultSet resultSet1 = statement.executeQuery(sqlCommand);
    while (resultSet1.next()) {
    if (resultSet1.getString("C0620_Title") != null) {
    System.out.println("resultSet1 Title = " + resultSet1.getString("C0620_Title"));
    PreparedStatement preparedStatement = conn.prepareStatement(sqlCommand);
    ResultSet resultSet2 = preparedStatement.executeQuery();
    while (resultSet2.next()) {
    if (resultSet2.getString("C0620_Title") != null) {
    System.out.println("resultSet2 Title = " + resultSet2.getString("C0620_Title"));
    catch (Exception e) {
    System.out.println(e.getMessage());
    </code>

    Hi Peter,
    Are you using NCHAR column for Thai , or is your database character set set for Thai.
    If you are using a NCHAR column for holding Thai data, then you have to use the
    OraclePreparedStatement.setFormOfUse(...) before executing the select.
    Regards
    Elango. Hi Elangovan,
    Thank you for answering.
    The datatype on the column is VARCHAR2.
    I did my initial tests without doing anything special to make sure the database is localized for Thai, and I was happy to find that almost everything still worked fine - I was able to save and retrieve Thai strings to the database almost perfectly.
    The only problem I discovered was the difference between Statement and PreparedStatement selects on a column containing Thai. Colleagues of mine have said they see the same thing when testing on a Oracle database which has been configured specifically for the Thai customer.
    I read somewhere that the current JDBC drivers are using an older version of the Unicode standard than the most current version of the Java SDK and that it was causing some problems with Korean. I'm wondering if maybe it's the same problem with Thai.

  • Different results for same query on different servers

    1. database being converted from 7.3.4 to 9.2
    2. query is executed on both servers
    3. different results!
    The tables and data are the same, and indexes are setup on new server. EXPLAIN PLAN was run on both but with (predictably) widely different results.
    I know, not much detail here, but has anyone ever ran into anything like this?
    Thanks,
    Pat

    Folks,
    Here is the relevant information for this problem. The attributes have been changed for confidentiality. If you need any other information let me know.
    Thanks,
    Pat
    Query:
    SELECT
    one,two,three,four,a.five,six,seven,
    a.eight,a.nine,
    to_char(ten,'99999.99'),to_char(eleven,'99999.99'),
    to_char(twelve,'99999.99'),to_char(thirteen,'99999.99'),
    fourteen,fifteen,sixteen,seventeen,eighteen,
    nineteen,twenty,twentyone
    FROM
    table1 a,
    table2 b
    WHERE
    a.five = b.five
    AND one = 'X'
    AND six = ' '
    AND three != 12345
    AND three IN
    (SELECT DISTINCT
    three
    FROM table3
    WHERE
    one = 'X'
    AND twentytwo = 'XYZ'
    AND twentythree != 0
    AND twentyfour != 0
    AND twentyfive = 'Y'
    AND (a.five IN
    (SELECT DISTINCT
    five
    FROM table1
    WHERE
    one = 'X'
    AND three IN (12345)
    Table1:
    one          varchar2(1)     not null     PK
    two          varchar2(20)     not null     PK
    three          number(5)     not null     PK
    four          number(2)     not null     PK
    five          number(6)     not null     PK
    six          varchar2(4)     not null     PK
    seven          number(4)     not null
    eight          varchar2(8)     not null
    nine          date          not null
    ten          number(7,2)
    eleven     number(7,2)
    twelve     number(7,2)
    thirteen     number(7,2)
    Table2:
    five          number(6)     not null     PK
    fourteen     varchar2(5)     not null
    fifteen     varchar2(5)     not null
    sixteen     varchar2(2)     not null
    seventeen     varchar2(35)     not null
    eighteen     varchar2(4)     not null
    nineteen     varchar2(2)
    twenty     varchar2(1)
    twentyone     number(6)
    Table3:
    one          varchar2(1)     not null     PK
    twentytwo     varchar2(12)     not null     PK
    two          varchar2(20)     not null     PK
    three          number(5)     not null     PK
    four          number(2)     not null     PK
    twentysix     number(2)     not null     PK
    twentyfive     varchar2(1)     not null
    nine          date          not null
    twentythree     number(13,8)     not null
    twentyfour     number(12,8)     not null
    twentyseven     varchar2(1)     not null
    eight          varchar2(8)     not null
    Explain - Oracle9i (default, with CBO):
    SELECT STATEMENT
    RECURSIVE EXECUTION SYS_LE_3_0
    RECURSIVE EXECUTION SYS_LE_3_1
    TEMP TABLE TRANSFORMATION
    HASH JOIN
    HASH JOIN
    HASH JOIN
    TABLE ACCESS FULL SYS_TEMP_0FD9D6603_AB874A
    TABLE ACCESS BY INDEX ROWID TABLE1
    BITMAP CONVERSION TO ROWIDS
    BITMAP AND
    BITMAP MERGE
    BITMAP KEY ITERATION
    TABLE ACCESS FULL SYS_TEMP_0FD9D6603_AB874A
    BITMAP CONVERSION FROM ROWIDS
    INDEX RANGE SCAN TABLE1INDEX03
    BITMAP MERGE
    BITMAP KEY ITERATION
    TABLE ACCESS FULL SYS_TEMP_0FD9D6602_AB874A
    BITMAP CONVERSION FROM ROWIDS
    INDEX RANGE SCAN TABLE1INDEX04
    TABLE ACCESS FULL SYS_TEMP_0FD9D6602_AB874A
    TABLE ACCESS FULL TABLE2
    Query results - Oracle9i (with CBO):
    X|A | 1| 0| 22| | 1|08-MAR-02|XYZ | | 24.00| | |ABCDE|FGHIJ|AB|ABCDEFG |ABC | | | |
    X|B | 2| 1| 22| | 7|04-DEC-01|XYZ | | 3.25| 8.00| |ABCDE|FGHIJ|AB|ABCDEFG |ABC | | | |
    X|C | 3| 1| 22| | 1|14-AUG-02|XYZ | | 10.35| | |ABCDE|FGHIJ|AB|ABCDEFG |ABC | | | |
    X|D | 4| 1| 22| | 6|11-JUL-02|XYZ | | .00| 13.90| |ABCDE|FGHIJ|AB|ABCDEFG |ABC | | | |
    X|E | 5| 5| 23| | 1|22-FEB-01|XYZ | | 211.80| | |ABCDE|EFGHI|AB|HIJKLMN |DEF | | | |
    X|E | 5| 5| 23| | 1|22-FEB-01|XYZ | | 211.80| | |ABCDE|EFGHI|AB|HIJKLMN |DEF | | | |
    X|E | 5| 5| 23| | 1|22-FEB-01|XYZ | | 211.80| | |ABCDE|EFGHI|AB|HIJKLMN |DEF | | | |
    X|E | 5| 5| 23| | 1|22-FEB-01|XYZ | | 211.80| | |ABCDE|EFGHI|AB|HIJKLMN |DEF | | | |
    X|E | 5| 5| 23| | 1|22-FEB-01|XYZ | | 211.80| | |ABCDE|EFGHI|AB|HIJKLMN |DEF | | | |
    (approximately 4550 rows returned)
    Explain - Oracle9i (ALTER SESSION SET OPTIMIZER_METHOD=RULE;):
    SELECT STATEMENT
    MERGE JOIN
    SORT JOIN
    NESTED LOOPS
    NESTED LOOPS
    VIEW VW_NSO_1
    SORT UNIQUE
    TABLE ACCESS BY INDEX ROWID TABLE3
    INDEX RANGE SCAN TABLE3INDEXPK
    TABLE ACCESS BY INDEX ROWID TABLE1
    INDEX RANGE SCAN TABLE1INDEX03
    TABLE ACCESS BY INDEX ROWID TABLE2
    INDEX UNIQUE SCAN TABLE2INDEXPK
    SORT JOIN
    VIEW VW_NSO_2
    SORT UNIQUE
    TABLE ACCESS BY INDEX ROWID TABLE1
    INDEX RANGE SCAN TABLE1INDEX03
    Explain - Oracle 7.3.4:
    SELECT STATEMENT
    MERGE JOIN
    SORT JOIN
    NESTED LOOPS
    NESTED LOOPS
    VIEW
    SORT UNIQUE
    TABLE ACCESS BY ROWID TABLE3
    INDEX RANGE SCAN TABLE3INDEX03
    TABLE ACCESS BY ROWID TABLE1
    INDEX RANGE SCAN TABLE1INDEX03
    TABLE ACCESS BY ROWID TABLE2
    INDEX UNIQUE SCAN TABLE2INDEXPK
    SORT JOIN
    VIEW
    SORT UNIQUE
    TABLE ACCESS BY ROWID TABLE1
    INDEX RANGE SCAN TABLE1INDEX03
    Query results - Oracle 7.3.4:
    X|A | 1| 0| 22| | 1|08-MAR-02|XYZ | | 24.00| | |ABCDE|FGHIJ|AB|ABCDEFG |ABC | | | |
    X|B | 2| 1| 22| | 7|04-DEC-01|XYZ | | 3.25| 8.00| |ABCDE|FGHIJ|AB|ABCDEFG |ABC | | | |
    X|C | 3| 1| 22| | 1|14-AUG-02|XYZ | | 10.35| | |ABCDE|FGHIJ|AB|ABCDEFG |ABC | | | |
    X|D | 4| 1| 22| | 6|11-JUL-02|XYZ | | .00| 13.90| |ABCDE|FGHIJ|AB|ABCDEFG |ABC | | | |
    X|E | 5| 5| 23| | 1|22-FEB-01|XYZ | | 211.80| | |ABCDE|EFGHI|AB|HIJKLMN |DEF | | | |
    (approximately 1150 rows returned)
    Indexes (used):
    TABLE1INDEX03     (three)
    TABLE1INDEX04     (five)
    TABLE2INDEXPK     (five)
    TABLE3INDEXPK     (one,twentytwo,two,three,four,twentysix)
    Discussion:
    Notice the repeating result for X,E,5,5,23,.... in the Oracle9i retrieval using CBO.
    The execution of this query returned approximately four times the number of rows as
    Oracle 7.3.4 using RBO. This is a function of how many "fours" there are in table3
    that have matching "threes and fours" in table1. If you put a DISTINCT clause at the
    very front of the query (SELECT DISTINCT one,two,three ....) then the result is
    accurate and the same as Oracle 7.3.4. In one execution of this query, 27,000 rows
    are expected to be returned, but the server returned over 1 million rows!
    When RBO was used on Oracle9i, the results were identical to the ones on Oracle 7.3.4.

  • Same query takes different time for two different users with same privileges

    Hi,
    Just wanted to know if it is possible for an INSERT query to take different amount of time for two different users for the same volume of data. If so, what could be the reason? I would like to add that we are not executing the query simultaneously. But it is always faster for user1(within 10-20 seconds) and slower for user2(takes around 8-10 minutes).

    Show execution plan for each user. I think there is other reasons which you didn't not tell

Maybe you are looking for

  • Report-Query Value

    Hi Experts, Currently we are using one BW report in 3.5version(report query against multi provider). Current issue: Cube Fields: PO Number: 123 Order value 100. Confirmation value 50 Final Delivery Indicator: X (YES-No more confirmation is expected)

  • All but 5-6 of my songs have been deleted from my ipod shuffle.  I can find the list in purchased but can't get them on my device.

    Allbut 5-6 of my 44 songs on my Ipod shuffle have been deleted. They all show up on my purchases but I can't transfer them to my Ipod shuffle device.

  • -45054

    Hi there - Perhaps one of you can help me. When I try to start iTunes, it says "An unknown error has occurred: -45054" and then it crashes. I have tried re-installing it a few times, to no avail. Any ideas for me? Thank you all. Brooke

  • Err: Mail Adapter

    Hi all, I had config. the mail adapter at receiver side, with Transport Protocol SMTP and check the keep attachment. Now I got this error, checked in RWB "Mail: Configuration error: Channel 060f1137a095350a8ce839186d4ca610is not configured for XIMail

  • Looking for a ISO for Windows 2003 R2 Enterprise Volume License version.

    Hi all, We have our VL W2K3 R2 Enterprise 32bit license key already. Trying to get a link to the .iso file for the VL license to download it. I tried the non-VL W2K3R2 Standard version .iso from my standard TechNet subscription, of course it will not