Give me best one

Hi Friends,
I have following query . Can you pls give best one in performance point of view and tell me why also..
*To fetch Material to BoM link related data
SELECT matnr stlnr FROM mast
       INTO TABLE it_mast
       FOR ALL ENTRIES IN it_fp
       WHERE matnr EQ it_fp-matnr AND stlal EQ c_stlal_01.
*To fetch Base Quantity of BOM from STKO
LOOP AT it_mast.
  SELECT SINGLE bmeng INTO it_mast-bmeng
       FROM stko
       WHERE stlnr EQ it_mast-stlnr.
  MODIFY it_mast.
ENDLOOP.
Thanks IN Advance,
Murali Krishna K

Murali,
Let us start with analysing your code.
<b>You have not mentioned the structure of internal table it_fp. Is MATNR a unique field in this table? If so ok, otherwise you will be looping at the database multiple times for the same material number. You must ensure that the selection criteria being used in a for all entries clause is unique. Secondly it is very important that you check for the emptiness of internal table it_fp before this select using the for all entries clause. If you don't and it_fp happened to be empty SAP will download all the records from database table MAST into your internal table. This will cause a performance issue and may cause a dump if the quantity of data being retrieved is larger than the default maximum size of the internal table set during installation of SAP by the BASIS people. Thirdly when you use a for all entries clause you should include all the primary key fields of table MAST in the field list of the select to avoid data loss.</b>
SELECT matnr stlnr FROM mast
INTO TABLE it_mast
FOR ALL ENTRIES IN it_fp
WHERE matnr EQ it_fp-matnr AND stlal EQ c_stlal_01.
*To fetch Base Quantity of BOM from STKO
LOOP AT it_mast.
<b>Use a select within a loop only if it is a select single on a fully buffered table. For all other cases do not use a select within a loop. Secondly do not use a select single unless your where clause has all the primary key fields, meaning do not use select single unless you are sure that you will get a single unique record. In your case STLNR is not the only primary key field. You should have used select up to 1 rows, however not within a loop. Thirdly always use the transporting clause while modifying an internal table within a loop. If not you will be modifying all the fields of the current record of the internal table with the data in the header of the internal table. This is an overhead. If you are changing just one value there is no need to modify all the fields of the internal table. The Transporting clause is used for precisely that reason. </b>
SELECT SINGLE bmeng INTO it_mast-bmeng
FROM stko
WHERE stlnr EQ it_mast-stlnr.
MODIFY it_mast.
ENDLOOP.
<b>If I were to write this same piece of code I would do so as follows. Please note that you will have to check and correct this code for syntax errors.</b>
DATA: it_fp_tmp   LIKE TABLE OF it_fp  ,
      it_mast_tmp LIKE TABLE OF it_mast.
IF NOT it_fp[] IS INITIAL.
  it_fp_tmp[] = it_fp[].
  SORT it_fp_tmp BY matnr.
  DELETE ADJACENT DUPLICATES FROM it_fp_tmp COMPARING matnr.
  SELECT stlnr
         matnr
         werks
         stlan
         stlnr
         stlal
   FROM mast
   INTO TABLE it_mast
   FOR ALL ENTRIES IN it_fp_tmp
   WHERE matnr EQ it_fp_tmp-matnr
   AND   stlal EQ c_stlal_01.
  IF sy-subrc EQ 0.
    SORT it_mast BY stlnr.
    it_mast_tmp[] = it_mast[].
    DELETE ADJACENT DUPLICATES FROM it_mast_tmp COMPARING stlnr.
    SELECT stlty
           stlnr
           stlal
           stkoz
           bmeng
      FROM stko
      INTO TABLE it_stko
      FOR ALL ENTRIES IN it_mast_tmp
      WHERE stlnr EQ it_mast_tmp-stlnr.
    IF sy-subrc EQ 0.
      SORT it_mast_tmp BY stlnr.
    ENDIF.
  ENDIF.
ENDIF.
*To fetch Base Quantity of BOM from STKO
LOOP AT it_mast.
  AT NEW stlnr.
    READ TABLE it_stko WITH KEY stlnr = it_mast-stlnr
                                BINARY SEARCH
                                TRANSPORTING
                                  bmeng.
  ENDAT.
  IF NOT it_stko-bmeng IS INITIAL.
    it_mast-bmeng = it_stko-bmeng.
    MODIFY it_mast TRANSPORTING
                     bmeng.
  ENDIF.
ENDLOOP.

