How to ensure the link between iTunes Library itl file and Music Folder residing on a different drive?

I'm planning to move my Music Library from a PC to Mac.  Both running iTunes 10.  
On the PC (Win XP) the iTues folder did not move from My Music folder when music (and videos, books, etc) were moved to a different drive on the PC.  iTunes runs ok, but the itl, xml and itdb files remain in the My Music Folder.
When I transfer the music (folder and all other contents) to the Mac, and then the itl, xml, itdb files into the new Music>iTunes folder will they still be "linked" or will I need to rebuild the itl from scratch?
Is there a way to ensure that the itl and music files themselves transfer to the Mac and remain linked once iTunes is launched?
thanks

Making a split library portable
Here are typical layouts for the iTunes folders:
If the iTunes folder contains the iTunes Media folder as above then the iTunes folder can be moved to a new location/drive/computer without breaking the file references. Although it is possible to migrate a split library from one system to another, the media folder must end up at precisely the same drive letter & path on the target system. This is feasible when moving between Windows systems, possibly feasible moving between Macs, but definitely impossible when moving PC to Mac or vice versa.
Assume the media folder on the external drive is called ..\<Parent>\<Media> and the library files are in the usual place of <Profile's Music>\iTunes.
You need to copy the library files and Album Artwork folder into the <Parent> folder, then use the hold-down-shift-when-starting-iTunes method (hold down option for Macs) to open the copy of the database that you've made in the <Parent> folder.
Once this library has been opened and tested there are a few changes you can make so that it conforms to the standard layout. When iTunes opens it uses the folder name where the database is located as the window name so if the <Parent> folder isn't called iTunes then neither will be the main iTunes window. Close iTunes, rename <Parent> as iTunes and use the hold-down-shift-when-starting-iTunes method to open iTunes again. If <Parent> is the root of the drive, make a new folder called iTunes and move the library files, Album Artwork & <Media> folders into the new iTunes folder instead. Start iTunes, then check under Edit > Preferences > Advanced that the media folder location has been correctly updated and edit if necessary.
You may also want to correct the media folder name. Having applied the fix above, if it was necessary, close iTunes then rename the <Media> folder as iTunes Media. Start iTunes and again check under Edit > Preferences > Advanced that the media folder location has been correctly updated and edit if necessary.
Congratulations, your library is now fully portable and you can connect your external drive to any computer running the same build of iTunes, Mac or PC, in order to work with it. Don't forget to deauthorise the old computer if you won't need to access protected content on it again.
tt2

