Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

validation

Former Member
0 Kudos

hi experts,

s_rzzps for zupi5a-rzzps_posid obligatory no intervals."wbs element.

This is the field i need to do validation but with conditions

conditions are:

They r 2 types of wbs element one is starting with ' T ' and another is Starting with ' C ' .so when wbs element starts with T just pass the value but when the first letter of it is ' C'

goto table PRPS and check the field USR00. If this field is blank then rise the error message.even when the wbs element is other than this 2 letters we need to pass the error message

please help me i need this urgently.

Thanks & Regards,

Ramya

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

data:v_rzzps like zupi5a-rzzps_posid .

select-options: s_rzzps for zupi5a-rzzps_posid obligatory no intervals."wbs element.

AT SELECTION-SCREEN ON s_rzzps.

LOOP AT s_rzzps.

IF s_rzzps-low+0(1) = 'C'.

SELECT SINGLE usr00 INTO v_usr00

FROM prps WHERE usr00 = sy-uname.

IF v_usr00 IS INITIAL AND sy-subrc NE 0.

MESSAGE e999(zmde) WITH text-017 s_rzzps-low.

ENDIF.

*

ELSEIF s_rzzps-low+0(1) NE 'T'.

MESSAGE e999(zmde) WITH text-017 s_rzzps-low.

ENDIF.

ENDLOOP.

Same way you do for s_rzzps-HIGH also by putting in loop.

Regds

Parvathi

Please reward points if helpful..

Edited by: Siva Parvathi on Dec 24, 2007 1:54 PM

9 REPLIES 9

Former Member
0 Kudos

Hi Ramya

Here you go ...

At selection-screen on s_rzzps.

Loop at s_rzzps.

case s_rzzps-low(1).

when 'T'. " Do Nothing

When 'C'.

select USR00

from PRPS

into l_v_USR00

where PSPNR = s_rzzps-low.

if sy-subrc <> 0.

message e000(rp) with 'Option not valid'.

else.

if l_v_usr00 is initial.

message e000(rp) with 'Option not valid'.

endif.

endif.

When Others.

message e000(rp) with 'Option not valid'.

endcase

case s_rzzps-high(1).

when 'T'. " Do Nothing

When 'C'.

select USR00

from PRPS

into l_v_USR00

where PSPNR = s_rzzps-high.

if sy-subrc <> 0.

message e000(rp) with 'Option not valid'.

else.

if l_v_usr00 is initial.

message e000(rp) with 'Option not valid'.

endif.

endif.

When Others.

message e000(rp) with 'Option not valid'.

endcase

endloop.

~ Ranganath

PS : Reward points for all useful answers !

Edited by: Ranganath Ramesh on Dec 24, 2007 1:39 PM

Former Member
0 Kudos

Hi,

You can do as below :

declare a varible as .

data : char type c.

If you wnat to validate in the selection screen do as below:

if not s_rzzps[] is initial.

char = so_rzzps-low .

if char = 'T'.

Just pass the value.

elseif char = 'C'.

get the values from PRSP checking field USR00.

else.

message 'Input correct WBS element' type 'E'.

endif.

Similarly do for so_rzzps-high also.

Thanks,

Sriram Ponna.

0 Kudos

hi,

s_rzzps for zupi5a-rzzps_posid obligatory no intervals, "WBS Element

i didn't get ur idea. seelct options is with no intervals

can u please explain me along with the code.please its very urgent.and the error message should rise when the letter is other than T & C

0 Kudos

Hi ramya

The code mentioned would address all options even when it is not 'C' or 'T'.

Even though it's mentioned as no-intervals, user will have choice by clicking on additional selections he can give a range.

~ Ranganath

0 Kudos

Hi,

You the below code to do the validation.

Hi,

You can do as below :

declare a varible as .

data : char type c.

If you wnat to validate in the selection screen do as below:

if not s_rzzps[] is initial.

char = so_rzzps-low .

if char = 'T'.

Just pass the value as per your requirement.

elseif char = 'C'.

get the values from PRSP checking field USR00.

else.

message 'Input correct WBS element' type 'E'.

endif.

Thanks,

Sriram Ponna.

Former Member
0 Kudos

Hi,

data:v_rzzps like zupi5a-rzzps_posid .

select-options: s_rzzps for zupi5a-rzzps_posid obligatory no intervals."wbs element.

AT SELECTION-SCREEN ON s_rzzps.

LOOP AT s_rzzps.

IF s_rzzps-low+0(1) = 'C'.

SELECT SINGLE usr00 INTO v_usr00

FROM prps WHERE usr00 = sy-uname.

IF v_usr00 IS INITIAL AND sy-subrc NE 0.

MESSAGE e999(zmde) WITH text-017 s_rzzps-low.

ENDIF.

*

ELSEIF s_rzzps-low+0(1) NE 'T'.

MESSAGE e999(zmde) WITH text-017 s_rzzps-low.

ENDIF.

ENDLOOP.

Same way you do for s_rzzps-HIGH also by putting in loop.

Regds

Parvathi

Please reward points if helpful..

Edited by: Siva Parvathi on Dec 24, 2007 1:54 PM

0 Kudos

hi siva parvathi,

thanks for ur logic i have made some changes and its working fine now. but i have doubt in my program select-options is with no intervalsso there is no to to field(high).so i validated only for the from field (low).there will be multiple options choice so do i need to validate even for the s_rzzps-high. please suggest me .

s_rzzps for zupi5a-rzzps_posid obligatory no intervals,

at selection-screen on s_rzzps.

data v_usr00 like PRPS-USR00.

loop at s_rzzps.

*if s_rzzps-low0(1) = 'T'.*+

*Elseif s_rzzps-low0(1) = 'C'.*+

Select single usr00 into v_usr00

from PRPS where POSID = s_rzzps-low.

if v_usr00 is initial." and sy-subrc NE 0.

MESSAGE e013 .

endif.

endif.

endloop.

please any one can suggest me.

Thanks & Regards

Ramya.

0 Kudos

Hi Ramya,

You have to use loop at s_rzzps-low.

endloop.

no need to use for s_rzzps-high ( you dont have high option to enter) .

Because all the values you enter thru extension (arrow mark operator) will be stored s_rzzps-low option only.

Loop at s_rzzps.

if s_rzzps-low...

Normal validation.........

endloop.

Otherwise if you are confusing with low high, you can one thing.just take 1 internal table with one column like s_rzzps-low and append all the values from s_rzzps-low to that internal table column and afterwards you can validation for that internal table .

Regds

Sivaparvathi

Please reward points if helpful

0 Kudos

hi,

Thank u very much.