‎2008 Nov 04 8:25 AM
Hi Folks,
I have a requirement where i need to have check box.When check box is checked screen fields should be enabled else it should be disabled. Please suggest me.
If the checkbox is checked fields should become mandatory.
Please suggest
‎2008 Nov 04 8:32 AM
this is possible by in PBO add a module with the LOOP at screen loop.
Loop over all the screen objects and depending on checkbox you can hide the fields, make them obligatory. What ever you want.
regards,
Hans
‎2008 Nov 04 8:32 AM
this is possible by in PBO add a module with the LOOP at screen loop.
Loop over all the screen objects and depending on checkbox you can hide the fields, make them obligatory. What ever you want.
regards,
Hans
‎2008 Nov 04 8:32 AM
NO check box will not be mandatory(but it shd be in the Screen) as when user wants to change some data then only he will click the check box to(make all fields in editable form).
Hope you understand.
Amresh Panda.
‎2008 Nov 04 8:40 AM
hi
check this sample code
PARAMETERS : p_check AS CHECKBOX USER-COMMAND uc01.
PARAMETERS : p_bukrs TYPE bkpf-bukrs.
AT SELECTION-SCREEN OUTPUT.
IF p_check EQ 'X'.
SET CURSOR FIELD 'P_BUKRS'.
ELSE.
SET CURSOR FIELD 'P_CHECK'.
ENDIF.
regards
Satish
‎2008 Nov 04 8:46 AM
Hi,
In the PBO , write these code.
module <module name>
Loop at screen
if screen-name ne 'CHKBOX'.
if chkbox = 'X'.
screen-input = 0.
else.
screen-input = 1.
endif.
endif.
modify screen.
endloop.
endmodule.
‎2008 Nov 04 9:17 AM
Thanks for the replies.
But iam not able to default the checkbox in module pool programming
‎2008 Nov 04 9:53 AM
‎2008 Nov 04 10:03 AM
Hi Nishanth,
Understand the below logic and sort your issue.
You need when checkbox is selected then you want the fields to be enabled and when not checked disable.
give name of the checkbox in the screen as checkbox.
PBO
IF checkbox EQ 'X'.
LOOP AT SCREEN.
IF SCREEN-NAME = 'ZFORMA-qwert'. "screen name of field
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
In PAI
IF checkbox NE 'X'.
LOOP AT SCREEN.
IF SCREEN-NAME = 'ZFORMA-qwert'. "screen name of field
SCREEN-INPUT = 1.
SCREEN-ACTIVE = 1.
SCREEN-OUTPUT = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
For making your field mandatory double click on out field opens a window in attributes of tha window select program and in the dropdown box of input field select Required that makes the field mandatory.
Cheers!!
VEnk@
Edited by: Venkat Reddy on Nov 4, 2008 3:34 PM
‎2008 Nov 04 10:16 AM
PROGRAM ZSRK_025 .
DATA : F1 LIKE VBAP-VBELN,
F2 LIKE VBAP-POSNR,
F3 LIKE VBAP-NETWR.
DATA : CH1,
CH2,
CH3.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE STATUS_0100 OUTPUT.
IF CH1 EQ 'X'.
LOOP AT SCREEN.
IF SCREEN-NAME = 'F1'.
SCREEN-INPUT = 1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-NAME = 'F1'.
SCREEN-INPUT = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
IF CH2 EQ 'X'.
LOOP AT SCREEN.
IF SCREEN-NAME = 'F2'.
SCREEN-INPUT = 1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-NAME = 'F2'.
SCREEN-INPUT = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
IF CH3 EQ 'X'.
LOOP AT SCREEN.
IF SCREEN-NAME = 'F3'.
SCREEN-INPUT = 1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-NAME = 'F3'.
SCREEN-INPUT = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.