Similar Messages

  • What does it mean when I get the error of iTunes Library .itl file is locked

    What does it mean when I get the error iTunes Library .itl file is locked

    It means that your iPod Hardisk has crashed and cant be started, you need to have the Hardisk replaced at Apple Store or any 3rd Party iPod service, if it is out of warranty.

  • Itunes Library .itl file in one folder, music in another Itunes makes no sense!

    A while ago I attempted to move one of my libraries to another folder to try to force Itunes to orginise my files in a way that makes sense.   Older versions of itunes apparently used a Music folder and the new one doesn't (or is it the other way around).  So I end up with some files in The Beatles/ItunesMedia/Music/Beatles and other files in Itunes The Beatles/Itunes Mediia/Beatles.  
    I wanted to force Itunes to re-orginize all of the files under which ever system is newer.  I read up and was happy to find tha Itunes had a command to re-orginize and/or consolidate the files.   BUT carrying out this process turned out to be baffling.   It is very unclear what exactly these commands do and how to use them.
    So now I have one folder called The Beatles and another folder called The Beatles ALL.   My .itl file is in The Beatles and all my music is in folders in The Beatles All/
    I tried to fix this and saw some really strange behavior.   When I open my Library and play a song, that song is moved to ANOTHER folder next to the Music folder.   So now I have my itl file in one folder, most of my music in another folder, and two songs in this new folder that itunes just created.   I'm guessing that everytime I play a song itunes will move it to the new folder (Why?)
    If you don't use separate Libraries please don't ask me why I am using separate Libraries.    I have a LOT of Beatles music that is more of a historical collection and I need to keep it separate from the Library of albums that I actually listen too.
    To me itunes behavior is crazy.   Can some one explain it in a way that will make me slap my forehead and say "of course...it makes so much sense!"?   or is it just as bizzare and random as I think?  
    Another approach that I considered was just creating a new library and importing all of those songs.  But I believe I would lose all of my playlists and I have my beatles collection extensively orginized by playlists.
    Help appreciated.
    Mike

    This is an overview of how your library ought to be organized and how you might get it there. I can give specific instructions if you provide more details such as the full locations of the folders you mentioned earlier.
    Make a split library portable
    Here are the typical layouts for the iTunes folders:
    In the layout above, with the media folder (everything in the red box) inside the library folder, the library is considered to be portable. A portable library can be moved from one path to another without breaking the links between the library and the media, and being self-contained is much easier to backup (You do backup, don't you?).
    You can rearrange things to make a split library portable by taking a number of small steps which don't break the library.
    Before you start any media files that are outside of the media folder will need to be consolidated (File > Library > Organize Library > Consolidate Files). If the library is in the old style layout then it should be upgraded to iTunes Media Organization (File > Library > Organize Library > Rearrange files in the folder <Media Folder>) to ensure that iPod Games, Mobile Applications etc. are brought inside the media folder.
    The basic non-fatal manipulations are:
    You can connect to an alternate set of library files by holding down Shift (Win) or Option (Mac) when starting iTunes.
    You can move the library files to a new location as long as the media stays put.
    You can move the library files and the media together if the media folder is a direct subfolder of the library folder.
    If you have already moved/copied the media content from a subfolder of the library folder to a different location then you only need to copy the library files for it to appear as if you have moved the entire library in the way allowed above. I.e. just copy the library files into the parent folder of the media folder.
    You can rename the media folder to iTunes Media (if it isn't already) if the media folder is inside the library folder.
    iTunes (prior to iTunes 11) uses the name of the folder holding the library files as the window title. Having made a library "portable" you may need to take a final step of renaming the library folder to iTunes or, if the library files have ended up at the root of a drive, moving all of the library files and content folders into a new folder called iTunes.
    After each change you need to open, test and close the relevant library before attempting another change. If a change broke the library, undo it or revert to using the previous set of library files.
    In essence all you need to do to make your library portable is copy the library files into the parent folder of the media folder on the external/secondary drive and use the hold-down-shift/option-when-starting-iTunes method to connect to it. Other manipulations may be required to normalize the library so that the library and media folders have standard names.
    tt2

  • ITunes Library.itl file, and temp files after Time Machine retrieval

    Hi - I messed up a playlist and got it back fine using Time Machine, but I'm left with temp files as well as iTunes Library.itl and iTunes Library.xml files on my desktop (that's where I placed the needed file for playlist re-import).  Can't delete them, can't move them....what do I do with them?!  Thanks in advance for any guidance.

    <<  Quit iTunes then delete them.  >>
    Thanks, but with iTunes closed, I get this when I try to delete.

  • Need Help!  I lost entire itunes library after copying "My Music" folder to an external hard drive.

    I was recently hire by one of my sisters friends to set up a new computer and to repair wireless router.  The client asked me to copy music files from their old computer to an external hard drive so that they could be transfered to the new computer. So I connected the external hard drive to the old computer and copyed the entire "My Music" folder to it.  I never deleted files from the old computer. I did however uninstall a few applications at the clients request such as Microsoft Office and Kodak EasyShare which have nothing to do with itunes.  I got a call from the client a few hours later stating that their entire itunes music library is no longer there.  I do not have much experince with itunes this just doesnt make any sense to me.  I am sure the music is there but itunes is not pulling it up.   Can someone please tell me how to fix this problem?
    Thanks so much

    I was recently hire by one of my sisters friends to set up a new computer and to repair wireless router.  The client asked me to copy music files from their old computer to an external hard drive so that they could be transfered to the new computer. So I connected the external hard drive to the old computer and copyed the entire "My Music" folder to it.  I never deleted files from the old computer. I did however uninstall a few applications at the clients request such as Microsoft Office and Kodak EasyShare which have nothing to do with itunes.  I got a call from the client a few hours later stating that their entire itunes music library is no longer there.  I do not have much experince with itunes this just doesnt make any sense to me.  I am sure the music is there but itunes is not pulling it up.   Can someone please tell me how to fix this problem?
    Thanks so much

  • My itunes keeps popping up with this; the itunes library .itl file cannot be found or created

    i found my itl files and even when i click on them it still pops up with that message what do i do?

    Hello EliCooper,
    It sounds like when you open iTunes, it says your iTunes Library.itl file cannot be located.  If you know where this is located, you need to point iTunes to this file to avoid the error message.  I found an article with the steps to choose your iTunes Library.itl file:
    Steps to create or choose a different iTunes Library file
    If iTunes is running, quit iTunes.
    If you are using Windows, hold down the Shift key and from the Start menu and choose All Programs > iTunes > iTunes.
    You should see one of the following screens:
    Once you get that dialogue box, you can click on Choose Library and navigate to your iTunes Library.itl file.
    You can find the full article here:
    iTunes: How to open an alternate iTunes Library file or create a new one
    http://support.apple.com/kb/ht1589
    Thank you for posting in the Apple Support Communities. 
    Best,
    Sheila M.

  • Editing the iTunes Library.itl file?

    I'm going back to iTunes v6 from v7. The iTunes Library.itl file for v7 doesn't work with iTunes v6 so I had to go back to my old version of the file (last one from v6).
    Problem is I added about 7 CDs while in v7 and none of this is coming up (album art, ratings, music files) in the old v6 iTunes Library.itl file.
    Is there anyway to extract the info for the new stuff from the v7 iTunes Library.itl file and include it into the v6 version of that same file?
    Please?

    I would seem that you are.
    The XML file is provided for 3rd party support. It allows other applications to interrogate your library. iTunes doesn't normally have any cause to read it back or make use of it.
    Create a smart playlist with the rule Checked is True. Drag the contents of this into a new playlist called iPhone Tunes (or similar), Select the Songs list and CMD-click on any empty playlist. Delete the initial playlist. Sync your device with iPhone Tunes. Drag new stuff into it when you want, delete stuff when it gets too big.
    That's the simple way of reworking your current selections into a more flexible set up. There are other things you could do like create smaller size-limited playlists along the lines of "Recently Played", "Recently Added", "Not Played In Ages", "Top Rated", along with say a regular list called "Essentials" which, once set up, would allow you to have some rotating content on the device without having to do any extra work.
    tt2

  • When i double click itunes it doesn't open it just comes up with an error saying " The itunes library.itl file cannot be found or created. The default location for this file is in the 'itunes' folder in the 'music' folder". How can i fix this?

    When i double click itunes it doesn't open it just comes up with an error saying " The itunes library.itl file cannot be found or created. The default location for this file is in the 'itunes' folder in the 'music' folder. How can i fix this problem?

    Anyone can help to advice how to solve this issue ?

  • TS1717 unes, i have windows 8, i get the message, "the itunes Library .itl file is locked, on a locked disk, or you do not have write permission for this file.  how did this happen, how do i fix this?

    the message"The itun, library .itl file is locked, on a locked disk, or you do not have write permission for this file". i have windows 8. how why did this happen? how do i correct this and prevent another occurance?  I am able to access itunes on my i5, ipad, and my old i4 that i use solely as my ipod now. At the time  problem occurred, i was connected to ext hard drive that hold over 190GB music, to add to my library. I am now unable to add to my library using my laptop.  any advise/help is greatly appreciated!!

    I just had the same problem and was able to fix it after trying a couple of things I found after a search.
    The solution that worked for me:
    Find iTunes folder - it should be in C:\Program FIles (x86) or similar depending on your operating system
    Right click the entire folder (no need to open it) and click properties
    Click the security tab
    Click edit and highlight the user name under which you logged in.
    Click the box next to full in the allow column, which should check everything
    Click apply
    Open iTunes
    This worked for me.

  • How To Fix: "The iTunes Library.itl file is locked, on a locked disk, or you do not have write permission for this file."

    I can't reopen my iTunes after I have to force quit when it does not respond. I get this message:
    "The iTunes Library.itl file is locked, on a locked disk, or you do not have write permission for this file."
    I've read to do the solutions. I right clicked on both the iTunes and Music folder and went to info for each. On both the lock at the bottom of the Get Info was locked. All of my users including admin can read and write all files within those folders. They are even a shared folder. I clicked on the lock to unlock it, typed in my admin password, and went to the gear to apply to all files inside. After doing that I keep getting the saved message.
    I tried another way that I've found online to move my ituneslibrary folder to the desktop and then open my iTunes. In theory the iTunes is supposed to ask for where the iTunes library is. Once that is prompted you quit iTunes and drag the iTunes Library folder back to the folder from the desktop and reopen iTunes to apprently solve the problem. However, when I move the iTunes Library file to the desktop and try to reopne iTunes the icon just keeps bouncing and when I right click the application does not respond.
    This problem is only resolved if I restart/shut down my macbook pro which is a 15-inch Core 2 Duo with intel. It will be 5 years old in December. I currently have Lion and the latest iTunes 10.5. This problem started in late December. 

    If you hold down the option key when starting iTunes, it will allow you to select a library or create a new one.
    You can create a new one, and then add all of your iTunes music back in by simply dragging the old iTunes music file onto iTunes.
    There are more detailed instructions at http://support.apple.com/kb/HT1451#
    It will show you how to re-build your iTunes database file.

  • TS1717 iTunes will not open.  I get a message that says, "The iTunes Library.itl file cannot be found or created.  The default location for this file is in the "iTunes" folder in the music folder."  How can I fixt this?

    iTunes will not open.  I get a message that says, "The iTunes Library.itl file cannot be found or created.  The default location for this file is in the "iTunes" folder in the music folder".  How can I fix this?

    Hi pgarard1,
    If you are having issues with launching iTunes after an update, you may want to take a look at the troubleshooting in the following article:
    iTunes for Windows: Doesn't open after upgrading in Windows Vista or Windows 7
    http://support.apple.com/kb/TS2363
    Regards,
    - Brenden

  • I get an error message saying "The iTunes Library.itl file cannot be found or created" when I try to open iTunes on my computer and the program fails to open.   How can I fix this?

    When I try ot open iTunes on my computer I get an error message stating "The iTunes Library.itl file cannot be found or created" and the program fails to open.  How can I fix this issue?

    Hi pgarard1,
    If you are having issues with launching iTunes after an update, you may want to take a look at the troubleshooting in the following article:
    iTunes for Windows: Doesn't open after upgrading in Windows Vista or Windows 7
    http://support.apple.com/kb/TS2363
    Regards,
    - Brenden

  • I have downloaded the most recent itunes on my new computer with windows 8        but a message pops up saying "the itunes library.itl file is locked, on a locked disk or you do not have write permission for this file. How do I fix?

    I have downloaded the most recent itunes on my new computer with windows 8 but when I attempt to get in I get this message "The itunes library.itl file is locked, ona locked disk, or you do not have write permission for this file."  How do i fix this?

    Repair iTunes Security Permissions
    Right-click on your main iTunes folder and click Properties, then go to the Securitytab and click Advanced. Use the Change Permissions... button grant to your account (or the Users group) and SYSTEM full control of this folder, subfolders and files, then tick the option to Replace permissions entries... which will repair permissions throughout the library. When complete switch to the General tab, click in the Read-only check box to clear it, then click Apply.
    If you don't have the option to change the permissions then use the Owner tab and Edit... button to take ownership from an account with administrator privileges. Tick the option to Replace owner on subcontainers and objects.
    Repeat with the media folder if it isn't stored inside the main iTunes folder.
    If you've brought over the library from another computer you may also want to remove any "mystery" identities (S<string of dashes & digts>) that have come over from the old computer...
    The images above are from Windows 7. Hopefully the system isn't too different in Windows 8.
    tt2

  • How to find the link between strcture and query technical name

    Hi Guru's
    How to find the link between Strcture in the query and query technical name. In other way where used list of the structure  used in queries?
    I know we have table called RSZELTDIR which have the values of strcuture name. from here i do not find any link to query technical name.
    Please can anyone help me?
    Regards,
    Sirisha

    Hi ,
    For structure and query relationship, the structure has to be a reusable structure( a global one). Then you can right click in on the structure name (in BEX query designer) and select the where used list. You will find all the query names where it is being used.
    U can also check out tables RSRREPDIR and RSZCOMPDIR for other query properties.
    Thanks,
    Amit

  • How to get the link between mara, ausp, cawn and cawnt tables

    hello ABAPERS
    i have got a requiremet in that i have to get the relation .
    how to get the link between mara, ausp, cawn and cawnt tables and also type how can we get link between  char value and char description in cawn and cawnt tables through ausp and mara tables.
    I would be very thankful  for ur help in advance.
    Thanks & Regards.
    soni

    Hi,
    Sample report using the linkage between tables;
    report batch_char no standard page heading
                              line-size  132
                              line-count 58(1)
                              message-id mm.
           Report by Batch Characteristic                                *
    Description          : Report by Batch Characteristic                *
    Declaration for Tables
    tables: mara,    " Material Master
            mard,    " Storage Location Data for Material
            t001w,   " Plants/Branches
            t001l,   " Storage Locations
            cabn,    " Characteristics
            inob.    " Link between Internal Number and Object
    Declaration for Constants
    constants : c_klart like ausp-klart value '023',     " Class Type
                c_obtab like inob-obtab value 'MCH1',    " Database Table
                c_flag  type c          value 'X',       " Flag
                c_c23   type i          value '23',      " Ratio
    Constants for Ratio Categories
                c_13    type p decimals 2 value '13.00', " For Ratio 13
                c_1499  type p decimals 2 value '14.99', " For Ratio 14.99
                c_15    type p decimals 2 value '15.00', " For Ratio 15
                c_1699  type p decimals 2 value '16.99', " For Ratio  16.99
                c_17    type p decimals 2 value '17.00', " For Ratio 17
                c_1899  type p decimals 2 value '18.99', " For Ratio 18.99
                c_19    type p decimals 2 value '19.00', " For Ratio 19
                c_2099  type p decimals 2 value '20.99', " For Ratio 20.99
                c_21    type p decimals 2 value '21.00', " For Ratio 21
                c_2299  type p decimals 2 value '22.99', " For Ratio 22.99
                c_23    type p decimals 2 value '23.00', " For Ratio 23
                c_g23(4) type c value '>=23',            " For Ratio >=23
                c_ratio(5) value 'RATIO',                  " For Ratio
    Constants for Storing Selected item field information
                c_cursor1(15) value 'I_OUTPUT1-MEINS',   " For Selected Base
                                                         " Unit of Measure
                c_cursor2(15) value 'I_OUTPUT1-MATNR',   " For Selected Base
                                                         " Material Number
                c_cursor3(15) value 'I_OUTPUT1-MAKTX',   " For Selected Base
                                                         " Material Des.
                c_cursor4(15) value 'I_OUTPUT1-CLABS',   "For Selected Base
                                                         " Stock Value
                c_cursor5(15) value 'I_OUTPUT1-ATFLV',   " For Selected Base
                                                        " Char.Value (Ratio)
                c_cursor6(5) value 'C_G23'.
    Declaration for Global Variables
    data : g_exit  type c,                            " Flag
           g_clabs1(16) type c,                       " Quantity
           g_clabs(18)  type c,                       " Quantity
           g_cursor(15) type c,                       " Cursor field name
           g_matnr     type mara-matnr,               " Material Number
           g_werks     type mchb-werks,               " Plant
           g_atinn(30) type c.                        " Character.
    Declaration for Internal tables
    Internal table to hold Batch Stock data
    data : begin of i_mchb occurs 0,
             matnr like mchb-matnr,      " Material Number
             werks like mchb-werks,      " Plant
             lgort like mchb-lgort,      " Storage Location
             charg like mchb-charg,      " Batch Number
             clabs like mchb-clabs,      " Stock Value
             meins like mara-meins,      " Unit of measure
             atflo like ausp-atflv,      " Char.Value (Ratio)
             atflv like ausp-atflv,      " Char.Value (Ratio)
           end of i_mchb.
    Internal table to hold Secondary List data
    data : begin of i_mchb1 occurs 0,
             werks like mchb-werks,      " Plant
             matnr like mchb-matnr,      " Material Number
             lgort like mchb-lgort,      " Storage Location
             charg like mchb-charg,      " Batch Number
             atinn like ausp-atinn,      " Char.Value
             clabs like mchb-clabs,      " Stock Value
             atflo like ausp-atflv,      " Char.Value (Ratio)
             atflv like ausp-atflv,      " Char.Value (Ratio)
           end of i_mchb1.
    Internal table to get the Plant Name
    data : begin of i_plant occurs 0,
             werks like t001w-werks,     " Plant
             name1 like t001w-name1,     " Name
           end of i_plant.
    Internal table to get the Material Description
    data : begin of i_makt occurs 0,
             matnr like makt-matnr,      " Material
             maktx like makt-maktx,     " Description
           end of i_makt.
    Internal table to hold AUSP data
    data : begin of i_ausp occurs 0,
             objek like ausp-objek,      " Object No
             atinn like cabn-atinn,      " Characteric value
             atflv like ausp-atflv,      " Characteristic Value
           end of i_ausp.
    Internal table to hold output data
    data : begin of i_output occurs 0,
             atinn like cabn-atinn,      " Characteric value
             werks like mchb-werks,      " Plant
             matnr like mchb-matnr,      " Material Number
             atnam like cabn-atnam,      " Characteristic
             atflv like ausp-atflv,      " Char.Value (Ratio)
             name1 like t001w-name1,     " Plant Description
             maktx like makt-maktx,      " Material Description
             clabs like mchb-clabs,      " Stock Value
             meins like mara-meins,      " Base Unit of Measure
           end of i_output.
    Internal table to hold final Output data
    data : begin of i_output1 occurs 0,
             atinn like cabn-atinn,      " Characteric value
             werks like mchb-werks,      " Plant
             matnr like mchb-matnr,      " Material Number
             atnam like cabn-atnam,      " Characteristic
             atflv(32) type c,           " Char.Value (Ratio)
             name1 like t001w-name1,     " Plant Description
             maktx like makt-maktx,      " Material Description
             clabs like mchb-clabs,      " Stock Value
             meins like mara-meins,      " Base Unit of Measure
           end of i_output1.
           Selection screen
    selection-screen begin of block b1 with frame title text-001.
    select-options: s_werks for t001w-werks obligatory,  " Plant
                    s_lgort for t001l-lgort,             " Stor.Location
                    s_matnr for mara-matnr  obligatory,  " Material No
                    s_atinn for cabn-atinn.              " Character.
    selection-screen end of block b1.
    At selection screen
    at selection-screen.
    Validation of Selection Screen Fields
      perform validate_screen.
    Start of selection
    start-of-selection.
    Get the Material and Batch Stock data from MARA and MCHB Tables
      perform get_mat_stock_data.
    Get the Material Group Text and Plant Name from T023T and T001W Tables
      perform get_plant_grp_data.
    Append the data into final Output Internal Table after getting the
    Characteristic Values data from INOB and AUSP Tables
      perform append_final_data.
    Processing if the Characteristics contain 'RATIO'
      perform collect_ratio.
    End-of-Page
    end-of-page.
      write /1(125) sy-uline.
    End of selection
    end-of-selection.
      if g_exit <> c_flag.
    Display the Report Output data
        perform display_report.
      endif.
    Top-of-Page
    top-of-page.
    Write the Report and Column Headings
      perform get_headings.
    at line-selection
    at line-selection.
      if sy-lsind = 1.
        perform display_batch.
      endif.
    Top of page during line-selection
    top-of-page during line-selection.
      perform heading_seclist.
          Form validate_screen
    Validation of Selection Screen fields
    form validate_screen.
    Validation of Plant
      clear t001w.
      if not s_werks[] is initial.
        select werks
          into t001w-werks
          from t001w
          up to 1 rows
          where werks in s_werks.
        endselect.
        if sy-subrc <> 0.
          message e899 with 'Enter Valid Plant'(002).
        endif.
      endif.
    Validation of Material Number
      clear mara.
      if not s_matnr[] is initial.
        select matnr
          into mara-matnr
          from mara
          up to 1 rows
          where matnr in s_matnr.
        endselect.
        if sy-subrc <> 0.
          message e899 with 'Enter Valid Material'(003).
        endif.
      endif.
    Validation of Storage Location
      clear t001l.
      if not s_lgort[] is initial.
        select lgort
          into t001l-lgort
          from t001l
          up to 1 rows
          where lgort in s_lgort.
        endselect.
        if sy-subrc <> 0.
          message e899 with 'Enter Valid Storage Location'(004).
        endif.
      endif.
    Validation of Characteristic Value
      clear cabn.
      if not s_atinn[] is initial.
        select atinn
          into cabn-atinn
          from cabn
          up to 1 rows
          where atinn in s_atinn.
        endselect.
        if sy-subrc <> 0.
          message e899 with 'Enter Valid Characteristic Value'(005).
        endif.
      endif.
    Validation of Plant, Material and Storage Location
      clear mard.
      select matnr werks lgort
        into (mard-matnr, mard-werks, mard-lgort)
        from mard
        up to 1 rows
        where matnr in s_matnr and
              werks in s_werks and
              lgort in s_lgort.
      endselect.
      if sy-subrc <> 0.
        message e899 with 'No Data found for the Selection Criteria'(006).
      endif.
    endform.                          "validate_screen
    *&      Form  get_headings
    Write the Report and Column Headings
    form get_headings.
      data: l_repid type sy-repid.
      l_repid =  sy-repid.
      call function 'Y_STANDARD_HEADING'
           exporting
                repid    = l_repid
                heading1 = sy-title.
      write:/1(125) sy-uline.
      format color col_heading on.
      write : /1  sy-vline,  2(18)   'Material Number'(008) centered,
              20  sy-vline,  21(40)  'Material Description'(011) centered,
              61  sy-vline,  62(22)  'Ratio'(009) centered,
              84  sy-vline,  85(18)  'Quantity'(010) centered,
             103  sy-vline, 104(20)  'Base Unit of Measure'(015) centered,
             125  sy-vline.
      write:/1(125) sy-uline.
      format color off.
    endform.                    "get_headings
    *&      Form  get_mat_stock_data
    Get the Material and Batch Stock data from MARA and MCHB Tables
    form get_mat_stock_data.
      clear: i_mchb,i_output, i_output1.
      refresh: i_mchb,i_output, i_output1.
      select a~matnr       " Material Number
             b~werks       " Plant
             b~lgort       " Storage Location
             b~charg       " Batch Number
             b~clabs       " Stock Value
             a~meins       " Base Unit of Measure
          into table i_mchb
          from mara as a inner join mchb as b
          on amatnr eq bmatnr
          where b~matnr in s_matnr and
                b~werks in s_werks and
                b~lgort in s_lgort.
      if sy-subrc <> 0.
        g_exit = c_flag.
        message s899 with 'No Data found for the Selection Criteria'(006).
        stop.
      endif.
      sort i_mchb by matnr werks lgort charg.
    endform.                    " get_mat_stock_data
    *&      Form  get_plant_grp_data
    Get the Material Group Text and Plant Name from T023T and T001W
    form get_plant_grp_data.
      if not i_mchb[] is initial.
    Get the Plant Description from t001w Table
        clear i_plant.
        refresh i_plant.
        select werks      " Plant
               name1      " Name
          into table i_plant
          from t001w
          for all entries in i_mchb
          where werks = i_mchb-werks.
    Get the Material Description from MAKT Table
        clear i_makt.
        refresh i_makt.
        select matnr      " Material number
               maktx      " Material Description
          into table i_makt
          from makt
          for all entries in i_mchb
          where matnr = i_mchb-matnr and
                spras = sy-langu.
        sort i_plant by werks.
        delete adjacent duplicates from i_plant comparing werks.
        sort i_makt by matnr.
        delete adjacent duplicates from i_makt comparing matnr.
      endif.
    endform.                   "form get_plant_grp_data.
    *&      Form  append_final_data
    Append the data into final Internal Table
    form append_final_data.
      data : l_matbatch(28),
             l_tabix like sy-tabix.
      if not i_mchb[] is initial.
        loop at i_mchb.
          l_tabix = sy-tabix.
          clear l_matbatch.
          concatenate i_mchb-matnr i_mchb-charg into l_matbatch.
          move-corresponding i_mchb to i_output.
    Get the Plant Description from i_plant Table
            read table i_plant with key werks = i_mchb-werks binary search.
            if sy-subrc = 0.
              i_output-name1 = i_plant-name1.
            endif.
    Get the Material Description from i_makt Table
          read table i_makt with key matnr = i_mchb-matnr binary search.
          if sy-subrc = 0.
            i_output-maktx = i_makt-maktx.
          endif.
    Get the Characteristic Values data from INOB and AUSP Tables
          clear inob.
          select single cuobj from inob
              into inob-cuobj
              where klart = c_klart and
                    obtab = c_obtab and
                    objek = l_matbatch.
          if sy-subrc = 0.
            select objek
                   atinn
                   atflv
               from ausp
               into table i_ausp
               where objek = inob-cuobj and
                     atinn in s_atinn   and
                     klart = c_klart.
            sort i_ausp by objek atinn.
            loop at i_ausp.
              clear cabn.
              select single atinn atnam from cabn
                         into (cabn-atinn,cabn-atnam)
                         where atinn = i_ausp-atinn.
              if sy-subrc = 0.
    If the ratio value is between 13-14.99, display 13
                if cabn-atnam cs c_ratio.
                  if i_ausp-atflv between c_13 and c_1499.
                    i_mchb-atflo = i_ausp-atflv.
                    i_mchb-atflv = c_13.
    If the ratio value is between 15-16.99, display 15
                  elseif i_ausp-atflv between c_15 and c_1699.
                    i_mchb-atflo = i_ausp-atflv.
                    i_mchb-atflv = c_15.
    If the ratio value is between 17-18.99, display 17
                  elseif i_ausp-atflv between c_17 and c_1899.
                    i_mchb-atflo = i_ausp-atflv.
                    i_mchb-atflv = c_17.
    If the ratio value is between 19-20.99, display 19
                  elseif i_ausp-atflv between c_19 and c_2099.
                    i_mchb-atflo = i_ausp-atflv.
                    i_mchb-atflv = c_19.
    If the ratio value is between 21-22.99, display 21
                  elseif i_ausp-atflv between c_21 and c_2299.
                    i_mchb-atflo = i_ausp-atflv.
                    i_mchb-atflv = c_21.
    If the ratio value is greater than or equal to 23, display 23
                  elseif i_ausp-atflv >= c_23.
                    i_mchb-atflo = i_ausp-atflv.
                    i_mchb-atflv = c_23.
                  endif.           " Condition for RATIO values
                else.              " If characteristic does contain RATIO
                  i_mchb-atflv = i_ausp-atflv.
                endif.
                i_output-atinn = cabn-atinn.
                i_output-atnam = cabn-atnam.
                i_output-atflv = i_ausp-atflv.
                i_mchb1-matnr = i_mchb-matnr.
                i_mchb1-werks = i_mchb-werks.
                i_mchb1-lgort = i_mchb-lgort.
                i_mchb1-charg = i_mchb-charg.
                i_mchb1-clabs = i_mchb-clabs.
                i_mchb1-atinn = i_ausp-atinn.
                i_mchb1-atflo = i_mchb-atflv.
                i_mchb1-atflv = i_ausp-atflv.
                append : i_output, i_mchb1.
                clear i_mchb1.
                modify i_mchb index l_tabix transporting atflo atflv .
              endif.
            endloop.
          endif.
        endloop.
      endif.
    Checking whether the table is filled or not
      if not i_output[] is initial.
        sort i_output by atinn werks matnr atflv.
      else.
        g_exit = c_flag.
        message s899 with 'No Data found for the Selection Criteria'(006).
      endif.
    Delete the records where RATIO is less than 13.
      delete i_output where atnam cs c_ratio and atflv lt c_13.
    endform.                    "append_final_data
    *&      Form  display_report
    Display the Report Output data
    form display_report.
    data: l_tabix like sy-tabix.
      loop at i_output1.
        l_tabix = sy-tabix.
    At new Characteristic
         at new atinn.
          read table i_output1 index l_tabix.
          format color 1 intensified on.
          write: /1 sy-vline, 2(20) 'Characteristic Name:'(007),
                 23(40) i_output1-atnam,
                 125 sy-vline.
          format color off.
          format color 4 intensified on.
          write: /1 sy-vline, 2(20) 'Plant Name         :'(022),
                 23(4) i_output1-werks, 29(30) i_output1-name1,
                 125 sy-vline.
          format color off.
          write /1(125) sy-uline.
        endat.
        clear: g_clabs, g_clabs1.
        format color col_normal.
        write :/1 sy-vline,  2(18)   i_output1-matnr,
               20 sy-vline,  21(40)  i_output1-maktx,
               61 sy-vline.
        if i_output1-atflv = c_c23.
          write: 62(22)  c_g23 centered.
        else.
          shift i_output1-atflv left deleting leading space.
          write: 62(22)  i_output1-atflv centered.
        endif.
        write:  84     sy-vline,
               103     sy-vline,
               110(5)  i_output1-meins.
    If the quantity value is negative
        if i_output1-clabs ge 0.
          write: 85(18) i_output1-clabs unit i_mchb-meins,
                125     sy-vline.
        else.
          i_output1-clabs = - i_output1-clabs.
          write i_output1-clabs unit i_mchb-meins to g_clabs1.
          condense g_clabs1.
          concatenate '(' g_clabs1 ')' into g_clabs separated by space.
          write: 85(18) g_clabs right-justified,
               125 sy-vline.
        endif.
        format color off.
        hide : i_output1.
        new-line.
    At end of material
        at end of matnr.
          sum.
          move : i_output1-matnr to g_matnr.
          format color 3 intensified on.
          write /1(125) sy-uline.
          write :/1 sy-vline,  2(25) 'Total for Material      :'(012),
                 28(18) g_matnr.
          if i_output1-clabs ge 0.
            write: 85(18) i_output1-clabs  unit i_mchb-meins,
            125 sy-vline.
          else.
            i_output1-clabs = - i_output1-clabs.
            write i_output1-clabs unit i_mchb-meins to g_clabs1.
            condense g_clabs1.
            concatenate '(' g_clabs1 ')' into g_clabs separated by space.
            write: 85(18) g_clabs right-justified,
                 125 sy-vline.
          endif.
          write: 125 sy-vline.
          format color off.
          write /1(125) sy-uline.
        endat.
    At end of plant
        at end of werks.
          sum.
          move : i_output1-werks to g_werks.
          format color 3 intensified off.
          write :/1 sy-vline,  2(25) 'Total for Plant          :'(013),
                 28(4) g_werks.
          if i_output1-clabs ge 0.
            write:  85(18) i_output1-clabs  unit i_mchb-meins,
            125 sy-vline.
          else.
            i_output1-clabs = - i_output1-clabs.
            write i_output1-clabs unit i_mchb-meins to g_clabs1.
            condense g_clabs1.
            concatenate '(' g_clabs1 ')' into g_clabs separated by space.
            write: 85(18) g_clabs right-justified,
                 125 sy-vline.
          endif.
          format color off.
          write /1(125) sy-uline.
        endat.
    At end of  characteristic
        at end of atinn.
          read table i_output1 index l_tabix.
          sum.
          format color 3 intensified on.
          write :/1 sy-vline,  2(25) 'Total for Characteristic:'(014),
                 28(25) i_output1-atnam.
          if i_output1-clabs ge 0.
            write:  85(18) i_output1-clabs  unit i_mchb-meins,
            125 sy-vline.
          else.
            i_output1-clabs = - i_output1-clabs.
            write i_output1-clabs unit i_mchb-meins to g_clabs1.
            condense g_clabs1.
            concatenate '(' g_clabs1 ')' into g_clabs separated by space.
            write: 85(18) g_clabs right-justified,
                 125 sy-vline.
          endif.
          format color off.
          write /1(125) sy-uline.
        endat.
      endloop.
    endform.                    " display_report
    *&      Form  DISPLAY_BATCH
         Display the batch details for the seclected material            *
    form display_batch.
    Get the batch details for the selected material
      get cursor field g_cursor.
      if g_cursor = c_cursor1 or
         g_cursor = c_cursor2 or
         g_cursor = c_cursor3 or
         g_cursor = c_cursor4 or
         g_cursor = c_cursor5 or
         g_cursor = c_cursor6.
        format color 3.
        write: /1 sy-vline,
                2(17) 'Material Number :'(020),
               20(17) i_output1-matnr,
               94 sy-vline.
        format color off.
        write /1(94) sy-uline.
        loop at i_mchb1 where matnr = i_output1-matnr and
                              atinn = i_output1-atinn and
                              atflo = i_output1-atflv.
          format color col_normal.
          shift i_mchb1-charg left deleting leading '0'.
          write :/1 sy-vline,  2(16) i_mchb1-lgort centered,
                 18 sy-vline, 19(17) i_mchb1-charg centered,
                 36 sy-vline.
          if i_output1-atnam cs c_ratio.
            write: 37(29) i_mchb1-atflv
                           exponent 0 decimals 2 centered.
          else.
            write : 37(29) i_mchb1-atflv
                          exponent 0 decimals 0 centered.
          endif.
          write : 66 sy-vline, 67(27) i_mchb1-clabs unit i_mchb-meins,
                  94 sy-vline.
          format color off.
        endloop.
        write /1(94) sy-uline.
      else.
        message s899 with 'Invalid cursor position'(016).
        exit.
      endif.
    endform.                    " DISPLAY_BATCH
    *&      Form  HEADING_SECLIST
          Write the Column Headings for Interactive Report
    form heading_seclist.
      write /1(94) sy-uline.
      format color col_heading on.
      write :/1 sy-vline,  2(16) 'Storage Location'(021),
             18 sy-vline, 19(17) 'Batch Number'(017) centered,
             36 sy-vline, 37(29) 'Characteristic Value'(018) centered,
             66 sy-vline, 67(27) 'Quantity'(019) centered,
             94 sy-vline.
      write /1(94) sy-uline.
      format color off.
    endform.                    " HEADING_SECLIST
    *&      Form  COLLECT_RATIO
          Display the Characteristic ratio data
    form collect_ratio.
      loop at i_output.
        clear g_atinn.
        i_output1-atinn = i_output-atinn.
        i_output1-atnam = i_output-atnam .
        i_output1-werks = i_output-werks.
        i_output1-name1 = i_output-name1.
        i_output1-matnr = i_output-matnr.
        i_output1-maktx = i_output-maktx.
        i_output1-clabs = i_output-clabs.
        i_output1-meins = i_output-meins.
        call function 'CONVERSION_EXIT_ATINN_OUTPUT'
             exporting
                  input  = i_output-atinn
             importing
                  output = g_atinn.
        if g_atinn cs c_ratio.
    If the ratio value is between 13-14.99, display 13
          if i_output-atflv between c_13 and c_1499.
            i_output1-atflv = c_13.
    If the ratio value is between 15-16.99, display 15
          elseif i_output-atflv between c_15 and c_1699.
            i_output1-atflv = c_15.
    If the ratio value is between 17-18.99, display 17
          elseif i_output-atflv between c_17 and c_1899.
            i_output1-atflv = c_17.
    If the ratio value is between 19-20.99, display 19
          elseif i_output-atflv between c_19 and c_2099.
            i_output1-atflv = c_19.
    If the ratio value is between 21-22.99, display 21
          elseif i_output-atflv between c_21 and c_2299.
            i_output1-atflv = c_21.
    If the ratio value is greater than or equal to 23, display 23
          elseif i_output-atflv >= c_23.
            i_output1-atflv = c_23.
          endif.
          write i_output1-atflv to i_output1-atflv .
        else.
          write i_output-atflv to i_output1-atflv exponent 0 decimals 0.
        endif.
        collect i_output1.
        clear   i_output1.
      endloop.
      sort i_output1 by atinn werks matnr atflv.
    endform.                    " COLLECT_RATIO
    Reward if useful..
    Regards,
    Anji

Maybe you are looking for