‎2006 May 24 12:05 AM
Hi,
I have declared a checkbox in an internal table and I have displayed the fields of the internal table along with checkbox as a list. Now based on the check of the checkbox value i need to do action specified by the button in the pf-status. So i want to give a message to user if no checkbox is checked asking him to check the checkboxes. How do i validate on this?
Thanks
VIcky
‎2006 May 24 12:12 AM
Vicky,
How about a pop up?
if ...
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
TITEL = 'Error: no boxes checked'
TXT1 = ' '
TXT2 = 'You must check at least 1 box.'
TXT3 = ' '
TXT4 = ' '
EXCEPTIONS
OTHERS = 1.
stop.
endif.
regards,
den
‎2006 May 24 12:10 AM
‎2006 May 24 12:12 AM
Vicky,
How about a pop up?
if ...
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
TITEL = 'Error: no boxes checked'
TXT1 = ' '
TXT2 = 'You must check at least 1 box.'
TXT3 = ' '
TXT4 = ' '
EXCEPTIONS
OTHERS = 1.
stop.
endif.
regards,
den
‎2006 May 24 12:27 AM
There are a couple of ways to do this. Here is one.
1) move the data from the ITAB to a second one.
ITAB2[] = ITAB1[].2) Delete all of the entries that do not have a CHECK
delete itab2 where check = space.3) Describe the table and get the lines
data: checked_lines type i.
describe table itab2 lines checked_lines.4) Now give message if the check_lines = 0.
if check_lines = 0.
message e001(00) with 'Please select at least one line.
endif.
In this solution, I assume that you are modifing the internal when rows are being selected.
REgards,
Rich Heilman
‎2006 May 24 12:22 AM
Vicky,
And if you're asking about how to check to see if any checkboxes are checked... You could either loop/endloop or read the table looking for check = 'X'.
e.g.,
read table itab with key check = 'X'.
if sy-subrc <> 0.
<insert the pop-up code here>
endif.
‎2006 May 24 4:43 AM
Hi Vicky,
Use similar code.
data recs type C.
at user-command.
case sy-ucomm.
when 'BUTTON'.
perform check_recs.
if recs is initial.
message i000 with 'No records were selected'.
exit.
endif.
perform function.
endcase.
form check_recs.
lsind = sy-lsind - 1.
clear recs.
clear anzkr.
refresh tbkpf.
do.
read line sy-index index lsind field value xpickc.
if sy-subrc = 0.
check xpickc ne space.
rec = 'X'.
anzkr = anzkr + 1.
move-corresponding vbkpf to tbkpf.
append tbkpf.
else.
exit.
endif.
enddo.
endform.
Hope that was useful.
Cheers,
Susmitha.
Dont forget to reward points for useful answers.
‎2006 May 24 5:02 AM
Hi,
If you are using ALV, call one event.
i dont remember the name right now.
this event automatically updates your internal table with the checked values.
then check your internal table whether your check field is populated for any line item or not.
if no line item is check, throw the error to the user.