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: 

Reports - Check Boxes

Former Member
0 Kudos

Hi All,

I'm not getting idea how to approach this requirement.

My requirement is

I have one report with check box for each record output in the list.

Here in this report i'll check i.e. put tick mark in the check box, then the checked list of records should be written to the other report.

Can you please let me know the solution.

Jeevi.

4 REPLIES 4

Former Member
0 Kudos
report Ztest no standard page heading.
 
data: imara type table of mara with header line.
 
data: check_box(1) type c,
      report_lines type i.
 
start-of-selection.
 
* Create the gui status with BACK button in standard place
* and a READ button in the application toolbar
  set pf-status 'CHECK'.
 
  select * into corresponding fields of table imara
           from mara up to 100 rows.
 
  loop at imara.
    write:/ check_box as checkbox, imara-matnr, imara-matkl.
    hide imara-matnr.
  endloop.
 
  report_lines  = sy-linno - 1.
 
top-of-page.
 
  write: 'List of materials'.
  uline.
 
top-of-page during line-selection.
 
  write:  'Material.....'.
  uline.
 
at user-command.
 
  case sy-ucomm.
    when 'READ'.
      check_box = space.
      set pf-status 'CHECK' excluding 'READ'.
      do report_lines times.
        read line sy-index field value check_box.
        if check_box = 'X'.
          write:/  'You have selected material', imara-matnr.
        endif.
      enddo.
  endcase.
 
DEMO_LIST_READ_LINE

**********************************************************
refer this code if u want furtehr help.


END-OF-SELECTION.
  lines = sy-linno - 1.
SET PF-STATUS 'ZSTATUS'.
 
AT USER-COMMAND.
      wa_output-cb = space.
      SET PF-STATUS 'ZSTATUS' EXCLUDING 'SAVE'.
      DO lines TIMES.
        READ LINE sy-index FIELD VALUE wa_output-cb.
          IF wa_output-cb = 'X'.
        MODIFY i_output  FROM wa_output INDEX sy-tabix TRANSPORTING cb.
        ENDIF.
      ENDDO.
 
CASE sy-ucomm.
WHEN 'SAVE'.
*      DELETE i_output WHERE cb = 'X'.
   LOOP AT i_output WHERE cb = 'X'.
    MOVE i_output TO i_fina.
   APPEND i_final.
   ENDLOOP.
 
  ULINE.
  FORMAT INTENSIFIED OFF.
  FORMAT COLOR COL_HEADING.
  WRITE:/001 'CB' ,
         003 'Material No',
         015 'Mat type',
         024 'Mat group'.
 
  FORMAT COLOR OFF.
  FORMAT INTENSIFIED ON.
  ULINE.
 
  IF NOT i_output[] IS INITIAL.
    LOOP AT i_output INTO wa_output.
      WRITE:/001 wa_output-cb AS checkbox,
             003 wa_output-matnr,
             015 wa_output-mtart,
             024 wa_output-matkl.
      CLEAR wa_output.
    ENDLOOP.
  ENDIF.
 
WHEN 'BACK'.
LEAVE SCREEN.
ENDCASE.

former_member181962
Active Contributor
0 Kudos

Check the sample demo program:

demo_list_read_line

Former Member
0 Kudos

Hi Jeevi,

Please refer the similar thread below,

Regards,

Hema.

    • Reward points if it is useful.

Former Member
0 Kudos

loop at t_spfli into wa_spfli.

format color col_normal.

write :

/ sy-vline,

3 w_box as checkbox, 5 sy-vline,

8 wa_spfli-carrid, 20 sy-vline,

22 wa_spfli-connid, 35 sy-vline,

38 wa_spfli-cityfrom, 58 sy-vline,

60 wa_spfli-cityto, 80 sy-vline.

format color off.

endloop. " Loop at t_spfli into wa_spfli.

uline.

clear wa_spfli.

at user-command.

.......................

data:

lw_lines type i, " Holds no.of lines in t_spfli

lw_linno type i value 5,

lw_count type i.

describe table t_spfli lines lw_lines.

do lw_lines times.

read line lw_linno field value :

w_box into w_box,

wa_spfli-carrid into wa_tspfli-carrid,

wa_spfli-connid into wa_tspfli-connid.

if w_box = 'X' .

add 1 to lw_count.

append wa_tspfli to t_tspfli.

endif. " If w_box = 'X' and

clear : w_box, wa_tspfli.

add 1 to lw_linno.

enddo. " Do lw_lines times.

if lw_count eq 0.

message 'Select at least one record'(003) type 'E'.

else.

export t_tspfli to memory id 'YH640'.

refresh t_tspfli.

endif. " If lw_count eq 0.

reward if it is helpful

sai ramesh