‎2006 Nov 21 5:34 AM
hi i have a problem.
i want to extract records from three fields in a table using select statement.after extraction.
if there is no records in the three fields i had to give another condition.can any body provide code for this
‎2006 Nov 21 5:36 AM
select field1 field2 field3 from TAB_NAME
into tab itab
where condition.
if sy-subrc NE 0.
select ....
endif.
Regards
- Gopi
‎2006 Nov 21 5:36 AM
select field1 field2 field3 from TAB_NAME
into tab itab
where condition.
if sy-subrc NE 0.
select ....
endif.
Regards
- Gopi
‎2006 Nov 21 5:36 AM
Write a select statement to fetch the data into internal table.
Get the number of records in the internal table using DESCRIBE statement.
describe itab lines n.
if n = 0.
*write next piece of code.
endif.
I hope it helps.
Best Regards,
Vibha
*Please mark all the helpful answers
‎2006 Nov 21 5:36 AM
Hi Siva,
want to extract records from three fields in a table using select statement.after extraction.
if there is no records in the three fields i had to give another condition.can any body provide code for this
select field1 field2 field3 from <dbtable> into table itab
where = ...........
if sy-subrc ne 0.
give ur comdition here and proceed
endif.
Regards,
nagaraj
‎2006 Nov 21 5:38 AM
Hi Siva,
You can check the field sy-subrc to verify if your selection returns any records? if sy-subrc = 0, it means the selection is successful.
Is this what you required?
Best regards,Junwen
‎2006 Nov 21 5:38 AM
HI,
try with this
select field1 field1 field 1
from <tablename>
into itab1
where
condition1...
now u check for
if sy-subrc ne 0. OR itab1[] is initial.
select field1 field1 field 1
from <tablename>
into itab1
where
condition1...
condition2...
endif.
If i am not clear ... reply back
-
Santhosh
‎2006 Nov 21 5:41 AM
SELECT F1 F2 F3 FROM DBTAB INTO ITAB........
IF SY-SUBRC NE 0.
CONDITION.
ENDIF.
ENDSELECT.
SHIBA PRASAD DUTTA
‎2006 Nov 21 5:41 AM
Hi
1. load data to internal table
2.use DESCRIBE TABLE it_mat_dtl LINES w_dbcnt.
w_dbcnt is no of records in the internal table
3. IF w_dbcnt > 0.
<< YOUR STATMENT>>
ENDIF.
Note,
Please add maks for useful ans.