Fixed length fields??

Hi,
can anyone suggest a simple way of doing the following...
using rightnow as an instance of a calendar,
rightNow.get(Calendar.MINUTE) returns the minute, but if its less than 10, doesn't have the leading zero, but i want it, so i display 09 instead of just 9. could do it with an if statement, but i think thats messy. Cheers
Steve

Hi,
Simply use the following:
DecimalFormat df = new DecimalFormat( "00" );
System.out.println( df.format( j ) );
Works with any number. The format given to the DecimalFormat class tells it the minimum number of fields to use for any given number. For example:
int j = 9; --> 09
int k = 12; --> 12
int m = 113; --> 113
Not messy at all ...
Regards,
Manfred.

Similar Messages

  • Export to fixed length field format

    Sometimes we need to export records from our student system as fixed length text file to integrate with other software.
    Basically the report will only contains  rows of records, But we want to export it to fixed length field text file.
    And then automate the process.
    We also have Crystal enterprise server.  What is the easy and best way to accomplish this?
    Thanks

    Sorry.  Please ignore my last message.  It went into the wrong thread. 
    There is one huge problem with exporting to Fixed Length in 8.5.  The Fixed Length will truncate any trailing white space.  So if you have a could that's 5 characters long but the current value is only 3, it will only be 3 characters long. 
    To get around this, I've had to create a formula for each column in the report and check the lenght of the field and pad or truncated accordingly. 
    For example:
    If Length ({Table.FIELD1}) > 10 Then
         {Table.FIELD1} [1 to 10]
    Else {Table.FIELD1} & ReplicateString ("*", (10 - Length ({Table.FIELD1}));
    So this column should be 10 characters long.  If the field is longer than 10 characters it will truncate it to 10, otherwise it will pad the extra spaces with *.  You can't use spaces to pad because the export driver will truncate them so I decided * were the best choice because for my purposes I knew that character would never be used. 
    Good luck,
    Brian

  • BPC 7.5 NW -- Data Manager Export:  Fixed-Length Fields?

    Hi Experts,
    Client has a requirement that we export a batch of transaction data from BPC, which is generally no problem, but in this case they want to do it with Fixed-Length fields in the Export file.
    I've done a lot of BPC Data Manager Imports with Fixed-Length fields, and that function really works well.  But, has anyone tried to use the Export package with this option?  It doesn't seem to be working in my case yet.
    Any tips?
    Thanks so much, as always,
    Garrett
    =======================
    Update -- After going back to review documentation, it looks like the the *PAD() function is actually intended for export not really importing, which makes sense.  ...The SAP online help library says that it's meant for import, but I now believe that is a typo.
    Also, I've added the line "OUTPUTFORMAT = NORMAL" in my *OPTIONS section.  Anyone else manage to get export working on BPC 7.5 NW
    Edited by: Garrett Tedeman on Mar 3, 2011 1:37 PM

    Update -- This problem may now be resolved.
    I have been able to conduct test IMPORTs of 48,000, then 96,000 and then 1.7 million records.  All were fine.
    It turns out that that difference is that the text files were sorted by amount in the ones that failed.  They were sorted by GLAccount in column A for the ones that succeeded.
    Edit:  Yep, all files loaded normally when re-sorted by GLACCOUNT, etc. on the left-hand side.  Apparently, when you're doing a lot of records that might confuse the system or something
    Edited by: Garrett Tedeman on Nov 18, 2010 11:41 AM

  • Output file as a text file with tab delimited and fixed length fields

    Hi all,
    I have developed a custom report which outputs an excel file on the user desktop who executes that report.Now i need to create an additional (second) excel file with almost the same data as the first file.
    Im using the FM GUI_DOWNLOAD to create the file.i need have the 2nd file as txt file(seperated by space/tab delimited) and also i want the fields to have fixed length.For this format of the file,what parameters do I need to pass to the FM ?
    BR,
    SRM Tech.

    Thanks for the prompt reply.
    Also in the sel screen,Im entering the path where  the o/p file needs to be downloadede.g. C:/Output_folder/Output.xls...Now if I need a text file,do I need to give the fielname as C:/Output_folder/Output.txt.?

  • How to output non-fixed length field by DMEE?

    Hi,
    In DMEE, I need to set a fixed length for each field. If the source data length is less than what we set, it will ouput space to fill in rest of the place. Is that a way I could just out put exactly what I need? No extra space to be output.
    Thank you!

    Hi
    The extra spaces can be removed as follows:
    In the transaction DMEE --> Head --> Format attributes --> Field type = 1
    Best regards
    Jean Daniel

  • Fixed length field in conky

    Please note the "Net: 271B " in the second line on conky. This screenshot was taken when internet was almost idle.
    When the internet speed increases to something like 250Kbps, the while second line shifs by 1 or 2 pixels, resulting into the movement of the whole second line.
    How can I avoid that?
    Screenshot:-
    http://img830.imageshack.us/i/conkyissue.png/
    My .conkyrc file:-
    #avoid flicker
    double_buffer yes
    #own window to run simultanious 2 or more conkys
    own_window yes
    own_window_transparent yes
    own_window_type desktop
    own_window_hints undecorate,sticky,skip_taskbar,skip_pager
    #borders
    draw_borders no
    border_margin 1
    #shades
    draw_shades yes
    # Stippled borders?
    stippled_borders 8
    # border margins
    border_margin 40
    # border width
    border_width 1
    #position
    gap_x 0
    gap_y 0
    alignment top_left
    #behaviour
    update_interval 1
    #colour
    default_color 8f8f8f
    #default_shade_color 000000
    own_window_colour 262626
    #font
    use_xft yes
    xftalpha 0.8
    xftfont bauhaus:pixelsize=10
    override_utf8_locale yes
    #to prevent window from moving
    use_spacer yes
    minimum_size 1268 0
    #mpd
    mpd_host localhost
    mpd_port 6600
    TEXT
    Cpu: ${color e0e0e0}${font} ${freq}Mhz ${cpu}% ${cpubar 7,50} | ${color} Temp: ${execi 60 ~/thermal} | ${color} Mem: ${color e0e0e0}${font}${mem} ${membar 7,50} | ${color} Root: ${color e0e0e0}${font}${fs_free /} ${color} | ${color} Email: ${color e0e0e0}${execi 300 ~/gmail} | ${color} Mpd: ${color e0e0e0}${font}${mpd_smart} | ${color} Up: ${color e0e0e0}${font}${uptime_short}${color} | ${color} ${execi 5 ~/battery}
    Net: ${color e0e0e0}${font}${downspeed eth0} Kb/s ${color} ${totaldown eth0} downloaded | ${color} ${color e0e0e0}${upspeed eth0} Kb/s ${color} ${totalup eth0} uploaded${color}

    anonymous_user wrote:
    For example, in the last line, use this:
    Net: ${color e0e0e0}${font}${downspeed eth0} Kb/s ${color} ${goto 150}${totaldown eth0} downloaded | ${color} ${color e0e0e0}${upspeed eth0} Kb/s ${color} ${totalup eth0} uploaded${color}
    Tweak the value of the goto if necessary.
    cool. that did the job...
    Thanks

  • Multiple idoc segment values to field fixed length FCC

    Friends,
    I need help to resolve a mapping issue. here is the brief about the scenario.
    Scenario: IDoc to Flat file Fixed length fields
    Issue: Idocs has values in multiple segments. i need to check condition for each segment occurrence if value exists then pass value if not then pass constant (i have to pass constant so that i can get the actual column width after FCC)
    Iam using the following logic.
    If condition then value1 -> remove contexts -> split by value -> target
    My scenario works fine for the above mapping however when i try introduction a constant in "if then else" then all my contexts in the target structure messes up.
    Thanks for your help.
    Regards,
    Pavan

    Did you tried MapWithDefault before Remove Contexts? To give more perfect solution , we would like to see a sample structure.
    raj.

  • Bank statement: problem to load variable length field

    we have many bank accounts with different banks, and we would like to use the bank reconciliation module to do bank reconciliation.
    we have problem in load the MT940 bank statement. All these banks are providing so called standard SWIFT940 format, which not able to give fixed length field.
    we have problem on line 61 which have a lot of variable length fields.
    line 61 comprise of 7 fields, which are:
    A) Value date - fixed 6 chars.
    B) Entry date - fixed 4 chars.
    C) Credit/debit - variable 1-2 chars.
    D) Fund Code - fixed 1 char
    E) Transaction amount - variable 15 chars
    F) Transaction code/type - fixed 4 chars
    G) MID, cheque#, BIS - variable 16 chars
    How can we write the SQL Loader script if there is no delimiter, and the start position of the fields are not fixed?
    we can load A and B easily, but C onwards we will have problems.
    please help.
    INTO TABLE ce_stmt_int_tmp
    WHEN rec_id_no = '61'
    TRAILING NULLCOLS
    (rec_no RECNUM,
    rec_id_no POSITION(1:2) CHAR,
    column1 POSITION(4:9) CHAR,
    column2 POSITION(10:13) CHAR,
    column3 ??
    column4 ??
    column5 ??
    column6 ??
    column7 ??
    ------

    Hi Linda,
    As said by gupta, please check, whether the bank statement has the statement 62F:
    If not, please get the statement again from bank and ensure that the end statement 62F exists in the statement..
    This will help you to overcome your problem..
    Regards,
    Praisty

  • Fixed Length RFC Values?

    I have an RFC call I need to make.  The results of the call contained a fixed length field.  Naturally, the leading/trailing whitespace of this field is trimmed by the XML parser.  To persist the whitespace I'll need to use CDATA which is unparsed.  However, I haven't found a way to modify the data structure or call to make that XML element use the CDATA block.  Can anyone share their tips for solving this condition?

    Hi,
    CDATA conversion shd be done in the function Module. unfortunatley i am not ABAPer so i don't how, but i know this shd be done at ECC.
    when the function module is coded to generate the field with CDATA, PI will not trim the spaces.
    This is not the solution but thought this info may guide you in right path
    Regards,
    Sukarna.

  • Defaulting fixed length file fields to 'blank'

    Hi,
    I am currently working on an outbound interface which results in the construction of a fixed length record flat file. At the moment I am having to deal with each field in person to ensure that either a value,or a blank is mapped to the target field as each field is mandatory. Is there an easier way to do this such as using the 'default' setting in the data type definition with some special character to represent a blank so that I dont have to worry about missing values in my message.
    Regards,
    Pete

    Hi
    I have the same problem, and didn't find any way to default the fields.
    It helps to use the function "mapWithDefault", but you still have to deal with each field.
    Br,
    Elling

  • Fixed length for the fields of  ALV output

    Hi,
          How to fix a field in the ALV output to its max length..For example..if a field's max length is 10...that coloumn should not be dragged or moved to right..Its lenght shluld be fixed to 10...Could any bod suggest me how to perform this...thanks..
    Shyam.

    Hi,
    U can better optimize the width.it will be good.
    data : W_LAYOUT TYPE SLIS_LAYOUT_ALV.
    W_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM     = SY-REPID
          I_STRUCTURE_NAME       = 'T_ALV'
          IS_LAYOUT              = W_LAYOUT
          IT_FIELDCAT            = T_FIELDCAT_ALV
          I_CALLBACK_TOP_OF_PAGE = 'ALV_TOP_OF_PAGE'
        TABLES
          T_OUTTAB               = T_ALV
        EXCEPTIONS
          PROGRAM_ERROR          = 1
          OTHERS                 = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

  • Filtering Fixed Length data type fields

    Hello,
    My application has filters on fixed length charcter(CHAR) columns. But the query do not return any data because of trailing blanks. I cannot use RTRIM function as there are many filters and modifying them will be a big project. So is there any SET variable that can be used to solve this problem?
    EX: select * from emp where name = 'SMITH' do not return any data.
    select * from emp where name = 'SMITH ' returns data.
    Thanks for help.

    So is there any SET variable that can be used to solve this problem?Nope. This is just one reason why CHAR dataypes are teh Suck and really ought to be avoiding.
    The other problem with using TRIM() is that it will invalidate any indexes on those columns, so you need to build function-based indexes, which is a PITN. An alternative approach would be to
    select * from emp where name = rpad('&ename', 15)
    /but that would require you to go through all your queries and apply RPAD which would be an even bigger PITN.
    I suppose a migration exercise to replace all your CHAR columns is out of the question????
    Cheers, APC

  • Need to download a file which si space delimted and has fixed length char

    Hi,
    I have a custom report which downloads an output file in text format.I need the contents to be space delimited.My file data contains numbers as well as characters.I ahve pased the parameter WRITE_FIELD_SEPARATOR = ' ' in the FM.Hwoever the space is introduced only oif the column value is a character.If its a number/digit,the columns are not seperated by space.
    Now my data appears like that:
    0000101310179.28 +0827200808 DHLBSRF VISA AUG 2008US021SW111 RYAN,BICOVNY
    I want my data to be like this :
    0000101310 179.28 + 0827200808 DHLBSRF VISA AUG 2008 US02 1SW111 RYAN,BICOVNY
    DO I need to pass any additinal parametre?Also for fixed length characrets,do i need to pack/unpack data before passing to the FM ?
    Thanks.

    Hi,
    try this way.
    REPORT ztest_notepad.
    DATA: BEGIN OF it_download OCCURS 0,
           data TYPE string,
          END OF it_download.
    DATA: BEGIN OF it_vbrk OCCURS 0,
            vbeln TYPE vbrk-vbeln,
            fkart TYPE vbrk-fkart,
            fktyp TYPE vbrk-fktyp,
            netwr TYPE vbrk-netwr,
          END OF it_vbrk.
    DATA : l_netwr TYPE char21.
    "START-OF-SELECTION.
    START-OF-SELECTION.
      SELECT  vbeln
              fkart
              fktyp
              netwr
       FROM vbrk
       INTO CORRESPONDING FIELDS OF TABLE it_vbrk
       UP TO 100 ROWS.
      LOOP AT it_vbrk.
        l_netwr = it_vbrk-netwr.
        CONCATENATE it_vbrk-vbeln
                    it_vbrk-fkart
                    it_vbrk-fktyp
                    l_netwr
            INTO it_download-data
            SEPARATED BY space.
        APPEND it_download.
        CLEAR  it_download.
      ENDLOOP.
      CALL FUNCTION 'GUI_DOWNLOAD'
           EXPORTING
                filename = 'C:\test.txt'
                filetype = 'ASC'
           TABLES
                data_tab = it_download.
    Thanks
    Venkat.O

  • Loading "fixed length" text files in UTF8 with SQL*Loader

    Hi!
    We have a lot of files, we load with SQL*Loader into our database. All Datafiles have fixed length columns, so we use POSITION(pos1, pos2) in the ctl-file. Till now the files were in WE8ISO8859P1 and everything was fine.
    Now the source-system generating the files changes to unicode and the files are in UTF8!
    The SQL-Loader docu says "The start and end arguments to the POSITION parameter are interpreted in bytes, even if character-length semantics are in use in a datafile....."
    As I see this now, there is no way to say "column A starts at "CHARACTER Position pos1" and ends at "Character Position pos2".
    I tested with
    load data
    CHARACTERSET AL32UTF8
    LENGTH SEMANTICS CHARACTER
    replace ...
    in the .ctl file, but when the first character with more than one byte encoding (for example ü ) is in the file, all positions of that record are mixed up.
    Is there a way to load these files in UTF8 without changing the file-definition to a column-seperator?
    Thanks for any hints - charly

    I have not tested this but you should be able to achieve what you want by using LENGTH SEMANTICS CHARACTER and by specifying field lengths (e.g. CHAR(5)) instead of only their positions. You could still use the POSITION(*+n) syntax to skip any separator columns that contain only spaces or tabs.
    If the above does not work, an alternative would be to convert all UTF8 files to UTF16 before loading so that they become fixed-width.
    -- Sergiusz

  • Import data from a Fixed Length File into Oracle database

    Hi,
    I would like to import data from a Fixed Length text file into a table using HTML DB application.
    As of now, i have a .sql file(that uses external table) to import the data into Oracle tables
    I would like to integrate this in my HTML DB application so that the user can directly import the data into the table.
    Sample data
    XXXYYYYZZZZZ
    Data should be read to table that has
    Col1 Col2 Col3
    XXX YYYY ZZZZZ

    Hi,
    I would like to import data from a Fixed Length text
    file into a table using HTML DB application.AFAIK, fixed length imports are not something you can do directly with the HTML DB tools or available APIs.
    As of now, i have a .sql file(that uses external
    table) to import the data into Oracle tables
    I would like to integrate this in my HTML DB
    application so that the user can directly import the
    data into the table.Any fixed-length data needs to have a specification associated with it that indicates which character position begins a new column and what each column represents. Some also include what datatype should be used for each of those.
    If you really want to do this I would suggest that you create a table that you can store the file spec in. It would probably have columns for field name, start position, length or end position, datatype and any alias/column name you might want to apply. You would then use this table in a PL/SQL procedure (probably a package with the main processing procedure and various supporting procedures/functions) to read the file into memory, apply the file spec to each line and then do inserts into your table.
    Obviously, this is just a concept or strategy. Implementing it will depend on your PL/SQL skills and determination. If you want to pursue this strategy I'm sure you can find some jump-starts by doing a search on the PL/SQL forum.
    This may not sound like an answer - but the answer is you need to code it to fit your requirements. Hope that helps.
    Earl

Maybe you are looking for

  • Camera Raw in Photoshop CC with a bug ?

    I'm trying to edit some raw files from my Canon 6D with Camera Raw. I change the exposure setting, but everytime I move to the next slide bar ( contrast ou highlights, or any other), the exposure setting goes back to zero. What is happening ? I never

  • Can't download a file because I don't have privileges.

    I need to install a program on my iMac which I just downloadeD. When I drag it from my desktop to my folder it tells me I don't have privileges to do this. What do I need to change to make this happen?

  • FM 8 and FM 9 - impossible to create large sized PDFs

    This is on Windows Vista, FM 9 and FM 8: 1) Save as PDF does not work when the paper size is 1188 mm x 840 mm (A0 format). A blank pdf is created or a pdf with a size of 1 mm x 1 mm. Same with A1 format 594 mm x 841 mm. A2 format (420 mm x 594 mm) wo

  • Can you change the batteries in the older iMac remote control

    I have the small white remote that came with my iMac in about 2003. Is their any information, like how to change the battery and/or how to pair it with newer iMac etc?

  • How to deinstall Adobe Drive - This is very nasty

    Hello all, during the installation of the TCS2, an application called Adobe Drive has been installed as well. This was not announced, there was no way to avoid the installation and now it cannot be selected in the system settings for deinstallation.