Skip to Content
avatar image
Former Member

At Selection screen validation

Hi All,

I am putting validation on selection screen.

My Selection screen has following fields

s_Bukrs = t001-bukrs

s_GJAHR = bsak-gajhr

s_budat = bsak-budat

s_lifnr = lfa1-lifnr.

I am applying validation as below

at selection-screen on s_bukrs.

if s_bukrs ne t001-bukrs.

message-id e001. 'Invalid INput

endif.

when i put any company code which exist i am getting the same message 'Invalid Input'.

At the same time when i remove this check and run the report it takes lots of time to execute except for the company code DP01.

Please revert.

Thanks,

VB

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Jun 22, 2010 at 12:58 PM

    Use the folllowing logic and let me know.

    at selection-screen on s_bukrs.

    if not s_bukrs[] is initial.

    select single bukrs into t001-bukrs from t001

    where bukrs in s_bukrs.

    if sy-subrc <> 0.

    message e054 with text-042."'Invalid company code'.

    exit.

    endif.

    endif.

    Regards,

    Preetham

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 22, 2010 at 01:03 PM

    Hi Vikram,

    You are doing in wrong way.

    Follow like below code for other field validations.

    
    DATA:v_bukrs TYPE bukrs,
          lv_bukrs TYPE bukrs.
    
    SELECT-OPTIONS:s_bukrs FOR v_bukrs.
    
    SELECT bukrs FROM t001 INTO lv_bukrs WHERE bukrs IN s_bukrs.
    
    ENDSELECT.
    
    IF sy-subrc <> 0 AND lv_bukrs IS INITIAL.
      MESSAGE 'COMPANY CODE DOES NOT EXIXT' TYPE 'E'.
    ENDIF.
    

    Regards,

    Pravin

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 23, 2010 at 05:47 AM

    You can use the following logic:

    TYPES: BEGIN OF ty_bukrs,

    bukrs type bukrs,

    END OF ty_bukrs.

    DATA: it_bukrs type ty_bukrs.

    AT SELECTION-SCREEN on s_bukrs.

    if not s_bukrs is initial.

    select bukrs

    from t001

    into it_bukrs

    where bukrs in s_bukrs.

    endif.

    if it_bukrs is initial.

    message-id e001. 'Invalid INput

    endif.

    Add comment
    10|10000 characters needed characters exceeded