Select Query fields

Hi,
I have a select query like this.
  select   vbakvbeln posnr vkorg vbakauart kunnr matnr edatu kdgrp
           kvgr3 kvgr4 bsark
           from ztsddelividx
           inner join vbak on ztsddelividxvbeln = vbakvbeln
           inner join tvak on vbakauart = tvakauart
           into table rt_delividx
           where spart_i     = rp_spart      and
                 edatu      in ro_date       and
                 vkorg      in ro_vkorg      and
                 werks      in ro_werks      and
                 matnr      in ro_matnr      and
                 ztsddelividx~auart in ro_auart      and
                 kunnr      in ro_kunnr      and
                 stgak       = c_stgak.
This select query is from a program in production and is working fine. But I want to know from which tables this select query is fetching the fields posnr vkorg kunnr matnr edatu kdgrp kvgr3 kvgr4 bsark .
I checked the Z table  ztsddelividx. But to my surprise the fields vkorg kunnr kvgr3 kvgr4 bsark are  not there in this Z table.
I want to know from which tables this select query is fetching the fields posnr vkorg kunnr matnr edatu kdgrp kvgr3 kvgr4 bsark .
Thanks in advance.
Brahma Reddy

Go for a ST05 trace and check out the select statement that is being executed and built from ABAP open SQL. I hope you will get the solution. By the way, whats the SAP version you are using?

