Let me know when we use only CASE not IF statement?

Hi Folks,
What are the scenarios where a “CASE” statement cannot be used but the “IF” statement can be used? plz give me an example.
Thanks.
Naresh

HI Naresh,
CASE
Basic form
CASE f.
Effect Case distinction.
Depending on the current contents of a field, this statement executes one of several alternative processing branches. The field whose contents determine how the subsequent processing is specified after CASE ; the individual processing branches are introduced by WHEN , followed by the value to be tested. The entire block is concluded by ENDCASE . The structure of the CASE statement is as follows:
CASE f.
  WHEN f1.
  WHEN f2.
ENDCASE.
On reaching such a CASE statement, the processor compares f with f1 .
If f = f1 , it executes the processing block between " WHEN f1. " and the next WHEN statement. If there are no further WHEN statements, it executes the processing block up to the ENDCASE statement and then continues with any subsequent processing.
If f <> f1 , the processor compares the field f2 in the next WHEN statement with f and proceeds as with f1 and so on.
Although f should be a variable, f1 can be a variable or a literal. For the comparison " f = f1 ", the rules are the same as for IF .
There is a second variant of the WHEN statement:
WHEN OTHERS.
No more than one such WHEN statement is allowed within a CASE block. The " WHEN OTHERS " processing block is always concluded by ENDCASE , i.e. no further WHEN statements can follow.
The " WHEN OTHERS " processing block is executed only if none of the preceding WHEN blocks have been executed, i.e. if all previous comparisons (" f = ... ) have returned a negative result.
Example
DATA: ONE   TYPE I VALUE 1,
      THREE TYPE P VALUE 3.
DO 5 TIMES.
  CASE SY-INDEX.
    WHEN ONE.
      WRITE / 'That is'.
    WHEN 2.
      WRITE   'a'.
    WHEN THREE.
      WRITE 'good'.
      WRITE 'example'.
    WHEN OTHERS.
      WRITE '!'.
  ENDCASE.
ENDDO.
Output: " That is a good example ! ! "
Notes
You can nest several CASE statements and even combine them with IF statements.
The statement " WHEN: f1, f2. " does not make sense. The example below shows that the block belonging to " WHEN f1 " is empty:
WHEN f1.
WHEN f2.
Regards,
Santosh

Similar Messages

  • Please let me know when unlocked iphone 5 is going to lunch in Florida, USA and what is price for that...

    Please let me know when unlocked iphone 5 is going to lunch in Florida, USA and what is price for that...

    Only Apple knows. This isn't Apple.  But I have heard rumours that the unlocked iPhone 5 is due to take a light supper around seven o'clock.

  • Let us know when you personally receive the ICS OTA update!

    We are all tired of frequently Googling for when Verizon is going to officially release the Ice Cream Sandwich OTA update for our HTC Rezounds. Please feel free to add to the discussion about the update, but most importantly, let us know when you personally receive the ICS OTA update!
    ...so we can stop wasting valuable hours every day just Googling...

    xnavflyer wrote:
    The only reason I bought the Rezound was because the sales person assured me it would be getting the ICS update in April.  LIES, LIES, LIES.  Will be very glad when my contract is up!!!
    That surely can't be the only reason...the HTC Rezound is a BEAST! With or without ICS.

  • My usb that i have been using on my computer for a while suddenly stopped working, but is still glowing and letting me know that it is connected, but not showing up in disk utility

    my usb that i have been using on my computer for a while suddenly stopped working, but is still glowing and letting me know that it is connected, but not showing up in disk utility

    Either the physical drive or the enclosure electronics has failed. The light you are seeing is powered by the USB connection, the power, electricity, all USB ports put out. That doesn't mean the actual physical hard drive or the USB to SATA bus electronics are working properly. If it doesn't show in Disk Utility then it is DEAD.
    Most of the time it is the enclosures electronics that fail. Removing the physical drive from the enclosure and put it in another enclosure or using a SATA to USB adapter, one that has it's own AC power supply, might allow you to get the files off the drive.

  • I like to know when i use fire fox why it take so much resource of my computer ? it almost 1/4 of my 4gig of memeory , ihave 6,7 page of firefox window open

    i like to know when i use fire fox why it take so much resource of my computer ? it almost 1/4 of my 4 gig of memory , i have 6,-8 page of firefox window open at cpu level its is almost 25% been used up. i see its taking too much resource i wonder why ?? how not to take so much and it crashes often.. any help,ive 24.0 ,

    Firefox add-ons take some memory. This amount varies depending on the add-on.
    '''Try Firefox Safe Mode''' to see if the problem goes away. Safe Mode is a troubleshooting mode, which disables most add-ons.
    ''(If you're not using it, switch to the Default theme.)''
    * On Windows you can open Firefox 4.0+ in Safe Mode by holding the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * On Mac you can open Firefox 4.0+ in Safe Mode by holding the '''option''' key while starting Firefox.
    * On Linux you can open Firefox 4.0+ in Safe Mode by quitting Firefox and then going to your Terminal and running: firefox -safe-mode (you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
    * Or open the Help menu and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    [[Image:FirefoxSafeMode|width=520]]
    ''Once you get the pop-up, just select "'Start in Safe Mode"''
    [[Image:Safe Mode Fx 15 - Win]]
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    Does this decrease the memory usage? Please report back soon.

  • How can I get my iPhone to let me know when I get an email from Outlook?

    How can I get my iPhone to let me know when I get an email from Outlook?

    You don;t get an e-mail from outlook.
    Outlook is just an e-mail client, just like the mail app on the iphone.
    Your e-mail comes into your e-mail account, which you access from both Outlook and the Mail app.
    What are you trying to accomplish?

  • When I stream a movie via Apple TV from my iPad Air into my Samsung TV, I'm getting the "soap opera" effect. This only happens when I use Apple TV, not when I view a movie directly through a cable channel. Is there a way to eliminate this effect?

    When I stream a movie via Apple TV from my iPad Air into my Samsung TV, I'm getting the "soap opera" effect. This only happens when I use Apple TV, not when I view a movie directly through a cable channel. Is there a way to eliminate this effect?

    I'm having the same problem.  It's not an issue with my TV, i've turned this feature off.  I've tried playing with the ATV display settings but nothing works.  When I stream netflix from my Samsung bluray player, I don't get the soap opera effect, but when I stream any video from the ATV, the soap opera effect is there.  I'm thinking it's a choice that Apple made, but I really wish it could be turned off.  Not a lot of people are searching for this, because it can be easy to overlook, but it's driving me nuts!

  • When I use my EE4G in the States, exactly how do I dial a local U.S. number?

    When I use my EE4G in the States, exactly how do I dial a U.S. number? I will be arriving in Philadelphia and changing planes to go to New York. I want to be able to phone my host in NY when I arrive in Philly, to let them know I've arrived all right and that I've made it to my connecting flight. I get very stressed when travelling and need to make sure I know precisely how to dial. Do I still add the country code? Are there any other differences for dialing NY from the States as opposed to the UK?  Is there anything else special that I must do?

    Yes, you always need to dial the number in the full international format including the country code then the area code followed by the number.
    So for example, to dial a number in Manhattan, New York (different areas of New York have different area codes as we have), you enter it as +1 (the US country code) followed by the area code (Manhattan is either 212, 646 or 917) followed by the full number.  To get a + sign press and hold down the 0 (zero) button for a few seconds.  You don't drop any digits off US numbers when dialing them in the international format like you have to for UK numbers.
    Example, dialing lets say the W New York Times Square hotel which is (212) 930 7400, you enter it as +1 212 930 7400

  • HT201415 I want to purchase a month of cellular service for my IPAD2.  When I use my ITunes password,  it states that I have the wrong password but does not offer a way to reset my password.  Please advise.

    I want to purchase a month of cellular service for my IPAD2.  When I use my ITunes password,  it states that I have the wrong password but does not offer a way to reset my password.  Please advise.

    Read through this link and maybe you'll see something that will help you:
    http://www.tech-recipes.com/rx/5827/ipad-3g-activating-purchasing-att-cellular-d ata-for-the-ipad-3gwifi/

  • You sent me a notice letting me know that adobe forms central will not continue any more. What tool will replace it? How can I continue creating forms? Thanks for your responses.

    You sent me a notice letting me know that adobe forms central will not continue any more. What tool will replace it? How can I continue creating forms? Thanks for your responses.

    Hello Chalo,
    There are many FormsCentral alternatives. Our solution, JotForm, has the most complete Import Wizard both for your forms and for your response database.
    http://www.jotform.com/formscentral/

  • Can I answer this inqury using minus or not in statement?

    Hi everyone,
    I'm trying to solve a inquery, here's the ERP [http://www.flickr.com/photos/78615233@N04/7201804950/]
    and here's the relational schema
    CRUISE
    CRUISEID CHAR (6 BYTE)
    * CRUISE_DEPT DATE
    * CRUISE_RETURN DATE
    * CRUISE_PAY NUMBER (6,2)
    * CRUISE_DIR VARCHAR2 (10 BYTE)
    PASSENGER
    PASSID CHAR (6 BYTE)
    * PASS_LN VARCHAR2 (20 BYTE)
    * PASS_FN VARCHAR2 (20 BYTE)
    * PASS_ADD VARCHAR2 (20 BYTE)
    * PASS_DOB DATE
    * PASS_EMG_CONTACT NUMBER (10)
    NATIONALITY VARCHAR2 (20 BYTE)
    PASSID_PK (PASSID)
    TRAVEL
    PF* CRUISEID CHAR (6 BYTE)
    PF* PASSID CHAR (6 BYTE)
    CABIN_NO NUMBER (2)
    * FARE NUMBER (5,2)
    * RATING NUMBER (2)
    TRAVEL_PK (CRUISEID, PASSID)
    CABIN_NO_UN (CABIN_NO)
    TOUR_PARTICIPANT (TAKETOURS IN ERP)
    PF* CRUISEID CHAR (6 BYTE)
    PF* PASSID CHAR (6 BYTE)
    PF* TOURID CHAR (6 BYTE)
    TIP_GIVEN CHAR (1 BYTE)
    TOUR_PARTICIPANT_PK (CRUISEID, PASSID, TOURID)
    TOUR
    P * TOURID CHAR (6 BYTE)
    U TOUR_NAME VARCHAR2 (10 BYTE)
    TOUR_DURATION VARCHAR2 (7 BYTE)
    * TOUR_PRICE NUMBER (5,2)
    * TOUR_DATE DATE
    F PORTID CHAR (4 BYTE)
    F GUIDEID CHAR (5 BYTE)
    TOURID_PK (TOURID)
    TOUR_NAME_UN (TOUR_NAME)
    The question here is to List the details of all the tours for cruise number 373 that did not attract any passengers in 2011.
    I was trying to solve this problem by using MINUS or NOT IN statement, but none of them worked, so can you please help me? Thanks a lot.
    PS: Do I need to post all the CREAT TABLE and INSERT VALUE queries?

    the posting all the CREATE TABLE and INSERT's are helpful...
    -- List the details of all the tours for cruise number 373 in 2011
    select t.*
    from TRAVEL tr, TOUR t
    where
    tr.TOURID  = t.TOURID
    and CRUISEID = 373
    and to_char (TOUR_DATE ,'YYYY') = '2011'
    -- List passengers of all the tours for cruise number 373 in 2011
        select *
        from TOUR_PARTICIPANT p
        where p.CRUISEID  = tr.CRUISEID -- =373
        and p.TOURID = t.TOURID -- Tours for CRUISEID = 373 in year 2011
    -- If exist tour for CRUISEID = 373 in year 2011 and not exists passengers [PASSID] then:
    select t.*
    from TRAVEL tr, TOUR t -- (List the details of all the tours for cruise number 373 in 2011)
    where
    tr.TOURID  = t.TOURID
    and CRUISEID = 373
    and to_char (TOUR_DATE ,'YYYY') = '2011'
    and not exists -- (List passengers of all the tours for cruise number 373 in 2011)
        select 1
        from TOUR_PARTICIPANT p
        where p.CRUISEID  = tr.CRUISEID
        and p.TOURID = t.TOURID
        )

  • Just wondering why an email or text message cannot be sent to prepaid customers to let us know when another card is needed. Straight talk does this a week in advance. Thanks

    JJust wondering why an email or text message cannot be sent to prepaid customers to let them know another card is needed in order to keep their service? Other carriers do this

    Perhaps you can sign into your MyVerizon account online and see if the options are available, but not turned on.

  • Do I have to execute irca.bat even when I use (only) Olite built-in DB?

    As well known I can use an external (full) Oracle database or an internal Olite database.
    Do I have to execute the irca.bat script even when I use the internal built-in Olite DB ?
    Where is this irca.bat ? I did not found it in the installation folder.
    Is the "default" domain automatically created without the irca.bar script or part of it?
    Peter

    No the basic version handles this all for you. But if you upgrade from 10.1.3.1 to any other release you need to run the SQL scripts for olite.
    cheers
    James

  • What is "netfront" and when to use it (or not)?

    Just wondering and the Xen FAQ is not giving a satisfying answer: what does "type=netfront" in vm.cfg (regarding the vif) stand for and when do I have to use it (or not)?
    Is it really needed? Under what circumstances? And only for specific types of virtual machines (HVM / PV)? Etcetera.
    Please enlighten us if you know. TIA!

    If the virtual machine is a hardware virtualized machine (fully virtualized), you can configure the virtual interface (VIF) type to be either ioemu or netfront.
    The netfront driver is a paravirtualized driver which can be used with a paravirtualized machine, or with a hardware virtualized machine. The ioemu driver is a hardware virtualized driver, and can only be used with a hardware virtualized machine. Both drivers contain the BIOS and device emulation code to support hardware virtualized machines.
    For hardware virtualized machines, the default is ioemu. For paravirtualized machines, the default is netfront.
    After you configure the virtual interface type for one network interface card, all the network interface cards in the virtual machine will be set to the same type.

  • WhenI close firefox, and later when I try to open firefox again, it says it is already open, although it shows to be closed---don't know when it is closed or not, don't like this

    When I close firefox, it closes, then later when I try to open firefox again a message opens and says firefox is already running, ---have to open task manager to close firefox before it will open again, browser may have been open for hours and didn't show to be---why does this happen, don't know when firefox closes or not------

    https://support.mozilla.com/en-US/kb/Firefox+hangs#Hang_at_exit

Maybe you are looking for