About audio format encoding and byte[] data

1.may i know how many types of encoding besides 5 types list in java api?
2.how will encodings affect output sound?
3.i get an exception when i try to to convert from PCM_UNSIGNED to ALAM. Is there any plugin to support it?
java.lang.IllegalArgumentException: Unsupported conversion: ALAW 22050.0 Hz, 8 bit, mono, 1 bytes/frame, from PCM_UNSIGNED 22050.0 Hz, 8 bit, mono, 1 bytes/frame.4.how will the number of channel affect output sound?
5.how will the data array size affect output sound? what value should we put instead of 4096?
byte[]     data = new byte[4096];
while ((bRead = ais.read(data, 0, data.length)) != -1) line.write(data, 0, bRead);thanks for your reply~

user13556330 wrote:
1.may i know how many types of encoding besides 5 types list in java api?Too many to list...
2.how will encodings affect output sound? They'll generally decrease the quality of the sound, or have no effect on the sound. Depends on the encoding...
3.i get an exception when i try to to convert from PCM_UNSIGNED to ALAM. Is there any plugin to support it?
java.lang.IllegalArgumentException: Unsupported conversion: ALAW 22050.0 Hz, 8 bit, mono, 1 bytes/frame, from PCM_UNSIGNED 22050.0 Hz, 8 bit, mono, 1 bytes/frame.
There's no ALAW converted built-in, no. There probably is a plugin you can find on the internet to do the conversion, but, it's up to you to find it...
4.how will the number of channel affect output sound?Generally sound is designed to be rendered as one-channel per speaker... so "stereo" is 2-speakers, "surround sound" is 5 or 7 speakers, etc... you don't have to follow this rule, but, that's the "goal" of multi-channel sound.
5.how will the data array size affect output sound? what value should we put instead of 4096?Assuming you're doing that code to play a file, that's essentially your "buffer" size. If you use a buffer that's too big, it'll take a long time to begin playing... if you use a buffer that's too small, it'll have too much overhead and your audio may skip.
The standard sound format is 2-channel 16-bit PCM played at 44.1K, so a buffer size of 4096 represents about 25 milliseconds of sound... which is a good length for a buffer. I'd recommend keeping your buffer length to where it represents 20-50 milliseconds worth of data...but you can always have a longer buffer. Standard anti-skip CDs generally use a 4-second buffer, which would be 705,600 bytes...

