‎2008 Aug 18 5:11 PM
Hi friends,
i have internal table with header line.
displaying them on the screen with check box defaulted under certain conditions.
From the screen user want to uncheck certain records. so i have quoted as below. it is working if user unchecks the records other than the last record.
if user unchecks the last record still the last record is picking.
any one give me reson why? is it becasue i haven't cleared the itab before DO? am bit puzzled..
at user-Command.
case sy-ucomm.
when 'exec'.
DO.
read line sy-index field value itab-check.
IF sy-subrc NE 0.
EXIT.
ENDIF.
CHECK itab-check = 'X'.
MODIFY itab INDEX sy-index TRANSPORTING check.
ENDDO.
‎2008 Aug 18 5:20 PM
May be try this way
start-of-selection.
perform f_write_output.
v_lines = sy-linno. "<-----
at user-Command.
case sy-ucomm.
when 'exec'.
DO v_lines times. "<-----
read line sy-index field value itab-check.
IF sy-subrc NE 0.
EXIT.
ENDIF.
CHECK itab-check = 'X'.
MODIFY itab INDEX sy-index TRANSPORTING check.
ENDDO.
a®
‎2008 Aug 18 5:15 PM
You must update the CHECK field if the user un-selects that.
This Statment must be like:
* CHECK itab-check = 'X'.
* MODIFY itab INDEX sy-index TRANSPORTING check.
MODIFY ITAB INDEX SY-INDEX TRANSPORTING CHECK.
Regards,
Naimesh Patel
‎2008 Aug 18 5:21 PM
Hi
Thanks for prompt reply.
But why this peculiarity happening if only the last record from itab unchecked..
If the previous records unchecked, no issue with them..
‎2008 Aug 18 5:31 PM
May be somewhere else in the code, it is getting cleared.
Regards,
Naimesh Patel
‎2008 Aug 18 5:20 PM
May be try this way
start-of-selection.
perform f_write_output.
v_lines = sy-linno. "<-----
at user-Command.
case sy-ucomm.
when 'exec'.
DO v_lines times. "<-----
read line sy-index field value itab-check.
IF sy-subrc NE 0.
EXIT.
ENDIF.
CHECK itab-check = 'X'.
MODIFY itab INDEX sy-index TRANSPORTING check.
ENDDO.
a®
‎2008 Aug 19 4:52 PM
Hi
FYI
Issue resolved with the following code:
DATA: LINENO TYPE I.
lineno = 0.
DO.
lineno = lineno + 1.
READ LINE lineno FIELD VALUE itab-check.
To check the endpoint
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
IF itab-check = 'X'.
READ CURRENT LINE
FIELD VALUE itab-belnr INTO itab1-belnr.
APPEND itab1.
CLEAR itab1.
ENDIF.
Enddo