cancel
Showing results for 
Search instead for 
Did you mean: 

How to process checkbox change in a simple list?

Former Member
0 Kudos

Hi guys,

I'm in a middle of a task, where some table is asked to be written on the screen (simple WRITE statement) and one of the fields is written in a way:

...

LOOP AT it.

WRITE: it-f1 AS CHECKBOX.

ENDLOOP.

...

The screen in simple, PF-STATUS is not complex also.

Everything is shown as expected. But I've been asked to manipulate content of the it-f1 depending on the user-action on the screen - i.e. if the user checked/unchecked f1 at line 23, this should be corrected into an it[23] also. In my PF-STATUS I have a 'SAVE' button, and after pressing it I should have my internal table filled correctly depending on the user interaction. The table is expected to be long (approx. 200-300 records or so).

How to achieve this? I played with AT LINE-SELECTION and much more which I found in the docu, but with no success until now.

Any help would be highly appreciated.

If any specifics are needed, I'm ready to supply them here.

Many thanks in advence.

Ivaylo

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello ,

The following code sample should do the trick.

==========================================================


REPORT  ZTEST no standard page heading.

data : begin of itab occurs 0,
         check type c,
         value type i,
       end of itab.

data: w_line_no  type i,
      w_itab(72) type c.

start-of-selection.

do 10 times.
  itab-value = sy-index.
  append itab.
enddo.

loop at itab.
  write : / itab-check as checkbox,
            itab-value.
endloop.

at user-command.

if sy-ucomm eq 'SAVE'.
  clear itab.
  loop at itab.
    w_line_no = sy-tabix.
    read line w_line_no line value into w_itab.
    itab-check = w_itab(1) .
    modify itab transporting check.
  endloop.
endif.

==========================================================

Get back if you have any more doubts on this.

Regards,

Anand Mandalika.

P.S. : Don't forget to award the points if you like the solution.

Former Member
0 Kudos

Hi,

Thanks to all of you, guys.

Anand,

your answer did the trick for me.

Thank you.

Ivaylo

Answers (1)

Answers (1)

former_member534411
Participant
0 Kudos

Hi,

Use the following peace of code to find whether check box is selected or not for that if so...

Code:

do n times. (Here N is no of records on list)

read line sy-index field value wc_check.

if wc_check eq 'X'.

write select query to fetch records

endif.

enddo.

If i am not understand issue please reply again!!!

Best regards

Suresh Babu Karanam