Similar Messages

  • ITunes Cleaner - Any recommendations on the best one?

    ITunes Cleaner - Any recommendations on the best one?

    My suggestions would be to start with Volume Equalizing, to bring both speakers levels up to around the same point.  This might increase the noise level of any amplified portions, so my next suggestion would be a Noise Reduction pass.  I would probably recommend not using a captured noise profile for this, as the adaptive NR should help to address those changes, but it might be worth trying both and seeing which gives better results.
    Next, I'd suggest making EQ adjustments, and then Volume matching to a preferred source.  You could probably do these two different, but I'd be concerned that adjusting EQ levels on certain frequencies might make the file sound louder than the reference file.  Better to make it sound right at one level, and then adjust everything to match the reference track.

  • My iphone is at tech service and since it is in guarantee period most probably they will give a new one.Thats why I want to deactivate or sign out my apple ID from that Iphone. Please help me, what shoud I do?

    My iphone is at tech service and since it is in guarantee period most probably they will give a new one.Thats why I want to deactivate or sign out my apple ID from that Iphone. Please help me, what shoud I do?

    Wow... you seriously over paid for an iPhone.
    That probably explains why you have/had no clue you were purchasing a locked device and think it's an Apple problem to get it unlocked.

  • Can we give more than one value for an Authorization field in Auth-Check.

    Hi all,
    Can we give more than one value for an Authorization field in Auth-Check.
    Ex: AUTHORITY-CHECK OBJECT 'S_TRVL_BKS'
    ID 'ACTVT' FIELD '02'
    ID 'CUSTTYPE' FIELD <Value 1> <Value 2> <Value 3>.
    IF SY-SUBRC 0.
    MESSAGE E...
    ENDIF.
    If yes, please help me with exact syntax.
    Think it will be like
    ID 'CUSTTYPE' FIELD: <Value 1>, <Value 2>, <Value 3>.

    Hi,
    yes we can give more than one field.
    program an AUTHORITY-CHECK.
    AUTHORITY-CHECK OBJECT <authorization object> 
       ID <authority field 1> FIELD <field value 1>. 
       ID <authority field 2> FIELD <field value 2>. 
       ID <authority-field n> FIELD <field value n>. 
    The OBJECT parameter specifies the authorization object.
    The ID parameter specifies an authorization field (in the authorization object).
    The FIELD parameter specifies a value for the authorization field.
    The authorization object and its fields have to be suitable for the transaction. In most cases you will be able to use the existing authorization objects to protect your data. But new developments may require that you define new authorization objects and fields.
    please reward points, if it is useful.
    satish.

  • What version of Itunes is the best one for m4a encoding?

    What version of Itunes is the best one for m4a encoding?

    In that all versions of iTunes support ripping or converting to .m4a (both AAC and Apple Lossless) and in that the latest version is likely to included bug fixes and optimisations, I would say the answer is always going to be the latest version.
    An area where there maybe a need to consider using an older version is that older versions of Windows are no longer supported by the latest versions of iTunes. For example Windows 2000 is no longer supported but Windows XP and later still are.

  • Using camera accessory, I have imported photos to my iPad 3rd generation. By mistake I have imported multiple copies of same photos. Now if I want to delete additional copies I can't. It gives me only one option "Delete everywhere" instead of delete 1copy

    Using camera accessory, I have imported photos to my iPad 3rd generation. By mistake I have imported multiple copies of same photos. Now if I want to delete additional copies I can't. It gives me only one option "Delete everywhere" instead of delete one by one, so that I can keep one copy of that photo.
    Is there a way to delete additional copies of a photo and keeping only one?

    The links below have instructions for deleting photos.
    iOS and iPod: Syncing photos using iTunes
    http://support.apple.com/kb/HT4236
    iPad Tip: How to Delete Photos from Your iPad in the Photos App
    http://ipadacademy.com/2011/08/ipad-tip-how-to-delete-photos-from-your-ipad-in-t he-photos-app
    Another Way to Quickly Delete Photos from Your iPad (Mac Only)
    http://ipadacademy.com/2011/09/another-way-to-quickly-delete-photos-from-your-ip ad-mac-only
    How to Delete Photos from iPad
    http://www.wondershare.com/apple-idevice/how-to-delete-photos-from-ipad.html
    How to: Batch Delete Photos on the iPad
    http://www.lifeisaprayer.com/blog/2010/how-batch-delete-photos-ipad
    (With iOS 5.1, use 2 fingers)
    How to Delete Photos from iCloud’s Photo Stream
    http://www.cultofmac.com/124235/how-to-delete-photos-from-iclouds-photo-stream/
     Cheers, Tom

  • How toconvert multiple currency translation please give details in one repo

    how toconvert multiple currency translation please give details in one report

    Hi Venu,
    Yes you can do currency translation in update rule as well as in the bex query.
    please follow the below steps:
    business scenario
    you have records in different currencies and you want to convert them to a fixed target currency USD, using the avergae rate type 'M' on a monthly basis
    Step 1
    Create translation keys using RRC1. here you need to specify the source currency. "select source currency from data records"
    specify the target currency as USD
    choose the exchange rate type as 'M' and the translation should happen using 0CALMONTH
    Step 2
    create key figure 1 (KF1) that stores the amount in differnet curreny and it refers to 0currency. create another key figure (KF2) which has a fixed currency as USD. in the target cube you use 'KF2' and it is mapped from KF1.
    in the update rule just below hte currency mapping you can find the currency translation screen, use the translation key created in step 1
    Step 3
    if you have KF2 in your cube then you don't need any currency translation becoz you have already performed the translation in update rules. but if you have KF1 in your cube then you need to [erform the currency translation in bex. create a restricted key figure from KF1 (give it name as KF2). right click on the RKF and go to properties -> currency  translation -> select the translation key created in step 1.
    hope it helps.
    thanks
    soumya

  • 2010 iMac 2.93 i7 27" or 2011 2.8 i7 21.5" - which will suit better long-term?  I do a fair amount of audio, video editing and photoshop, but I have a limited budget.  What's going to give the best bang-for-buck for the next 3-5 yrs?

    I do a fair amount of audio, video editing and photoshop, but I have a limited budget.  What's going to give the best bang-for-buck for the next 3-5 yrs?  My current machine is a 13" Macbook unibody 2.4 Core 2 Duo w/ 4Gb Ram so it's time to move forward with more power and screen real estate!

    Hello, Jeff
    I could never edit on a 13" screen. I'm currently using a 17" MBP i7 Early 2011 as a fast replacement to my aged 20" Intel iMac.
    Both systems are not that far apart on stats and you will find that processing HD video will rely highly on the read/write to your storage. Myself, I'd be eye balling the 2011 for the Thunderbolt port so HD Video export/compression doesn't take forever! Currently processing a finished HD project for DVD uses at most 20% of my total CPU capacity. The FW800 drive is the big bottleneck! (I know I need at least a RAID to see a real speed boost).
    How good your eyes are and your usage style would dictate if the difference in screen size make a difference to you.

  • Hi pls give me any one update routine, transfer routine scenarios

    hi pls give me any one update routine, transfer routine scenarios for to telling interviews (easy scenario for interviews)

    Hi Venkat,
    Pls chk this nice paper:
    How To… Routines within Transformations
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6090a621-c170-2910-c1ab-d9203321ee19
    Pls chk this links for samples & Examples:
    http://help.sap.com/saphelp_nw04s/helpdata/en/e3/732c42be6fde2ce10000000a1550b0/content.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/43/c3963dfbde4dede10000000a422035/content.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/43/bcdb7801344defe10000000a422035/content.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/43/bcdc6001344defe10000000a422035/frameset.htm
    Hope this helps,
    Regards
    CSM Reddy

  • Hooking up a monitor  to m macbook pro ?what would give the best picture ??

    i just picked up a monitor to hook up to my macbook pro the moniter is 1080 p what would give the best picture vga or dvi ??? for full 1080 p
    Message was edited by: go lakers

    You want to go directly from the video out of your MacBookPro to DVI. Don't involve VGA if at all possible.
    Depending on the exact model MacBookPro you have, it has either a miniDVI out or a miniDisplayPort out.
    • For miniDVI out, all you need is a miniDVI-to-DVI cable or a miniDVI-to-HDMI cable.
    • For miniDisplayPort out, you will need the Apple miniDisplayPort-to-DVI adapter plus either a DVI-to-DVI cable or a DVI-to-HDMI cable to connect to your monitor.
    Again, what make/model monitor do you have?

  • Which adblock is the best one for Safari 5 ?

    Which adblock is the best one for Safari 5 ?
    I was recommend "Safari AdBlocker" and "Safari adblock". Is it worth to install both or another one app ? which one is best and why ?

    stamat --
    I would not recommend anything AdBlock.
    GlimmerBlocker is much better, and does not become outdated . . .
    For more info, see:
    http://glimmerblocker.org

  • I have an iphone 5, and the battery is so bad! I was just wonder if anyone had used an external battery before? are they good? can they do damage to your phone? what's the best one to get? any help would be great thanks!

    I have an iphone 5, and the battery is so bad! I was just wonder if anyone had used an external battery before? are they good? can they do damage to your phone? what's the best one to get? any help would be great thanks!

    I'd just like to say that ahs70's post on Dec 1, 2013 at 1:17am on Pg. 9 worked for me as well: https://discussions.apple.com/thread/5338609?start=120&tstart=0
    If your iPhone's battery is acting up you need to determine if it's a software issue or a hardware/battery issue.  To do that, after syncing your iPhone, erase/hard reset all data and settings from your iPhone to what it was from the factory as new.  This can be found in Settings/General/Reset/Erase All Content and Settings.  Then test it out for a day or two.  If it's still acting up then it's likely a hardware issue and you will need to get your battery replaced.  If your warranty is done than check out this link to get a battery kit to replace your iPhone battery yourself:  http://www.ifixit.com/Store/iPhone/iPhone-5-Replacement-Battery/IF118-001#produc tDescription
    If your iPhone is now working properly after hard resetting it than it's most likely a software issue.  This battery issue only started after upgrading to the new iOs7, so it is obviously related to the update not properly installing itself.  What has worked for me and many others is to manually update to iOS 7.0.4 using the full downloaded version of the update which is about 1.32 Gigs.
    But first you need to find out what model of iPhone you have, click here to determine if it's GSM or CDMA: http://support.apple.com/kb/HT3939?viewlocale=en_US&locale=en_US
    Then go here and scroll down to download the iOS 7.0.4 complete update for your device:  http://www.downloadios7.org/download-ios-7-0-4-ipsw-file.html
    Then scroll up on the download page and follow the instructions of updating your iPhone manually following the instructions below:  "IPSW with iTunes"
    And your done.
    Problem solved.
    I only posted this because it was a very frustrating problem that no one really seemed to figure out a solution for.
    I hope this helps.
    Emile Beaulieu

  • How can I move my data to a new macbook and give my old one to my child

    I am getting a new macbook air and want to give my old macbook pro 13 to my daughter.  I would like to remove all my data but keep the progrtams on it when I give it to her. I have a copy of office that is usable on up to two family computers. I have been using a 1.5Tb drive for both timemachine backup and storage of itunes movies and it is hooked up thru a thunderbolt display.
    Is there an easy way to pull all my files off the pro and move them to the air (they both have 500gb drives) and if I give my daughter the pro will she have to log in with my apple id to get the program updates?

    Doing what you recommended... now.
    I also need to (re)create the local users with a specific GeneratedUID for each one.
    I used "dscl . -read /Users/USERNAME GeneratedUID" command to get the UID of the old local users.
    What is the best way to do this
    Create the user and then update the UID?
    OR
    Create the user while specifying the UID at creation time?
    What is the command for each, i can't seem to dig up anything on google?

  • Joining 18 tables -- one at a time or in two stages ?? best one..??

    I have to join 18 tables,.. Is it best to join all 18 in a single shot or to go with
    multi stages-- 9 tables in one stage and after that anotther 9 tables..
    Please anyone give me a good suggestion on this with some reason...
    Thanks in advance

    If you can look at your query and recognise that it is trying to collect (say) two small result sets and then join the result sets, then it is actually a good idea to express the query in that fashion to Oracle.
    Take for example a query that sums last week's profits for a supermarket by department using a 9 table query in about 2 minutes. A similar query reports the previous week's profits with a marginally different query in about two minutes. You write the two queries as inline views and join them to report the percentage change in profit by department - and the query takes 4 hours because Oracle has used "complex view merging" to turn your two 9-table queries into a single 18-table query.
    In this case, a workaround is to use the /*+ no_merge */ hint. In outline, something like:
    select     {columns}
    from
         select /*+ no_merge */
              dept_no,
              etc.
         from     ...
         )     lw,
         select /*+ no_merge */
              dept_no,
              etc.
         from     ...
         )     pw
    where
         pw.dept_no = lw.dept_no
    ;In less obvious cases you may still be able to find that you can break up a big query into a few smaller, logical sections, and use this technique to generate and join what are, in effect, intermediate results.
    An alternative to the /*+ no_merge */ hint is to use subquery factoring to the same end. There's a more complex example of the method here: http://jonathanlewis.wordpress.com/2007/07/01/internet-sql/
    In either case, avoid turning your 18-table query into 18 separate pieces and sticking them back together - it may make the optimizer do some very silly things. Karen Morton mentions an example of this on her blog: http://karenmorton.blogspot.com/2008/06/dont-do-work-you-dont-have-to-do.html
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    "The greatest enemy of knowledge is not ignorance,
    it is the illusion of knowledge." (Stephen Hawking)

  • What settings give the BEST audio quality (original audio CD to iTunes)

    Further to my last post, can ya'll PLEASE help me get the bottom of this? I have heard so many different opinions & need to resolve ASAP....
    What pref' settings will give me the VERY BEST audio quality, when importing original audio CD's into iTunes 4?
    File size is of no issue (I have TONS of storage). I aim to import all at the highest quality possible (files need to be "broadcast quality" - for playing through a big PA system). I have been advised to either.....
    1. Import using the AAC encoder at a stereo bit rate of 320 kbps with a sample rate of 48.000 kHz.
    2. Import using AIFF (lossless uncompressed).
    3. Import using Apple Lossless (lossless compressed).
    WHICH ONE SHOULD I USE? Bearing in mind that the files will be played LOUD through a professional PA system & I'd prefer the crowd not to notice a significant diference between iTune files & orginal audio CD's (I will be spining both, side by side).
    Cheers - Sweetamix.

    You are finding out that the answer to this question tough. Everyone has their own opinion on this one.
    I saved the responses to a topic I opened six months ago on this same subject. I saved them and cut and pasted them into one document. Here were the answers I received. Good luck. bob
    Subject: Re: Classical Music & Bitrate
    Date: Sunday, June 26, 2005 11:12 PM
    To: <[email protected]>
    RE: Classical Music & Bitrate
    My experience with classical music (and music in general) is that the higher the bitrate, the better the quality and richness of the music. On the other hand, there is a limit to how much distinction your ears can make, and I think that anything above 192 kbps (mp3 format) is not significantly better (and not worth the larger file size). And in terms of volume adjustment, I personally have not found any need for it.
    RE: Classical Music & Bitrate
    I copied the same CD to my computer in 128, 160, 192, and 320 bitrates, and I couldn't tell a difference between any of 'em. I was listening to them with Grado SR60 headphones too.
    RE: Classical Music & Bitrate
    I’m sure you will get several if not many responses. You may also find they vary with the preference of the individual. However there are some rules of thumb. Generally speaking I think you will indeed find the higher the bit rate brings you closer to the CD sound.
    Certainly, 32-bit rate does not offer very good sound quality. Actually going from 32 to 320 should have been noticeably better, if not…. Then you’re in good shape. Because what you don’t know is there, can’t be missed.
    Also, the bit rate is only part of the equation. What format codec <http://docs.info.apple.com/article.html?artnum=51910> are your songs ripped to.
    Consider the following - iPod: About compatible song formats
    <http://docs.info.apple.com/article.html?artnum=61476>
    MP3 (from 32 Kbps to 320 Kbps)
    MP3 Variable Bit Rate (VBR)
    AIFF
    WAV
    M4A AAC
    Apple Lossless Encoder
    It sounds to me as though your songs may be in MP3 format. As a suggestion you might try ripping your CD’s to 128 AAC format. The general consensus is that AAC is better than MP3. Give it a shot…for the heck of it, and see what you think.
    Finally in the end…..it matters little what we all might think….If you think your sounds are better ripped at a MP3 320 bit rate……Great. If not…experiment, and play around till you find what sounds wonderful to you!
    RE: Classical Music & Bitrate
    Sorry for taking so long to get back to this thread: had two twelve-hour work days in a row.
    I did a Get Info on a typical piece in my iTunes and got this
    Kind: AAC Audio File
    Bit Rate: 128kb (have some at 192 & 2 or 3 at 320)
    Sample Rate: 44.100 kHz
    Profile: Low Complexity
    Channels: Stereo
    Volume: +2.3
    I was troubled that one responder couldn't tell the difference among 128, 160, 192, and 320 bitrates even using Grado SR60 headphones!
    And another seems to be of a similar opinion when he says that I think that anything above 192 kbps (mp3 format) is not significantly better (and not worth the larger file size). Does this apply to AAC format, too?
    However, I am going to continue to add tunes at the 320 bitrate - for a while - because I swear that I can tell a difference when I play them over my car radio via the cassette adapter.

Maybe you are looking for