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 ticked- some field should be enable. in abap programming

devika96
Explorer
0 Kudos

Hi Experts!!

Please help me out with the following problem:

I am writing a program with several screens. Now, I need a requirement like: there will be a check box and a corresponding fields for that on a screen. When the box is checked, then only the fields should become editable, else non-editable. How can I achieve this?

In reports,, how can we achieve this .plz help me with some examples?

Please help me out. Thanks a lot in advance

7 REPLIES 7

venkateswaran_k
Active Contributor
0 Kudos

Hi devika96

In your program - in following section you add the statement similar to this - as per your field names.
AT SELECTION-SCREEN OUTPUT.
  IF your_check_box = 'X'.
    LOOP AT SCREEN.
      IF screen-name = 'P_SENT'.  "<=== your field name to be hidden 
        screen-invisible = 1.     " to hide
        screen-input = 0.         " to disable
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.
Regards,Venkat

0 Kudos

Hi Venkat ,

below shown is the ouput obtained and it is not hiding any fields. Could u pls guide me

AT SELECTION-SCREEN OUTPUT.
IF p_jda = 'X'.
LOOP AT SCREEN.
IF screen-name = 'P_BWKEY'.
SCREEN-NAME = 'P_RELDAT'.
SCREEN-NAME = 'S_BSART'. "<=== your field name to be hidden
screen-invisible = 1. " to hide
* screen-input = 0. " to disable
MODIFY SCREEN.
ENDIF.
ENDLOOP

0 Kudos

hi devika96

Please put if statement for each fieldname. as below Loop end loop also to be corrected as below:

Please note that , after checking the checkbox - you need to press Enterkey.

IF p_jda = 'X'.
LOOP AT SCREEN.
  IF screen-name = 'P_BWKEY'.
     screen-invisible = 1. " to disable
  ENDIF.
  if SCREEN-NAME = 'P_RELDAT'.
    screen-invisible = 1.. " to disable
  ENDIF.
  MODIFY SCREEN.
ENDLOOP
ENDIF.

IF p_jda NE 'X'.    "To enable back - if check box is not selected
LOOP AT SCREEN.
  IF screen-name = 'P_BWKEY'.
     screen-invisible = 0. " to enable back
  ENDIF.
  if SCREEN-NAME = 'P_RELDAT'.
    screen-invisible = 0.. " to enable back
  ENDIF.
  MODIFY SCREEN.
ENDLOOP
ENDIF.



regards,

0 Kudos

venkateswaran.k

No, you do not have to press the enter key after checking the checkbox. For example, this will trigger the PAI on clicking on the checkbox.

PARAMETERS x_box AS CHECKBOX USER-COMMAND 'CHK'.

0 Kudos

Hi devika96

Did you try as above and update if working?

0 Kudos

Hi Venkat ,

not getting the required output

Sandra_Rossi
Active Contributor

There's a field attribute Function Code which is triggered when the checkbox is changed. It will be same as pressing a button.