Skip to Content
author's profile photo Former Member
Former Member

Validation


SELECT VBELN BSARK VTWEG SPART VDATU FROM VBAK INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE
 ERDAT IN S_ERDAT
 AND VKORG IN S_VKORG
 AND VTWEG IN S_VTWEG
 AND BSARK IN S_BSARK
 AND SPART IN S_SPART.

I want to provide validation for the above statements in selection screen.Can anyone plz tell the code for it.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 20, 2007 at 06:59 PM

    Hi

    Declare them as select-options

    write BSARK field also like this

    select-options: s_vkorg for tvko-vkorg ,

    s_vtweg for tvtw-vtweg,

    s_spart for tspa-spart.

    and in the at selection-screen write the code as below.

    at selection-screen.

    • Checking for the input values of selection screen.

    perform screen_check.

    &----


    *& Form screen_check

    &----


    • Ckecking for Selection Screen fields Validation

    ----


    form screen_check.

    • Validation of Sales Organization

    clear tvko.

    if not s_vkorg-low is initial.

    select vkorg from tvko up to 1 rows

    into tvko-vkorg

    where vkorg in s_vkorg.

    endselect.

    if sy-subrc ne 0.

    message e009. " Invalid Sales Organization

    endif.

    endif.

    • Validation of Distribution Channel

    clear tvtw.

    if not s_vtweg-low is initial.

    select vtweg from tvtw up to 1 rows

    into tvtw-vtweg

    where vtweg in s_vtweg.

    endselect.

    if sy-subrc ne 0.

    message e010. " Invalid Distribution Channel

    endif.

    endif.

    • Validation of Division

    clear tspa.

    if not s_spart-low is initial.

    select spart from tspa up to 1 rows

    into tspa-spart

    where spart in s_spart.

    endselect.

    if sy-subrc ne 0.

    message e011. " Invalid Division

    endif.

    endif.

    endform. "screen_check

    Regards

    Anji

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 20, 2007 at 07:04 PM

    We normally validate paramaters but not select options. The reason is that the user could put in a number of single entries, some of which are wrong, but if there is at least one correct entry, the select option will pass the validation check.

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 20, 2007 at 07:12 PM

    Why cant You use VALUE CHECK in selection screens

    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.