Skip to Content
0
Jan 22, 2013 at 11:13 AM

Input validation based on radio button

1204 Views

Hi,

I am having a problem with input validation based on radio button if the user does not hit 'enter'.

The scene is : I have a parameter and 4 radio buttons on the selection screen and i want to validate user input (based on selection criteria) if 4th radio button is checked. If I enter the wrong value in parameter field and check 4th radio button and then execute it, it generates the output but it should not. But if the user inputs the value, checks the 4th radio button and then again on parameter field if the user presses enter , it shows the error message defined by me.

What to do to validate this input without hitting 'enter' based on check of 4th radio button .

Here is my code:

SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-002 .

PARAMETERS : p_vbeln LIKE vbrk-vbeln.

PARAMETERS: r1 RADIOBUTTON GROUP rad1," DEFAULT ’X’,
r2 RADIOBUTTON GROUP rad1,
r3 RADIOBUTTON GROUP rad1,
r4 RADIOBUTTON GROUP rad1 .

SELECTION-SCREEN : END OF BLOCK b2 .

AT SELECTION-SCREEN ON p_vbeln. "Invoice no.
IF r4 IS NOT INITIAL.
SELECT SINGLE * FROM vbrk WHERE ( fkart = 'F2' OR fkart = 'ZEX' ) AND vbeln = p_vbeln .
IF sy-subrc <> 0.
MESSAGE e000(zinv_print) WITH p_vbeln.
ENDIF.

ENDIF.


START-OF-SELECTION.