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

Problem in AT Selection Screen on field problem.

Hello Expert,

I have the problem in AT SELECTION SCREEN ON Field.

I have 2 radio button rad1 and rad2 and 2 parameter matnr and mtart.

if user click first radiobutton that is rad1, the 2 parameter should enable and accept user input.

if user click second radio button that is rad2, the matnr should disable and mtart should enable.

My code working fine for all this. My problem i have writen one validation for mtart ie if iit is empty it should display

error message.

So my problem is if i click on second radion button ie rad2 , first parameter disabling and second parameter it is giving error 'material type not exists'.

i dont want error message when i clicking on the second radiobutton, i need the error message after user clicking second radio button and if dont enter any value in the second parameter ie p_mtart.

here is my code

PARAMETER: p_rad1 RADIOBUTTON GROUP rad1 DEFAULT 'X'  USER-COMMAND f1,
p_rad2 RADIOBUTTON GROUP rad1.

Parameter: p_matnr like mara-matnr.

Parameter: p_mtart like mara-mtart .


AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.
if p_rad2 = 'X'.
if screen-name = 'P_MATNR'.
screen-input = 0.
screen-output = 1.
screen-group1 = 'BL1'.
modify screen.
elseif p_rad1 = 'X'.
screen-input = 1.
screen-active = 0.
modify screen.
endif.
endif.
endloop.


AT SELECTION-SCREEN on P_MATNR .
if p_rad1 = 'X'.
if p_matnr is initial.
MESSAGE E999  with 'material doesnt exists'.
endif.
endif.


AT SELECTION-SCREEN on P_MTART .
if p_rad2 = 'X'.
if p_mtart is initial.
MESSAGE E999  with 'material type doesnt exists'.
endif.
endif.

<Added Code tags>

Edited by: Suhas Saha on Nov 24, 2011 10:33 AM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Nov 23, 2011 at 04:18 PM

    Why don't you just make that validation when the user press F8, so while you are entering data you won't get that error.

    AT SELECTION-SCREEN ON p_matnr .
      IF sy-ucomm EQ 'ONLI'.
        IF p_rad1 = 'X'.
          IF p_matnr IS INITIAL.
            MESSAGE e398(00) WITH 'material doesnt exists'.
          ENDIF.
        ENDIF.
      ENDIF.
    
    
    AT SELECTION-SCREEN ON p_mtart .
      IF sy-ucomm EQ 'ONLI'.
        IF p_rad2 = 'X'.
          IF p_mtart IS INITIAL.
            MESSAGE e398(00) WITH 'material type doesnt exists'.
          ENDIF.
        ENDIF.
      ENDIF.
    

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 23, 2011 at 06:02 PM

    But i need to be when pressing enter button. This because in AT SELECTION-SCREEN I have one more field where if i press value should fill. it would be great help if you give me the code, where error display when pressing enter button.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 24, 2011 at 04:41 AM

    Hi,

    Switch debugging on and check what is the value of sy-ucomm when you change radiobutton?

    Now Dont provide the check on material type for this sy-ucomm.

    The code should be:

    If sy-ucomm not equal tp '......'.

    Mtart check.

    end if.

    This will solve ur problem

    Edited by: Suruchi Razdan on Nov 24, 2011 6:17 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 24, 2011 at 07:56 AM

    Thanks.. closed

    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.