Application Development and Automation 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: 
Read only

use a checkbox event call a method

ng82si
Participant
0 Likes
2,092

Hi experts,

I'm absolute new to ABAP and learning ABAP OO programming now.

Now I have checkbox in a block as below:

SELECTION-SCREEN BEGIN OF BLOCK mail_send WITH FRAME.

SELECTION-SCREEN begin of LINE.

PARAMETERS p_send AS CHECKBOX DEFAULT ' ' USER-COMMAND UC_SEND.

SELECTION-SCREEN COMMENT 4(55) text-002.

SELECTION-SCREEN end of LINE.

SELECTION-SCREEN END OF BLOCK mail_send.



And in other class I have method send_mail.


How can I execute this method when the checkbox is marked?


Thanks and regards

Chistine



1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,615

Hi Christine,

Just use a conditional statement. The value checkbox fields is 'X' when checked so you can use it compare its value. If its 'X' simply call your method.

Hi experts,

I'm absolute new to ABAP and learning ABAP OO programming now.

Now I have checkbox in a block as below:

SELECTION-SCREEN BEGIN OF BLOCK mail_send WITH FRAME.

SELECTION-SCREEN begin of LINE.

PARAMETERS p_send AS CHECKBOX DEFAULT ' ' USER-COMMAND UC_SEND.

SELECTION-SCREEN COMMENT 4(55) text-002.

SELECTION-SCREEN end of LINE.

SELECTION-SCREEN END OF BLOCK mail_send.



And in other class I have method send_mail.


How can I execute this method when the checkbox is marked?


Thanks and regards

Chistine



6 REPLIES 6
Read only

Former Member
0 Likes
1,615


Hi,

In side method send_mail put condition like abap

If p_send = 'X'. (if check box selected)

--------------------

------------------

------------------

endif.

Read only

0 Likes
1,615

Hi, thanks for prompt reply.

however it does not work.

Read only

Former Member
0 Likes
1,616

Hi Christine,

Just use a conditional statement. The value checkbox fields is 'X' when checked so you can use it compare its value. If its 'X' simply call your method.

Read only

0 Likes
1,615

Hi Shivam,

thanks.

It works.

but I must add the codes after the End-of-Selection. why?

Read only

0 Likes
1,615

Hello Christine,

The END-OF-SELECTION event is triggered in type executable programs once the logical database has finished reading all data and before the list processor is started.

It tells the server that all the database reading is completed and no further reading is going to take place..

Read only

former_member201285
Active Participant
0 Likes
1,615

Hi Christine,

do I get it right that you want to call the method as soon as the checkbox is ticked by the user (before the execution of the report)?

Then, you must use the following coding:

TABLES: sscrfields.

AT SELECTION-SCREEN.

   IF sscrfields-ucomm = 'UC_SEND'.


        if p_send = 'X'.

*          call your method here

         endif.


   ENDIF.


However, let me remark that this behaviour might be surprising for the user.


Regards,

Ulrich