Need some input on comparision btw sorted and std table.

Hi,
Just a small comparision on using standard table, sorted table, and sorted table using index in a loop with where conditions.
I just ran this report to find out the time taken and it is quite surprising. Case 3 of the program is quite faster than case2 and of course very fast than case1. any inputs on how this is possible???
output value :
try 1: 674, 192, 147 for 100 entries.
try 2: 603, 53 , 6 for 20 entries.
*C-- Small report to compare sorted and standard table.
REPORT  zloopcompare.
TYPES : BEGIN OF tp_marc,
          werks TYPE marc-werks,
          matnr TYPE marc-matnr,
        END OF tp_marc.
DATA : t_marc TYPE STANDARD TABLE OF tp_marc.
DATA : t_marc1 TYPE SORTED TABLE OF tp_marc
WITH NON-UNIQUE KEY werks matnr.
DATA : wa_marc TYPE tp_marc.
DATA : p1 TYPE i,
       p2 TYPE i.
DATA : l_tabix TYPE sy-tabix.
DATA : count TYPE i.
PARAMETERS : p_werks TYPE marc-werks OBLIGATORY.
SELECT werks matnr FROM marc
INTO TABLE t_marc1
UP TO 1000 ROWS.
t_marc[] = t_marc1[].
*Case1 - standard table with where condition.
GET RUN TIME FIELD p1.
LOOP AT t_marc INTO wa_marc
WHERE werks EQ p_werks.
ENDLOOP.
GET RUN TIME FIELD p2.
p2 = p2 - p1.
WRITE : / p2.
*Case2- sorted table sorted as per the where condition.
GET RUN TIME FIELD p1.
LOOP AT t_marc1 INTO wa_marc
WHERE werks EQ p_werks.
ENDLOOP.
GET RUN TIME FIELD p2.
p2 = p2 - p1.
WRITE : / p2.
*Case3- using index to get faster access.
GET RUN TIME FIELD p1.
READ TABLE t_marc1 INTO wa_marc WITH KEY werks = p_werks.
IF sy-subrc EQ 0.
  l_tabix = sy-tabix + 1.
  LOOP AT t_marc1 INTO wa_marc FROM l_tabix.
    IF wa_marc-werks NE p_werks.
      EXIT.
    ENDIF.
  ENDLOOP.
ENDIF.
GET RUN TIME FIELD p2.
p2 = p2 - p1.
WRITE : / p2.

HI sharath,
I just checked and executed the code :
1. case 1 and 2 are fine.
2. but 3 is not what u desire.
  <b>(in fact its not looping at all)</b>
3.  the code in case 3 is :
IF wa_marc-werks NE p_werks.
EXIT.
ENDIF.
So the loop goes inside ONLY ONCE,
and so, hence, its LIGHTNING FAST.
Please note that READ TABLE reads only
1 record.
4. ***************
Instead of NE
write this, and u will see that its not so fast.
<b>IF wa_marc-werks = p_werks.</b>
EXIT.
ENDIF.
regards,
amit m.

