How to get the only the last raw of the table

Hello All,
While fetching a table into internal table, how to get only the last record of the table.?
Thanks and Regards, Pradeep

I hope following code will solve your problem.
DATA : it_bseg TYPE TABLE OF bseg,
       x_bseg TYPE bseg,
       v_index TYPE i.
SELECT COUNT(*)
  FROM bseg
  INTO v_index.
SELECT *
  FROM bseg
  INTO TABLE it_bseg.
READ TABLE it_bseg INTO x_bseg INDEX V_INDEX.
First SELECT will give you the number of rows in a table in v_index. Second SELECT will fetch all table data and then READ will give you the last record of the table in a structure x_bseg.
Reward points if the answer is helpful.

Similar Messages

  • How to get footer only in last page of report

    anybody tell me
    1).how to get footer only in last page while we are displaying reports
        and header only in first page .
    2) how to create search help and how to use it .
    3) how to create lock objects and how can we use it

    Hi
    This posting has an example of using a splitter container:
    Changing width of a custom container dynamically
    This posting has a discussion about using TOP-OF-PAGE:
    Display Page numbers in ALV
    This posting has an example of using picture control:
    Insert picture in selection screen.
    This posting has an example of putting a picture on top of an ALV grid:
    Logo in OO ALV Grid
    The page footer is defined using the statement END-OF-PAGE.
    The processing block following END-OF-PAGE is processed only if you reserve lines for the footer in the LINE-COUNT option of the REPORT statement.
    <u><b>CREATION:</b></u>
    Go to SE11 Tcode
    select search help
    give the 'z' search help name and create
    select the selection method ur table name eg : 'mara'
    dialog module 'display value immediately'.
    add the field whatever u want and lpos = 1 and spos = 1 and check import and export parameter.
    where left position when displaying and spos = search position
    and then save and activate ..
    <b>Creating Search Help:</b>
    http://www.sapdevelopment.co.uk/dictionary/shelp/shelp_basic.htm
    http://www.sapdevelopment.co.uk/dictionary/shelp/shelp_imp.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ee86446011d189700000e8322d00/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ee2b446011d189700000e8322d00/frameset.htm
    A lock object is a virtual link of several SAP tables which is used to synchronize simultaneous access by two users to the same set of data ( SAP lock concept).
    Locks are requested and released in the programming of online transactions by calling certain function modules which are automatically generated from the definition of the lock objects. These lock objects must be explicitly created in the ABAP Dictionary.
    <b>To set locks, you must perform the following steps:</b>
    1. You must define a lock object in the ABAP Dictionary. The name of the lock object should begin with E.
    2. The function modules for requesting and releasing locks which are created automatically when the lock object is activated must be linked to the programming of the relevant online transactions.
    <u><b>Reasons for Setting Locks</b></u>
    Suppose a travel agent want to book a flight. The customer wants to fly to a particular city with a certain airline on a certain day. The booking must only be possible if there are still free places on the flight. To avoid the possibility of overbooking, the database entry corresponding to the flight must be locked against access from other transactions. This ensures that one user can find out the number of free places, make the booking, and change the number of free places without the data being changed in the meantime by another transaction.
    <u><b>Lock Mechanisms in the Database System</b></u>
    The database system automatically sets database locks when it receives change statements (INSERT, UPDATE, MODIFY, DELETE) from a program. Database locks are physical locks on the database entries affected by these statements. You can only set a lock for an existing database entry, since the lock mechanism uses a lock flag in the entry. These flags are automatically deleted in each database commit. This means that database locks can never be set for longer than a single database LUW; in other words, a single dialog step in an R/3 application program.
    Physical locks in the database system are therefore insufficient for the requirements of an R/3 transaction. Locks in the R/3 System must remain set for the duration of a whole SAP LUW, that is, over several dialog steps. They must also be capable of being handled by different work processes and even different application servers. Consequently, each lock must apply on all servers in that R/3 System.
    <u><b>SAP Locks</b></u>
    To complement the SAP LUW concept, in which bundled database changes are made in a single database LUW, the R/3 System also contains a lock mechanism, fully independent of database locks, that allows you to set a lock that spans several dialog steps. These locks are known as SAP locks.
    The SAP lock concept is based on lock objects. Lock objects allow you to set an SAP lock for an entire application object. An application object consists of one or more entries in a database table, or entries from more than one database table that are linked using foreign key relationships.
    Before you can set an SAP lock in an ABAP program, you must first create a lock object in the ABAP Dictionary. A lock object definition contains the database tables and their key fields on the basis of which you want to set a lock. When you create a lock object, the system automatically generates two function modules with the names ENQUEUE_<lock object name> and DEQUEUE_<lock object name> . You can then set and release SAP locks in your ABAP program by calling these function modules in a CALL FUNCTION statement.
    <u><b>Lock Types</b></u>
    There are two types of lock in the R/3 System:
    <u><b>
    Shared lock</b></u>
    Shared locks (or read locks) allow you to prevent data from being changed while you are reading it. They prevent other programs from setting an exclusive lock (write lock) to change the object. It does not, however, prevent other programs from setting further read locks.
    <u><b>Exclusive lock</b></u>
    Exclusive locks (or write locks) allow you to prevent data from being changed while you are changing it yourself. An exclusive lock, as its name suggests, locks an application object for exclusive use by the program that sets it. No other program can then set either a shared lock or an exclusive lock for the same application object.
    example uses the lock object ESFLIGHT and its function modules ENQUEUE_ESFLIGHT and DEQUEUE_ESFLIGHT to lock and unlock the object.
    For more information about creating lock objects and the corresponding function modules, refer to the Lock objects section of the ABAP Dictionary documentation.
    The PAI processing for screen 100 in this transaction processes the user input and prepares for the requested action (Change or Display). If the user chooses Change, the program locks the relevant database object by calling the corresponding ENQUEUE function.
    MODULE USER_COMMAND_0100 INPUT.
      CASE OK_CODE.
        WHEN 'SHOW'....
        WHEN 'CHNG'.
    * <...Authority-check and other code...>
          CALL FUNCTION 'ENQUEUE_ESFLIGHT'
    EXPORTING
    MANDT = SY-MANDT
    CARRID = SPFLI-CARRID
    CONNID = SPFLI-CONNID
    EXCEPTIONS
    FOREIGN_LOCK = 1
    SYSTEM_FAILURE = 2
    OTHERS = 3.
    IF SY-SUBRC NE 0.
    MESSAGE ID SY-MSGID
    TYPE 'E'
    NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    The ENQUEUE function module can trigger the following exceptions:
    FOREIGN_LOCK determines whether a conflicting lock already exists. The system variable SY-MSGV1 contains the name of the user that owns the lock.
    The SYSTEM_FAILURE exception is triggered if the enqueue server is unable to set the lock for technical reasons.
    At the end of a transaction, the locks are released automatically. However, there are exceptions if you have called update routines within the transaction. You can release a lock explicitly by calling the corresponding DEQUEUE module. As the programmer, you must decide for yourself the point at which it makes most sense to release the locks (for example, to make the data available to other transactions).
    If you need to use the DEQUEUE function module call several times in a program, it makes good sense to write it in a subroutine, which you then call as required.
    The subroutine UNLOCK_FLIGHT calls the DEQUEUE function module for the lock object ESFLIGHT:
    FORM UNLOCK_FLIGHT.
         CALL FUNCTION 'DEQUEUE_ESFLIGHT'
              EXPORTING
                  MANDT     = SY-MANDT
                  CARRID    = SPFLI-CARRID
                  CONNID    = SPFLI-CONNID
              EXCEPTIONS
                  OTHERS    = 1.
         SET SCREEN 100.
    ENDFORM.
    You might use this for the BACK and EXIT functions in a PAI module for screen 200 in this example transaction. In the program, the system checks whether the user leaves the screen without having saved his or her changes. If so, the PROMPT_AND_SAVE routine sends a reminder, and gives the user the opportunity to save the changes. The flight can be unlocked by calling the UNLOCK_FLIGHT subroutine.
    MODULE USER_COMMAND_0200 INPUT.
      CASE OK_CODE.
        WHEN 'SAVE'....
        WHEN 'EXIT'.
          CLEAR OK_CODE.
          IF OLD_SPFLI NE SPFLI.
             PERFORM PROMPT_AND_SAVE.
          ENDIF.
          PERFORM UNLOCK_FLIGHT.
          LEAVE TO SCREEN 0.
        WHEN 'BACK'....
    <b>
    Another Example</b> :
    please see this link with Screen shot .....
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/frameset.htm
    Reward all helpfull answers
    Regards
    Pavan

  • How to get image out from LONG RAW from the database

    Dear fellow Oracle users
    I have a table about 50,000 rows one of the the column is LONG RAW.. and we store image files within this column ... almost 99% is gif format.
    Does anyone able to recommand a way to get ALL these images out of the database and save it into a directory. May be a batch process or may be some kind of tools?
    Not all the rows consists of images (i.e some of the the long raw can be null for some row) .
    Any sample codes are very much appreciated...(I am okay with PL/SQL , a little rusty with Java coding but okay to pick it up again...)
    regards
    Ivan

    Hi,
    if u are using oracle forms than u can integrate Webutil with it, there are many function available within webutil to do this.
    Thanks

  • A while ago i went to sync music onto my Ipod Touch. Not only did the computer erase my music i had no idea how to get it back :( I contacted Apple on the phone but the name was american and i found it really hard to understand him. How do i get it back!

    A while ago i went to sync music onto my Ipod Touch. Not only did the computer erase my music i had no idea how to get it back I contacted Apple on the phone but the name was american and i found it really hard to understand him. How do i get it back! i bought most of my music on itunes but i just dont have any idea where to go and whjat to do can any help me??
    Respond please!

    Depending upon what country that you are in (music can't be re-downloaded in all countries) then see if you can redownload your past music purchases (those that are still in the store) via the Purchased link under Quick Links on the right-hand side of the iTunes store home page on your computer's iTunes : re-downloading.
    If you are not in a country where music can currently be re-downloaded, then have you not got it on your computer and/or on a backup ? If not then you can try contacting iTunes support and see if they will grant you a re-download : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page

  • I have iMovie 09. I just erased my external hard drive, but it is still formatted for the mac. However, iMovie will not recognize the hard drive. It shows the only hard drive available is the computers. How do I get the external hard drive to show up?

    I have iMovie 09. I just erased my external hard drive, but it is still formatted for the mac. However, iMovie will not recognize the hard drive. It shows the only hard drive available is the computers. How do I get the external hard drive to show up?

    In Finder's Menu, select Go menu>Go to Folder, and go to "/volumes". (no quotes)
    Volumes is where an alias to your hard drive ("/" at boot) is placed at startup, and where all the "mount points" for auxiliary drives are created for you to access them. This folder is normally hidden from view.
    Drives with an extra 1 on the end have a side-effect of mounting a drive with the same name as the system already think exists. Try trashing the duplicates with a 1 or 2 if there are no real files in them, and reboot.
    If it does contain data...
    http://support.apple.com/kb/TS2474

  • TS2972 I have 4 Apple TV's. All set up to Home share. One will not see the computer. It is also the only 720 I have. The other three are 1080's. How do I get the 4th one (the720) to recognize my Mac?

    I have 4 Apple TV's. All set up to Home share. One will not see the computer. It is also the only 720 I have. The other three are 1080's. How do I get the 4th one (the720) to recognize my Mac?

    Need more information to help you, but I am providing some suggestions.  Sorry if you are past these type of basic things.  But didnt really have much to start with and understand your technical level to start with. 
    Have you got into Settings > Computers > Turned on Home Sharing (Note: You must use the some Apple ID used by the iTunes library on your MAC for them to see one another)
    How is your MAC connected to the network vs the 720 ATV2?  Is one WiFi and the other Ethernet?  Have you tried switching the ATV2 to WiFi if Ethernet? 
    Has the MAC been restarted since this started happening?  Same with your Router and any other networking device being used?  Sometimes an IP conflict can arise in your networking and most consumer networking equipment does not know how to "self heal" without a reboot. 
    Make sure you have given those things a whirl and share back your results.  Any other information you can provide, such as how you connect to your network from each ATV and MAC. 

  • How can I get trial for after effects 4? it is the only version my PC meets the requirements.

    How can I get trial for after effects 4?
    it is the only version my PC meets the requirements.

    Hello  yaniv7m,
    in my eyes you will find it only in shops like ebay or Amazon, like this:
    http://www.ebay.com/sch/i.html?_from=R40&_trksid=p2050601.m570.l1313.TR0.TRC0.H0.Xafter+ef fects+4&_nkw=after+effects+4&_sacat=0
    or
    http://www.amazon.com/Adobe-After-Effects-CS4-VERSION/dp/B001EUJ0SI/ref=sr_1_1?s=software& ie=UTF8&qid=1407396391&sr=1-1&keywords=after+effects+cs4
    Good luck!
    Hans-Günter

  • I accidently lost my ipad's photos when i got the new OS. How to get them back? last backup contained my photos

    i accidently lost my ipad's photos when i got the new OS. How to get them back? (last backup contained my photos)

    I just restaured backup and bingo!! all my photos came back

  • Okay i had to install Itunes onto my new OS because window's Vista messed up on me and i can't get any of my old purchases back from my account such as music and movies any ideas on how to get them back (i do not have the folder that contains old items)

    Okay i had to install Itunes onto my new OS because window's Vista messed up on me and i can't get any of my old purchases back from my account such as music and movies any ideas on how to get them back (i do not have the folder that contains old items from the last itunes or anything from that OS because it had a virus and i just wanted windows 7)

    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    Hope this helps,
    JD

  • My apple tv is not working, the only thing showing up on the screen is the apple box with a white usb cord connected to it under the hdmi plug in and next to it is an iTunes sign- how do i fix my apple tv?

    my apple tv is not working, the only thing showing up on the screen is the apple box with a white usb cord connected to it under the hdmi plug in and next to it is an iTunes sign- how do i fix my apple tv?

    Restore.

  • How do I dispute a copyright claim against a video i made using a trailer in iMovie? The only content I used was the video I shot of friends daughter on a merry-go-round.IMovie had the music etc that I used.

    How do I dispute a copyright claim against a video i made using a trailer in iMovie? The only content I used was the video I shot of friends daughter on a merry-go-round.IMovie had the music etc that I used. Here's the message It gives a number of options to choose from if I want to dispute the claim but I don't know which one this would come under. Several obviously don't apply and of the ones left I don't know which content that is in IMovie that I use comes under. "This video is my original content and I own the rights to it" "I have a license or written permission of the property rights holder to use this material" "My use of the content meets the legal requirements for fair use of fair dealing under applicable copyright laws" or "The content is in the public domain or is not eligible for copright protection."

    You want to use the "I have a license..." option, since clearly the music is not yours, but Apple has granted you a license.
    For your license, see this document, section 2.M. http://images.apple.com/legal/sla/docs/iMovie.pdf
    For more on this irritating problem and why it is so hard to solve, see this article. (It is a problem for Final Cut Pro users as well.)
    http://www.larryjordan.biz/app_bin/wordpress/archives/1842

  • How to get physical number of selected row on the screen.

    Hi,
    We have block defined with Numbers of Records Displayed = 3. In the same time the data set contains 10 records. We would like to know how to get a number of row selected on the screen. i.e. in our case that the number will be always between 1 and 3 independent of the current row position in the data set.
    Best regards,
    Constantin.

    You can calculate that number by subtracting :SYSTEM.CURSOR_RECORD and GET_BLOCK_PROPERTY('BLOCK', TOPMOST_RECORD)

  • I bought a new 5c and transferred from an old update from my iPhone 4.  The only issue I have is the name of my new phone.  How can I change it from Amyiphone4 to something else?

    I bought a new 5c and transferred from an old update from my iPhone 4.  The only issue I have is the name of my new phone.  How can I change it from Amyiphone4 to something else?

    settings - general - about - name - make the changes

  • How to get structure of IDOC into xi in the scenario is IDOC - XI - File

    hi XI Guys,
          When i want to Integrate SAP sys(IDOC) with File how to get structure of IDOC into XI, As we will define Data types in File -> XI -> File. Please send Step by Step process as i am new to Netweaver(XI)
    ThankYou,
    B.Pushparaju.

    When i want to Integrate SAP sys(IDOC) with File how to get structure of IDOC into XI
    >>>>
    import the IDoc under the imported object in your SCV. Note that import should be allowed for the SCV.
    As we will define Data types in File -> XI -> File.
    >>>>
    Ref. these blogs to help you out ..
    /people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
    /people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2

  • How to get backed up data in iphone3gs when the phone is disabled

    how to get backed up data in iphone3gs when the phone is disabled

    can someone help? this is shaking my trust in icloud backups.
    i am on iOS 6.1.

  • I've lost a load of notes, but dont know why or how to get them back. I cant find the folder that is in my Yahoo account that people have suggested might be the location for the messages.  I recently signed into iCloud for the first time.

    I've lost a load of notes, but dont know why or how to get them back. I cant find the folder that is in my Yahoo account that people have suggested might be the location for the messages.  I recently signed into iCloud for the first time.  Any idea how to get the notes back?   I really dont want to lose them.

    It should keep asking for the password, because it's trying to check for purchases... As soon as you login, it will see you have pending downloads and create the downloads section on the left below Purchases under the Store section. Then it will start the music downloads there, as they will be listed one below the other.
    You could just try to check your account balance or view your account and that will trigger a password request too. You can just click on that and say that now iTunes keeps asking for the password and ask him to help you with that. Trick would be to interrupt him so that he carries on with another task after, so he doesn't notice the download. Or you carry on with email or browsing which you were "busy" with when iTunes interrupted you for the password (stupid iTunes)

Maybe you are looking for

  • Microsoft Pro Photo - Geotag metadata in Lightroom

    Geotagging (embedding location information in image metadata) has occasionally been mentioned in posts in this forum, but I just thought I'd share my recent experiences with Microsoft Pro Photo Tools (MPPT) with those that may not be aware of its exi

  • Reg:restart the completed task in human workflow

    Dear team, We are working on Oracle soa10g.We have a requiremnt on human tasks. once the task is approved/rejected in bpm worklist, immediately we need to get the task payload and status from BPMworklist and insert in DB. Using human workflow java ap

  • Problem using LV 8.0.x with Delcom USB Visual Signal Indicator

    This could end up being more of a general question about USB and LabVIEW 8.0.x.  I have a USB Visual Signal Indicator from Delcom that doesn't function properly under either LV 8.0 or 8.0.1.  I've had to revert back to LV 7.1 where it works fine. Ple

  • 2 query in Single excel

    HI All, I need the sql query output in Excel sheet. We use sqlunload for this. But my requirement is to export 2 sql query in 2 tabs of a single excel sheet. Please let m eknow how to process this. Thanks, Lony

  • IPhone Apps Message

    Hello I wonder if anyone can offer me advice please. For a while, whenever there is an update for one of my apps, I get the following messages: "This discounted price is only available to customers who own a previous version of this item. To purchase