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: 

Event on checkbox

Former Member
0 Kudos

Hey SAP mates,

I'd like to know how to retrieve the value of a checkbox when its status is checked or not in a selection screen.

For instance, if it is checked, i'd like to be able to write something in a field on the same selection screen.

I don't want to test the value of this checkbox (IF checkbox IS INITIAL, etc), I just need to retrieve its value at the selection screen (event) each time I click on it.

Thx in advance.

4 REPLIES 4

former_member181962
Active Contributor
0 Kudos

Hi Christian,

YOu can use the function module:

DYNP_VALUES_READ

Example:

data: dyname like d020s-prog value 'TESTPROG',

dynumb like d020s-dnum value '100'.

data: begin of dynpfields occurs 3.

include structure dynpread.

data: end of dynpfields.

move 'TABNAME' to dynpfields-fieldname.

append dynpfields.

move 'FIELDNAME' to dynpfields-fieldname.

append dynpfields.

call function 'DYNP_VALUES_READ'

exporting

dyname = dymame

dynumb = dynumb

translate_to_upper = 'X'

tables

dynpfields = dynpfields

exceptions

invalid_abapworkarea = 01

invalid_dynprofield = 02

invalid_dynproname = 03

invalid_dynpronummer = 04

invalid_request = 05

no_fielddescription = 06

undefind_error = 07.

Regards,

Ravi

Former Member
0 Kudos

Could you define a variable with the "as checkbox" option? Or is this too basic for your application?

Here is what I do:

PARAMETERS: l_cb type c as checkbox.

AT SELECTION-SCREEN OUTPUT.

PERFORM check_box.

...

FORM check_box .

LOOP AT SCREEN.

if l_cb = 'X'.

do something.

endif.

ENDLOOP.

ENDFORM.

...

Regards,

/Carl

Former Member
0 Kudos

Thank you for helping Carl but it's not that easy, i was searching for the event, not the test to apply.

Ravi thank you, i tried this MF earlier but there is still one problem, this MF needs an action to be launch. The "mouse click" event is not triggered, i have to press down "Enter" button to launch the MF...do you have any idea on how to avoid this?

Thank you.

Former Member
0 Kudos

Well, its work. Let's call this MF when you call the "matchcode" of the second field and it's ok.

Thanks again Carl Ravi, here your points.