Checking the valid email add
Dear all,
I need to perform the check on a string where it contains email address.
For eg:
[email protected] - this is a valid email add
@yaho.com - this is invalid email add
qwertyuyu.com - this is invalid email add
Do you think is there any standard FM can perform such check?
Please comment.
Thanks in advance.
Hi,
Please try this code. I hope it will meet most of your requirements.
FORM check_email_val .
DATA: lv_len type i,
lv_len1 type i,
lv_len2 type i,
lv_char1,
lv_char2(2) type c,
lv_char3,
lv_last_3 type i,
lv_email(40) type c,
lv_email_str(40) type c,
lv_temp1(40) type c,
lv_temp2(40) type c,
lv_temp3(40) type c,
lv_temp4(40) type c,
lv_temp5(10) type c,
lv_temp6(10) type c,
lv_rev_str(20) type c,
lv_last_4(4) type c,
lv_flag1 type c,
lv_flag2 type c,
lv_flag3 type c,
lv_str(6) type c.
lv_email = zuserpass-email.
lv_len = strlen( lv_email ).
IF ok_code EQ 'PRO'.
*check whether @ symbol is there, depending on flag validate any further
IF lv_email CA '@'.
lv_flag1 = 'X'.
ELSE.
lv_flag1 = ' '.
Message S013(zusermsg). "Email ID must have a '@'
Endif.
IF lv_flag1 = 'X'.
*split and check whether the split halves have any '@' or special characters leaving out '_' and '.'
SPLIT lv_email at '@' INTO lv_temp3 lv_temp4.
IF ( lv_temp3 CA '@~!#$%^&*()-={}}[]'',/?<>:"|\`' ) OR ( lv_temp4 CA '@~!#$%^&*()''-={}}[],/?<>:"|\`' ).
Message S016(zusermsg). "Special characters except '_' , '.' , '@' are not allowed
EXIT.
ENDIF.
*checking whether there is an '_' of '.' in immediate precedence to '@'
*reversing lv_temp3 and taking its first character
CALL FUNCTION 'STRING_REVERSE'
EXPORTING
STRING = lv_temp3
LANG = sy-langu
IMPORTING
RSTRING = lv_rev_str
IF SY-SUBRC <> 0.
ENDIF.
*fetching the character just before '@'
lv_char1 = lv_rev_str+0(1).
IF ( lv_char1 EQ '_' ) or ( lv_char1 EQ '.' ).
MESSAGE S021(zusermsg). "Cannot have '_' or '.' just before or just after '@'
EXIT.
ENDIF.
*fetching the character just after '@'
lv_char3 = lv_temp4+0(1).
IF ( lv_char3 EQ '_' ) or ( lv_char3 EQ '.' ).
MESSAGE S021(zusermsg).
EXIT.
ENDIF.
*checking whether a '.' is present in lv_temp4
IF lv_temp4 CA '.'.
lv_flag2 = 'X'.
ELSE.
lv_flag2 = ' '.
MESSAGE S020(zusermsg). "Email ID should have a '.'
ENDIF.
*further checking whether there is a '.' separating email id into two halves
IF lv_flag2 EQ 'X'.
SPLIT lv_temp4 at '.' INTO lv_temp1 lv_temp2.
IF lv_temp1 EQ ' '.
MESSAGE S018(zusermsg). "Enter a valid portal name
ENDIF.
IF lv_temp2 EQ ' '.
MESSAGE S019(zusermsg). "Domain name cannot be blank
ELSE.
lv_flag3 = 'X'.
ENDIF.
ENDIF. "end of flag2 IF
*check for a valid domain
IF lv_flag3 EQ 'X'.
IF ( lv_temp2 CP 'com' ) OR ( lv_temp2 CP 'edu' ) OR ( lv_temp2 CP 'net' ) OR ( lv_temp2 CP 'org' ).
LEAVE TO SCREEN 1003.
ELSE.
*if email ID is of type co.in
IF lv_temp2 CA '.'.
SPLIT lv_temp2 at '.' INTO lv_temp5 lv_temp6.
IF lv_temp5 CP 'co'.
lv_len1 = strlen( lv_temp6 ).
the email ID should be of the form co.xx
IF lv_len1 GT 2.
MESSAGE S022(zusermsg). "Email Id will be of the form .com, .org, .net or .co.in or .co.uk etc.
EXIT.
ENDIF.
checking whether the penultimate and the final character are alphabets
lv_char2 = lv_temp6+0(2).
IF ( lv_char2 NA 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ' ).
MESSAGE S023(zusermsg). "Invalid domain name
ENDIF.
LEAVE TO SCREEN 1003.
ELSE. "to the 'co' IF
MESSAGE S022(zusermsg). "Email Id will be of the form .com, .org, .net or .co.in or .co.uk etc.
ENDIF. " end of 'co' IF
ENDIF. "end of first IF
ENDIF. "end of lv_temp CA '.'
ENDIF. "end of flag3 IF
ENDIF. "end of flag1
ENDIF. "end of ok_code IF
ENDFORM. " check_email_val
Reward if Helpful.
Similar Messages
-
Ehancement for to check the validations in ME21n,ME22n,ME28,ME29n
Hi experts...
I have one requirement in Ehancement for to check the validations in ME21n,ME22n,ME28,ME29n...
If the PO document date is after 31.12.2010 and vendor Group 1800 then check the Inco-terms with "SET" values whether the user entered value fals with in the "SET" value, if so then allow to save the PO else Else system should read the "SET" values and suggest user to select correct Inco terms.
Example when user enter wrong Inco-Terms then system shoud give Error Message Please Select Inco-terms CPT or DAP or FCA..
Can any body plz suggest me the user exit or Is it possible through the enhancement Framework...
plz help me how to proceedd??
Thanks & Regards,
Veena.
Moderator Message: Spec-dumping is not allowed.
Edited by: kishan P on Jan 3, 2011 11:00 AMHi Veena,
To find a BADI for a given tcode follow the below steps.
1. Go to the TCode.
2. Menu Item System -> Status.
3. Double click on the transaction Name (For ME21N double click on ME21N).
4. Check the Package (e.g. ME)
5. Go to TCode SE80
6. In the drop down choose Package and type the Package Name (e.g. ME). Dont forget to Hit Enter or display.
7. Object Name Enhancements -> Business Add-ins (Def.) (You will see all the BADI's available here ).
In your case, you need BADI : ME_BAPI_PO_CUST.
Go to SE19 to implement the BADI.
If you put your conditions in Create Purchase Order(ME21N), you will not need to add them in Release PO(ME28N) since the conditions will be checked when PO is created.
Regards,
Jovito. -
Is there anyway we can check the validity of dump file in Unix system
Hi,
I have taken export of 2 tables which are huge in volume. one of the table seems to be successfully exported yet another one failed due to space scarcity. Since both the tables share a single dumpfile.
I wanted to know.
1. Can we use the same dumpfile to import the table which is successfull or it can not be used because the second table got error while exporting?
2. Is there any way we can check the validity of dumpfile in unix plateform.
Your reply is highly appreciated.784786 wrote:
Hi,
I have taken export of 2 tables which are huge in volume. one of the table seems to be successfully exported yet another one failed due to space scarcity. Since both the tables share a single dumpfile.
I wanted to know.
1. Can we use the same dumpfile to import the table which is successfull or it can not be used because the second table got error while exporting?No. It is better to take another backup of the same
>
2. Is there any way we can check the validity of dumpfile in unix plateform.
Please check the export log backup. If it says that export terminated successfully, then the dump may be fine. -
I cannot update in my application store because the previous email add still exist even i have a new apple id
FAQ apple id http://support.apple.com/kb/he37
Doesn't matter if you have a new ID, all apps are tied to the apple id that was used to download it. -
hi..i'm creating a new user jsp page and in that i want to check whether the date entered by user as his/her date of birth is valid or not...i've taken three dropdown boxes to enter the date, month & year. how will i check the validity and concate three values and save it in database..thnx
Validate it using java.util.Calendar which is set not to be lenient.
Example: [http://balusc.blogspot.com/2007/09/calendarutil.html].
Save it in DB using PreparedStatement#setDate().
Example: [http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html].
The field in DB must be a DATE, DATETIME, or TIMESTAMP. -
How to check the validation of RegEx
Hi,
My application needs users to enter RegEx. My question is how I can check the validation of the RegEx that users enter. The Class RegExp does not seem to provide any methods to check the validation of the RegEx.
Regards,
HaibinYou would need to hand roll your own validator, unless someone knows of one that is out there. Flex does not validate RegEx.
If this post answers your question or helps, please mark it as such. -
Check the validity of a SQL statement before execution
Hi everyone,
In an applet I have created, I am allowing the user to create a SQL statement which will be sent to a servlet that in turn issues the JDBC request for the SQL statement. My concern is that since my GUI lets the user create more or less any kind of SQL statement (including an illegal one) I need to verify if the user has created the correct SQL. How can this be achieved?
To recapitulate and summarize, I need to know how I can check the validity of a SQL statement without actually executing it and handling the SQLException. FYI, I am using the mm-mysql driver.
Thanks,
Alanjschell is correct. Unless you're writing something like an ISQL tool you want to be very careful doing this.
Having said that Mimer SQL have SQL validators that may do what you want http://developer.mimer.com/validator/index.htm
They've also got the SQL Validator running as a web service that you can use. Theres example code here showing how to use it.
http://sqlvalidator.mimer.com/index.html
At the risk of being accused of selfpromotion you can check out the SQL Validator plugin for SQuirreL SQL CLient. This is a fully functional example of using the Mimer SQL Validation web service. http://squirrel-sql.sourceforge.net/
Col -
How to check the validity period of saprouter ?
Dear all,
As per sap note 1178684, we can check the validity period of the saprouter by executing "sapgenpse get_my_name -n validity"
I am wondering how to run that command in as/400 ?
Please advise. I am not familiar with as/400 OS.
Thanks
Regards,
KentHi Kent,
please proceed as described on the http://www.easymarketplace.de/snc-iseries-setup.php
logon with sidadm (or sidofr):
(depending on the user, that is running the SAPRouter)
CD DIR('/usr/sap/saprouter')
ADDLIBLE LIB(SAPROUTER) ??? or whereever the stuff is ...
RMVENVVAR ENVVAR('SECUDIR')
ADDENVVAR ENVVAR('SECUDIR') VALUE('/usr/sap/saprouter')
RMVENVVAR ENVVAR('SNC_LIB')
ADDENVVAR ENVVAR('SNC_LIB') VALUE('/usr/sap/saprouter/sapcrypto')
CALL PGM(SAPGENPSE) PARM('get_my_name')
Regards
Volker Gueldenpfennig, consolut international ag
http://www.consolut.net - http://www.4soi.de - http://www.easymarketplace.de -
I have currently changed previous email address but when I'm trying to purchase from apps store the old email add still keeps popping up? I can't purchase anything please help!!
Welcome to the Apple Community.
In order to change your Apple ID or password for your iTunes account on your iOS device, you need to sign out from your iOS device first, then sign back in using your updated details. (Settings > store, scroll down and tap your ID) -
request the code for the exchange of Mac OS X Mountain Lion, on 25 July and still I do not get the validation email, what should I do?
ANYBODY HELP ME!!same problem here.....
anyone can help? -
Check if valid email before add to DB
Hello, i want a class or JSP code for check if an email address submited by users is valid before add to database, sometimes the users send the email uncomplete or with errors and i want to depurate this.
If the email address is valid then add to DB, if not display the invalid email to the users and then they can fix the email error.
Thanks.These's not too much you can test for. You can check for invalid characters (spaces etc.), the presence of an @ symbol and that the address has a length greater than 3 (a@a is the shortist possible valid address I can think of). The best way to do this is use the java regular expression stuff. Google for a pattern that matches email addresses and test this way.
-
Read email adress from a text file then check the validity of them
a text file has three lines, each line contains one email adress:
[email protected]
qwe@@ws.com
wer//@we.net
read the email address from a text file, then check which one is invalid, output the invalid email adress in the console.no 3 .umm, an email adress can have more than 2 '.'s in it,
example:
[email protected]
would be a valid email address.
To decide what a valid address is you'd need to parse it against the correct standard.
I think however that javax.mail.internet.InternetAddress does this for you, check out the docs:
http://java.sun.com/products/javamail/1.2/docs/javadocs/javax/mail/internet/InternetAddress.html
even if it parses it may not be a valid address though in that it may not actually exist. -
How to check the validity of recipient when sending email
hi Gurus,
i wanna send email thru class, and i need to know if the email is sent successfully, i can check the email status thru SOST.
but is there any way to get a return message immediately as soon as I 'm sending the mail out.
Thanks in advance.
Desmond YangS you are right.
If you want to validate email id, use table ADR6. Check below code,
"Get Ship-to-party email address
DATA: l_f_adrnr TYPE adrnr,
l_f_mail TYPE ad_smtpadr.
SELECT SINGLE adrnr FROM vbpa INTO l_f_adrnr " Get Address number
WHERE vbeln = vbdkr-vbeln AND
parvw = 'WE'. " 'WE' Ship-to-party
IF sy-subrc = 0.
SELECT SINGLE smtp_addr FROM adr6 INTO l_f_mail " Get Email id from Address number
WHERE addrnumber = l_f_adrnr.
ENDIF.
IF l_f_mail IS INITIAL.
MESSAGE i503(sbcoms) WITH l_f_mail. " Throw a message saying Recipient is unknown
ELSE.
" Code to send mail
ENDIF. -
How to validate the valid email
Hi all
i have a creation page in that page email field is ther .while saving the transaction i need to check that email is a valid email or not
how can we achieve this functionality
Regards
SreekanthPlease see this link
Re: how to validate the email
Thanks
--Anil -
How to check the validation at data base level as well as current user ente
Dear all
i have creation page in that item code will not enter the duplicate values
in that creation page contains advanced table
user will click on create 15 blank records using add another row
suppose in first row user will enter LAPTOP assume this item code
in this case i need to raise exception through databse level
in second row also user enter LAPTOP1 in this case exception will not raise becaause data is not there at databse
in third row user will enter LAPTOP1 in this case item is not there in data base but it is there in second row in this case
i need to raise exception
how to achieve this
Thanks in Advance
SreekanthYou can validate this in form submission.
1. Call a method in AMImpl.java
2. loop the ViewObjects and check the values
3. If you find a match, throw the error
--Prasanna
Maybe you are looking for
-
Post Author: jase4now CA Forum: WebIntelligence Reporting For the past two days, I have received the WIJ 20002 ERROR when I attempt to create an ad-hoc. This is sudden, as I have been able to create reports in the past. Any help is gr
-
Duplex Printing, needs pdf to end in even
Hi all, i just started Designing forms in LC and have designed a dynamic form , i need some help on this. If the pdf ends with odd page how can i make it to end it with even (like adding a blank page if the pdf's end with odd number so as to make i
-
Can't install itunes on my windows pc
An update for iTunes failed to install, so I downloaded the latest 64 bit iTunes to my Windows 7 PC and ran the install. At the end it says it cannot start the Mobile Device Service. I also cannot get it to start from the Services menu. iTunes was ru
-
Apply policy from VB 6.0 using webservices?
Hi All, Our requirement is to call Adobe methods from VB 6.0 to apply policy, i have the .wsdl file of the service, using which i tried generating VB project to generate VB DLL with the help of tools Pocket Soap / wsdl.exe (for command line). but i a
-
About autonomous_transaction
Hi, The trigger stock_trigger works normally.But after I add these sentences :"PRAGMA AUTONOMOUS_TRANSACTION" and "COMMIT",it doesn't work anymore.And there is no error showed by system. Anybody cound tell me how to amend this triigger? many thanks x