Application Development 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: 

Checkbox and filename

Former Member
0 Kudos

Hello All,

I have a checkbox and a filename input next to it.

I want to make the filename input mandatory if the checkbox is ticked.

Please suggest.

Thanks,

Kunal.

9 REPLIES 9

Former Member
0 Kudos

Hi,

write condition

if checkbox is not initial, then make the field name has obligatory or madatory.

Regards,

Kasuladevi Srinivas

0 Kudos

Hello Kasuladevi,

How do i make the fieldname mandatory.

In which event should i write the code.

Please elaborate.

Thank you for the help.

Regards,

Kunal.

0 Kudos

Hello

Try:


parameters: filename like rlgrap-filename.
parameters: sss as checkbox.

if sss = 'X'.
  if filename is initial.
    MESSAGE 'Enter filename' TYPE 'E'
    exit. LEAVE SCREEN.
  endif.
endif.

Former Member
0 Kudos

Hi,

You can do a selection screen validation on your file name.

Check if the checkbox is checked if so throw an error message if the file name is empty.

Say :

w_check -- > Checkbox

w_file -


> filename.

code :

at selection-screen on w_file.

if w_check = 'X'.

if w_file is initial.

Message 'Please enter the file Name' type 'E'.

endif.

endif.

0 Kudos

THANKS

Former Member
0 Kudos

Hi,

Check this sample code


REPORT z_sdn.

PARAMETERS:
  p_chkbx AS CHECKBOX,
  p_char(10) TYPE c.


AT SELECTION-SCREEN.

  IF p_chkbx = 'X'.
    IF p_char IS INITIAL.
      MESSAGE 'Enter the value in field' TYPE 'E'.
    ELSE.
      MESSAGE 'You may proceed further' TYPE 'I'.
    ENDIF.
  ENDIF.

START-OF-SELECTION.
  WRITE: / 'TEST'.

Regards

Abhijeet

Former Member
0 Kudos

Hi kunal,

Parameters:
  p_chk as checkbox,
  p_file  LIKE dxfields-longpath . 

At selection-screen.
if p_chk = 'X' and p_file is initial.
Message 'Fill mandatory field' type 'E'.
Endif.

Regards,

Sravanthi

Former Member
0 Kudos

hi try this ...

intitally read the value of check box using DYNP_VALUES_READ ... after that loop at the SCREEN ... and when screen-fieldname = ParameterName ... make thse forllowing change

screen-required = 1.

modify screen.

hope this helps ...........

i048168
Advisor
Advisor
0 Kudos

Hi,

Find the sample code below to make the input field mandatory on clicking the checkbox.

REPORT ZCHECK_BOX.

TABLES sscrfields.

data: gv_x.

PARAMETERS check AS CHECKBOX USER-COMMAND check.

parameters test type mara-matnr modif id SC1.

AT SELECTION-SCREEN output.

IF gv_x = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'SC1'.

screen-required = '1'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

at selection-screen .

if sscrfields-ucomm = 'CHECK'.

gv_x = 'X'.

else.

clear gv_x.

endif.

START-OF-SELECTION.

WRITE 'Check Box Test'.

Regards,

Vadi