2007 Mar 12 10:13 AM
Hi All!
I am trying to write this ABAP program in 4.7 Enterprise. I wish to selectively display (based on radio buttons) selection screen blocks and make them mandatory in runtime. I use code like this:
AT SELECTION-SCREEN ON SAL_ORG. (this is one of the fields that will be obligatory)
IF RD2 EQ 'X'.
IF SAL_ORG IS INITIAL.
MESSAGE 'THIS FIELD IS MANDATORY' TYPE 'I'.
ENDIF.
ENDIF.
Now, if I execute this as is, then I will get this message as soon as the block is displayed, not just after hitting the execution button. Can you please tell me how I should put a condition on this checking. I know it is triggered by SY-UCOMM = 'ONLI' but i am not sure where to put the condition.
Thanks in advance!
2007 Mar 12 10:18 AM
AT SELECTION-SCREEN.
CHECK sscrfields-ucomm EQ 'ONLI'.
AT SELECTION-SCREEN ON SAL_ORG. (this is one of the fields that will be obligatory)
IF RD2 EQ 'X'.
IF SAL_ORG IS INITIAL.
MESSAGE 'THIS FIELD IS MANDATORY' TYPE 'I'.
ENDIF.
ENDIF.
2007 Mar 12 10:18 AM
Hi subhamoy,
1. for such things, it is better to follow this kind of logic.
(it will ensure that the report does not run when executed)
2.
START-OF-SELECTION.
IF FIELD IS INITIAL.
MESSAGE 'Please enter Field' type 'I'.
LEAVE LIST-PROCESSING.
ENDIF.
3. Important points.
a) Message should be of type I (and not E)
b) LEAVE LIST-PROCESSING. is important.
regards,
amit m.
2007 Mar 12 10:18 AM
AT SELECTION-SCREEN.
CHECK sscrfields-ucomm EQ 'ONLI'.
AT SELECTION-SCREEN ON SAL_ORG. (this is one of the fields that will be obligatory)
IF RD2 EQ 'X'.
IF SAL_ORG IS INITIAL.
MESSAGE 'THIS FIELD IS MANDATORY' TYPE 'I'.
ENDIF.
ENDIF.
2007 Mar 12 2:01 PM
hello J.C.!
this is what worked for me finally:
AT SELECTION-SCREEN.
CHECK sy-ucomm EQ 'ONLI'.
IF RD2 EQ 'X'.
IF SAL_ORG IS INITIAL.
MESSAGE 'THIS FIELD IS MANDATORY' TYPE 'I'.
ENDIF.
ENDIF.
SAP says sscrfields-ucomm is unrecognized. can you please tell me what it is actually? why did you prefer using it instead of SY-UCOMM? If possible, please direct me to some good reference on calling selection screen.
I have given your answer 10 points by the way. I am very new here, so i don't know what exactly it's role is, but i figured it is something significant.
2007 Mar 12 2:04 PM
declare table SSCRFIELDS at top
TABLES : SSCRFIELDS.
this structure stores the selection screen fields
Message was edited by:
Chandrasekhar Jagarlamudi