I have a requirement with which on entering the table name, i got to check if any data exists or not.
I have to return OK if table has data and return NG if it doesnt.
I am querying the table using Select stmt. The question is how to check the sy-subrc count inside the At selection screen event and then display the OK and NG? If I keep the sy-subrc check within END-OF-SELECTION, the write o/p doesnt display. If i put it outside the event, sy-subrc value gets changed after coming out of the event. How to resolve this? Any ideas please?
AT SELECTION-SCREEN.
SELECT COUNT(*) FROM dd02l INTO v_cnt WHERE TABNAME = p_tabnam.
END-OF-SELECTION.
IF SY-SUBRC EQ 0.
IF v_cnt <> 0.
WRITE: 'OK'.
ELSE.
WRITE: 'NG'.
ENDIF.
ELSE.
MESSAGE 'Invalid Table Name' TYPE 'S' DISPLAY LIKE 'E'.
ENDIF.
Thanks.