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

validation for select-options

Former Member
0 Likes
1,036

need help in validaiton for select-options.

5 REPLIES 5
Read only

Former Member
0 Likes
855

hi chayaarungupta,

1. suppose we want to check whether

the select options contains some value eg.xyz then,

2. If 'XYZ' in seloption.

error message.

endif.

regards,

amit m.

Read only

Former Member
0 Likes
855

Hi..,

could u paste ur selection screen declarations here !!!

check this..

*"Selection screen elements............................................

select-options :

s_vbeln for vbak-vbeln, " Sales document number

s_vkorg for vbak-vkorg, " Sales organization

s_erdat for vbak-erdat . " Run date

"----


  • AT SELECTION-SCREEN ON EVENT *

"----


*Validation on Sales document number range...

at selection-screen on s_vbeln.

  • Perform to validate Sales document number range...

perform f0000_validate_vbeln.

"----


  • AT SELECTION-SCREEN ON EVENT *

"----


*Validation on Sales Organization range...

at selection-screen on s_vkorg.

*Perform to validate the Organization number user input...

perform f0100_validate_vkorg.

"----


  • AT SELECTION-SCREEN ON EVENT *

"----


*Validation on Creation date range...

at selection-screen on s_erdat.

*Perform to validate the Creation date of the sales documents...

perform f0100_validate_erdat.

&----


*& Form f0000_validate_vbeln

&----


  • This subroutine validates the user input - Sales document *

  • number range *

----


  • There are no interface parameters *

----


form f0000_validate_vbeln.

select vbeln " Sales Document number

from vbuk

up to 1 rows

into vbak-vbeln

where vbeln in s_vbeln.

endselect.

check sy-subrc ne 0.

message e001(zsls640) with s_vbeln-low s_vbeln-high.

endform. " Form f0000_validate_vbeln

&----


*& Form f0100_validate_vkorg

&----


  • This subroutine validates the user input - Sales Organization *

  • range *

----


  • There are no interface parameters *

----


form f0100_validate_vkorg.

select vkorg " Sales Organization

from vbak

up to 1 rows

into vbak-vkorg

where vkorg in s_vkorg.

endselect.

check sy-subrc ne 0.

message e002(zsls640) with s_vkorg-low s_vkorg-high.

endform. " Form f0100_validate_vkorg

&----


*& Form f0100_validate_erdat

&----


  • This subroutine validates the user input - Creation date of the*

  • Sales documents *

----


  • There are no interface parameters *

----


form f0100_validate_erdat.

select erdat " Creation date

from vbak

up to 1 rows

into vbak-erdat

where vkorg in s_erdat.

endselect.

check sy-subrc ne 0.

message e003(zsls640) with s_erdat-low s_erdat-high.

endform. " Form f0100_validate_erdat

<b>regards,

sai ramesh</b>

Read only

Former Member
0 Likes
855

Hi Gupta,

Do validadtion in "At selection-screen on Field" Event.

Validation for Material Number

AT SELECTION-SCREEN ON s_matnr.

IF NOT s_matnr[] IS INITIAL.

SELECT SINGLE matnr

FROM mara

INTO v_matnr

WHERE matnr IN s_matnr.

IF sy-subrc <> 0.

MESSAGE e000 WITH text-032. "Invalid Material Number

ENDIF.

ENDIF.

Hope it will work.

Regards,

-->Suresh

Read only

Former Member
0 Likes
855

Hi Gupta,

select-options : so_matnr for mara-matnr.

data : w_matnr type mara-matnr.

AT SELECTION-SCREEN ON so_matnr.

IF NOT so_matnr IS INITIAL.

SELECT SINGLE matnr

FROM mara

INTO w_matnr

WHERE matnr IN so_matnr.

IF sy-subrc <> 0.

MESSAGE 'Material Number Not Exist' Type 'E'.

ENDIF.

ENDIF.

Regards

Purshoth

Read only

Former Member
0 Likes
855

Hi,

Look at the below link, you will get the answer

Regards

Sudheer