Check on special characters

In my program, on the selection screen a user can enter any variable except  special characters.How can I put a check on special characters??

hi,
In our key board, these many special characters present..
so try your code like this..
data: spe_char(31) value '~`!@#$%^&*()_+-=\|][{}";:,./?><'. ( include all
special chars whatever u want)
spe_char1 value ' '. ( this is to check empty space)
spechar2. (this is to check single ' ).
Create one text element and assign ' as value to that text element.
in ur program code as given below.
spechar2 = text-001.
if (fieldname) CA spe_char.
MESSAGE "special character is present in the given input
endif.
if ( fieldname) CA spe_char1.
message "special character is present in the given input
endif.
if (fieldname) CA spe_char2.
len = strlen( fieldname ).
if sy-fdpos NE len.
message "special character is present in the given input
endif.
endif.
Hope this code will guide you ..
regards
vijay

Similar Messages

  • How to check multiple special characters in instr function sql query.

    Hi,
    The following special characters are comma(,), slash(/), colan(:)
    these special characters i need to be check in instr function.
    select SUBSTR(master_title,1,INSTR(master_title,',',1,1)-1) from dual;
    Can you please write the query with right answer.
    Thanks in advance,
    Lakshman.

    Why multiple post?
    How to check multiple special characters in this query.

  • Checking for Special Characters

    I need to check if a textbox in my form containes special characters (entered by user). If there are any, I need to display an error message.
    I have written a function but it's not working.
    here's my function:
    function checkForSpecialChracters(oFiled)
    var userInput = oFiled.rawValue; // take the String entered by the user
    var iChars = "@#$%^&*+=-[]\\\';,./{}|\":<>?~_";
    for (var i = 0; i < userInput.length; i++)
    if (iChars.indexOf(userInput.charAt(i)) != -1) {
    xfa.host.messageBox("Please check for special characters. The following characters are not allowed: @#$%^&*+=-[]\\\';,./{}|\":<>?~_ ", "Error Message", 3);
    // Change the color of the field
    oFiled.fillColor = "255,100,50";
    Any help would be greatly appreciated.
    Thank you!

    Paul,
    It is working now. I don't know what I might have changed.
    Here's my final function (It works!):
    function checkForSpecialChracters(oFiled)
    var userInput = oFiled.rawValue; // take the String entered by the user
    var iChars = "@#$%^&*+=-[]\\\';,./{}|\":<>?~_";
    var hasSpecialCharacter = false;
    for (var i = 0; i < userInput.length; i++)
    //app.alert("Value is: " + userInput.charAt(i));
    if (iChars.indexOf(userInput.charAt(i)) != -1)
    hasSpecialCharacter = true;
    break;
    } // end if
    } // end For loop
    if (hasSpecialCharacter)
    // Change the color of the field
    oFiled.fillColor = "255,100,50";
    xfa.host.messageBox("Please check for special characters. \n\nThe following characters are not allowed:\n\n @#$%^&*+=-[]\\\';,./{}|\":<>?~_ ", "Error Message", 3);
    else if (!hasSpecialCharacter)
    oFiled.fillColor = "255,255,255";

  • Just a simple check with special characters

    Hi guys and gals,
    i created a boolean method that will check the value of string for any special characters like (/,'%&^# ), what i did is to used indexOf() method. it will return false if the string doesn't have any special character. But, i'm having a problem using the check for the backlslach character ' \ ', since it is considered as escape literal when i put inside indexOf('\'). i really need you help on this.
    if you have other ways to check this kind of character, please put them here. i really need them bady. :D many thanks,

    Look for "\\" or look up the unicode for "\" and use that.

  • Code to Check for Special Characters \/:*?" | in the given String

    Hi All,
    I need a java code to verify if the given string contains the Special Characters like \/:*?"<>|
    thanks
    krishnaveni

    http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
    bye
    TPD

  • How to check multiple special characters in this query.

    When the master_title has no comma in it, I am getting an empty master_title. This is because INSTR(master_title,',',1,1) is returning 0.
    In addition, I want to be able to specify other characters besides the comma. Example: ":" "/" "-".
    Can we fit these options in the INSTR to look for them as well?
    Query given below.
    SELECT DISTINCT e.brm_id, SUBSTR(master_title,1,INSTR(master_title,',',1,1)-1) master_title
    FROM e_m_view e
    WHERE e.asset_dist LIKE'%WBPI Germany%'
    OR e.asset_dist LIKE '%krupp%'
    OR e.asset_dist IN (SELECT FN_SETRPTG(FN_GETPIREGN('%WBPI%')) FROM dual)
    AND e.kl='Live' AND NVL(wbpi_publish_date,SYSDATE) <= SYSDATE
    ORDER BY 2 ASC;
    ---------------------

    This?
    SQL> with t as(
      2  select 'abcd,efgh' name from dual union all
      3  select 'abcd:efgh'  from dual union all
      4  select 'abcd/efgh'  from dual union all
      5  select 'abcd-efgh'  from dual )
      6  select regexp_substr(name,'[^,:/-]+') name
      7  from t;
    NAME
    abcd
    abcd
    abcd
    abcd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Special Characters Check in OBPM

    Is this code good to check for special characters in OBPM 10GR3?
    Pattern p = Pattern.compile("/[a-zA-Z0-9]/g");
         Matcher m = p.matcher("This is a string");
         boolean matched = m.matches();
         logMessage("--Identifying Special Characters--"+matched);
         if (matched == true)
              logMessage("--Contains Special Character--");
         }

    Here's what I use to fix file names to ensure that they do not have special characters or international characters:
    String beforeConversion = "àÀâÂäÄáÁéÉèÈêÊëËìÌîÎïÏòÒôÔöÖùÙûÛüÜçÇ’ñ";
    String afterConversion = "aAaAaAaAeEeEeEeEiIiIiIoOoOoOuUuUuUcC'n";
    // does it contain international characters?
    if (originalFileNameArg.match(regexp : '/[àÀâÂäÄáÁéÉèÈêÊëËìÌîÎïÏòÒôÔöÖùÙûÛüÜçÇ’ñ]+/').length() > 0) {
        int i = 0;
        String @char;
        while (i < beforeConversion.length()) {
            originalFileNameArg = originalFileNameArg.replace(from : beforeConversion.charAt(position : i),
                                                              @to : afterConversion.charAt(position : i));
            i = i + 1;
    String[] m = originalFileNameArg.split(regexp : '/[^a-zA-Z0-9_,']+/');
    int i = 0;
    boolean first = true;
    foreach (item in m) {
        if (! item.empty) {
            if (first) {
                retValue = item;
            else {
                retValue = retValue + " " + item;
        first = false;
        i = i + 1;
    return retValue.trim();Dan

  • 0CUSTOMER Special Characters Error in Load

    Hi Experts,
        I am loading Customer Master data from R/3 into BW via 0CUSTOMER_ATTR extractor. Some user-entered fields in R/3 such as NAME, NAME1, STREET etc have some special characters - which look like a square.
    This data used to come over into BW w/o errors. Now I have added some date fields to the extract eg CREATED_ON. All records that have the special characters now show-up incorrectly; as in ALL fields after the special characters have shifted to the left. So a few characters from CREATED_BY have spilled into CREATED_ON, Telephone Ext has spilled into Telephone Num and so on.
    This is how the data is coming into the PSA from R/3. So I can't even check for special characters in the trans routine. ( The data is already bad in the PSA).I checked RSA3. there is no such spillage on the R/3 side. The spilling of data is happening between R/3 and BW.
    Any Idea whats going on here and how to fix this?
    thanks,
    Kartik.

    I think you have to check infoobject length in BI and the order of the infoobjects in the infosource compared to extractor fields.Any incosistency here may cause the spillage of data.
    The new fields created in R/3 especially with varying lengths of data seems to be causing the trouble..

  • A name should not start with any special characters

    I need to put a condition in iF statement such that a name that is given by the user should not start with any special charecters.A dialog box should display indicating this conditon.Can u plz give sample code for this.My code is as below.
    //text box for giving the name
    JTextFeild ReportNameText;
    //the name is stored in String
    String name=ReportNameText.getText();
    //Here tell me how the if condition should be written
    //condition to be mentioned

    Already asked, and answered, here: http://forum.java.sun.com/thread.jspa?threadID=727919
    See reply 4 in that thread, and scsi-boy's suggestion of writing another
    method to check for "special" characters. And the links to the String
    and Character API documentation given.

  • Error of Special Characters in Export to Excel

    Hi,
    I guess the error you are getting is a Parser error. To solve this problem, before putting the data on the XML file, you have to pass the data through an encoding process. For UTF-8 the code for encoding should be something like.
      public java.lang.String encodeSpecialChar( java.lang.String attributeValue )
        //@@begin encodeSpecialChar()
              //Created By : AVIK SANYAL Date : 28 March 2008.
              //          Check for special characters like "&" in the String.
              //      replace "&" with "&amp;"
              //      Returns the new encoded String.
              try {
                   if (attributeValue != null) {
                        attributeValue = attributeValue.replaceAll("&", "&amp;");
                        attributeValue = attributeValue.replaceAll("<", ""&lt;"");// this is & lt
                        attributeValue = attributeValue.replaceAll(">", ""&gt;"");//this is & gt
                   } else {
              } catch (Exception ex) {
                   //          wdComponentAPI.getMessageManager().reportException(
                   //               "Failed to convert the character.",
                   //               true);
              //Returns the encoded String.
              return attributeValue;
        //@@end
    Try this and let me know if this works. The reason is that in Binary Cache method, the data is passed in an XML format and the MS-Excel application reads this to show it in the spreadsheet. The characters '&', '<' and '>' can cause failure in reading from this file.
    Thank You
    Avik
    Edited by: AVIK SANYAL on Sep 12, 2008 10:45 AM

    OK....!!!!!
    just download the Excel file (*.xls) and try open with Word-MS. In the document search by the string that you have mentioned in the question. (Use Ctrl +F).
    If you see something like "ABC bla bla ba & instead of  &amp ,  then you have to pass the data through the code I've mentioned.
    You can get more details on encoding special characters UTF-8 in Google.com or Sun Websites etc.
    You can also encode the & in hexadecimal format to get the desired output.

  • How to check special characters in view

    hi,
    I have a field in view,in which want to check the field value doesnt contain any special characters.
    the field is a char field and it is not associated to any specific data element.
    Can u please help me in this reg.
    Regards,
    Saujanya

    Hi Saujanya,
                        In my recent reply............i have give the general answer.
    Here is the answer you are  looking for........
    data:
       w_check(37)  TYPE c.
    w_check = sy-abcde.
    concatenate '0123456789' w_check INTO  w_check.
    concatenate '_'   w_check INTO  w_check.
    IF view_name-field_name CO w_check.
    ur code.......
    ELSE.
    Message 'UR text' TYPE 'E'.
    ENDIF.
    Hope,your problem is solved.........
    Reward,if helpful.
    Regards,
    V.Raghavender.

  • Check whether there is any Special Characters in a String ?

    Hi All,
    I am having a very large String. I like to know how to check whether there is any special characters present in a string
    Thanks,
    J.Kathir

    I am having a very large String. I like to
    I like to know how to check whether there is any
    special characters present in a stringAll characters are special in a way. You shouldn't just single a few out because they don't look "normal" to you. Maybe they have golden hearts?

  • Function Module tto check special characters in a field

    Hi All,
    I have a requriemnt where i need to make sure there are no special characters allowed
    in a paremeter ( is there any functional module to check it)
    r anyway to work with
    Thank in advance for u replies.
    Regards,
    Riyaz.

    DATA: vergleich_string(100) VALUE
              'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.
      CONCATENATE vergleich_string ' 1234567890,./!@#$%&*-_+=~|\[{]}()"'
                                                   INTO vergleich_string.
    use condition.
    if var ca vergleich_string.
    raise error message.
    endif.

  • Check special characters in a string

    Hi all
    I am using oracle 10g.......
    Need to know what should be the query to check whether a special character exists or not in a column value....used the following query like.....
    select count(*) into emp_no_count_special_char
    from dual
    where REGEXP_LIKE(insert_data_rec.emp_no , '[#!$^&*%./\|]$' )
    or REGEXP_LIKE(insert_data_rec.emp_no , '^[#!$^&*%./\|]' );
    This works fine in case a string starts or ends with a special character ,what if a string of special characters lies in between numeric digits.
    e.g: '100#$%7'
    Please help find a query that checks for the existence of sp. characters irrespective of their position in the column!!!
    Thanks
    Dave
    Edited by: Dave on Jun 6, 2012 5:17 AM
    Edited by: Dave on Jun 6, 2012 5:18 AM

    Hi Dave,
    example below:
    -- Check that at least one special character exists in the string
    SELECT COUNT (*)
      INTO emp_no_count_special_char
      FROM DUAL
    WHERE REGEXP_LIKE (insert_data_rec.emp_no, '[#!$^&*%./\|]');
    -- Check that no special characters exist in the string
    SELECT COUNT (*)
      INTO emp_no_count_special_char
      FROM DUAL
    WHERE NOT REGEXP_LIKE (insert_data_rec.emp_no, '[#!$^&*%./\|]');
    {code}
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Regular expression: check for the presence of special characters.

    I have the following requirement:
    I need to check for the presence of the following characters in a keyword: @, #, > if any of these characters are present, then they need to be stripped off, before going further. Please let me know the regular expression to check for these characters.

    I am trying to extend the same logic for the following characters:
    .,‘“?!@#%^&*()-~<>[]{}\+=`©® . here is the code fragment:
    Pattern kValidator = Pattern.compile("[\\.,\\‘\\“?!@#%^&*()-~<>[]{}\\+=\\`©®]");
    Matcher kMatcher = kValidator.matcher(keyWord);
    if (kMatcher.find(0)) {
    keyWord = keyWord.replaceAll("[.,\\‘\\“?!@#%^&*()-~<>[]{}\\+=\\`©®]", " ");
    }I get the following error. This error is from the weblogic command window. I dont understand these special characters.
    Error:
    28 Oct 2008 12:27:48 | INFO  | SearchController   | Exception while fetching search results in controller:Unclosed character class near index
    39
    [\.,\&#915;Çÿ\&#915;Ç£?!@#%^&*()-~<>[]{}\+=\`&#9516;&#8976;&#9516;«]
                                           ^
    java.util.regex.PatternSyntaxException: Unclosed character class near index 39
    [\.,\&#915;Çÿ\&#915;Ç£?!@#%^&*()-~<>[]{}\+=\`&#9516;&#8976;&#9516;«]
                                           ^
            at java.util.regex.Pattern.error(Pattern.java:1650)
            at java.util.regex.Pattern.clazz(Pattern.java:2199)
            at java.util.regex.Pattern.sequence(Pattern.java:1727)
            at java.util.regex.Pattern.expr(Pattern.java:1687)
            at java.util.regex.Pattern.compile(Pattern.java:1397)
            at java.util.regex.Pattern.<init>(Pattern.java:1124)
            at java.util.regex.Pattern.compile(Pattern.java:817)

Maybe you are looking for

  • How can I share user in the same workspace but different applications

    I recently created a new application (new) in the same workspace as my old application (old). I have about 35 application express users. They are stored in uppercase. The new appl (old) , login page will only accept the DB user login and Not the appl

  • How to email multiple pictures in one email?

    While doing a search on this topic I found answers from 2007 that this was not possible. (That is almost the year when iPhone was released.) So what about now? PS. Let me give you a simple scenario. My friends and I went out last weekend. I want to s

  • Update current date in mysql using Update form DW CS4 PHP

    I have a field called datePosted that is set to curdate in the database.  What I want to do is when the checkbox on this form called approved is checked, and the form is submitted, I want that dateApproved field to update to the current date in the d

  • Can you help us improve our SAProuter configuration process?

    Have you recently discussed installing SAProuter in order to enable remote connectivity to your SAP BusinessObjects systems with an SAP Support Consultant? Perhaps you have watch a video or read some of the material at http://service.sap.com/remote-s

  • Upgrade OID from 10G 10.1.2.3.0 to 11G

    Hi All We have our OID installed on Oracle 10G Rel 2 (10.2.0.4.0) on AIX 6.1 I have installed OID as follows Created 10G databaase( patched to 10.2.0.4.0) using Metadata repository creation assistant to load metadata in existing OID database used app