2007 Aug 23 6:40 AM
Hi Experts,
I have a parameter in the selection-screen like ths:
Parameters: p_mail type string.
So when we run report we can give email address there.
But i want to validate that.How can we do this:
Suppose if i give value for p_mail like: [email protected]
Regards
2007 Aug 23 6:48 AM
Hi Ravi, I understand your query, to validate that parameter, I am posting a sample code. Reward points if helpful
AT SELECTION-SCREEN.
if not p_mail CP '%@%.com'.
message I000(YMSG) with 'Please enter a valid mail id'.
endif.
hope it will work. Reward poinrs if helpful
Hi Ravi, I understand your query, to validate that parameter, I am posting a sample code. Reward points if helpful
AT SELECTION-SCREEN.
if not p_mail CP '%@%.com'.
message I000(YMSG) with 'Please enter a valid mail id'.
endif.
hope it will work. Reward poinrs if helpful
2007 Aug 23 6:42 AM
Hi,
Declare the fields with their master tables after declaring those tables with TABLES statement.for few I will give the code, rest you practice.
You have to write this code in AT SELECTION-SCREEN event.
S_WERKS FOR T001W-WERKS,
S_KUNNR FOR KUNNR-KUNNR,
Validation of Customer
clear kna1.
if not s_kunnr is initial.
select kunnr from kna1 up to 1 rows
into kna1-kunnr
where kunnr in s_kunnr.
endselect.
if sy-subrc ne 0.
message e014. " Invalid Customer Number
endif.
endif.
Validation of Plant
clear t001w.
if not s_werks is initial.
select werks from t001w up to 1 rows
into t001w-werks
where werks in s_werks.
endselect.
if sy-subrc ne 0.
message e004. " Invalid Plant Number
endif.
endif.
reward if useful
regards,
rewards point.
2007 Aug 23 6:43 AM
Use the event AT SELECTION SCREE ON <Feild Name> for each selection screen element.
For each element perform the following checks.
1. Value has been entered
IF <Feild_name > is initial.
give error message.
endif.
2. Valid value is entered
Select single <feild>
from <table>
where <feild_t> = <feild_name>.
if sy-subrc = 0 .
Give success message
else
Give error message
endif.
Hope this helps
Regards
rewards point
2007 Aug 23 6:43 AM
Here it is...
SELECT-OPTIONS sel_opt1 FOR field1.
SELECTION-SCREEN BEGIN OF BLOCK block1.
PARAMETERS: test1(10) TYPE c,
test2(10) TYPE c.
SELECTION-SCREEN END OF BLOCK block1.
AT SELECTION-SCREEN ON BLOCK block1.
MESSAGE i888 WITH 'AT SELECTION-SCREEN'
'ON BLOCK BLOCK1'.
Have a look at the demo program demo_selection_screen_events for more details.
Regards,
rewards point .
2007 Aug 23 6:48 AM
Hi Ravi, I understand your query, to validate that parameter, I am posting a sample code. Reward points if helpful
AT SELECTION-SCREEN.
if not p_mail CP '%@%.com'.
message I000(YMSG) with 'Please enter a valid mail id'.
endif.
hope it will work. Reward poinrs if helpful
2007 Aug 23 7:39 AM
Hi all,
Thanks.Suppose my parameter contais:
data : w_str type string.
Here i want to check whether dot ('.') is there or not before @ and after @ .
How can i check this?
Regards
2007 Aug 23 7:43 AM
Hi
do one thing
first find the positions of @ and .
if the position of (first occurance of ). is lessthan @ raise a error message
and if . is more than one position of @ raise a error message ( [email protected])
reward points to all helpful answers
kiran.M
2007 Aug 23 7:47 AM
2007 Aug 23 7:47 AM
Hi,
As u want to check whether '.' present before and after @, split w_str at @ into w_str1 and w_str2.
Then u can search for '.' in both w_str1 and w_str2.
Reward if it helps....
Regards,
Sankar
2007 Aug 23 7:50 AM
Hi Ravi
y cant u use this one
AT SELECTION-SCREEN on p_mail.
if not p_mail CP '%@%.com' or p_mail CP '%.%@%.COM.
message I000(YMSG) with 'Please enter a valid mail id'.
endif.
reward points to all helpful answers
kiran.M
2007 Aug 23 7:50 AM
Hi,
SPLIT W_STR AT '@' INTO W_STR1 W_STR2.
SEARCH W_STR1 FOR '.'.
IF SY-SUBRC NE '0'.
MESSAGE..
ENDIF.
SEARCH W_STR2 FOR '.'.
IF SY-SUBRC NE '0'.
MESSAGE..
ENDIF.
Regards,
Sankar,
2007 Aug 23 8:22 AM
Hi Ravi...This is the Code for u..
parameters: p_mail(40).
AT SELECTION-SCREEN ON P_MAIL.
IF P_MAIL NP '.@.'.
Message 'Enter Email Id in proper format' type 'E'.
ENDIF.
<b>Reward if Helpful</b>
2007 Aug 23 8:38 AM
Hi Thanks. But i wnat to check like this:
str1 = ravi.babu
str2= gmail.com
i want to check whether '.' is there after 'u' in str1 and
'.' is there or not after 'm' in str2
How can i do this?
2007 Aug 23 9:02 AM
Hii Ravi, according to your requirement.
Sample coding
IF NOT STR1 CA '%U.'.
MESSAGE.
ELSE.
MESSAGE.
ENDIF.
IF NOT STR2 CA '%M.'.
MESSAGE.
ELSE.
MESSAGE.
ENDIF.
but there is a problem that u have m in str2 twice. so instead of all these use the below sample code it will work.
IF NOT P_MAIL CP '%@%.com'.
MESSAGE
ENDIF.
Reward points if helpful
2007 Aug 23 6:51 AM
hi ravi
try this....
at selection-screen.
select single * from table where fieldname = p_name.
if sy-subrc <>0.
message e001(zerror).
endif.
REWARD IF USEFUL........!!!
2007 Aug 23 6:53 AM
Hi,
make your email parameter like this adr6-AD_SMTPADR then no need to maintain it at your side.
Like
Parameters : p_email like adr6-AD_SMTPADR.
rewards points if it is useful;.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |