Application Development and Automation 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: 
Read only

problem with validation

Former Member
0 Likes
819

as i am using single in this statement it is fetching only one record but in select options only low value is taking into consideration not high value what i need to do for high value .

IF NOT s_route IS INITIAL.

SELECT SINGLE route FROM tvro

INTO tvro-route

WHERE route IN s_route.

IF sy-subrc NE 0.

MESSAGE e001(8i) WITH text-009.

ENDIF.

ENDIF.

8 REPLIES 8
Read only

Former Member
0 Likes
793

That is not considering low value...

That will check with the BETWEEN LOW and HIGH values condition and selects any value which comes first....

Also we will use SELECT SINGLE ... in Select-opitons in order to validate the data. I mean just to check whether there are any records for that selection- or not. So the functionality is correct in that case.

Read only

Former Member
0 Likes
793

IF NOT s_route IS INITIAL.

SELECT <b>SINGLE(remove)</b> route FROM tvro

INTO tvro-route

WHERE route IN s_route.

IF sy-subrc NE 0.

MESSAGE e001(8i) WITH text-009.

ENDIF.

ENDIF.

Regards

prabhu

Read only

Former Member
0 Likes
793

Hi,

The logic is even if you find atleast one record btw the values entered by the user in low and high the user can view the report or can proceed.

if you want explicit check of each value in low and high then u need to write two selects

at selection-screen on s_route-low.

select single from ...where route = s_route-low.

at selection-screen on s_route-high.

select single from ...where route = s_route-high.

Read only

Former Member
0 Likes
793

hi,

in this case its better not to use select single , select all records base on the condition.

regards,

Navneeth.K

Read only

Former Member
0 Likes
793

hi

IF NOT s_route IS INITIAL.

SELECT SINGLE route FROM tvro

INTO table tvro-route

WHERE route IN s_route.

ENDIF.

praveen

Read only

Former Member
0 Likes
793

Hi

U need to store the data in an internal table:

IF NOT s_route IS INITIAL.

DATA: T_ROUTE LIKE TVRO-ROUTE OCCURS 0.

SELECT route FROM tvro

INTO TABLE T_ROUTE

WHERE route IN s_route.

IF sy-subrc NE 0.

MESSAGE e001(8i) WITH text-009.

ENDIF.

Max

Read only

Former Member
0 Likes
793

Hai,

Jusy a small change is needed in your coded.

See the High lighted one.

IF NOT s_route IS INITIAL.

SELECT SINGLE route FROM tvro

<b>INTO corresponding fields of tvro</b>

WHERE route IN s_route.

IF sy-subrc NE 0.

Hope the problem is solved.

<b>Reward points if it helps you.</b>

Regds,

Rama chary.Pammi

Read only

Former Member
0 Likes
793

Hi,

You can use two select single statements. One or High and other for low value.

Eg.

DATA : v_route type tvro-route,

v_route1 type tvro-route.

IF NOT s_route IS INITIAL.

SELECT SINGLE route FROM tvro

INTO v_route

WHERE route EQ s_route-low.

if sy-subrc = 0.

SELECT SINGLE route FROM tvro

INTO v_route1

WHERE route EQ s_route-high.

IF sy-subrc NE 0.

MESSAGE e001(8i) WITH text-009.

ENDIF.

endif.

ENDIF.

Rewards Point if helpful

Sourabh