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

Checkbox in interactive report

Former Member
0 Likes
1,106

Hi,

I have a report with three checkbox for each row. I need to know how can I manage when the user activate or deactive each checkbox, I'm trying to use at user-command, but it only works when I do double-click into the checkbox.

How can I manage checkboxs in an interactive report?

thanks in advance

Hi,

I have a report with three checkbox for each row. I need to know how can I manage when the user activate or deactive each checkbox, I'm trying to use at user-command, but it only works when I do double-click into the checkbox.

How can I manage checkboxs in an interactive report?

thanks in advance

6 REPLIES 6
Read only

Former Member
0 Likes
915

hi Javier,

Check

Regards,

Santosh

Read only

Former Member
0 Likes
915

Hi,

I hope you are using a Normal report and not a ALV report.

First create a GUI Status with some buttons in Applciation Tool bar in your program, and use it in START-OF-SELECTION with command SET PF-STATUS <gui_status>.

Now on click of the buttons the event: AT USER-COMAMND is triggered.

there you can use the code.

READ LINE sy-lilli FIELD VALUE <itab>-<chkbox>.

IF <itab>-<chkbox> = 'X'.

        • Do your processing.

ENDIF.

Kindly let me know if further details are required.

Regards,

Goutham.

Read only

0 Likes
915

Hi Pasapula,

I'm using a normal report, but looking at your code I've seen that you need to push a button in status to trigger the event. What I'm looking for it's a way of trigger an event even when the user does a click in checkbox, not in a button.

Is this possible?

thanks in advance

Read only

Former Member
0 Likes
915

hi see this code...........

REPORT ychatest. .

TABLES : sflight.

TYPE-POOLS: slis.

DATA : w_repid LIKE sy-repid.

w_repid = sy-repid.

DATA : BEGIN OF it_sflight OCCURS 0,

checkbox(1),

carrid LIKE sflight-carrid,

END OF it_sflight.

*layout

DATA: wa_layout TYPE slis_layout_alv.

*field catalog

DATA: it_fieldcatalog TYPE slis_t_fieldcat_alv,

wa_fieldcatalog TYPE slis_fieldcat_alv.

START-OF-SELECTION.

SELECT carrid FROM sflight INTO CORRESPONDING FIELDS OF TABLE

it_sflight.

END-OF-SELECTION.

CLEAR it_fieldcatalog.

REFRESH it_fieldcatalog.

wa_fieldcatalog-fieldname = 'CHECKBOX'.

wa_fieldcatalog-outputlen = '3'.

wa_fieldcatalog-col_pos = '1'.

wa_fieldcatalog-seltext_m = 'Chk'.

wa_fieldcatalog-checkbox = 'X'.

wa_fieldcatalog-edit = 'X'.

APPEND wa_fieldcatalog TO it_fieldcatalog.

CLEAR wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'CARRID'.

wa_fieldcatalog-outputlen = '10'.

wa_fieldcatalog-col_pos = '2'.

wa_fieldcatalog-seltext_m = 'Carrid'.

APPEND wa_fieldcatalog TO it_fieldcatalog.

CLEAR wa_fieldcatalog.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = w_repid

is_layout = wa_layout

i_callback_user_command = 'USER_COMMAND'

it_fieldcat = it_fieldcatalog

TABLES

t_outtab = it_sflight

EXCEPTIONS

program_error = 1

OTHERS = 2.

&----


*& Form USER_COMMAND

&----


FORM user_command USING p_ucomm TYPE sy-ucomm

p_selfld TYPE slis_selfield.

CASE p_ucomm.

WHEN '&DATA_SAVE'.

DATA ref1 TYPE REF TO cl_gui_alv_grid.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = ref1.

CALL METHOD ref1->check_changed_data.

LOOP AT it_sflight WHERE checkbox = 'X'.

DELETE it_sflight INDEX sy-tabix.

ENDLOOP.

p_selfld-refresh = 'X'.

ENDCASE.

ENDFORM. "user_command

plz review the points if it is usefull...........

Read only

Former Member
0 Likes
915

Hi Javier,

if the write stmt for your basic list would be like this:

LOOP AT IT_basic.

WRITE : /2 <b>w_box1</b> as checkbox,

10 <b>w_box2</b> as checkbox,

25 <b>w_box3</b> as checkbox,

40 it_basic-field1,

55 it_basic-field2,

ENDLOOP.

g_lines = sy-linno - 1 " for getting the no of lines displayed.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'READ'. " READ will be the sy-ucomm value for the button which is

" clicked after checkng the desired check boxex

w_BOX1 = SPACE.

w_BOX2 = SPACE.

w_BOX3 = SPACE.

SET PF-STATUS 'CHECK' EXCLUDING 'READ'.

DO w_LINES TIMES.

l_num = SY-INDEX + 1.

READ LINE l_num FIELD VALUE w_box.

IF w_BOX1 = 'X'.

" Do your Processing according to checkbox 1.

ELSEIF w_BOX2 = 'X'.

" Do your Processing according to checkbox 2.

ELSEIF w_BOX3 = 'X'.

" Do your Processing according to checkbox 3.

ENDIF.

ENDDO.

ENDCASE.

Hope this should help you.

As per my knowledge I think it is not possible to trigger on the base of checking a check box. Not sure...

Regards,

Vinod.

NOTE: Plz close the thread if solved.

Message was edited by:

vinod kumar

Read only

Former Member
0 Likes
915

Please do the following.

Initially at tables statement add...

Tables: sscrfields.

Then please add the following code at the list output where you are displaying the checkbox

write ......as checkbox USER-COMMAND uc001

..

..

Then AT USER-COMMAND use the following code

IF sscrfields-ucomm = 'uc001'.

Your processing.....

..

..

ENDIF.

I use to do the same thing for the selection screens

Regards

Hardik Mehta