Skip to Content

Can I validate parameter fields before filling the mandatory field in Parameters(OBLIGATORY)

I have one parameter which is a mandatory field in the selection screen.

I have another two parameters for which I want to validate some scenarios.

Before filling the Mandatory field my validations on parameter fields aerror.png

re not working. After filling the Mandatory parameter then only my validations on other parameters are working .

Can anyone help me to solve my issue?

I tried this example

SELECTION-SCREEN BEGIN OF BLOCK blck1 WITH FRAME.
PARAMETERS:p1 TYPE zd_studentno MATCHCODE OBJECT z1132_sh OBLIGATORY.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: pselect RADIOBUTTON GROUP rad1 DEFAULT 'X' USER-COMMAND ucomm.
SELECTION-SCREEN COMMENT (30) TEXT-001.
PARAMETERS: p_month TYPE numc2 MODIF ID mnt,
p_year TYPE numc4 MODIF ID yer.
SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: pdate RADIOBUTTON GROUP rad1 .
SELECTION-SCREEN COMMENT (30) TEXT-002.
PARAMETERS: p_date1 TYPE sy-datum MODIF ID dt.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK blck1.

AT SELECTION-SCREEN OUTPUT .
LOOP AT SCREEN.
IF pselect = 'X'.
IF screen-group1 = 'DT'.
screen-input = '0'.
p_date1 = ''.
p_year = sy-datum+0(4).
p_month = sy-datum+4(2).
MODIFY SCREEN.
ENDIF.
ELSEIF pdate = 'X'.
p_year = ''.
p_month = ''.
p_date1 = sy-datum.
IF screen-group1 = 'MNT'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'YER'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.

error.png (20.8 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Oct 15, 2019 at 06:40 PM

    Hello Anusha anusha,

    Remove the OBLIGATORY keyword and write the Validation in AT SELECTION SCREEN.

    Your code should be as below:

    TABLES sscrfields.
    SELECTION-SCREEN BEGIN OF BLOCK blck1 WITH FRAME.
    
    PARAMETERS:p1 TYPE matnr MATCHCODE OBJECT qalsm.  --> This is for Example, similarly give valid MATCHCODE
    
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: pselect RADIOBUTTON GROUP rad1 DEFAULT 'X' USER-COMMAND ucomm.
    SELECTION-SCREEN COMMENT (30) TEXT-001.
    PARAMETERS: p_month TYPE numc2 MODIF ID mnt,
                p_year  TYPE numc4 MODIF ID yer.
    SELECTION-SCREEN END OF LINE.
    
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: pdate RADIOBUTTON GROUP rad1 .
    SELECTION-SCREEN COMMENT (30) TEXT-002.
    PARAMETERS: p_date1 TYPE sy-datum MODIF ID dt.
    SELECTION-SCREEN END OF LINE.
    
    SELECTION-SCREEN END OF BLOCK blck1.
    
    AT SELECTION-SCREEN OUTPUT .
      LOOP AT SCREEN.
        IF pselect = 'X'.
          IF screen-group1 = 'DT'.
            screen-input = '0'.
            p_date1 = ''.
            p_year = sy-datum+0(4).
            p_month = sy-datum+4(2).
            MODIFY SCREEN.
          ENDIF.
    
        ELSEIF pdate = 'X'.
    
          p_year = ''.
          p_month = ''.
          p_date1 = sy-datum.
    
          IF screen-group1 = 'MNT'.
            screen-input = '0'.
            MODIFY SCREEN.
          ENDIF.
    
          IF screen-group1 = 'YER'.
            screen-input = '0'.
            MODIFY SCREEN.
          ENDIF.
        ENDIF.
    
      ENDLOOP.
    
    AT SELECTION-SCREEN.
      CASE sscrfields-ucomm.
        WHEN 'ONLI' OR 'CRET' OR 'JOBS'. " button "EXECUTE" or similar
          IF p1 IS INITIAL.
            MESSAGE 'Fill the value of p1' TYPE 'E'.
          ENDIF.
      ENDCASE.
    
    
    Regards!
    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.