2012 Dec 27 5:09 AM
Sir,
The statement is
loop at record.
select * from vfkp where fknum = record-FKNUM_001.
endselect.
if sy-subrc = 0.
if sy-DBCNT = 1.
Perform Operation_One.
elseif sy-DBCNT = 2.
Perform Operation_two.
endif.
endif.
endloop.
THERE WAS DATA IN THE TABLE VFKP AND THE SY-DBCNT IS DISPALYING AS '0'.
IS THERE ANOTHER WAY THAT I CAN PROCEED FURTHER.
Thanks & Regards.
Sir,
The statement is
loop at record.
select * from vfkp where fknum = record-FKNUM_001.
endselect.
if sy-subrc = 0.
if sy-DBCNT = 1.
Perform Operation_One.
elseif sy-DBCNT = 2.
Perform Operation_two.
endif.
endif.
endloop.
THERE WAS DATA IN THE TABLE VFKP AND THE SY-DBCNT IS DISPALYING AS '0'.
IS THERE ANOTHER WAY THAT I CAN PROCEED FURTHER.
Thanks & Regards.
2012 Dec 27 5:26 AM
Hi Satish-
You can do DESCRIBE TABLE vfkp LINES var_lines.
DATA: var_lines TYPE sy-dbcnt.
DESCRIBE TABLE vfkp LINES var_lines.
IF var_lines = 1.
PERFORM Operation_One.
ELSEIF var_lines = 2.
PERFORM Operation_two.
ENDIF.
2012 Dec 27 5:38 AM
Hi,
You may want to try.
loop at record.
select count(*) from vfkp where fknum = record-FKNUM_001.
if sy-subrc = 0.
if sy-DBCNT = 1.
Perform Operation_One.
elseif sy-DBCNT = 2.
Perform Operation_two.
endif.
endif.
endloop.
Hope it helps!
2012 Dec 27 7:34 AM
Hi Satish kumar
in your case, sy-dbcnt hold value '0' always...sy-dbcnt triggers in another case, not this. you cant perform your code using sy-dbcnt. one thing, that you use select statement in loop....endloop. in real scenario we always avoid select statement between loop....endloop.
Thanks
Sabyasachi
2012 Dec 27 7:51 AM
Hi Satish,
Sy-dbcnt will get filled only when the select operation is performed for chunk of data. It holds the number of entries fetched from DB.
In your case, instead of
select.. endselect..
Try to use,
data: it_vfkp type table of vfkp,
select * from vfkp into table it_vfkp.
This statement will fill the sy-dbcnt variable to number of entries fetched.
Hope this clarifies.
Regards,
Manjesh.
2012 Dec 27 8:21 AM
Hello,
There could be many ways of doing it as already suggested in replies above. But I was curious to find out why sy-dbcnt is 0. The only possible reason for sy-dbcnt to be 0 could be, you have to use conversion routine before doing the check in where condition on field FKNUM. Thanks.
Regards,
Kumud
2012 Dec 27 8:57 AM
Sir,
The data i am passing in the spread sheet consisting of 9 characters.
The field FKNUM length is 10 characters, if i am passing with additional
zero with the values (ex :- 0128999890). then in sy-dbcnt the value was displaying.
Thanks & Regards.
2012 Dec 27 11:12 AM
Requirement: Get value in Sy-dbcnt (Number of records fetched)
As your are saying it is working with padding Zero. Please use Padding Zero conversion exit function module before select query.
Thank you
2012 Dec 27 1:20 PM
Ya the problem is because the select statement is failing to search as you have to have data in '0000111122' format only for character types. So use conversion exit alpha and modify the data in the internal table before using select statement.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |