10-07-2013 11:02 AM
Hi All,
i have a small query .
i have kept a checkbox in my selection screen when i check that check box and press enter . 2 parameters are getting default values
which is fine.
now my requirement is when i check the checkbox without pressing the Enter button i need to populate the default values .
please see the attached doc with screenshots and the code i have written ..
IF cb_adw IS INITIAL.
LOOP AT SCREEN.
IF screen-name = 'P_AFFIL' OR
screen-name = 'P_AFFTY'.
CLEAR p_affil.
CLEAR p_affty.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF NOT cb_adw IS INITIAL.
p_affil = gc_adw.
p_affty = gc_a.
MODIFY SCREEN.
ENDIF.
please guide...
10-07-2013 11:20 AM
Hello Venkatesh,
Please do the following while declaring your check-box:
PARAMETERS: cb_adw as CHECKBOX USER-COMMAND u-comm.
Please keep the rest of code same. This addition of USER-COMMAND u-comm will populate default values, when you check the checkbox, without a need to hit the ENTER button. Only thing to keep in mind, if you use USER-COMMAND, it should be the used on the first element on your selection screen (Check-box or radio-button).
Hope this solves your requirement.
Regards,
Anubhab
10-07-2013 11:20 AM
Hello Venkatesh,
Please do the following while declaring your check-box:
PARAMETERS: cb_adw as CHECKBOX USER-COMMAND u-comm.
Please keep the rest of code same. This addition of USER-COMMAND u-comm will populate default values, when you check the checkbox, without a need to hit the ENTER button. Only thing to keep in mind, if you use USER-COMMAND, it should be the used on the first element on your selection screen (Check-box or radio-button).
Hope this solves your requirement.
Regards,
Anubhab
10-07-2013 12:28 PM
10-08-2013 4:07 AM
Hello Venkatesh,
Most welcome, I'm happy to help you.
Regards,
Anubhab
10-07-2013 11:23 AM
Hi Venkatesh,
Try the 'User-command' addtion to your check box field.
This addition once implemented willt trigger the at selection screen output event when the checkbox is selected/deselected.
and then the code will be triggered.
Hope it was of help.
Regards,
Vamsi
10-07-2013 11:23 AM
Hi Venkatesh,
I prefer to achieve this with Module Pool Programming.
ON INPUT and ON REQUEST will be helpful to achieve desired output.
... ON INPUT
With this condition, module mod is called only if the screen field dynp_field is not empty. All screen fields except fields of type STRING or SSTRING are considered empty if they contain nothing but blanks in the screen representation. Screen fields of type STRING and SSTRING are considered empty if they do not contain any characters.
... ON REQUEST
With this condition, module mod is called only if the value of the screen field dynp_field has been changed by input after the event PBO. It is considered as input if the existing input is overwritten with the same value or if the initial value of the field is entered explicitly. Besides user input, the following value input results in a call of mod:
I hope suggestion will be helpful to achieve your requirement.
Regards,
Jeetendra
10-07-2013 11:51 AM
Hi,
pls check the below code
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS:
P_CHECK AS CHECKBOX USER-COMMAND AAA.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.
PARAMETERS :
P_DATA TYPE char01.
SELECTION-SCREEN END OF BLOCK B2.
AT SELECTION-SCREEN .
if sy-ucomm = 'AAA'.
"here write your logic to fill the field
p_data = 'A'.
endif.