Skip to Content

validations at selection-screen

hi ,

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

7 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on May 14, 2008 at 04:42 PM

    Hi

    All validations should be done in the event AT SELECTION-SCREE (see the help for more informations): here u need to insert all code for validations and if an error occurs to raise a message

    PARAMETERS: P_BUKRS TYPE T001-BUKRS.
    
    AT SELECTION-SCREEN.
    
      SELECT SINGLE * FROM T001 WHERE BUKRS = P_BUKRS.
      IF SY-SUBRC <> 0.
        MESSAGE E208(00) WITH 'Company code doesn't exit'.
      ENDIF.

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 14, 2008 at 04:42 PM

    Hi,

    Validations can be done at command AT SELECTION-SCREEN on p_datum where p_datum is the parameter field you want to validate. After AT SELECTION-SCREN you can validate using abap code. Example given below.

    AT SELECTION-SCREEN on p_bukrs.

    SELECT SINGLE * in lw_bukrs FROM T001

    where bukrs in p_bukrs.

    if sy-subrc ne 0.

    display error message.

    endif.

    Anand

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 14, 2008 at 04:43 PM

    The same way you do validations in any part of the program...

    I don't get your question.

    I did this validation recently for a currency field, because it is obligatory I don't care if is initial.

    If is not in the masters table I don't accept the currency

    AT SELECTION-SCREEN.
    IF NOT p_waers IS INITIAL.
          SELECT SINGLE waers INTO l_waers FROM tcurc
          WHERE waers = p_waers.
          IF sy-subrc <> 0.
            MESSAGE e001(00) WITH
                    'Currency '
                    p_waers
                    ' doesn't exist.
          ENDIF.
        ENDIF.
    

    Add a comment
    10|10000 characters needed characters exceeded

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

    In At Selection-screen event you have to validate the values of field.

    if p_plant = 1000.

    Display message

    endif.

    In addition At Selection-screen event you can validate the authorization of user.

    eg.

    Authority-check object 's_carrid'

    ID 'carrid' FIELD pa_carr

    ID 'actvt' FIELD actvt_display.

    IF SY-SUBRC <> 0 .

    ...

    ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

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

    Hi Buddy

    Its good to learn alwasys . Here are some progarms which are useful in selection- screen.

    Dont forget to reward points.

    -


    at selection-screen.

    select LIFNR

    from LFB1

    into table

    where lifnr in s_lifnr.

    if sy-subrc ne 0.

    message e888(sabapdocu) with 'no number found'.

    endif.

    in this way u can write the select query.

    -


    selection-screen begin of block b1.

    parameters: p_datum1 type sy-datum,

    p_datum2 type sy-datum.

    selection-screen end of block b1.

    at selection-screen on block b1.

    if p_datum1 is initial

    and p_datum2 is initial.

    message e001(00) with 'Enter at least one date'.

    endif.

    -


    PARAMETERS: TEST1(10) MODIF ID SC1,

    TEST2(10) MODIF ID SC2,

    TEST3(10) MODIF ID SC1,

    TEST4(10) MODIF ID SC2.

    AT SELECTION-SCREEN OUTPUT.

    LOOP AT SCREEN.

    IF SCREEN-GROUP1 = 'SC1'.

    SCREEN-INTENSIFIED = '1'.

    MODIFY SCREEN.

    CONTINUE.

    ENDIF.

    IF SCREEN-GROUP1 = 'SC2'.

    SCREEN-INTENSIFIED = '0'.

    MODIFY SCREEN.

    ENDIF.

    ENDLOOP.

    -


    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.

    PARAMETERS: R1 RADIOBUTTON GROUP RAD1 DEFAULT 'X',

    R2 RADIOBUTTON GROUP RAD1,

    R3 RADIOBUTTON GROUP RAD1.

    SELECTION-SCREEN END OF BLOCK B1.

    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.

    PARAMETERS: R4 RADIOBUTTON GROUP RAD2 DEFAULT 'X',

    R5 RADIOBUTTON GROUP RAD2,

    R6 RADIOBUTTON GROUP RAD2.

    SELECTION-SCREEN END OF BLOCK B2.

    AT SELECTION-SCREEN ON RADIOBUTTON GROUP RAD1.

    IF R1 = 'X'.

    MESSAGE W040(HB).

    ENDIF.

    AT SELECTION-SCREEN ON RADIOBUTTON GROUP RAD2.

    IF R4 = 'X'.

    MESSAGE W040(HB).

    ENDIF.

    -


    Add a comment
    10|10000 characters needed characters exceeded

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

    Hi,

    here i am giving you sample code for validation.

    You can as it as a reference.

    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 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.

    Regards

    Sandeep reddy

    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.