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: 

Need HELP IN CHECK box in alv

Former Member
0 Kudos

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...

1 ACCEPTED SOLUTION

anubhab
Active Participant
0 Kudos

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

6 REPLIES 6

anubhab
Active Participant
0 Kudos

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

Former Member
0 Kudos

Thnks Anubhab ,

ur just awesome

anubhab
Active Participant
0 Kudos

Hello Venkatesh,

Most welcome, I'm happy to help you.

Regards,

Anubhab

vamsixk
Active Participant
0 Kudos

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

0 Kudos

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

Effect

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

Effect

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

Former Member
0 Kudos

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.