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: 

checkbox on interactie list

Former Member
0 Kudos
121

Hi guys,

I'm creating a report where in it could display the details of a selected record/s for printing. In selecting a record you have to tick the checkbox and click display icon on the application bar.

how will i do that?

I already did it in in user-command, where in sy-ucomm = display it will read table lt_header with key check = 'X'.

but I dont think it doesn't get the selected record.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
93

You can have a look at this code :

REPORT ZRAVI_CHECKBOXES_IN_REPORT .

*Creating checkboxes in report

tables : ZRAVI_DEPT.

data : counter type i,

pick,

it_dept like ZRAVI_DEPT occurs 0 with header line.

top-of-page.

format color col_heading.

write at 5 'Dept code'.

write at 35 'Department'.

format color off.

start-of-selection.

set pf-status 'BASIC'.

perform write_report.

top-of-page during line-selection.

case sy-pfkey.

when 'SELECT'.

write 'Selected department list'.

uline.

format color 6 inverse on.

write at 5 'Dept code'.

write at 35 'Department'.

format color off inverse off.

endcase.

at user-command.

case sy-ucomm.

when 'EXIT'.

leave program.

when 'SHOW'.

set pf-status 'SELECT'.

SY-LSIND = 1.

window starting at 15 2 ending at 80 15.

do counter times.

read line sy-index.

if sy-lisel(1) = 'X'.

  • ***********************************************

  • Sy-lisel contains contents of the selected line

  • ************************************************

select single * from ZRAVI_DEPT where dept_code =

it_dept-dept_code.

write : /5 zravi_dept-dept_code,

35 zravi_dept-department.

endif.

enddo.

when 'BACK'.

sy-lsind = 0.

perform write_report.

endcase.

&----


*& Form WRITE_REPORT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM WRITE_REPORT.

SELECT * FROM zravi_dept into it_dept.

write : / pick as checkbox,

5 it_dept-dept_code,

35 it_dept-department.

hide it_dept-dept_code.

endselect.

counter = sy-dbcnt + 1. "For header data.

ENDFORM. " WRITE_REPORT

7 REPLIES 7

Former Member
0 Kudos
94

You can have a look at this code :

REPORT ZRAVI_CHECKBOXES_IN_REPORT .

*Creating checkboxes in report

tables : ZRAVI_DEPT.

data : counter type i,

pick,

it_dept like ZRAVI_DEPT occurs 0 with header line.

top-of-page.

format color col_heading.

write at 5 'Dept code'.

write at 35 'Department'.

format color off.

start-of-selection.

set pf-status 'BASIC'.

perform write_report.

top-of-page during line-selection.

case sy-pfkey.

when 'SELECT'.

write 'Selected department list'.

uline.

format color 6 inverse on.

write at 5 'Dept code'.

write at 35 'Department'.

format color off inverse off.

endcase.

at user-command.

case sy-ucomm.

when 'EXIT'.

leave program.

when 'SHOW'.

set pf-status 'SELECT'.

SY-LSIND = 1.

window starting at 15 2 ending at 80 15.

do counter times.

read line sy-index.

if sy-lisel(1) = 'X'.

  • ***********************************************

  • Sy-lisel contains contents of the selected line

  • ************************************************

select single * from ZRAVI_DEPT where dept_code =

it_dept-dept_code.

write : /5 zravi_dept-dept_code,

35 zravi_dept-department.

endif.

enddo.

when 'BACK'.

sy-lsind = 0.

perform write_report.

endcase.

&----


*& Form WRITE_REPORT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM WRITE_REPORT.

SELECT * FROM zravi_dept into it_dept.

write : / pick as checkbox,

5 it_dept-dept_code,

35 it_dept-department.

hide it_dept-dept_code.

endselect.

counter = sy-dbcnt + 1. "For header data.

ENDFORM. " WRITE_REPORT

gopi_narendra
Active Contributor
0 Kudos
93

Hi

Check if this is included or not

Calling of the Function Module should be given the user command

call function 'REUSE_ALV_LIST_DISPLAY'

exporting

I_CALLBACK_PROGRAM = SY-REPID

IS_LAYOUT = IS_LAYOUT

IT_FIELDCAT = IT_FIELDCAT

I_CALLBACK_USER_COMMAND = 'USER_COMMAND' IT_EVENTS = IT_EVENTS

I_SAVE = C_ISAVE

tables

T_OUTTAB = IT_OUTPUT

exceptions

PROGRAM_ERROR = 1

others = 2.

if SY-SUBRC <> 0.

message id SY-MSGID type SY-MSGTY number SY-MSGNO

with SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

Regards

Gopi

Former Member
0 Kudos
93

Hi maui,

In alv interactive,

we have to use the CALLBACK routine,

and not sy-ucomm.

1. To get a taste of it,

just copy paste this program.

2. It will display alv (t001)

It will show CHECKBOXES (besides every row)

TICK some rows,

and DOUBLE-CLICK ON any row.

3. It will display all the row numbers which have been checked/ticked.

4.

report abc.

TYPE-POOLS : slis.

*----


Data

DATA : BEGIN OF itab OCCURS 0.

INCLUDE STRUCTURE t001.

DATA : flag tyPE c,

END OF itab.

DATA : alvfc TYPE slis_t_fieldcat_alv.

DATA : alvly TYPE slis_layout_alv.

*----


Select Data

SELECT * FROM t001 INTO TABLE itab.

*------- Field Catalogue

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-repid

i_internal_tabname = 'ITAB'

i_inclname = sy-repid

CHANGING

ct_fieldcat = alvfc

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

*----


Display

alvly-box_fieldname = 'FLAG'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

it_fieldcat = alvfc

i_callback_program = sy-repid "<-------Important

i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important

is_layout = alvly

TABLES

t_outtab = itab

EXCEPTIONS

program_error = 1

OTHERS = 2.

*----


  • CALL BACK FORM

*----


FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE

slis_selfield.

data : msg(100) type c.

LOOP AT itab.

if itab-flag = 'X'.

msg = sy-tabix.

condense msg.

concatenate 'Row Number ' msg ' ' into msg

separated by space.

message msg type 'I'.

endif.

ENDLOOP.

ENDFORM. "ITAB_user_command

regards,

amit m.

0 Kudos
93

I don't know how to use alv yet. I'm starting on reports and depends on basic codes.

0 Kudos
93

Try to have a look in these programs.

BALVSD02_GRID

BALVST02_GRID

BCALV_FULLSCREEN_DEMO

Regards

Gopi

0 Kudos
93

You can check my code above.it is a simple interactive report based on checkboxes

Former Member
0 Kudos
93

hi,

In internal table include

Checkb type C as first row.

So that checkbox will be included in the report.

If u click the box those records sd be selected.

In User_Command.

Case sy-ucomm.

when 'Display'.

Loop at itab where checkb = 'X'..

move itab to itab1.

Appen itab1.

endloop.

endcase.

So that itab1 will have all the selected records..

Display itab1.

Loopa t itab1.

write /: itab1.

endloop.