How can i compare the character fields?

I have a requirement to compare the character fields .
I have to compare the 2 character fields of a table CDPOS
As follows .
  If CDPOS-VALUE-OLD  GT  CDPOS-VALUE-NEW
      Populate    REDATED = ‘YES’.
ELSE
      Populate  REDATED = ‘NO’.
My doubt here is how can we compare the character fields.?
   When I do Extended Program Check: I am getting error like this ?
Greater than/less than comparisons with character type operands may not be portable
Please give me idea .
Thanks ,
Suresh Kumar.

Hi suresh,
DATA : a TYPE char10  VALUE 'DBCD',
       b TYPE char10  VALUE '4234',
       c TYPE char10  VALUE '3456',
       d TYPE char10  VALUE 'ADA',
       e TYPE char10 VALUE  '234567'.
IF b GT c.        "this case checks for numeric values
  WRITE :/ 'B is bigger'.
ELSE.
  WRITE :/ 'C is bigger'.
ENDIF.
IF a GT d.      "this case checks for alphbetical order
  WRITE :/ 'A is bigger'.
ELSE.
  WRITE :/ 'D is bigger'.
ENDIF.
IF strlen( a ) GT strlen( d ). "this case checks for no of chars
  WRITE :/ 'A is bigger'.
ELSE.
  WRITE :/ 'D is bigger'.
ENDIF.
IF a GT c.      "this case first alph then numerics
  WRITE :/ 'A is bigger'.
ELSE.
  WRITE :/ 'D is bigger'.
ENDIF.

