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 for GL account

Former Member
0 Kudos
105

Hi all,

i am doing valodations for GL accouont. my requirement is to if the user enters the any GL account other then the range 0000100000 to 0000299999, it should through a Error message saying that Enter GL account in the range range 0000100000 to 0000299999.

i tried with the below code, but still not able to get the requirement.

SELECT-OPTIONS: s_saknr FOR skat-saknr .

AT SELECTION-SCREEN.

if not o_saknr-low is NOT INITIAL.

SELECT SINGLE * FROM skat WHERE saknr = o_saknr-low and

saknr in between '0000100000' and '0000299999'.

IF sy-subrc NE 0.

MESSAGE e001(00) WITH 'GL account in the range range 0000100000 to 0000299999'.

ENDIF.

ENDIF.

thanks

Nirmala

if not o_saknr-high is NOT INITIAL.

SELECT SINGLE * FROM skat WHERE saknr = o_saknr-low and

saknr in between '0000100000' and '0000299999'.

IF sy-subrc NE 0.

MESSAGE e001(00) WITH 'GL account in the range range 0000100000 to 0000299999'.

ENDIF.

ENDIF.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
56

Hi,

Try this:

1) First loop at the select option and fill the data into a range.

2) Validate the values in range:

if r_range NOT between (0000100000' , '0000299999').

error message----

endif.

OR

if not o_saknr-low LT 0000100000' OR o_saknr-high GT '0000299999'.

error message---

endif.

Regards

Shiva

2 REPLIES 2

Former Member
0 Kudos
57

Hi,

Try this:

1) First loop at the select option and fill the data into a range.

2) Validate the values in range:

if r_range NOT between (0000100000' , '0000299999').

error message----

endif.

OR

if not o_saknr-low LT 0000100000' OR o_saknr-high GT '0000299999'.

error message---

endif.

Regards

Shiva

0 Kudos
56

Hi,

i tried like following .. but still iam unable to get the error message.

AT SELECTION-SCREEN.

if not o_saknr-low is NOT INITIAL.

SELECT SINGLE * FROM skat WHERE saknr = o_saknr-low and

saknr >= '0000100000' or

saknr <= '0000299999'.

IF sy-subrc NE 0.

error message

ENDIF.

ENDIF.