Similar Messages

  • Update only one select query field

    hello
    how i can update select query result field in original table.
    update table1 set field_1 from(select field_1 from table 1,table2,table3,table4 where table1.field_1=table1.field_1 and table2.field_2=table3.field_2 and table4.field_3=table1.field_4)
    like that.is it possible!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!can u please help me to rewrite query/
    select query returns result like that from different tables
    lets example field_1 field_2 field_3 field_4
    TIGER 1 V A
    TIGER 2 F B
    TIGER 3 R C
    I need to update 'TIGER' instead of 'LION' in original table.
    THANKS

    Maybe something like
    update table1
       set beast = (select animal
                      from <table_list>
                     where <predicates>
    where beast = 'LION'when your query returns a single row
    or when multiple rows are returned
    update (select t1.beast,t2.animal
              from (select beast,
                           <join_columns_list>
                      from table1
                     where beast = 'LION'
                   ) t1,
                   (select animal,
                           <join_columns_list>
                      from <table_list>
                     where <predicates>
                   ) t2
             where t1.<join_columns_list> = t2.<join_columns_list>
       set beast = animalRegards
    Etbin

  • How to use Field-symbol with dynamic select query

    Can anybody tell me, how to use field-symbols in the dynamic select query.

    FIELD-SYMBOLS <fs> { typing | STRUCTURE struc DEFAULT dobj }.
    1. ... typing
    2. ... STRUCTURE struc DEFAULT dobj
    The FIELD-SYMBOLS statement declares a field symbol <fs>. The name conventions apply to the name fs. The angle brackets of the field symbols indicate the difference to data objects and are obligatory. You can declare field symbols in any procedure and in the global declaration section of an ABAP program, but not in the declaration section of a class or an interface. You can use a field symbol in any operand position in which it is visible and which match the typing defined using typing.
    After its declaration, a field symbol is initial - that is, it does not reference a memory area. You have to assign a memory area to it (normally using the ASSIGN statement) before you can use it as an operand. Otherwise an exception will be triggered.
    eg.
    FIELD-SYMBOLS <fs> TYPE ANY.
    DATA: BEGIN OF line,
            string1(10) VALUE '0123456789',
            string2(10) VALUE 'abcdefghij',
          END OF line.
    WRITE / line-string1+5.
    ASSIGN line-string1+5(*) TO <fs>.
    WRITE / <fs>.
    output:
    56789
    56789
    reward if helpful
    anju

  • Multiple values in where clause(IN) of select query in Cisco Cloud Portal using single field

    I can actually pass multiple values in the IN statement of select query using multiple dictionary fields in the data retrieval rule of the AFC in Cisco cloud portal like
    #dictionary.field1# = 1 and
    #dictionary.field2#=2
    select col1,col2 from table1 where col3 in (#dictionary.field1#,dictionary.field2#).
    but I want to pass mutiple values in a single field as
    #dictionary.field1#=1,2
    select col1,col2 from table1 where col3 in (#dictionary.field1#) and the query gives no data because it is taking as '1,2' instead of '1','2'.
    Please give the solution for passing multiple values in a single variable to use in IN operator of WHERE clause

    Ok, I now understand what you are trying to do. Unfortunately, you cannot inject parts of a SQL statement into a DDR through a dictionary field, which always represents a specific value (the comma in your case is attempting injection of a SQL construct to refer to multiple values). One possible solution is to arbitrarily consolidate your list of values using a delimiter that you know will not be in the values themselves such as a colon (:). Let's use 3 values as it serves as a better example.
    Set your dictionary field to a single reference to all 3 values of interest, say 'a', 'b', 'c' as:
    :a:b:c:  (you can use javascript to create this consolidated dictionary field)
    Now your query would look something like the following:
    select col1,col2 from table1 where #dictionary.field1t# like '%:'+col3+':%'
    This should achieve the desired result.

  • How to truncate a field in a Select Query

    Hello Gurus,
    I am new in SAP, i have a question i am making an appointment letter in SMARTFORMS , in global declaration (initialization) i am using a select query
    SELECT SINGLE BET01 FROM PA0008 INTO G_BET01 WHERE PERNR = WA_PERNR.
    where BET01 is the Amount field which is getting printed in the smart form but its takes 5 to 6 character blank spaces in the printing time, i want to truncate this space (remove this space ) in the print time , please tell me how to remove this space , the field size is 13 , how can i reduce the field size in my smartform query. please help . G_BET01 is a variable

    Maybe you can use this.
    DATA: d_char(15).
    WRITE G_BET01 TO d_char CURRENCY 'XXX'.
    'Then you can remove the spaces using :
    CONDENSE d_char no-gaps.

  • Secondary Index Picked with one field short in select query

    Hi,
    We have a select query as follows
    select  single lgort       vgbel        vgpos
        into   (lips-lgort,lips-vgbel,lips-vgpos)
        from    lips
       where         vbeln          Eq p_zlcpp-vbeln
         and         matnr          Eq p_zlcpp-matnr
         and         charg          Eq p_zlcpp-charg
    The secondary index ZB has the fields as follows:
    MANDT     Client
    MATNR     Material Number
    CHARG     Batch Number
    BWART     Movement Type (Inventory Management)
    When seen in the trace it seems the select query picks this secondary index. Whether it is correct? since i find no BWART in the select query. Because of this index the query take large time. I used the Hint statement as follows:
    select  single lgort       vgbel        vgpos
        into   (lips-lgort,lips-vgbel,lips-vgpos)
        from    lips
       where         vbeln          Eq p_zlcpp-vbeln
         and         matnr          Eq p_zlcpp-matnr
         and         charg          Eq p_zlcpp-charg   %_HINTS ORACLE 'INDEX("LIPS" "LIPS~0")' .
    and it now works fast. Please advice the best way to make the select query work on itself without using the hint statement to pick the index LIPS~0 instead of the invalid secondary index ZB.
    Thanks & Regards,
    Selvakumar M.
    Edited by: Selva on Jun 17, 2011 7:35 PM

    Hello Selva,
    your problem here is the decision of the optimizer that does not exactly know the selectivity of the fields.
    If your deliveries are normally small (not too many items), then selecting via the document number will be relatively fast.
    And selecting via the material number + batch will be slow in case if many deliveries are having same product from the same batch delivered.
    I assume that the latest is the case in your system. That's why the selection with ZB index is slow.
    If the data distribution is as I described above, then your hint is quite OK and I advise you to stick to the hint.
    From my PoV this is the better solution rather changing the coding and throwing out MATNR field from the WHERE clause to filter later in ABAP.
    Another solution would be trying to play with histograms. But you'll need %SUBSTITUTE VALUES% or %SUBSTITUTE LITERALS% hint anyway, so I find your solution better.
    So, please stay with hint. Even SAP standard development does it for some select statements.
    Regards,
      Yuri

  • Dynamic field in select query

    Hi Team,
    I have to select dynamic fields from database table GLT0.
    This depends on period value given on screen.
    If period is 01 then fields will be hsl01.
    If period is 02 then fields will be hsl01 and hsl02.
    If period is 03 then fields will be hsl01,hsl02 and hsl03 .
    so on...till 12..
    My code is throwing exception at select query.
    "Error in module RSQL of the database interface."
    My code :
    *"      Type declaration to store field name as per given period
    TYPES : BEGIN OF y_fieldname        ,
               fieldname(10)  TYPE c    ,
             END OF y_fieldname         .
    data  t_fieldname  TYPE  STANDARD TABLE OF y_fieldname   .
      DO p_monat TIMES.
         clear w_count .
          MOVE sy-index TO w_count
          IF sy-index LE c_9.
            CONCATENATE c_hsl
                        c_0
                        w_count
            INTO      e_fieldname-fieldname.
            APPEND e_fieldname TO t_fieldname.
          ELSE.
            CONCATENATE c_hsl
                        w_count
            INTO     e_fieldname-fieldname.
            APPEND e_fieldname TO t_fieldname.
          ENDIF.
        ENDDO.
      Get Local Currency Amounts
      from table glt0 depending on period
        SELECT (t_fieldname)
          FROM glt0
          INTO TABLE t_glto_with_saknr
          FOR ALL ENTRIES IN t_bukrs
         WHERE rldnr EQ c_00
           AND rrcty EQ c_0
           AND rvers EQ c_001
           AND bukrs EQ t_bukrs-bukrs
           AND ryear EQ p_gjahr
           AND racct IN r_saknr.
    Please guide me.
    Thanking u in advance.
    Sangeeta Verma

    Hi Asik,
    I m selecting all fields now as suggestd by u so in one record i have hsl01 to hsl12.
    I have to calculate balance into e_glt0_bal-bal .This balance is summation of e_glt0_bal-hsl01 till  e_glt0_bal-hsl12 (depending on monat).
    I m using logic in process then
    my code now :
    data:    w_monat_bal type string  .
              DO p_monat TIMES.
                MOVE c_01 TO w_count .
                CONCATENATE 'e_glt0_bal-hsl'
                             w_count
                       INTO w_monat_bal.
                ASSIGN w_monat_bal TO <fs_monat_bal>.
                e_glt0_bal-bal = e_glt0_bal-bal + <fs_monat_bal>.
                w_count = w_count + c_01.
              ENDDO.
    But <fs_monat_bal> can not be added.
    Giving exception :
    Unable to interpret "e_glt0_bal-hsl01" as a number.
    If I do <fs_monat_bal> type GLT0-hslvt instead to type any
    Then assigning from w_monat_bal  is not possible.

  • Update a field based on a max select query

    Hi
    I am just learning SQL so apologies if this is simple to you guys.
    I have a table called [Stock WIP Table] which has duplicates in it.  I have an [autonumber] field, a [palletid] field, and a [number5] field.  I have the select query working to show the most recent record for each palletID:
    SELECT
    PalletID,MAX(autonumber)
    FROMdbo.[Stock
    WIP Table]
    GROUPBYPalletID
    How do I get the query to now delete all rows that are not in the select query?
    Alternatively how could I add update the [number5] field to '1' where the [autonumber] is in the select and I can  then delete all records that do not contain a '1' in [number5]
    Can anyone help?
    Thanks
    AJ

    Hi
    I am just learning SQL so apologies if this is simple to you guys.
    I have a table called [Stock WIP Table] which has duplicates in it.  I have an [autonumber] field, a [palletid] field, and a [number5] field.  I have the select query working to show the most recent record for each palletID:
    SELECT
    PalletID,MAX(autonumber)
    FROMdbo.[Stock
    WIP Table]
    GROUPBYPalletID
    How do I get the query to now delete all rows that are not in the select query?
    Alternatively how could I add update the [number5] field to '1' where the [autonumber] is in the select and I can  then delete all records that do not contain a '1' in [number5]
    Can anyone help?
    Thanks
    AJ
    Simply this for the DELETE
    DELETE t
    FROM dbo.[Stock WIP Table]t
    WHERE EXISTS (SELECT 1
    FROM dbo.[Stock WIP Table]
    WHERE PalletID = t.PalletID
    AND autonumber > t.autonumber)
    No need of UPDATE bit value and then deleting. just above will ensure it gets deleted in single step
    another method you may use is this
    DELETE t
    FROM dbo.[Stock WIP Table] t
    CROSS APPLY (SELECT MAX(autonumber) AS MaxID
    FROM dbo.[Stock WIP Table]
    WHERE PalletID = t.PalletID
    )t1
    WHERE t1.MaxID <> t.autonumber
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • I need to add a single field from with_item table . need to write select query with reference to company code , account doc no , fiscal year

    I need to add a single field from with_item table . need to write select query with reference to company code , account doc no , fiscal year

    Hi Arun ,
    Can you explain little bit more ??
    what is account doc no? 
    what are the transactions should be displayed in your output??
    -Rajesh N

  • Decode a blob field with a C script in a select query

    HI
    I have a coded field in a table which has been populated using 3rd party software. I need to decode this field so that i could rub a few reports. I have a C script that can decode this field but do not know how to call it up from a select statement.
    Is there any way of decoding this by calling up the C script in a select query.
    Thanks.

    can you duplicate this code into a PL/SQL function?
    Or else, you might try configuring your external procedures setup and call this routine (if it was available as a shared library or a DLL).

  • How to dynamically add field name in where clause of select query in web dynpro?

    Hello,
    Can any body tell me how i can use select query with dynamic wheere condition.
    i have a requirement like there are multiple input fields  and i want to select data from two database
    and condition may vary .

    Hi
    In the where clause you need to write like
    WHERE NAME LIKE 'DE%'
    Regards
    Sudheer

  • Slow Select Query - Where clause contains Seconday index field +other flds

    Hi friends,
    The below query is taking about an Hour to execute in production server when there are about 6 Million records in PLAF table. I have verified the trace in ST05 and the correct secondary index (Material Matnr + Plant Plwrk) is being selected.
    SELECT plnum
                 matnr
                 plwrk
                 pedtr
                 dispo
                 rsnum  FROM  plaf
                INTO TABLE it_orders
                WHERE ( ( matnr  IN r_mat1 )  OR
                                 matnr IN r_mat2  AND dispo IN s_mrp1 ) AND
                 pedtr IN s_date AND   
                 obart = '1'.
    Will it be a good idea to have only MATNR (secondary index field) in the where condition of the select query and delete the internal table entries for the other where conditions ?
    Edited by: Shruthi Seth on Feb 1, 2009 10:10 AM

    Hello.
    Creating a range r_mat = r_mat1 + r_mat2, I would do something like:
    READ TABLE s_mrp1 TRANSPORTING NO FIELDS INDEX 1.
    IF sy-subrc EQ 0.
      SELECT plnum matnr plwrk pedtr dispo rsnum
        FROM plaf
        INTO wa_orders
       WHERE matnr IN r_mat
         AND pedtr IN s_date
         AND obart = '1'.
        IF wa_orders-matnr IN r_mat2.
          CHECK wa_orders-dispo IN s_mrp1.
        ENDIF.
        APPEND wa_orders TO it_orders.
      ENDSELECT.
    ELSE.
      SELECT plnum matnr plwrk pedtr dispo rsnum
        FROM plaf
        INTO TABLE it_orders
       WHERE matnr IN r_mat1
         AND pedtr IN s_date
         AND obart = '1'.
    ENDIF.
    Regards,
    Valter Oliveira.

  • SAP query field selection order and text

    Hello All,
       Is there any way I can change the position of fields on the selection screen of query. Also can I change the text of the selection fields. Thanks
    Atul

    In SQ01 enter your query name and go into change mode, on the menu click "Goto" , "Field Selection" then "Field Selection"
    in there change the text of selection field, to change to ordering just enter the number sequence in the "No" the order in which you want them to appear. Like
    Production Order 02
    Order Type       03
    Plant            01
    after you execute the query selection screen will appear like below
    Plant
    Production Order
    Order Type

  • Selection screen fields in query

    experts
    i have created a query with 5 selection screen fields, now i want to change the order of the fields in the selection screen.
    Earlier:
    Material
    order
    delivery
    qty
    amount
    Now i want
    order
    material
    delivery
    amount qty
    In sq01 i tried but there are possibility to change the output fields but not selection screen field sequence.

    Hi,
    In SQ01, enter the query name and click on the change button.
    Next click on the next screen (top left) arrow button until you reach Change query xxxxx: Selections.
    Here under the column No  enter the number like 1,2,3, 4 ... against the checked fields that want to see in order. Then save the query.
    Regards,

  • Selection screen fields in SAP Query

    HI friends,
    I have to make the seletion screen field as mandatory in SAP-Query.
    Please let me know the procedure to make field as mandatory or Let me know how to validate the selection-screen field in Query.
    Thanks in Advance,
    Ravi

    Go to SQ02
    Select your Infoset-->Change
    On next Screen.
    Select GoTo->Code->Initialization.
    Write there code
    LOOP AT SCREEN.
      IF screen-name EQ 'SP$00004'.
           screen-required = 1.
           MODIFY SCREEN.
      ENDIF.
    ENDLOOP.

Maybe you are looking for

  • How do i change my apple id on the imac?

    how do i change my apple id on the imac?

  • Can't get FCKeditorAPI to load to validate HTML Editor contents

    I have an HTML Editor item on my page and wanted to quickly check the length of the text in the editor before submitting the page. It should be possible to get the contents of the HTML Editor using the FCKeditorAPI, but I can't get it to load. I'm do

  • Urgent! how does one fix admn-202022 error on dcmctl start?

    I'm getting from dcmctl start or dcmctl getstate-v the following error ADMN-202022 The object, "portal.host.domain.com", already exists in the configuration repository. The object names must be unique. Remove the existing object then retry the operat

  • BT email sends and receives ok. But according to t...

    Had this issue since day one, but since I don't use the email address at all I wasn't fussed.  But I want to opt out of FON (that apparently I have been opted into recently without my knowledge) and the BT website wants my email address to let me che

  • Multiple Genius Mix Playlists

    On my ipad after signing up for iTunes match I now get multiples of each genius mix.  They all show the same album art and name, but I have 3 of each of them instead of just one.  When I try turning iTunes Match off and on again it doesn't fix the pr