How to avoid end-select in the sel;ect statement

Hi All
i have the following select statement,
            SELECT KBETR FROM KONV
                        INTO (V_EXDUTY) UP TO 1 ROWS
                        WHERE KNUMV = VBRK-KNUMV
                          AND KSCHL = 'JEXP'
                          AND KPOSN = VBFA-POSNN.
            ENDSELECT.
now i want to know the alternative stat for this one by removing the end-select. and also explain me why do we use select ..... end-select. brief explanation is appreciated.
thanks in advance
ABAPER

hi,
u can use SELECT SINGLE ...since u r using select upto 1 rows. they hv used select upto 1 rows...as they are passing partial primary keys. there is a possibility that u mite have more than one matching records.
u can use "select..into table" and use some condition to retrieve the specific record.
regards,
madhu

Similar Messages

  • How to avoid data selection inside the loop?

    Hello Experts,
    I am working on one performance item and I have already applied some changes to the original version.
    Now, If I compare my new program with old program, I have good improvement in performance. I am checking if I can do anything on statements that are top on the below list. I think 40% for Modify statement is acceptable after my research (Below run is updating around 20M records which is real time volume for this application).
    As we can see 34% of run time to going for one SELECT query on custom table. Take a look at below high level flow of my program to understand above select query.
    1. Select data from ZABC
    2. Select data from Variant Table (Var1, Var2, Var3 etc.., 12 in real time)
    3. Loop Variant Table
    4. Select data from X, Y, Z table for Var<n>.
    5. Populate final internal table from ZABC, X, Y and Z table
    6. Modify ZTABLE with Final Internal table data
    7. End Loop on Variant Table
    As described in the flow of the program, ZABC table data is common for all the variants and need not to fetch multiple times. Hence I am doing it only once in my program. Below is that select query:
    select rrcty ryear rbukrs racct rcntr sum( amt1) as amt1  "Like I have 32 amount fields in original query
               from zabc
                into table i_zabc
                where ryear in r_year    " Two records in ranges with I and EQ
                and rvers = '001'
                and rrcty in r_rrcty        "Three records in ranges with I and EQ
                and rldnr = 'DT'
                group by rrcty ryear rbukrs racct rcntr
                order by rrcty ryear rbukrs racct rcntr.
    ZABC table is again having huge volume of data and we are fetching millions of records with above query. That is primary reason to take long time. May be that is okay as I am already using Indexes of this table. But, I am not comfortable with it as it can reach max. memory point and through run time error. Fetch Cursor is one reliable option that I can see here, but with that, I should move ZABC selection inside the variant loop which can cause fetching ZABC data 12 times (Let me know If I am missing anything here).
    Now, third statement in my trace results, with 10% of overall time is this:
    loop at i_abc assigning <fs_abc>. 
    loop at i_table assigning <fs_table> where low <= <fs_abc>-racct and high >= <fs_abc>-racct. 
    endloop. 
    endloop. 
    6 million executions with this complex WHERE condition is causing this statement to get 3rd position in trace results. I tried below two options which are, I think, taking even more time - (I am still monitoring these options)
    1) Removed WHERE condition on LOW, HIGH and applied filter inside the loop.
    2) Removed WHERE condition on HIGH only and applied filter inside the loop.
    Any suggestions on how to proceed with ZABC selection and I_TABLE loop.
    Let me know if you have any questions on above compose.

    Since I looked at this case before, let me try some quick suggestions:
    Is table ZABC related to table X, Y and/or Z and can the selection be limited by applying those 12 selection variants?
    If yes, try a join select involving these tables that could make your step 1 obsolete and replace steps 4 and 5.
    This might also get rid of the "loop inside loop" problem. Generally, make sure that the inner table is declared as a sorted table with a key that consists of the fields as used in the WHERE-condition of the inner loop. Use secondary keys for internal tables if your ABAP release permits and the task at hand warrants it.
    Finally, look at PACKAGE SIZE option for the (join) select to reduce memory consumption.
    Thomas

  • How to avoid default selection screen in HR interfaces(using pnp ldbs)

    How to avoid default selection screen in HR interfaces(using pnp ldbs)

    Dear Rakesh,
    The report category is used to change the selection screen of programs that use the 'PNP' logical database.
    See links bellow:
    http://www.sapdevelopment.co.uk/hr/hr_repcat.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/15/229357553611d3967f00a0c9306433/frameset.htm
    Report categories for selection screen in HR programming
    Also visit the following blog:
    /people/alvaro.tejadagalindo/blog/2006/02/19/how-to-deal-with-hr-payroll-reports
    Regards,
    Naveen.

  • How to handle multiple selection in the Spark List control with checkbox as itemrenderer?

    Hi All,
    I am using checkbox as an ItemRenderer in spark list.
    I have a query.
    how to handle multiple selection in the Spark List control with checkbox as itemrenderer?
    how to retrieve the selected item label?
    Thank you in advance.

    Hi there, I'll tweak your code a little bit to something like this:
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                    layout="vertical">
        <mx:Script>
            <![CDATA[
                 import mx.events.ListEvent;
                 import mx.controls.CheckBox;
               [Bindable]
               private var mySelectedIndexes:ArrayCollection=new ArrayCollection();
                private function onChange(e:ListEvent):void
                   if(CheckBox(e.itemRenderer).selected){
                             mySelectedIndexes.addItem(e.rowIndex);
                   }else{
                                  mySelectedIndexes.removeItemAt(mySelectedIndexes.getItemIndex(e.rowIndex));     
                   chkList.selectedIndices=mySelectedIndexes.toArray();
            ]]>
        </mx:Script>
    <mx:ArrayCollection id="collection">
            <mx:Object label="Test A"/>
            <mx:Object label="Test B"/>
            <mx:Object label="Test C"/>
            <mx:Object label="Test D"/>
            <mx:Object label="Test E"/>
            <mx:Object label="Test F"/>
            <mx:Object label="Test G"/>
        </mx:ArrayCollection>
    <mx:List id="chkList" dataProvider="{collection}" itemRenderer="mx.controls.CheckBox"  itemClick="onChange(event);" allowMultipleSelection="true"/>
    </mx:Application>

  • When to use SELECT and END SELECT in the query.

    hi all,
    When to use SELECT and END SELECT in the query.
    regads,
    Venkata Suresh Penke.

    Hi Suresh..
    When do we need to use SELECT .. ENDSELECT
    Usually we will never use SELECT .. ENDSELECT as it gives very poor performance.
    But whenever we read a single Record we will use it as an alternative for SELECT SINGLE in some scenarios.
    Eg: When the Full primary key is not specified in the WHERE clause.
    SELECT * FROM MARC INTO WA_MARC UP TO 1 ROWS WHERE MATNR = P_MATNR.
    ENDSELECT.
    And other scenario is when we perform AGGREGATE OPERATIONS.when the Result is only one row.
    SELECT SUM( LABST ) FROM MARD INTO V_LABST UP TO 1 ROWS
    WHERE MATNR = P_MATNR.
    ENDSELECT.
    Note: In The Above scenario we cannot use SELECT SINGLE..
    <b>REWARD IF HELPFUL.</b>

  • How to save slices selected by the slice-select-tool ?

    How to save slices selected by the slice-select-tool ? In the past, I select several slices in edit window and saved for web(ctrl+alt+shift+s) But now, selected slices are unselected in the Save-for-web dialog except first slice.
    I'm sorry my short english.

    How to save slices selected by the slice-select-tool ? In the past, I select several slices in edit window and saved for web(ctrl+alt+shift+s) But now, selected slices are unselected in the Save-for-web dialog except first slice.
    I'm sorry my short english.

  • How to avoid extended checks for the events used in ALV.

    Hii,
    I hav delvpd an alv report in which i hav used events for which i haven't declared PERFORM for the same. but when i had checkd in the Extended program checks it says that form interface is not called directly.. check for dynamic PERFORMS...
    how to avoid this error in the extended check program.

    Another option can be calling the routine from the program itself with a check that never satisfies.
    like:
    if 1 = 2.
    perform top_of_page.
    endif.
    form top_of_page.
    endform.
    Regards,
    Joy.

  • How to avoid JS Error in the status bar when report doesnt contain value.

    Hi
    Whenever the tabular report doesnt show any records for the given input parameter (parameter passed using select list item).
    We are displaying error message in APex. But at the status bar, it is showing "Error" (unspecified
    error).
    Kindly let me know how to avoid this kind of error at status bar.
    Thanks
    Vijay

    Hi Vijay,
    Your javascript is probably trying to access one or more of the items within a displayed tabular form - the "f01", "f02" etc named items.
    If your script does something like:
    var x = document.getElementsByName("f01");
    ..rest of your code for f01 items..you can test if there are any "f01" items by doing:
    var x = document.getElementsByName("f01");
    if (x){
    ..rest of your code for f01 items..
    }If there are no items, x is null, so the "..rest of your.." script will not get executed and no errors will occur.
    Andy

  • How to avoid clear data in the block in a form

    Hi All
    I am using Oracle form 10g and db 10g.
    My form i have a list item in my main canvas. It has a value of (EXPENSE,AMOUNT,SUPPLIER,ACCOUNT).
    The user used to select the list item one by one and used to enter values in the each canvas assigned to the Item(expense,amount,supplier,account) and go for a save.
    For instance when the user enter the value in expense ,amount and supplier and again back when the user navigate back to amount the entered value get cleared.
    how to avoid the data get cleared.
    Thanks & regards
    Srikkanth

    you can use EXECUTE_QUERY built-in to populate the data when that canvas or block instance. If it need at block level write this at When New Block Instance. if it a tab page then you can write when tab page change. If need where condition, add block level where condition.

  • How to avoid blank page in the report?

    adding a field in the grouping and checking the page break option means then we are getting blank page as the first page of the report? How to avoid this blank page?

    Usually blank pages appear as first page due to the presence of filler lines (//////) on top of report header.Please ensure that the top header is exactely started from top of page itself.

  • How to put variable selection and the query result the same screen

    Dear all,
       how can I put the variable selection and the query result in the same screen? Please advise. Thanks.
    Jin Ming

    Not sure if you are saying you want the prompts on the same page as the results... however in 7.0 with BEx Analyzer, you can insert a text object from the design toolbar and assign it to the variable.... this way, lets say you run query for period 6, then the text object will display "6" on the same area where the query results are.

  • How is the address selected in the Customer Account Statement (F.27)?

    Hi expert,
    The customer account statement (transaction F.27) uses the address which is in the customer master data.
    This is the customer master data on the company code level (Street, postal code, city).
    Is it possible to select the PO address (PO box , postal code, city) in the account statepment?
    This data is also available on the company code level.
    Thank you for your feedback.
    Kind regards,
    Linda

    Hi,
    Customer Account Statement uses the below program :
    SAP13: Customer statement (single statement)
    Copy the same and change accorndingly.
    Your requirement can be done with the ABAP changes
    VVR

  • How to do multi select for the oracle forms textfields using openscript

    hi
    my scenario is to record  by selecting 3 order number same time and do copy of that in the oracle order management module.
    can anybody help me in to select the 3 order numbers and execute.
    thanks
    sudhiir

    hi Deepu,
    the code you have given is not working.
    Below is the code i have written
    Robot robot = new Robot();
    robot.keyPress(KeyEvent.VK_SHIFT);
    FORMS.TEXTFIELD(ORDER_NUMBER_0).CLICK
    FORMS.TEXTFIELD(ORDER_NUMBER_1).CLICK
    FORMS.TEXTFIELD(ORDER_NUMBER_2).CLICK
    robot.keyRelease(KeyEvent.VK_SHIFT);
    even after adding the above code it is clicking on the each text field instead of selecting all the three text field which is my requirement.
    i think their is some defect in openscript or my code is wrong.
    thanks
    sudhiir

  • How to avoid multiple selection in ALV tree control?

    Hi,
    Experts,
    I want to avoid multiple selections on Alv tree control after pressing control keyboard button(Ctrl). Even by pressing Ctrl keyword button i want to select only one row of a Alv tree control.i have used cl_salv_tree class for it is there any method to achieve this please pass some code/idea on it.
    Thanks in advance,
    Shabeer ahmed.

    I haven't tried it before but it should help.
    [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01]

  • How to extend data selection to the existing delta update without disturbin

    Is there any way to extend data selection to the existing delta update with out disturbing the delta mechanism? I mean, is there anyway to add new delta init for the new data selection to the existing delta update without disturbing?

    the scenario is we have existing delta, let's say, for the 2 company codes 0001 and 0002. I want to extract delta for the company code 0003 without disturbing the existing delta mechanism. I mean to say I want to extend the data selection for the existing delta from 2 comp codes (0001, 0002) to 3 company codes (0001,0002 & 0003) without disturbing the delta mechanism.

Maybe you are looking for