1. using SY-SUBRC statement.
Once you’ve executed an internal table using query, use the sy-subrc statement to check if the internal table is empty or not. If it’s empty the return value will be “4″, if it’s not empty then the return value will be “0″.
select ... into table itab from ...
if sy-subrc = 0.
"Your statement here
endif.
2. Using describe … lines.
This statement will return the lines in the internal table, if empty then the return value will be 0.
Data nRow TYPE i.
DESCRIBE TABLE itab LINES nrow.
if nrow = 0.
"Your statement here
endif.
3. Using IS INITIAL statement. If the internal table is INITIAL then it’s empty.
select * into table itab from ....
if itab is INITIAL. "INITIAL is EMPTY
"Your statement here
endif.
Post a Comment