Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Validation check in selection screen

Former Member
0 Likes
767

Hi experts,

I have a below given piece of code:

SELECTION-SCREEN: BEGIN OF BLOCK b4 WITH FRAME TITLE text-004.

PARAMETERS: s1 RADIOBUTTON GROUP rad2 DEFAULT 'X' USER-COMMAND ucom,

s2 RADIOBUTTON GROUP rad2 .

SELECTION-SCREEN: END OF BLOCK b4.

SELECTION-SCREEN: BEGIN OF BLOCK b5 WITH FRAME TITLE text-005.

PARAMETERS: p_path LIKE rlgrap-filename.

SELECTION-SCREEN: END OF BLOCK b5.

AT SELECTION-SCREEN OUTPUT.

IF s1 IS NOT INITIAL.

LOOP AT SCREEN.

IF screen-name = 'P_PATH'.

screen-input = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

In the above code, if the user selects the S2 radio button, only then the p_path text box gets enabled, otherwise not.

Now I have a req. in which once the user selects S2 and the p_path is enabled, if the user presses F8 without entering any value in p_path, there should be a proper message thrown to input the value in p_path.

How can I achieve this functionality?

Thanks,

Ajay.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
729

Hi Ajay ,

Try the code

at SELECTION-SCREEN.
BREAK-POINT.
  if s2 = 'X' and p_path is INITIAL and sy-ucomm = 'ONLI'.
         MESSAGE ID 'message if' TYPE 'E'
            NUMBER '242'.
  endif

.

SY-UCOMM = ONLI , when F8 is pressed.

Hope this helps.

Regadrs

Arun

7 REPLIES 7
Read only

Former Member
0 Likes
729

Hi,

Try to use AT SELECTION-SCREEN ON FIELD Event..

Read only

Former Member
0 Likes
730

Hi Ajay ,

Try the code

at SELECTION-SCREEN.
BREAK-POINT.
  if s2 = 'X' and p_path is INITIAL and sy-ucomm = 'ONLI'.
         MESSAGE ID 'message if' TYPE 'E'
            NUMBER '242'.
  endif

.

SY-UCOMM = ONLI , when F8 is pressed.

Hope this helps.

Regadrs

Arun

Read only

0 Likes
729

Hi,

Check this code.

IF S2 = CNS_X AND S_ISSUE IS INITIAL.

SET CURSOR FIELD 'S_ISSUE-LOW'.

MESSAGE E001(ZGSD001) WITH TEXT-017.

ENDIF.

Hope it helps.

Regards,

Raj

Read only

Former Member
0 Likes
729

Hi Ajay,

You need to write code in "START-OF-SELECTION" EVENT for your requirement.

There you need to check whether the S2 radio-button is selected and P_path is empty and then you should give

Information Message and then "LEAVE LIST-PROCESSING".

This will resolve the issue.

Please check the below code.

SELECTION-SCREEN: BEGIN OF BLOCK b4 WITH FRAME TITLE text-004.
PARAMETERS: s1 RADIOBUTTON GROUP rad2 DEFAULT 'X' USER-COMMAND ucom,
s2 RADIOBUTTON GROUP rad2 .
SELECTION-SCREEN: END OF BLOCK b4.

SELECTION-SCREEN: BEGIN OF BLOCK b5 WITH FRAME TITLE text-005.
PARAMETERS: p_path LIKE rlgrap-filename.
SELECTION-SCREEN: END OF BLOCK b5.

AT SELECTION-SCREEN OUTPUT.
  IF s1 IS NOT INITIAL.
    LOOP AT SCREEN.
      IF screen-name = 'P_PATH'.
        screen-input = '0'.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.

START-OF-SELECTION.
  IF s2 IS NOT INITIAL AND p_path IS INITIAL.
    MESSAGE 'Enter value for path' TYPE 'I'.
    LEAVE LIST-PROCESSING.
  ENDIF.
  WRITE 123.

Regards

Pinaki

Read only

Former Member
0 Likes
729

SELECTION-SCREEN: BEGIN OF BLOCK b4 WITH FRAME TITLE text-004.

PARAMETERS: s1 RADIOBUTTON GROUP rad2 DEFAULT 'X' USER-COMMAND ucom,

s2 RADIOBUTTON GROUP rad2 .

SELECTION-SCREEN: END OF BLOCK b4.

SELECTION-SCREEN: BEGIN OF BLOCK b5 WITH FRAME TITLE text-005.

PARAMETERS: p_path LIKE rlgrap-filename.

SELECTION-SCREEN: END OF BLOCK b5.

AT SELECTION-SCREEN OUTPUT.

IF s1 IS NOT INITIAL.

LOOP AT SCREEN.

IF screen-name = 'P_PATH'.

screen-input = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

START-OF-SELECTION.

IF s2 IS NOT INITIAL AND p_path IS INITIAL.

MESSAGE 'Enter p_path' TYPE 'E'.

ENDIF.

Read only

Former Member
0 Likes
729

You can try to use the component "REQUIRED" of the table "SCREEN". this component makes the field mandatory.

http://help.sap.com/saphelp_nw04/helpdata/EN/9f/dbab6f35c111d1829f0000e829fbfe/content.htm

Chk the site for information about the table "SCREEN"

Read only

Former Member
0 Likes
729

chk the following code:


SELECTION-SCREEN: BEGIN OF BLOCK b4 WITH FRAME TITLE text-004.
PARAMETERS: S1 RADIOBUTTON GROUP RAD2 USER-COMMAND FCODE,
            S2 RADIOBUTTON GROUP RAD2.
SELECTION-SCREEN: end OF BLOCK b4.

SELECTION-SCREEN: BEGIN OF BLOCK b5 WITH FRAME TITLE text-005.
PARAMETERS: p_path LIKE RLGRAP-FILENAME modif id MOD.
SELECTION-SCREEN: END OF BLOCK b5.

AT SELECTION-SCREEN OUTPUT.
IF S2 = 'X'.
  LOOP AT SCREEN.
    IF SCREEN-GROUP1 = 'MOD'.
      SCREEN-ACTIVE = 0.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.
  ENDIF.
  at selection-screen on p_path.
  if p_path is initial.
  message 'Enter value' type 'S'.
  endif.

Regards