Similar Messages

  • I need some advice about the macbook pro and iPhone 5. I took a video on my iPhone and tried to email it it said it was too big to send? So i downloaded it to my macbook pro and tried to mail it to no avail? The macbook tells me the server won't let it th

    I need some advice about the macbook pro and iPhone 5.
    I took a video on my iPhone and tried to email it it said it was too big to send? So i downloaded it to my macbook pro and tried to mail it to no avail? The macbook tells me the server won't let it through other mail goes through any ideas how to resize it or what it might take to send it?

    I agree with LowLister, the best option for you to share the video online is to upload it to your online storage account for example : Box, Dropbox, SkyDrive (All of them provide free storage beginning from 2GB).
    You can upload the files which you want to share in this online storage and then they have sharing options in which you'll will get the link of the file to be sent and send the email. You're good to go!
    Tip : You can store multiple files for backup purposes.

  • TS2634 Please People I need some help.My iPod is disabled and when I connect it to iTunes it says: Itunes could not connect to the ipod because it is locked with a passcode...

    Please People I need some help.My iPod is disabled and when I connect it to iTunes it says: Itunes could not connect to the ipod because it is locked with a passcode...how can I do it?

    Place the iPod in Recovery mode and then restore.

  • I need some information about jre 1.5 and jre 1.6.

    Hello guys,
    I need some information about jre 1.5 and jre 1.6.
    Suppose if i have jre 1.5 customized with "additional language support" installed in my my desktop, and later on i install jre 1.6. will this jre over write all the esisting settings which was present in jre 1.5?
    In short will the version upgrades disable the features of the old Version even though the old version is present in the desktop?
    Thanks in advance for your answers.

    In <2j_j3.1889$[email protected]> =?iso-8859-1?B?VG9t4XMgU3XhcmV6?= writes:
    > Hi all, I am developing an acquisition data system for biomedical
    >signals and I need to transmit this data from my hardware to PC using the
    >USB port. For this, I am writing a device driver for Windows 98
    ^^^^^^ ^^^^^^ ^^^^^^^ ^^
    That's not a trivial step. I would write a small C/C++ program that
    exercises your driver (for robustness) just to be sure it's working
    right first without crashing your system.
    >The problem is that I don't know to use this driver in LabView.
    >For now, I think to use a "code interface node" with code writen in C or a
    >"call library function" with a DLL.
    That's correct. _After_ you got your C/C
    ++ test program (and USB
    driver) above working, then you can convert this little test program
    into a DLL or CIN, which can interface with LabView. A DLL might be
    easier (slightly) to write, but the CIN will work faster with LabView
    and can be designed to be reentrant. The Code Interface Reference
    Manual should guide you. Remember, this is a task for an _experienced_
    C programmer. You'll need to use handles to pointers into all your
    dynamic arrays and such passed into LabView.
    After you got your CIN or DLL written, you can use a special CIN
    function node to "link" (or bind) your CIN object into LabView's VI
    diagram.
    SOME THOUGHTS:
    There are many hardware devices already on the market today that come
    with Windows 98 drivers and DLL (or even CIN) libraries that would work
    immediately with LabView. Why don't you save yourself three months of
    work and simply buy one of these?
    /\ Mark M Mehl, alias Superticker (Supertickler to some)
    <><> Internet: [email protected]
    \/ Preferred
    UUCP: uunet!iastate.edu!mehl
    Disclaimer: You got to be kidding; who would want to claim anything I said?

  • I Need some Itractive Reports not using alvs and any other advanced

    I Need some Itractive Reports not using alvs and any other advanced topics like include and any other i need simple Intractive reports.

    Hello,
    Check this sample reports:
    Program name                   Report title
    DEMO_LIST_INTERACTIVE_1        Creating Detail Lists
    DEMO_LIST_INTERACTIVE_2        List Administration
    DEMO_LIST_INTERACTIVE_3        Page Headers in Detail Lists
    DEMO_LIST_INTERACTIVE_4        Messages in Lists
    If useful reward,
    Vasanth

  • What is the difference between standard,sorted and hash table

    <b>can anyone say what is the difference between standard,sorted and hash tabl</b>

    Hi,
    Standard Tables:
    Standard tables have a linear index. You can access them using either the index or the key. If you use the key, the response time is in linear relationship to the number of table entries. The key of a standard table is always non-unique, and you may not include any specification for the uniqueness in the table definition.
    This table type is particularly appropriate if you want to address individual table entries using the index. This is the quickest way to access table entries. To fill a standard table, append lines using the (APPEND) statement. You should read, modify and delete lines by referring to the index (INDEX option with the relevant ABAP command). The response time for accessing a standard table is in linear relation to the number of table entries. If you need to use key access, standard tables are appropriate if you can fill and process the table in separate steps. For example, you can fill a standard table by appending records and then sort it. If you then use key access with the binary search option (BINARY), the response time is in logarithmic relation to
    the number of table entries.
    Sorted Tables:
    Sorted tables are always saved correctly sorted by key. They also have a linear key, and, like standard tables, you can access them using either the table index or the key. When you use the key, the response time is in logarithmic relationship to the number of table entries, since the system uses a binary search. The key of a sorted table can be either unique, or non-unique, and you must specify either UNIQUE or NON-UNIQUE in the table definition. Standard tables and sorted tables both belong to the generic group index tables.
    This table type is particularly suitable if you want the table to be sorted while you are still adding entries to it. You fill the table using the (INSERT) statement, according to the sort sequence defined in the table key. Table entries that do not fit are recognised before they are inserted. The response time for access using the key is in logarithmic relation to the number of
    table entries, since the system automatically uses a binary search. Sorted tables are appropriate for partially sequential processing in a LOOP, as long as the WHERE condition contains the beginning of the table key.
    Hashed Tables:
    Hashes tables have no internal linear index. You can only access hashed tables by specifying the key. The response time is constant, regardless of the number of table entries, since the search uses a hash algorithm. The key of a hashed table must be unique, and you must specify UNIQUE in the table definition.
    This table type is particularly suitable if you want mainly to use key access for table entries. You cannot access hashed tables using the index. When you use key access, the response time remains constant, regardless of the number of table entries. As with database tables, the key of a hashed table is always unique. Hashed tables are therefore a useful way of constructing and
    using internal tables that are similar to database tables.
    Regards,
    Ferry Lianto

  • Sorted and hashed tables

    what happens when duplicate entries are present in sorted and hashed tables?

    Hi,
    Sorted internal tables can be of two types:
    unique or non unique.
    If u enter duplicate records in Sorted tables with unique  it will show error.
    If u enter duplicate records in Sorted tables with  non-unique key it will not show error.
    Hashed tables are with only unique key
    so no way to enter the duplicate records.
    for more information see the following link
    http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/content.htm
    Reward if helpful.
    Jagadish

  • Comparision btw Struts and JSTL tags

    Hi,
    Is there any article or helpful information that any body have come across that have good comparision between struts and JSTL tags? I am trying to find similar JSTL tags to my struts application.
    Any help in this regard is appreciated.
    Thanks,
    -jon

    You can't use JSTL to replace struts completely. The struts tags and the JSTL tags have some overlap in the logic, control flow and formatting bits, but there is a lot that struts does that JSTL doesn't (the input controls).
    Struts-el was a bridge between Struts and JSTL for JSP1.2 containers.
    It has a very limited use nowadays. Most applications should be being written in J2EE1.4 (Servlet 2.4/JSP2.0), and thus the requirement for the struts-el tags is not there - the container understands EL without special tags required.
    As I said before you should only use Struts-EL if
    - You are stuck with a J2EE1.3 (Servlet2.3/JSP1.2) container
    - You want to use EL with struts.
    For myself, I prefer using the EL expression like ${expr} rather than older <%= expr %>, but it comes down to personal preference.
    Cheers,
    evnafets

  • Environment PATH is corrupted, need some expert RVM ruby version manager and environment PATH

    I have some serious issues with my ~/.bash_profile and I think I just figured out what it is.   I have a ~/.bash_profile for myself as a normal user and another one as root user.  They should be the same.  I am the administrator and the regular user and anything I do as root I should be able to do as a user in the least case it should work as root user.
    I really munged editing my path so I'm trying to reconstruct what I did and what I need it to do.  I would just like to get it back to where it was and add RVM and Sproutcore to my PATH.  That is all I need to do.  To explain it though I have to walk you through what I did wrong.
    1.  This is how my ~/.bash_profile is as a regular user .  I thought this should work with adding the two new programs to my path  RVM and Sproutcore.  So far not so good.
    export PATH=/usr/local/zend/bin:/usr/local/zend/mysql/bin:/users/jr/.rvm/bin:/usr/loca l/sproutcore:$PATH
    alias zf=/usr/local/ZendFrameworkCLi/bin/zf.sh
    2.  This is how my ~/.bash_profile is as the root user.  AS you can see I was going through the RVM install I guess a couple of times and it added something to my path.  This mostly looks right to me though.  I want my zend server to still work I probably added /usr/local/sproutcore to the end.  I don't know if that is right.  maybe I was supposed to do export $PATH and all that instead of just adding it to the end but that is what I did.
    sh-3.2# vi ~/.bash_profile
    PATH=$PATH:/usr/local/zend/bin:/usr/local/zend/mysql/bin:/usr/local/lib:/usr/loc al/sproutcore
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/zend/lib
    zf=/usr/local/ZendFrameworkCli/bin/zf.sh
    [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # LOAD RVM function
    [[ -S "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
    To make matters worse when you think it can't get worse.  I have another .bash_profile
    in
    /var/root/
    PATH=$PATH:/usr/local/zend/bin:/usr/local/zend/mysql/bin:/usr/local/lib:/usr/loc al/sproutcore
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/zend/lib
    zf=/usr/local/ZendFrameworkCli/bin/zf.sh
    [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # LOAD RVM function
    [[ -S "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
    ~     
    which looks strangely like the .bash_profile when I log in as root in my home directory.
    Also there is a .bashrc in the /var/root directory.  Here it is:
    export PATH=/usr/local/bin:/usr/localsbin:/usr/local/bin:/usr/local/sbin:~/bin:/usr/bi n:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/ant/bin:/usr/local /zend/bin:/usr/local/zend/mysql/bin:/Users/jr/.rvm/src/ruby-1.9.3-p194:/usr/loca l/sproutcore
    ~               
    I even thought of going to the environment.plist and editing it in Xcode but I don't know what the key value pairs should be if it can be fixed otherwise then we can skip that step.
    This is what I need to work as well as adding the path to sproutcore but this is the error I get when running it and it is installed correctly.
    RVM is not a function, selecting rubies with 'rvm use ...' will not work.
    You need to change your terminal settings to allow shell login.
    Please visit https://rvm.io/workflow/screen/ for example and their manual says this, so I need the RVM to work with the shell this way below.
    Can someone help me get the shell down below working in conjunction with my .bash_profile ? 
    This is the manual page on that error message: 
    Using RVM inside GNU Screen
    RVM should work out of the box with screen as long as you have your profiles configured correctly. The easiest way to ensure it's working is to make screen use a login shell by placing the following in your ~/.screenrc file:
    shell -${SHELL}
    Sincere thanks to a very helpful community in the past, Janis
    This is on a Macbook Pro with OS 10.6   THanks again,

    Hi KenO,
    Try the mentioned steps:
    1. Open command prompt in elevated mode(Run as admin)
    2. Go to the .msi and run the command msiexec.exe /i "name of package.ms
    Let me know whether it worked.
    Regards,
    Romit Sinha

  • Need some inputs

    hi,
    I have created a web service wherein on submitting the employee name, i can get the balance in the account of the employee.
    my service communicates with database which is an excel sheet. and the client is a servlet which invokes the service.
    hi all,
    I have created a web service wherein on submitting the employee name, i can get the balance in the account of the employee.
    my service communicates with database which is an excel sheet. and the client is a servlet which invokes the service.
    i have used Apache soap implementation for this.
    I have tried this out of my interest and want to get some inputs as where does this application stand.
    Also if anyone can tell me wht can be a real world financial application which i can try making as web service.
    How can i make this available on the net.
    any help would be highly appreciated.
    Thanks and regards
    neha

    Generally webservices are more useful in solving business application in which multiple organizations are involved. Suppose if one organizations creates the services they perform as webservices the other organization can use those services. For example customer order servise, health insurance and all. Better you send a mail to mail id then I can help you more. [email protected]

  • Need some input about a class I'm making.

    Hi guys.
    Take a look at this class:
    public class MyClass {
    public static final byte A_PARAM1 = (byte)0x80;
    public static final byte B_PARAM2 = (byte)0x40;
    public static final byte A_PARAM2 = (byte)0x20;
    public static final byte B_PARAM2 = (byte)0x10;
    public MyClass(byte param1, byte param2) {
    // Other functions go here...
    }As you can see from the code the constructor takes two byte's. I wanted the static variables to be the values for that constructor A/B_PARAM1 and A/B_PARAM2 for param1 and param2 respectively. It depends on the parameters (bytes) on what other behaviour the class will have. You know, A_PARAM1 OR'ed(bitwise) with B_PARAM1. I'm sorry if I'm not making any sense as I'm not that good with explaining things.
    I'm sure that most of you can already see some problems with this approach. For one, typesafety. Is that the correct term for that? Another problem is I'll be making a lot of these classes and each will have a different number of parameters for them. One or two can have as much as 5 parameters.
    One solution I'm thinking about is to have the parameters(mostly just byte's) represented as a class. Maybe an generic abstract class with just simple functions of getting and setting the value. The different subclasses will contain the static variables. I was also thinking that the class that will be using it as values will be the only one that can create the subclasses of the abstract parameter class.
    I don't know. Am I making any sense?
    Anyway. Could anyone give me some input? Am I doing this right or is it just too much that I should just stick with what I'm currently doing? How would you go on with the problem?
    Thanks in advance.

    Hello again. The EnumSet class is making me scratch my head a bit.
    I'd like to return to my initial idea of extending a class that will represent a parameter. Take a look at this:
    public class MutantCarThing {
         public static final byte HAS_EYES = (byte)0x80;
         public static final byte HAS_NOSE = (byte)0x40;
         public static final byte HAS_TEETH = (byte)0x01;
         public static final byte ONE_WHEEL = (byte)0x80;
         public static final byte ONE_DOOR = (byte)0x40;
         public static final byte HAS_WINDSHIELD = (byte)0x01;
         private byte facialFeaturesParam;
         private byte carFeaturesParam;
         public MutantCar(byte facialFeaturesParam, byte partsFeaturesParam) {
              this.facialFeaturesParam = facialFeaturesParam;
              this.partsFeaturesParam = partsFeaturesParam;
              // Stuff
    public class MutantCarMaker {
         public void make() {
              // Mutant car that has only eyes and one wheel.
              MutantCar mc = new MutantCar(MutantCar.HAS_EYES, MutantCar.ONE_WHEEL);
              // Mutant car with a nose, eyes, and only one door.
              MutantCar mc = new MutantCar(MutantCar.HAS_NOSE | MutantCar.HAS_EYES, MutantCar.ONE_DOOR);
              // Etc...
    }This is just an example and as I've said earlier, I'll be writing lots of these classes. The good thing here is that all of them have some common behaviors, both the xxThing and xxMaker class. I'll just make a base abstract class and extend. My only dilemma is the darn parameters (eg. facialFeaturesParam, carFeaturesParam). One xxThing class can have as much 5 parameters(usually as byte) and have a completely different names for the bit flags for each byte. That's why the idea of a Parameter class came to mind. I'm having a hard time grasping EnumSet.
    I guess what I want to do is just to make instantiating a xxMaker object more simple.
    xxMaker xm = new xxMaker(xxMaker.BFLAGA1 | xxMaker.BFLAGA2 | xxMaker.BFLAGA3 | xxMaker.BFLAGA4,
                                  xxMaker.BFLAGB1 | xxMaker.BFLAGB2 | xxMaker.BFLAGB3,
                                  xxMaker.BLFAGC1 | xxMaker.BFLAGC2);Ugly isn't it? I just want to make this more cleaner and more structured.
    So is my idea ok or is it totally off/unnecessary/stupid? How would any of you guys here do it? Or should I really get myself to use EnumSets?
    Edited by: romainechester on Nov 15, 2007 6:28 PM
    Edited by: romainechester on Nov 15, 2007 6:36 PM

  • Need some help with a Macally enclosure and a spare internal drive

    Need some help with a Macally enclousure
    Posted: Oct 1, 2010 10:55 AM
    Reply Email
    Aloha:
    I have a Macally PHR-S100SUA enclousure that does not recognise,my WD 1001fals hard drive. It has worked just fine with other internal drives, but not this one?
    This is a spare internal drive that I am trying to make an external drive to store back ups for a lot of data. But so far I can not get it recognized by the computer. Maybe I need different drivers?
    Any suggestions?
    Dan Page

    Hi-
    Drivers aren't typically needed for external enclosures.
    Macally has none listed for that enclosure.
    The same is true for the WD drive, internal or external; no drivers.
    With the exception of high end PM multi drive enclosures, I can't think of any that use drivers.
    How is the external connected?
    Have you tried different cables, different ports?
    Bad/damaged cables are fairly common.
    Have you verified connections inside of the enclosure?

  • Need some inputs to work on OWB 9.0.4 mappings

    In existing source data base tables client added new column and I have to update this table with target table.
    How to update source and target tables . which transformation do I need to use between source and targets and we are using oracle OWB 9.0.4

    Hi,
    Re-import the source table (it will be in the OWB registry with new column).
    Modify the target table by adding the new column and deploy it.
    In the mapping synchronize both the objects (i.e. source and target table).
    With regards to transformation it depends what exactly you want to do, if you do not want to change any thing no need of any transformation directly map the new source column to the new column of the target table.
    How about migrating to OWB 10gr2, it is easier and better option.
    Cheers,
    - Mohammed

  • We are on SCM5.0, and want to upgrade R3 from 4.6B to ECC6, need some input

    Hello All,
    Can anyone please offer any suggestions/pitfalls/documentation, etc with regards to the following:
    We have upgraded our APO3 system to SCM5 1 year ago
    We had been using R3 system 4.6b, and everything was working fine.
    Now we are going to upgrade 4.6b to ECC6.
    When we upgrade to ECC6, do we have to blow away all transaction data in SCM5 and reload since the logical system names for CIF will be different once we move from 4.6b to ECC6?
    Can anyone point me in the right direction to the approach to dealing with this from an upgrade perspective?
    Regards,
    Stella

    Hi Stella
    I would recommend you to look into the MasterGuide for SAP SCM (see http://service.sap.com/instgudies -> SAP Business Suite Applications -> SAP SCM). This guide deals with the relevant parts of SAP ERP 6.0 also.
    regards
    Andreas Rudolph

  • I need some input from the iphone community with regards to an App that I'm looking for.

    If anyone has any suggestions I'd appreciate it. If I'm posting in the wrong place, I apologize.
    Many times I take pictures of schedules, reciepts, or itinerary and send it via mms or e-mail to my daughter @college. Often I'd like to "highlight" specific info on the picture, but the apps that let me do this only offer this feature on a PDF file. (I already have goodreader) I have the app Labelbox which would be great in this instance, (I can place labels anywhere on a photo) however, none of the labels they provide are transparent/flourescent. Drawing apps are messy and don't provide the kind of coverage I need for neat highlighting of specific words or sentences. In short, does anyone know of an app that will let me place transparent labels on specific places on a photo? (Being able to change the width or length would also be an added bonus)
    TIA

    Yes. However, some folks like to use the Combo OS updates directly from Apple's Download site rather than going through Software Update.
    BTW: Have you checked the places where you keep your music CDs if you have any?
    If you are using a computer desk, the insall discs should always be kept in a safe place not to far from your computer or at least in a place where all your other computer stuff is.
    All of my CDs relating to my computers are kept in a CD/DVD binder inside my computer desk drawer.

Maybe you are looking for

  • Unity voice message

    Hi I have a Unity 5.0 with an Exchange 2007 as a message store partner, when the Unity sends the voice message and the subscribers open the mail in the outlook, the attachment is the subject of the email with an envelope at the left, and to see the .

  • I have an HP Laserjet M1319f MFP scanning problem

    I have an HP Laserjet M1319f MFPand ever since I moved from Windows XP to window7 it won't give me the option to scan to PDF

  • You guys helped me diagnose, now I'm hoping you can help me with the fix!

    I found out through the help of this forum that the hard drive in my original G5 iMac had failed. I ordered a new Serial ATA hard drive (Seagate Barracuda) and installed it without incident. The thermal sensor assembly (which I have read is a big iss

  • Maximum Memory Size & Memory Size

    Will a server's memory automatically increase from Memory Size to Maximum Memory Size as the VM requires it? Or is this only valid for adding memory to the Memory Size value manually?

  • Import Command background functionality

    Hello. I want to know that after Copying our custom application pages to Server why we use Import command from our machine ? What does this command do ? Regards Ajay