Formatting a field

hi ! gurus this is my problem
i have a field in this format : 20021201 (date)
but a need in this format 01/dec/2002
and...
another field in this format 2314224 ( hour)
but ai need in this format 23:42:24
(sometimes the format is 45621)
but in fact it is 04:56:21
how justify blanks to left?
how i can get difference between two hours in this format ?
i work in servlets pages with as/400
thanks
thanks, by everything
sam

Look into the java.text.DateFormat and SimpleDateFormat classes.

Similar Messages

  • Format for fields in an internal table

    DATA: BEGIN OF ITAB OCCURS 0,
      AUFNR  LIKE AFKO-AUFNR,  " Purchase Order Number
      PLNBEZ LIKE AFKO-PLNBEZ, " Part Number
      BISMT  like MARA-BISMT, " Old Material
      LNO(2),
      GAMNG LIKE AFKO-GAMNG, " Production Order Quantity
      GLTRP  LIKE AFKO-GLTRP,
      VDATU  LIKE VBAK-VDATU,
      KWMENG LIKE VBAP-KWMENG,
      MBDAT  LIKE VBEP-MBDAT,
      GBSTA  LIKE VBUK-GBSTK,
      PCTBS(5),
    *CSHOT
    "CDESC
    END OF ITAB.
    LOOP AT ITAB.
    WRITE:/3 ITAB-AUFNR,
    13 ITAB-PLNBEZ,
    23  ITAB-BISMT,
    LNO(2),
    45 ITAB-GAMNG,
    65 ITAB-GLTRP.
    57 ITAB-VDATU.
    *63 ITAB-KWMENG,
    69 ITAB-MBDAT.
    PCTBS(5),
    *C
    ENDLOOP.
    I have a internal table and I have writing the itab in the write statement. I need to format the field in itab.
    for eg:
    itab-gamng(lenght as 5)
    itab-gltrp(its a date) i just need the mm/yy how can I format it.

    You don' need to reformat the itab, just the fields before you write them.
    <b>data: monthyear(5) type c.
    data: qty(5) type c.</b>
    LOOP AT ITAB.
    <b>concatenate itab-gltrp+4(2) '/'
                itab-gltrp+0(4)
                        into monthyear.
    clear qty.
    qty = qty + itab-gamng.</b>
    WRITE:/3 ITAB-AUFNR,
    13 ITAB-PLNBEZ,
    23 ITAB-BISMT,
    * LNO(2),
    <b>*45 ITAB-GAMNG,
      45 qty,
    * 65 ITAB-GLTRP.
      65 monthyear.</b>
    * 57 ITAB-VDATU.
    * *63 ITAB-KWMENG,
    * 69 ITAB-MBDAT.
    * PCTBS(5),
    *C
    ENDLOOP.
    Regards,
    Rich Heilman

  • How can I format a field in the form creator?

    How can I format a field in the form creator? It's putting the same text in all the fields within a table. I want each field within the table to have different text. As soon as you click out of the table, all the text is the same.
    I even changed the fields from a text box to a drop-down list so a person can make their selection, which will be a quantity from 0-9. There are two of these such fields. You make your selection in each, click off the table and both fields show whatever I selected in field 1. The original Qty I selected in the bottom field was a 5 but it changed it to whatever is in the top field on it's own. I've added a screen shot.

    This behaviors usually happens when you create the fields but  a copy paste command from one of the fields. The copy paste command assumes that your intentions is to maintain a copy of the field in two separate locations (e.i, a form field  "company name" printed in each and every page of a multi-page form document.
    Go to the properties fields of each field and make sure  to assign unique form field  names.

  • How to create Using Formatted Text Field with multiple Sliders?

    Hi i found the Java Sun tutorial at http://java.sun.com/docs/books/tutorial/uiswing/components/slider.html very useful, and it tells how to create one Formatted Text Field with a Slider - however i need to create Formatted Text Field for multiple Sliders in one GUI, how do i do this?
    my code now is as follows, and the way it is now is scroll first slider is okay but scrolling second slider also changes value of text field of first slider! homework due tomorrow, please kindly help!
    // constructor
    label1 = new JLabel( "Individuals" );
    scroller1 = new JSlider( SwingConstants.HORIZONTAL,     0, 100, 10 );
    scroller1.setMajorTickSpacing( 10 );
    scroller1.setMinorTickSpacing( 1 );
    scroller1.setPaintTicks( true );
    scroller1.setPaintLabels( true );
    scroller1.addChangeListener(this);
    java.text.NumberFormat numberFormat = java.text.NumberFormat.getIntegerInstance();
    NumberFormatter formatter = new NumberFormatter(numberFormat);
            formatter.setMinimum(new Integer(0));
            formatter.setMaximum(new Integer(100));
    textField1 = new JFormattedTextField(formatter);
    textField1.setValue(new Integer(10)); //FPS_INIT
    textField1.setColumns(1); //get some space
    textField1.addPropertyChangeListener(this);
    //React when the user presses Enter.
    textField1.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),  "check");
            textField1.getActionMap().put("check", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    if (!textField1.isEditValid()) { //The text is invalid.
                        Toolkit.getDefaultToolkit().beep();
                        textField1.selectAll();
                    } else try {                    //The text is valid,
                        textField1.commitEdit();     //so use it.
                    } catch (java.text.ParseException exc) { }
    label2 = new JLabel( "Precision" );
    scroller2 = new JSlider( SwingConstants.HORIZONTAL, 0, 100, 8 );
    scroller2.setMajorTickSpacing( 10 );
    scroller2.setMinorTickSpacing( 1 );
    scroller2.setPaintTicks( true );
    scroller2.setPaintLabels( true );
    scroller2.addChangeListener(this);
    textField2 = new JFormattedTextField(formatter);
    textField2.setValue(new Integer(10)); //FPS_INIT
    textField2.setColumns(1); //get some space
    textField2.addPropertyChangeListener(this);
    //React when the user presses Enter.
    textField2.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),  "check");
            textField2.getActionMap().put("check", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    if (!textField2.isEditValid()) { //The text is invalid.
                        Toolkit.getDefaultToolkit().beep();
                        textField2.selectAll();
                    } else try {                    //The text is valid,
                        textField2.commitEdit();     //so use it.
                    } catch (java.text.ParseException exc) { }
    // State Changed
         public void stateChanged(ChangeEvent e) {
             JSlider source = (JSlider)e.getSource();
             int fps = (int)source.getValue();
             if (!source.getValueIsAdjusting()) { //done adjusting
                  if(source==scroller1)   {
                       System.out.println("source ==scoller1\n");
                       textField1.setValue(new Integer(fps)); //update ftf value
                  else if(source==scroller2)     {
                       System.out.println("source ==scoller2\n");
                       textField2.setValue(new Integer(fps)); //update ftf value
             } else { //value is adjusting; just set the text
                 if(source==scroller1)     textField1.setText(String.valueOf(fps));
                 else if(source==scroller2)     textField2.setText(String.valueOf(fps));
    // Property Change
        public void propertyChange(PropertyChangeEvent e) {
            if ("value".equals(e.getPropertyName())) {
                Number value = (Number)e.getNewValue();
                if (scroller1 != null && value != null) {
                    scroller1.setValue(value.intValue());
                 else if (scroller2 != null && value != null) {
                    scroller2.setValue(value.intValue());
        // ACTION PERFORMED
        public void actionPerformed(ActionEvent event) {
        if (!textField1.isEditValid()) { //The text is invalid.
            Toolkit.getDefaultToolkit().beep();
            textField1.selectAll();
        } else try {                    //The text is valid,
            textField1.commitEdit();     //so use it.
        } catch (java.text.ParseException exc) { }
             if (!textField2.isEditValid()) { //The text is invalid.
            Toolkit.getDefaultToolkit().beep();
            textField2.selectAll();
        } else try {                    //The text is valid,
            textField2.commitEdit();     //so use it.
        } catch (java.text.ParseException exc) { }
    ...

    if :p3_note_id is null
    then
    insert into notes (project_id, note, notes_month, notes_year) So, p3_note_id is NULL.
    Another option is that you have a trigger on table NOTES that generates a new note_id even for an update.

  • Formatted Text field for File Extensions

    Hi guys,
    Is it possible to create formatted text field for file extension like it should accept *.bmp, .bmp, bmp. etc..... It is not necssary to be a Combo Box. TextField will work.
    Thanks in advance.
    AZGHAR

    Any one here \Help\Help\Help ;-(

  • Formatted Text Field for getting Date

    I need a text field to get Date. does anyone know where I can find such a thing?
    all it needs to do is allow the user to type a date in dd/MM/yy format.
    10x.

    in a jtable it has a problem - when I press tab to exit the field the date is not changed.
    i set the on focus lost behaviour to commit, but still not working.
    also, it allows me to enter 4823749823/02/02 - and it translates it to the right format - I'm interested in something more fixed - allows to enter only 2 digits for day, 2 digits for month,2 digits for year.
    the relevent code I'm using is:
    // a cellEditor that uses a formatted text field that holds a Date object
    public class JFormattedDateCellEditor extends DefaultCellEditor {
    public JFormattedDateCellEditor(final JFormattedTextField textField) {
    super(textField);
    textField.setFocusLostBehavior(JFormattedTextField.COMMIT);
    textField.setHorizontalAlignment(SwingConstants.RIGHT);
    textField.setFont(JUtility.theFont);
    textField.setBorder(null);
    textField.addFocusListener(new FocusAdapter() {
    public void focusLost(FocusEvent e) {
    if (textField.getValue() == null) {
    textField.requestFocus();
    delegate = new EditorDelegate() {
    public void setValue(Object value) {
    textField.setValue((java.util.Date)value);
    public Object getCellEditorValue() {
    return textField.getValue();
    //to set the cell editor:
    column = collectionsTable.getColumnModel().getColumn(CollectionFrame_collectionsModel.DATE_COLUMN);
    column.setCellEditor(
    new JFormattedDateCellEditor(
    new JFormattedTextField(
    new DateFormatter(
    new SimpleDateFormat("dd/MM/yy")))));

  • Format a field as currency

    Hi All,
    Is there any way that one can format a field as currency.
    ie Aligned to the right with decimals - eg 1.00 NOT 1
    Thanks
    Alan

    Hi,
    Thanks for answer.
    I can't even find those options.
    I'm editing a form. Take options Edit | Edit Fields | Show Field Properties |  that brings up a tabbed window with following tabs:  General  Appearance Position Options Actions.
    Where do I find the options you mentioned?
    Regards
    Alan

  • Unable to format print field on Smart Form

    Hello,
    I have a problem trying to format a print field so that it displays correctly.
    The field in question is a display of a percentage (KOMVD-KBETR).
    I currently have the following in a Program node:
    IF NOT <KO>-KBETR IS INITIAL.
    WRITE <KO>-KBETR CURRENCY <KO>-KOEI1 TO GV_KBETR .
    ELSE.
    CLEAR GV_KBETR.
    ENDIF.
    GV_KBETR has to be a character field for the WRITE to work. However if I use GV_KBETR in my TEXT node it appears some of the formatting options don't work on character fields. The one in question is (<)
    I created a variable GV_KBETR_DISP type KBETR and added GV_KBETR_DISP = GV_KBETR to the program node above. Thisformats fine on the smartform. However using this setup I occasionally get an error when executing the smartform which I diagnosed that the GV_KBETR_DISP = GV_KBETR statement doesn't handle the data correctly if the data has a space in it.
    Has anybody got any suggestions I could use to get round this problem?
    Regards
    Mike.

    Hi,
    Why can't you use the field - KOMVD-KBETR to display ?
    IF you want to map the currency to this currency format, then you can simply add it in the Gloabal defnition -> Currency / Qty fields tab.
    If you do not want to display the initial value, then you can use the text formatting option
    &symbol(I)&  Suppress output of the initial value 
    Regards,
    Selva K.

  • Error Message - Value Entered Does Not Match Format of Field

    I keep getting an error message in Adobe Pro X: "The value entered does not match the format of the field [JF13]".
    I have JF13 programmed as follows:
    On Calculate tab:
    if(Number(this.getField("ck4").value) > 0) this.getField("JF13").value = Number(this.getField("FL019").value); else this.getField("JF13").value = " ";
    It is programmed this way so if the user checks the check box before the field, only then will JF13 populate a value, which pulls from FL019. I also have the settings set to "number" because the data needs to display as a dollar amount $xxx.xx.
    FL019 is a hidden field on the form which pulls a dollar amount from a Mainframe, and its settings are also set to "Number" :
    I get four pop up windows with the above mentioned error message, and the only way to make the message stop is to remove the "number" format from the fields. However, when this is done, if any number which ends in a zero is entered, it cuts off the zero. This is not acceptable either.
    Is there some sort of script I could add or some other way to prevent both the error message and the cutting off of the zero on JF13?
    I am not very proficient with javascript, so any assistance would be appreciated!

    Thank you so much for your response!!
    Forgive me for my lack of knowledge - but where exactly would I add that in the script?
    I tried it like this:
    if(Number(this.getField("ck4").value) > 0) this.getField("JF13").value = Number(this.getField("FL019").value); else this.getField("JF13").value = ""(empty string);
    And I got an error saying I was missing a parenthesis. Should it go somewhere else or am I completely off?

  • How can I format a field to have a Check Box in the center.

    I am a new adobe user and I am creating a form in Adobe LiveCycle Designer. Most of what I needed to do I was able to figure out, but I cannot find a way to place a Check Box in the center of a chosen field. Each time I use the Check Box from the library it automatically places the Box in the center-right of the field. Then when trying to format the paragraph, I get no options about where I'd like the box to reside within the field. Is there a simple way to get a Check Box into the center of a Field or will I have to pursue other options. If I do have to pursue other options are there any ways to limit a text to an X and have it either be On or Off?
    Thanks for your aid.

    This behaviors usually happens when you create the fields but  a copy paste command from one of the fields. The copy paste command assumes that your intentions is to maintain a copy of the field in two separate locations (e.i, a form field  "company name" printed in each and every page of a multi-page form document.
    Go to the properties fields of each field and make sure  to assign unique form field  names.

  • Formatting a field in the repetitive area of the Print Layout Design

    Our quantity fields in the repetitive area print out with a decimal point and 3 spaces after the decimal point (i.e. 10.000). How can I change the format of these fields so that there are no decimals included (i.e. 10) when we print an order?
    Thanks.
    Edited by: Philip Eller on Jun 19, 2008 9:56 AM
    Edited by: Philip Eller on Jul 3, 2008 3:11 PM*

    Mike,
    You could use the Formula ABS( )
    Add a Formula type field
    In the Formula select formala ABS()
    syntax: ABS(Field_xyz)..here field Field_xyz is your number field
    If your value was 10.000 the result will be 10. This formula ignores the decimal part.
    The formula ROUND could be used if you want to ROUND the value to the nearest higher or lower integer
    Consider number 10.450
    ROUND(Field_xyz,2)  will give 10 
    ROUND(Field_xyz,1) will give 11
    Suda

  • Number formatted Amount field not working in Excel 2010

    Hi,
    We have BI reports in EBS 11.5.10.2 designed using word 2007 RTF templates. The output is selected to write to Excel so that they can calculate on amount fields. Recently we upgraded to Office 2010 and the amount filed which has number format when downloaded to Excel will not allow to use functions like Sum. If i deleted the table column and add the column back, then it works. Is anyone runing into similar issues....

    Interesting to note this is still a problem, but even more interesting is as to why Excel works fine the first time you bring in the xsd, but not after you save it.  I found information that says it's related to resolving externally referenced xsds,
    which is fine, but again, why does it work the first ime and not the second?   If it were a problem with external xsds then it should never work at all so I think that answer is bogus.
    Something has to be getting corrupted on the save and it's not important enough to MS to spend the time to fix it.

  • Format Tab  - Field Properties (Special)

    The format tab for field properties - Special - gives a phone number option which allows 10 numeric characters or spaces. UK Telephone number format is 11 numeric characters. Would be useful to have a pre defined UK phone format. If you try and create one using the 'arbitary mask' option - that does not permit a mix of numeric values or spaces - it only allows numeric values.

    If one looks at the code Acrobat uses for formatting one would see that the JavaScript uses RegExp object to construct the needed pattern to test keystrokes, validation, and formatting. So it is possible for one to either field level or document level functions for other types of data to collect.
    Beginning JavaScript for Adobe Acrobat has 3 chapters dealing with this subject.

  • Format NUMBER fields in SQLPLUS

    Hi All,
    I'm trying to extract a table into a file (fixed-length fields) with SQLPLUS. The column is 'DEPTNO', defined as NUMBER(2), So I did:
    select to_char(DEPTNO, 'FM09') from table;
    But this always gave me 3-character long output. I expect it to be 2-character long. Given the definition and the fmt I used. I can't figure out why. I also tried '09' and even RTRIM and LTRIM. Didn't work.
    I had the following settings:
    set space 0
    set colsep ""
    Am i missing something here?
    I'll appreciate your help in advance.
    Thanks!
    Scott
    null

    The number formatting functions leave an extra character for a potential sign. This is an old "feature".
    If you have access to Oracle's bug database there is information and some cross references in bug 287153 you may wish to review.
    - CJ

  • Formatting SPRY Fields

    I've got a nice XML stream coming into my page that uses SPRY
    to read the XML and present the data. My problem is this...or
    should I say these, If I get in a data field that has time in it or
    a numeric field that I want to convert to currency I'm not having
    any luck. I tried JSTLs fmt: commands but it appears that there's
    precedence issue and the value of the SPRY field has not yet
    returned so I'm dealing with the {DATE_FIELD} string rather than
    the {DATE_FIELD} value of day 01/17/2006 11:24:57. Obviously I've
    tried setcolumn for the date but that doesn't affect the output to
    the screen.
    I know SPRY has added validation but is there a format
    library on the way or other work around?
    Thanks,
    Chris

    An alternative to the region observer is to use an onPostLoad
    observer on the data set containing the dates ... this is probably
    a better approach since you only do the formatting once, whereas
    the region approach will do it every time the region is
    re-generated.
    Here's a link that shows you how to register a data set
    observer:
    http://labs.adobe.com/technologies/spry/samples/data_region/DataSetObserver.html
    And here's a somewhat overly-complicated example of how to
    access/modify/add columns in a data set:
    http://labs.adobe.com/technologies/spry/samples/data_region/CustomColumnsSample.html
    --== Kin ==--

Maybe you are looking for

  • Seeburger Module Runtime Error when I am executing the 810 signal

    Hi, My Scenarios is Idoc to EDI (810), for testing purpose I configured the receiver File adapter with modules, when i send the data from RWB Integrationengine test tab, I am getting the below runtime error "Message processing failed. Cause: com.sap.

  • Pagination using JSP Presentations.

    Hi, I have implemented a search function in my JSP presentation. The search shows an array of bpm objects in a table and I want to put them in pages with a pagination like google does. I've tried with a taglib, importing the jar in my library and mod

  • Using old G4 to submit CT600 company tax return to HMRC, unable to submit

    This is an odd one, was wondering if anyone else has come across this problem I'm nurturing an old G4 as my main computer, as I still want to use the old Cinema Display monitor. Last year (April 2012) I prepared my Company Tax Return CT600 for the HM

  • SOE report

    I have had a request for a SOE type of report. We are needing a report that basically looks just like the check stub with all the details, but we need to be able to print this for a specific date range. Has anyone created anything like this that they

  • HDD to SSD Offloading

    I have a netbook with all partitions on a HDD, but I am thinking of offloading some mount points (I'm thinking of /usr/bin, firefox cache, and /home/ebooks) to a 8GB uSD card (using ext4 and LVM) so that the HDD will spinup less frequently and for gr