Similar Messages

  • What audio format encoded into iTunes HD Movies and TV shows?

    What audio format encoded into iTunes HD Movies and TV shows, AC3, 5.1 DolbyDigital? Its been a long long while since I rented an HD movie on ATV since netflix came around with streaming and BD. Now they have rentals and purchases. Anyone know if the purchases play with 5.1 or better audio?

    I think if you pull up the movie in the iTunes store it should tell you. For example, I pulled up the Star Trek movie that came out a few months ago, and it reports "Dolby Digital 5.1 surround sound". Clearly you need to make sure that your hardware supports whatever sound configuration the movie employs.

  • When attempting to format region and set date and time the busy icon appears and seems to stay like this?

    when attempting to format region and set date and time the busy icon appears and seems to stay like this?

    Click on DU's Partition tab when you have the raw drive name selected, then set it to one partition, Mac OS Extended. If it crashes or freezes, it is finding a bad block and can't write.
    In any event, if you want to use the drive, and have not zeroed it before, you should now.
    Click on Erase -> Security Options -> Zero out data. Still with the full drive selected and not any partition(s).
    Then repartition the drive if needed.
    Boot from the DVD if that doesn't work. And no, TTPro has never mapped out bad blocks let alone create partitions.
    Disk Utility in 10.4.8 is quite good, excellent in fact. No need for an alternative.
    Your eMac drive may need to touch of Disk Utility itself. FSCK from the command line, clear the caches with Applejack along with check for corrupt plists. Between Disk Utilty and Applejack (free/shareware) never had to use TechTool Pro - or at least there weren't any errors after those two got done. But if you want a good 3rd party, pick up Disk Warrior 4.

  • Settings General About Diagnostics & Usage Diagnostic and Usage data

    Settings > General > About > Diagnostics & Usage > Diagnostic & usage Data.
    Everytime I look Diagnostic & usage data I see full of crash reports such as Log-aggregate, LowMemory, assistivetouchd and etc... This crashes/crash report should be the reason why my ipod touch 4th gen is slow, sometimes hangs for a second and sometimes crash apps. I already tried to reduce the memory usage to 50% and momentarily double click home button to remove the applications running at the back but still crash reports are adding and reach about 100 and still increasing! Please help me to solve this problem. Maybe give me a tip on how to avoid, minimize or remove this crashes / crash reports on my ipod touch. thank you.

    Welcome to Apple Communities
    Hold Sleep and Home buttons and it will restart. It should be better

  • About Audio format supported

    hai buddies!
    where can i find the list of supported format by player object is player can it play .3gp format b/c many of the real world devices support that format
    hoping for early reply Thankx in advance

    Although I am not sure that I understand your question completely, I think this may help:
            String[] contentTypes = Manager.getSupportedContentTypes(null);
            for ( int i = 0; i < contentTypes.length; i++ )
                System.out.println(contentTypes);

  • Some advice on audio formats and converting tracks

    _*Some thoughts about audio formats and conversions. These are all supported by iTunes unless stated otherwise.*_
    General principles : there is no point in converting an already compressed track into a higher bit rate - it may seem as if this would give an improved quality, but once information has been lost through compression, there is no recovering it. The sound MAY be improved subjectively through the use of an appropriate EQ setting.
    This is not a definitive list : other formats, for example the one used by Real Player, and the ATRAC minidisc codec used by Sony, are not listed : many of the following can be used in iTunes, or are reasonably well-known.
    To use one of the available formats, they should be set in the Importing tag in *iTunes Preferences* (Advanced prior to iTunes 8, now in General). Once set, the format is used for importing CDs, but can also be used to convert tracks already in iTunes (using the Advanced menu : +Convert Selection to xxx+ ). It is not used when dropping files onto iTunes, or using Add To Library.
    1. _Lossless formats_
    Certain high-quality audio formats are "Lossless". This means that if the track is re-converted into the same format (after editing, for example), it will not degrade no matter how many times that is done.
    .AIFF - a format (common in Macs) representing full CD quality. Bit-rates are over 1400 kbps; +1 minute of music is approx 10MB.+
    .WAV - more or less the same as .AIFF but a Windows format.
    *Apple Lossless* - a 'once-only compression', applied to .AIFF or .WAV tracks to retain quality but reduce file sizes. A little (totally inaudible) information is lost, but also a more efficient 'codec' (compression algorithm) is involved. +1 minute = approx 5MB.+
    .FLAC - similar to Apple Lossless, but less proprietary (a more open standard). Not supported by iTunes.
    2. _'Lossy' formats_
    These formats are so-called because each time the conversion is done, the track is re-compressed, and more information is lost even if the file size remains the same. Various quality settings can be chosen, from around 320 kbps (high) down to below 128 kbps, though 128 is reckoned to be the lowest acceptable bit rate to listen to music in stereo.
    In general, the higher the input quality, the higher the output quality when 'stepping down'. Therefore an .AIFF track converted directly to 128kbps 'lossy' will sound better than a 256kbps track re-compressed to the same 128kbps.
    .MP3 - a standard audio compression format that has been around for many years. Common everywhere, and supported by virtually all contemporary music players. The codec has been improved so that modern MP3s sound markedly better than earlier versions. +1 minute @ 128 kbps = approx 1MB.+
    .AAC - a superior codec to MP3 (though the quality gap has narrowed), which has been chosen by Apple as the iTunes format of choice. Nowadays, a track at 128 kbps .AAC will sound around the same quality as the same track at 160 kbps MP3. +1 minute @ 128 kbps = approx 1MB.+
    .WMA - Windows' own proprietary lossy codec. It seems to have a bright and sparkly sound compared to MP3, but lacks a decent 'bottom end', i.e. the bass tones are somewhat lacking. Not supported by iTunes. (Can be played using VLC).
    .OGG - the open standard Ogg Vorbis format, often held to be superior to MP3 but little-used and therefore not supported in many platforms and players, including iTunes.
    When considering which format to use, the most important things to remember are
    1. how will these tracks be played back? (on a hi-fi? an iPod? expensive earphones?)
    2. the quality will depend finally on the judgement of the listener (some ears are better at telling small differences in quality than others)
    3. how much space is available to store (and expand) the music library?
    As for quality, a good way to decide is to "audition" different formats. Using one CD track known to you, try importing it at several different formats and bit rates (using iTunes Preferences). Then just play them, see which sounds best to you. In this way I came to decide for myself that AAC @ 256kbps was the best for me +(1 minute = approx 2MB).+

    The Windows version of iTunes supports importing of WMA files, converting them to one of the other formats. Mac iTunes offers now support of WMA files at all.
    Good point - and if I knew more about iTunes on Windows I would amend that and post a different version of the article in their forum.
    I accept the point about .WAV files being used also for compressed formats but didn't want to make it too complicated; the most common use for .WAV I believe, is full quality audio.
    On the subject of Lossless compressed audio (FLAC and AL), Wikipedia has this :
    _*Difficulties in lossless compression of audio data*_
    +It is difficult to maintain all the data in an audio stream and achieve substantial compression.+ +First, the vast majority of sound recordings are highly complex, recorded from the real world. As one of the key methods of compression is to find patterns and repetition, more chaotic data such as audio doesn't compress well. In a similar manner, photographs compress less efficiently with lossless methods than simpler computer-generated images do. But interestingly, even computer generated sounds can contain very complicated waveforms that present a challenge to many compression algorithms. This is due to the nature of audio waveforms, which are generally difficult to simplify without a (necessarily lossy) conversion to frequency information, as performed by the human ear.+
    +The second reason is that values of audio samples change very quickly, so generic data compression algorithms don't work well for audio, and strings of consecutive bytes don't generally appear very often. However, convolution with the filter [-1 1] (that is, taking the first difference) tends to slightly whiten (decorrelate, make flat) the spectrum, thereby allowing traditional lossless compression at the encoder to do its job; integration at the decoder restores the original signal.+
    +Codecs such as FLAC, Shorten and TTA use linear prediction to estimate the spectrum of the signal. At the encoder, the estimator's inverse is used to whiten the signal by removing spectral peaks while the estimator is used to reconstruct the original signal at the decoder.+
    This seems to imply that even Lossless codecs make changes, but it IS a very complex subject. If I could still edit the main article I would remove that bit about AL losing information.

  • Best audio format for recording speech?

    Hello everybody,
    I was wondering which audio format (encoding, sample rate, sample size) is considered best for recording speech in regard of memory usage and perceptible/acceptable quality loss.
    What do you suggest, what are your experiences, what reasons can you state?
    Thanks!

    I finally found something:
    [sample rate for speech|http://wiki.audacityteam.org/index.php?title=Sample_Rates#32_kHz_.2F_14.5_kHz]
    [bit depth|http://wiki.audacityteam.org/wiki/Bit_Depth#16_Bit]
    I know audacity is not an application based on the java sound api but these wiki articles provide good common information on signal processing.
    According to the article I believe 32kHz ist the optimal sample rate for recording speech. But I still don't feel satisfied by the information given about the bit depth. I think 8 bit is too low but 16 bit (CD quality) might be too sumptuous. Unfortunately the quality I can record with is limited my recording and output hardware so it might become hard for me to top that out. Maybe someone can help.
    Is it true, that the encoding can be customized with codecs by extending the audio service provider? How would something like that work?

  • Problem printing simplified Chinese on PM4i printer using multi-byte data

    I am new to printing data in Simplified Chinese and have tried for a period of time to get it to work but it is not working. I would appreciate any help.
    This is what I have:
    1. Chinese data stored as multi-byte data in oracle 10g db. It is in one of the attribute fields on the mtl_system_items table. The data field it is stored in is defined as varchar2(240). I have to extract that data and print it out as simplified Chinese characters on 3x4 label stock on PM4i printer which is setup to use IPL as the default language.
    2. Purchased the simplified Chinese font kit ( compact flash card ) and plugged it into the compact flash port on back of the printer. The simplified Chinese font is assigned.
    3. Created simple program to build the label file to send to the printer to print the Chinese glyphs. I expected 3 to print but it only prints 1 Chinese glyph and that is not the correct.
    a. Data shown in Chinese
    传感器
    b. Data in hex format => E4BCA0E6849FE599A8
    c. Data in utf8 => ä¼ æ„Ÿå™¨
    d. Simple oracle pl/sql program code to extract data from oracle and create the format file for printing
    CREATE OR REPLACE PROCEDURE china_test_label1 is
    hold_length number;
    v_hold_armpart varchar2(240):= null;
    v_hold_line varchar2(500);
    v_file_name varchar2(100) := 'chlabel1.txt';
    v_file_line1 varchar2(100) := '<STX><ESC>C<ETX>';
    v_file_line2 varchar2(100) := '<STX><ESC>P<ETX>';
    v_file_line3 varchar2(100) := '<STX>E4;F4;<ETX>';
    v_file_line4 varchar2(100) := '<STX>H00;o0200,0200;c60;k32;d0,30;<ETX>';
    v_file_line5 varchar2(100) := '<STX>L1;o102,102;f0;l575;w5;<ETX>';
    v_file_line6 varchar2(100) := '<STX>R<ETX>';
    v_file_line7 varchar2(100) := '<STX><ESC>E4<CAN><ETX>';
    v_file_line8 varchar2(100) := '<STX><ETB><ETX>';
    v_file_line varchar2(500);
    v_file_handle UTL_FILE.file_type;
    v_submit_status number;
    v_out_path_name varchar2(50);
    v_export_path_name varchar2(50);
    -- Program Starts Here
    BEGIN
    fnd_file.put_line(fnd_file.log, '------- Starting Label job -------');
    SELECT description
    INTO v_out_path_name
    FROM fnd_lookup_values
    WHERE lookup_type = 'ARM_DATA_FILE_OUT_PATH'
    AND lookup_code = '$FLMARM_TOP';
    v_file_handle := utl_file.fopen(v_out_path_name, v_file_name, 'W');
    v_file_line := v_file_line1;
    utl_file.put_line(v_file_handle, v_file_line);
    v_file_line := v_file_line2;
    utl_file.put_line(v_file_handle, v_file_line);
    v_file_line := v_file_line3;
    utl_file.put_line(v_file_handle, v_file_line);
    v_file_line := v_file_line4;
    utl_file.put_line(v_file_handle, v_file_line);
    v_file_line := v_file_line5;
    utl_file.put_line(v_file_handle, v_file_line);
    v_file_line := v_file_line6;
    utl_file.put_line(v_file_handle, v_file_line);
    v_file_line := v_file_line7;
    utl_file.put_line(v_file_handle, v_file_line);
    BEGIN
    select attribute13
    INTO v_hold_armpart
    FROM apps.mtl_system_items
    WHERE segment1 = '20928536'
    AND organization_id = 282;
    EXCEPTION
    WHEN others THEN
    v_hold_armpart := 'nothing';
    END;
    v_file_line := '<STX>'||v_hold_armpart||'<CR><ETX>';
    utl_file.put_line(v_file_handle, v_file_line);
    v_file_line := v_file_line8;
    utl_file.put_line(v_file_handle, v_file_line);
    utl_file.fclose(v_file_handle);
    fnd_file.put_line(fnd_file.log, '-------------------------------------------');
    fnd_file.put_line(fnd_file.log, '-- end of job ');
    fnd_file.put_line(fnd_file.log, '-------------------------------------------');
    END china_test_label1;
    show errors;
    e. i do lpr -P printer filename to print the file. here is the file contents :
    <STX><ESC>C<ETX>
    <STX><ESC>P<ETX>
    <STX>E4;F4;<ETX>
    <STX>H00;o0200,0200;c60;k32;d0,30;<ETX>
    <STX>L1;o102,102;f0;l575;w5;<ETX>
    <STX>R<ETX>
    <STX><ESC>E4<CAN><ETX>
    <STX>ä¼ æ„Ÿå™¨<CR><ETX>
    <STX><ETB><ETX>
    i think the issue here may be with formating the mulit-byte data into format it can be printed using the c60 font. Any
    coding examples would be greatly appreciated

    Hi,
    Welcome you post on the forum.
    However, this is not the right forum for you. It is only for SAP Business One user. Please search entire forums first to find which one is more proper.
    However, this issue may not be related to SAP at all. Search on the web would be better.
    Thanks,
    Gordon

  • Confusion regarding Binary data and byte arrays

    HI guys,
    I have a question...i am going to send some binary data...the format of that data is that first two bytes is the lenght of the data and then follows that data. Here i have one confusion. e.g. i want to say that the lenght of my data is 1000 bytes. How do i do it.
    coz if i do something like this.
    int k = 1000;//the length of my data
    String binaryString = Integer.toBinaryString(k);
    byte[] binaryData = binaryString.getBytes();
    and then if i say binaryData.lenght, i see a lenght of 10, as the binary string which
    is generated is -> 1111101000. i guess its obivious as this byte array is nothing but perhaps a character array with each character occupying one thread...so what exactly is the difference between byte array and binary data. and in the above said condition how do i send the binary data?
    Also adding to my confusion is the fact that i have a file which contains binary data, but that data is not 10010101 type of data...its just some absurd characters. How do we explain this.
    i would be highly grateful if you could explain me the solution to this problem.
    I am not getting as to how to go about it.
    its urgent..pls help...

    one sec..actually i dont want to 'read' the two bytes. That i know how to do? but The thing is that i want to write a binary stream. right? so in that the first two bytes should be the size of the data, followed by the data itself. So i want to write the first two bytes, which should contain the size of data (as a matter of fact i have that binary data in a byte array). But my question is , that if i say the size of data is 1000 (bytes , since, as i said i am gettting the data as a byte array), how do i write this in my binary stream as 1000 in this case would be an int. right? which is four bytes. So essentially that byte array (which contains binary data) i have to forward to somewhere, say X , but X reads binary data in the following way...it expects the first two bytes to give him info regarding the size of the data to follow and then it starts reading the data from the third byte onwards till the size of the data (which it got by reading first two bytes)...i hope i could communicate my confusion better this time

  • Create and read byte data

    How to create a byte data, I dont know how to call it, i will clear it below,
    Header | Message |
    Username | 01101001 |
    How to create like this, sorry if my question is not clear, i will clarify the doubt if you have.

    >
    Actually i am working in a sensor project, the sensor reads the heart beat and body temperature and then it sends through Bluetooth, so first i have to read it and later i have to convert it into string. Hope it clears now.
    >
    No - it isn't clear now.
    You need to explain how the sensor hardware is providing the data. Is it as a stream of bytes? What is the interface between the pc and the sensor? How does the Java app know that there is sensor data available? How does it query the sensor to determine the status.
    If the sensor provides a pulse value of '60' how does the sensor encode that value? Does it use binary? BCD? floating point?
    A binary value of '60' would be hexadecimal 0x3c and in binary would be 00111100. Why would you want to display 00111100? No one would understand what that value means. Shouldn't you display '60'?
    Provide sample sensor data, the format the sensor uses and what you are really trying to do with the data.

  • TS3579 I found this useful because I did not know about the effect of typing in data and that you could only drag to rearrange the data.  I had typed in data before and this had caused problems but restoring defaults did not cause correct dates to show up

    I found this  (TS3579: If the wrong date or time is displayed in some apps on your Mac Learn about If the wrong date or time is displayed in some apps on your Mac) useful because I did not know about the effect of typing in data and that you could only drag to rearrange the data.  I had typed in data before and this had caused problems but restoring defaults did not cause correct dates to show up in Finder. 

    It sounds like there are a couple things going on here.  First check if you have a successful install of SQL Server, then we'll figure out the connection issues.
    Can you launch SQL Server Configuration Manager and check for SQL Server (MSSQLSERVER) if default instance or SQL Server (other name) if you've configured your instance as a named instance.  Once you find this, make sure the service is started. 
    If not started, try to start it and see if it throws an error.  If you get an error, post the error message your hitting.  If the service starts, you can then launch SSMS and try to connect.  If you have a default instance, you can use the machine
    name in the connection dialog.  Ex:  "COWBOYS" where Cowboys is the machine name.  However, if you named the SQL Server instance during install, you'll need to connect using the machine\instance format.  Ex:  COWBOYS\Romo (where Romo
    is the instance name you set during install).
    You can also look at the summary.txt file in the SQL Server setup error logs to see what happened on the most recent install.  Past install history is archived in the log folder if you need to dig those up to help troubleshoot, but the most
    recent one may help get to the bottom of it if there is an issue with setup detecting a prior instance that needs to be repaired.
    Thanks,
    Sam Lester (MSFT)
    http://blogs.msdn.com/b/samlester
    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click
    "Mark as Answer" and
    "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.

  • Finder media encoder, how can I add audio formats support?

    I've noticed the feature where if you right click on a media file, you get an option in the popup menu to encode the file to some Apple-friendly format, I suppose.
    I am trying to find a way to enhance this program's support for audio formats. I have tons of music in FLAC and a little bit in other formats like OGG and -gosh- wma, and I'd rather convert them with a native, Apple-written app than with anything else.
    Any clues as to how we can enhance this Encoder feature's support for audio formats?

    Many video and audio files can be added to keynote slides using the Insert Media browser - the sounds and videos need to be in a format recognized by iPad and need to be placed in the browser via iPhoto then synched to the iPad using iTunes. Sound files can be created using Garageband or Quicktime and appear as movies in the browser so it is best to place them in a separate album with descriptive names.
    If you would like Apple to add additional features, give them somme feedback:
    http://www.apple.com/feedback/

  • Encoding h.264 with an audio format other than AAC?

    AME CC only lets me encode an h.264 with AAC audio, and that's the one format I *can't* use for this project! Without descending deep into the crazy world of ffmpeg command lines, is there any way to encode with AC3, WAV, MPEG-2, Vorbis, or FLAC? I hear the occasional murmur of plugins but have never seen a link to such a thing.

    Why can't you use AAC?
    MPEG-4 Part 3 describes support for quite a few audio codecs, AAC and MP3 being the only two most people have heard of.
    I imageine many decoders won't be able to read some codecs on the list. Likewise, other decoders may be able to read codecs not listed, like Vorbis and FLAC.
    I can sympathize with Adobe only wanting to let users make the configuration most likely to be supported. If you want to get fancy, I guess you'll need FFmpeg.

  • Data format/encoding of Transport files?

    Hello everyone,
    When an export is done, two files are generated - an Rxxxx and Kxxxx file.
    The K file contains transport information (I can see it with a utf-8 text editor) and the R file the contents of the transport.  However, I cannot determine what encoding is used - looks like some type of binary file.
    DOES ANYONE KNOW WHAT KIND OF ENCODING AND HOW I CAN CONVERT THIS TO A NON-BINARY FORMAT?
    I've tried the SAR utility but this does not seem to work.
    I have searched for this a bit but have come up empty.
    Any help is appreciated.
    Thanks,  John

    Hi John,
    the format in which the data are stored in the data file is AFAIK a SAP own format. So, I don't think you will find any other tool which is able to read this file. But you don't need another tool, you have R3trans.
    With the command
    R3trans -l <data file> [-w <logfile>] [-v <verbose level>]
    you can list the content of a data file. R3trans writes this content into the log file trans.log by default, but this can be changed with the -w option. And with the option -v you can increase the verbose level (just specify a number > 1) to let R3trans write more details into the log.
    Just try it, perhaps it matches your needs...
    Best regards,
      Dirk

  • Report is executing in background and need data(output) in excel format

    Report is executing in background and need data(output) to get downloaded in excel format in my PC from an internal table;;in any drive i.e. C: or D: .When executing in backround it prompt to user with which location excel file to be saved and the name of file.How to download in background in excel format?
    Edited by: PRASHANT BHATNAGAR on Aug 26, 2008 6:24 AM

    Hi
    Download a report to excel with format (border, color cell, etc)
    Try this program...it may help you to change the font ..etc.
    Code:
    REPORT ZSIRI NO STANDARD PAGE HEADING.
    this report demonstrates how to send some ABAP data to an
    EXCEL sheet using OLE automation.
    INCLUDE OLE2INCL.
    handles for OLE objects
    DATA: H_EXCEL TYPE OLE2_OBJECT,        " Excel object
          H_MAPL TYPE OLE2_OBJECT,         " list of workbooks
          H_MAP TYPE OLE2_OBJECT,          " workbook
          H_ZL TYPE OLE2_OBJECT,           " cell
          H_F TYPE OLE2_OBJECT.            " font
    TABLES: SPFLI.
    DATA  H TYPE I.
    table of flights
    DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
    *&   Event START-OF-SELECTION
    START-OF-SELECTION.
    read flights
      SELECT * FROM SPFLI INTO TABLE IT_SPFLI UP TO 10 ROWS.
    display header
      ULINE (61).
      WRITE: /     SY-VLINE NO-GAP,
              (3)  'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (4)  'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (8)  'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
      ULINE /(61).
    display flights
      LOOP AT IT_SPFLI.
      WRITE: / SY-VLINE NO-GAP,
               IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
      ENDLOOP.
      ULINE /(61).
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-007
           EXCEPTIONS
                OTHERS     = 1.
    start Excel
      CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
    PERFORM ERR_HDL.
      SET PROPERTY OF H_EXCEL  'Visible' = 1.
    CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'
    PERFORM ERR_HDL.
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-008
           EXCEPTIONS
                OTHERS     = 1.
    get list of workbooks, initially empty
      CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
      PERFORM ERR_HDL.
    add a new workbook
      CALL METHOD OF H_MAPL 'Add' = H_MAP.
      PERFORM ERR_HDL.
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-009
           EXCEPTIONS
                OTHERS     = 1.
    output column headings to active Excel sheet
      PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    changes by Kishore  - start
    CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
      CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    add a new workbook
      CALL METHOD OF H_MAPL 'Add' = H_MAP  EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    tell user what is going on
      SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-009
           EXCEPTIONS
                OTHERS     = 1.
    output column headings to active Excel sheet
      PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    changes by Kishore  - end
    disconnect from Excel
         CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING  #1 = 'C:\SKV.XLS'.
      FREE OBJECT H_EXCEL.
      PERFORM ERR_HDL.
          FORM FILL_CELL                                                *
          sets cell at coordinates i,j to value val boldtype bold       *
    FORM FILL_CELL USING I J BOLD VAL.
      CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_ZL 'Value' = VAL .
      PERFORM ERR_HDL.
      GET PROPERTY OF H_ZL 'Font' = H_F.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_F 'Bold' = BOLD .
      PERFORM ERR_HDL.
    ENDFORM.
    *&      Form  ERR_HDL
          outputs OLE error if any                                       *
    -->  p1        text
    <--  p2        text
    FORM ERR_HDL.
    IF SY-SUBRC <> 0.
      WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
      STOP.
    ENDIF.
    ENDFORM.                    " ERR_HDL
    Regards
    Murali Papana

Maybe you are looking for