Similar Messages

  • How can I get the "text" field from the actionEvent.getSource() ?

    I have some sample code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.ArrayList;
    public class JFrameTester{
         public static void main( String[] args ) {
              JFrame f = new JFrame("JFrame");
              f.setSize( 500, 500 );
              ArrayList < JButton > buttonsArr = new ArrayList < JButton > ();
              buttonsArr.add( new JButton( "first" ) );
              buttonsArr.add( new JButton( "second" ) );
              buttonsArr.add( new JButton( "third" ) );
              MyListener myListener = new MyListener();
              ( (JButton) buttonsArr.get( 0 ) ).addActionListener( myListener );
              ( (JButton) buttonsArr.get( 1 ) ).addActionListener( myListener );
              ( (JButton) buttonsArr.get( 2 ) ).addActionListener( myListener );
              JPanel panel = new JPanel();
              panel.add( buttonsArr.get( 0 ) );
              panel.add( buttonsArr.get( 1 ) );
              panel.add( buttonsArr.get( 2 ) );
              f.getContentPane().add( BorderLayout.CENTER, panel );
              f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              f.setVisible( true );
         public static class MyListener  implements ActionListener{
              public MyListener() {}
              public void actionPerformed( ActionEvent e ) {
                   System.out.println( "hi!! " + e.getSource() );
                   // I need to know a title of the button (which was clicked)...
    }The output of the code is something like this:
    hi! javax.swing.JButton[,140,5,60x25,alignmentX=0.0,alignmentY=0.5,
    border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@1ebcda2d,
    flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,
    disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,
    right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,
    rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=first,defaultCapable=true]
    I need this: "first" (from this part: "text=first" of the output above).
    Does anyone know how can I get the "text" field from the e.getSource() ?

    System.out.println( "hi!! " + ( (JButton) e.getSource() ).getText() );I think the problem is solved..If your need is to know the text of the button, yes.
    In a real-world application, no.
    In a RW application, a typical need is merely to know the "logical role" of the button (i.e., the button that validates the form, regardless of whether its text is "OK" or "Save", "Go",...). Text tends to vary much more than the structure of the UI over time.
    In this case you can get the source's name (+getName()+), which will be the name that you've set to the button at UI construction time. Or you can compare the source for equality with either button ( +if evt.getSource()==okButton) {...}+ ).
    All in all, I think the best solution is: don't use the same ActionListener for more than one action (+i.e.+ don't add the same ActionListener to all your buttons, which leads to a big if-then-else series in your actionPerformed() ).
    Eventually, if you're listening to a single button's actions, whose text change over time (e.g. "pause"/"resume" in a VCR bar), I still think it's a bad idea to rely on the text of the button - instead, this text corresponds to a logical state (resp. playing/paused), it is more maintainable to base your logic on the state - which is more resilient to the evolutions of the UI (e.g. if you happen to use 2 toggle buttons instead of one single play/pause button).

  • How can we change the input field on a view stop showing zeros

    Hello,
           To make screen look consistent with other character input field. How can we change the input field on the view stop displaying zeros even though the data type is NUMC and data type should not be change?
    Edited by: sap_learner on Mar 25, 2010 5:44 PM
    Edited by: sap_learner on Mar 25, 2010 5:49 PM
    Edited by: sap_learner on Mar 25, 2010 5:55 PM

    hello Manas Dua,
                           Thanks for your help. I am able to resolve my problem.
    My code will help  the future comers to resolve this kind of issues.
    *The code is applied to method WDDOINIT of the default view.
      DATA lo_nd_terms_input    TYPE REF TO if_wd_context_node.
      DATA lo_nd_terms_input_i TYPE REF TO if_wd_context_node_info.
      DATA lv_zeros             TYPE wdy_attribute_format_prop.
      lv_zeros-null_as_blank = 'X'.
      lo_nd_terms_input = wd_context->get_child_node( name = wd_this->wdctx_input ).
      lo_nd_terms_input_i = lo_nd_terms_input->get_node_info( ).
      lo_nd_terms_input_i->set_attribute_format_props(
        EXPORTING
          name              = `ENTER THE ATTRIBUTE NAME`
          format_properties = lv_zeros     ).
    Edited by: sap_learner on Mar 26, 2010 5:02 PM

  • How can I compare two summary field in cross-tab?

    <p>Dear expert:</p><p>I have one question for how can I compare two summary field in cross-tab?  I have following cross-table:</p><p>Type          Sector1     Sector2    Sector3       Total </p><p>Outlook         10            11           9              30         </p><p>Target            5              3           1               9</p><p>I want to compare the summary field(total) relationship percent, I want to get "9/30". Someone told me I must create the DB view or table via SQL, then can implete in Crystal Report. Can I implete it in Crystal Report via fomula or other function?</p><p>Thanks so much for your warm-hearted help!</p><p>Steven</p>

    Hello Steven, yes you can compare summary fields, If you are comparing Summary to Target, or vice versa - you can do it within Crystal Reports.
    1. In Suppress conditional formula, create 2 Global variables: CurrentOutlook and CurrentTarger and get the current value.
    2. In Display String formula for Total show ToText(CurrentTarget/CurrentOUtlook) + "%".
    For more difficult cases of compariing fields in cross--tab, you may look into http://www.relasoft.net/KB10001.html.
    Best,
    Alexander

  • How can I program the text fields in my email forum to have rounded corners

    How can I program the text fields in my email forum to have rounded off edges or corners. 
    this is the code im using.
    // insert code here// insert code here// prepare email field
    var email = sym.$("email")
    email.html("Enter your Email: ");
    inputEmail = $('<input />').attr({'type':'text', 'value':'', 'id':'email'});
    inputEmail .css ('font-size', 14);
    inputEmail .css ('width', 350);
    inputEmail .css ('background-color', '#4e4e4e');
    inputEmail .appendTo(email);
    // prepare topic field
    var topic = sym.$("topic");
    topic.html("Topic: ");
    inputTopic = $('<input />').attr({'type':'text', 'value':'', 'id':'topic'});
    inputTopic .css ('font-size', 14);
    inputTopic .css ('width', 350);
    inputTopic .css ('background-color', '#4e4e4e');
    inputTopic .appendTo(topic);
    // prepare message field
    var message = sym.$("message");
    message.html("Message: ");
    inputMessage = $('<textarea />').attr({'type':'textarea','rows':'10', 'cols': '25','value':'', 'id':'message'});
    inputMessage .css ('font-family',"Arial,Helvtica,sans-serif");
    inputMessage .css ('color',"#ffffff");
    inputMessage .css ('font-size', 14);
    inputMessage .css ('background-color', '#4e4e4e');
    inputMessage .css ('box-shadow', '#4e4e4e');
    inputMessage .css ('width', 350);
    inputMessage .css ('height', 150);
    inputMessage .appendTo(message);
    var submitBtn = sym.$("btn");
    submitBtn.html("Submit");
    submitBtn.css("text-align", "center");
    submitBtn.css("font-size",14);
    submitBtn.css("font-weight","bold");
    submitBtn.css("color","#ffffff");

    Try this: inputEmail.css ('border-radius', '25px');
    attachment
    more details

  • How can I increase the character limit of my text messages for Droid Maxx 4.4?

    How can I increase the character limit of my text messages for Droid Maxx 4.4?

    Send as a MMS.

  • How can we read the screen field values from the report selection screen wi

    Hi expart,
    How can we read the screen field values from the report selection screen with out having an ENTER button pressed  .
    Regards
    Razz

    use this code...
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_posnr.
    **Read the Values of the SCREEN FIELDs
    CALL FUNCTION 'DYNP_VALUES_READ'

  • How Can I Set the Search Field in iTunes?

    In applescript...
    In another app - I have copied a song title to the clipboard...
    Q: Now - How Can I Set the Search Field in iTunes to the clipboard contents?
    Q: Also how can I also open the main library itunes window?

    Hi Rev Dave,
    Q: Now - How Can I Set the Search Field in iTunes to
    the clipboard contents?
    Unfortunately the only way I can think to achieve this involves the use of "UI Scripting". The other previous posters have given you the preferred method you should consider using. If you want to script iTunes so that you visually see the search take place in iTunes you'll need to use the method shown in the script I've posted below.
    Q: Also how can I also open the main library itunes
    window?
    Cyclosaurus has given you the answer to this part of your question already.
    Here is a script that (though ugly IMHO) should achieve what you are asking for:set theSearch to (the clipboard) as string
    tell application "iTunes"
    activate
    set allPlaylists to playlists
    repeat with aList in allPlaylists
    if name of aList is not "Library" then
    set view of front browser window to aList
    exit repeat
    end if
    end repeat
    set LibList to playlist "Library"
    set view of front browser window to LibList
    end tell
    tell application "System Events"
    tell process "iTunes"
    if "iTunes" is not in name of windows or ¬
    focused of window "iTunes" is false then ¬
    keystroke "1" using command down
    keystroke tab
    keystroke theSearch
    end tell
    end tellIn order for the above script to work you need to have "Enable access for assistive devices" enabled in the "Universal Access" section of the "System Preferences" application.
    If you have any further questions about the above script feel free to ask.
    Hope this helps...
    iBook G4 1GHz   Mac OS X (10.4.3)   640 MB RAM

  • How can i compare the contents of two folders ?

    how can i compare the contents of two folders and find out which files are in one but not in the other?? Knowing how to do this would be the best thing ever, especially when dealing with a large number of files. Often, for instance, I'm dealing with a large number of images, processing them, and saving the retouched ones to a new folder, and need to check that they are all there. If there are say three files missing in the second folder (out of say a hundred in total) being able to automate the process of elimination would be very useful. Please help!!!
    B

    I really wish I knew the answer to this. I work between two macs, a G5 and MacBook Pro when I'm on the go. Each time I move from one to the other I have to copy all my files to the computer I'm going to work on, so I end up with the same files being duplicated. It's not a problem if it's not much data but in my case the it can be to 30GB, mostly graphics files, photoshop, motion, final cut pro, etc.
    There's has got to be a way automator can make a comparison between two folders to sort out what's changed and what's remained the same. It would be nice also if this feature could be done globally on the hard disk using spotlight's technology to stop files being duplicated in places you didn't even know about and taking up valuable disk space. I'm not sure how this could be done.
    Any bright ideas Apple?

  • I am using a 5s under IOS 7.1.1. How can I change the year field directly when editing an existing calendar entry?

    I am using a 5s under IOS 7.1.1. How can I change the year field directly when editing an existing calendar entry?

    Glad that helped.
    Enjoy your iPhone!

  • How can i update the REMARK field in ADRT database table

    Hi all,
    How can i update the REMARK field in ADRT database table
    By using Function modules or BAPI’s
    Please reply me fast

    Hi,
    you can try this code:
        SELECT SINGLE * FROM KNA1 WHERE KUNNR = wa_kunnr.
        IF sy-subrc = 0.
          CLEAR adrct.
          SELECT SINGLE * FROM adrct WHERE addrnumber = kna1-adrnr.
          IF sy-subrc = 0.
            adrct-remark = wa_remark.
            MODIFY adrct.
          ENDIF.
        ENDIF
    best regards,
    Thangesh

  • How can I find the reference field of components ?

    Hi everyone ;
    I am a Junior Abap Developer. I am  creating a structure that I will use in the report program. When I create a structure , some of the components needs to get reference field.Ex: NETWR,BTGEW,KWMENG.  How can i find the reference field of component?

    Hi,
    You have to put entries for currencies and quantity fields for these fields,
    Like for NETWR reference table is VBAK and field is WAERK,
    for other Quantity field you can use MEINS as reference field.
    You can check the reference table and reference fields in the respective tables( i.e. VBAP here).
    Thanks,
    Anmol.

  • How can i reinstall the search field of my Imac? I mean the field where one enters a web address.

    How can I reinstall the serach field of my Imac?

    Choose Show Toolbar or Customize Toolbar from the View menu and put it back.
    (90586)

  • How can you trim the contact field value without cloudconnector?

    How can you trim the contact field value without cloudconnector?

    You can add your contacts to segments, while right-clicking on the criteria you have added in segments, you will see the option for Merge, Intersect & Trim.
    See the attached URL, it might help you .
    Merge, Intersect, Trim

  • How can i set the character set ???

    hello
    now i have the following
    Message msg =
    new MimeMessage(Session.getDefaultInstance(props, null));
    how can i set the character set to be 'windows-1256'
    pleaze help if u can
    thanks very much
    Belal

    You have to deal with the NLS_LANG environment variable,it is defined as NLS_LANG=<Language>_<Territory>.<clients characterset> .
    Where is your oracle client installed? On the the server machine, where the database resides , on another Unix system or is it a Windows client? On Windows NLS_LANG is directly related to the OS settings and stored in the registry, on Unix NLS_LANG is not set automatically and defaults (if not set) to AMERICAN_AMERICA.US7ASCII. If you are working on UNIX, this could be the reason for disordering. I'm not familiar with Chinese, so I don't know the correct setting , but a good approach would be same setting as on the server.
    Metalink note 158577.1 describes NLS_LANG very detailed.

Maybe you are looking for

  • (Arch) Linux Myths

    I have recently noticed that online forums and Linux user communities in particular are prone to developing what I'd like to call "technology myths". Most of the problems and solutions given on forums are anecdotal in nature. Problems are rarely sour

  • Determine key date at runtime for time-dependant hierarchies

    Hello all, I have to develop a query based on time-dependant  and version-dependant hierarchy. I have selection variables for - Fiscal year posting period version and hierarchy . I want to achieve this - First I want to enter Fiscal Period and postin

  • Error when creating an article using WPC

    WPC has been deployed on our Portal, I have done all the configuration steps (assigning permissions to folder etc...). I'm able to create a new Website, but when trying to create an article in the WebContent folder I get a Portal Runtime Error. The f

  • ORACLE ERROR WHILE INSTALLING SAP DATABASE INSTANT

    HI this is rahul Iam facing some problem while installing SAP DATABASE INSTANCE with error code ORA-01092 instance terminated  with forced at the stage of database building please  help me urgently urgently

  • Deciphering contents of Setup tables

    Is there a tool, transaction which I can read a record from a setup table? Thanks