Skip to Content

validations

hi ,

if the end-user is entering some garbage like "-/-*" in the select-option.

how to do validations at selection-screen?

with regards

always learner

points will be rewarded if useful

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on May 15, 2008 at 05:15 PM

    Hi,

    You can do as below:

    at selection-screen.
    
    if not sp_field[] is initial.
    
      if sp_field CA '*-/'.
         message 'Error' type 'E'.
      endif.
    endif.
    

    Thanks,

    Sriram Ponna.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member M Mukhtar

      Hello,

      And depending of the domain of the field used in the select-options the ABAP do a self validations (without need of code).

      For example if you use a numeric type, only numbers will be accepted in the select-options.

      Regards,

  • author's profile photo Former Member
    Former Member
    Posted on May 15, 2008 at 05:20 PM

    Hi always,

    Check them:

    IF P_DATA CA '*'.
      WRITE:/ 'Invalid'.
    ENDIF.

    Replace them:

    REPLACE ALL OCCURRENCES OF '*' IN P_DATA WITH ''.

    Regards,

    Isaac Melendez

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 15, 2008 at 05:27 PM

    Hi,

    We can do validation like this.

    ----


    • SELECTION-SCREEN

    ----


    SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE tit.

    SELECT-OPTIONS: so_ebeln FOR v_ebeln OBLIGATORY.

    SELECTION-SCREEN END OF BLOCK b.

    ----


    • AT SELECTION-SCREEN ON

    ----


    AT SELECTION-SCREEN ON so_ebeln.

    PERFORM validate_ebeln.

    &----


    *& Form validate_ebeln

    &----


    FORM validate_ebeln.

    SELECT ebeln

    FROM ekpo

    INTO TABLE it_ebeln

    WHERE ebeln IN so_ebeln.

    IF sy-subrc NE 0.

    MESSAGE e020(z50871msg) WITH text-014.

    ENDIF.

    ENDFORM.

    Not only the "-/-".....for any value which is not valid, this code gives error message.

    Here , I am doing the validation for EBELN. According to ur requirement you can change this code.

    Regards

    Sandeep Reddy

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 15, 2008 at 06:47 PM

    hi check this..

    if this not the database element then use this..

    parameters: p_field(10) type c .

    at selection-screen .

    if p_field ca '-'.

    message s000 with 'this is invalid'.

    elseif p_field ca '*'.

    message s000 with 'this is invalid'.

    elseif p_field ca '/'.

    message s000 with 'this is invalid'.

    endif.

    if it is a database field..

    tables:mara .

    select-options:s_matnr for mara-matnr .

    data: v_matnr like mara-matnr .

    select matnr from mara into v_matnr where matnr in s_matnr .

    endselect .

    if sy-subrc ne 0.

    message s000 with 'the input is invalid'.

    endif.

    regards,

    venkat

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 25, 2008 at 03:15 AM

    thx

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.