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

Check box selection

Former Member
0 Likes
1,079

Hai all,

I have displayed material nos with check boxes.

If i select one check box and click a button in output screen means, then the selected check box value should be stored as 'X' in my internal table.

how to achieve this?

regards,

1 ACCEPTED SOLUTION
Read only

viquar_iqbal
Active Contributor
0 Likes
1,040

Hi

read the table line by line

read line w_line into checkbox.

when checkbox eq 'X'

w_checkbox = checkbox.

append t_atab.

thanks

Viquar Iqbal

8 REPLIES 8
Read only

Former Member
0 Likes
1,040

This message was moderated.

Read only

Former Member
0 Likes
1,040

HI

YOU CAN go like code

w_line has type i and value as number entery of table whose content has been displayed

at user-command.

case sy-ucomm.

when '.......'

DO w_line TIMES.

READ LINE w_lineno FIELD VALUE spfli-carrid INTO w_carr

spfli-connid INTO w_conn

w_check INTO w_chek

w_chek1 INTO w_chek1

and all other field on list.

IF w_chek = 'X'.

  • clear work_area.

  • here move fileds to a work_area

*append work_area to internal table

endif.

ENDDO. " DO W_LINE TIMES

endcase.

regards

Read only

Former Member
0 Likes
1,040

hi Kumar,

check this thread

hope it will be helpful to you.

thanks

Sachin

Read only

Former Member
0 Likes
1,040

Hi,

Read the table line by line,if the check box is checked then append the field into the internal table.

clear the workare so that to read another line.

Regards,

jaya

Read only

viquar_iqbal
Active Contributor
0 Likes
1,041

Hi

read the table line by line

read line w_line into checkbox.

when checkbox eq 'X'

w_checkbox = checkbox.

append t_atab.

thanks

Viquar Iqbal

Read only

Former Member
0 Likes
1,040

Hi,

Try using the following logic.

PUSHBUTTON 2(10) disp USER-COMMAND cmd

CASE sscrfields.

WHEN cmd.
 IF C1 = 'X'.
    "save the value X in a work area and update the table.
    UPDATE table from wa.
 ENDIF.

Hope this helps.

Regards,

Deepthi.

Read only

Former Member
0 Likes
1,040

Hi,

when u declare the structure , declare like this(Final output internal table passing to the ALV)

eg.

TYPES: BEGIN OF struc_final_output,

sel TYPE c,

pay(20) TYPE c,

bednr TYPE ekpo-bednr,

zlth_ref TYPE zp1012_mm_capnew-zlth_ref, " Sansaction No

ebeln TYPE ekpo-ebeln, " PO No

bedat TYPE ekko-bedat, " PO Date

netwr TYPE ekpo-netwr, " Amount commited

chect TYPE payr-chect, " Cheque Number

zaldt TYPE payr-zaldt, " Check Date

rwbtr TYPE payr-rwbtr, " cash flow amount(Actual)

END OF struc_final_output.

and when u r building the layout if it is ALV

FORM build_layout .

DATA lv_boxname TYPE slis_fieldname VALUE 'SEL'.

  • Layour for ALV Display

wa_layout-box_fieldname = lv_boxname.

wa_layout-zebra = 'X'.

wa_layout-colwidth_optimize = 'X'.

ENDFORM.

Do like this,

If u select any record in the output , that particular record will be marked as 'X'.

let me know if u find any problem.

Read only

Former Member
0 Likes
1,040

hi,

This code is as per your requirement. Run and check.

Report ZCHECK no standard page heading.

DATA : BEGIN OF itab1 OCCURS 0,
checkbox TYPE c,
value TYPE bseg-dmbtr,
END OF itab1,
w_checkbox TYPE c,
w_count TYPE i.



itab1-value = '1000.00'.
APPEND itab1.

itab1-value = '1100.00'.
APPEND itab1.

itab1-value = '1300.00'.
APPEND itab1.

itab1-value = '1400.00'.
APPEND itab1.

itab1-value = '1500.00'.
APPEND itab1.
LOOP AT itab1.
  WRITE: /
    itab1-checkbox AS CHECKBOX,
    itab1-value.
ENDLOOP.
SET PF-STATUS 'TEMP'. " Create your required status

AT USER-COMMAND.
  DO.
    ADD 1 TO w_count.
    READ LINE w_count FIELD VALUE itab1-checkbox INTO w_checkbox.
    IF sy-subrc EQ 0.
      IF w_checkbox EQ 'X'.
        itab1-checkbox = w_checkbox.
        MODIFY itab1 INDEX sy-index FROM itab1 TRANSPORTING checkbox .
      ENDIF. " The table is to be modified not just appended.
    ELSE.
      EXIT.
    ENDIF.
  ENDDO.

  LOOP AT itab1.
    WRITE: /
      itab1-checkbox ,
      itab1-value.
  ENDLOOP.

Thanks

Sharath