‎2007 Nov 14 5:55 AM
Can anybody please tell me why I'm not getting any output when running the below code. Thanks in advance.
START-OF-SELECTION.
SELECT * FROM ztr_emp
INTO CORRESPONDING FIELDS OF TABLE
it_tab1
WHERE ztr_uname = p_empno and ztr_date = pa_date.
IF sy-subrc = 0.
WRITE: 'hello'.
WRITE: / wa_performance-ZTR_uNAME.
WRITE: / wa_performance-ZTR_FNAME.
endif.
‎2007 Nov 14 5:59 AM
Hi
check whether data is there in the table ztr_emp.
then check the internal table fields
keep a break point at IF SY-SUBRC = 0 line and see whether it is 0 or not.
write it as:
SELECT * FROM ztr_emp
INTO CORRESPONDING FIELDS OF TABLE
it_tab1
WHERE ztr_uname = p_empno and ztr_date = pa_date.
IF sy-subrc = 0.
WRITE: 'hello'.
loop at it_tab1 into wa_performance.
WRITE: / wa_performance-ZTR_uNAME.
WRITE: / wa_performance-ZTR_FNAME.
endloop.
endif.
Regards
Anji
‎2007 Nov 14 5:59 AM
Hi
check whether data is there in the table ztr_emp.
then check the internal table fields
keep a break point at IF SY-SUBRC = 0 line and see whether it is 0 or not.
write it as:
SELECT * FROM ztr_emp
INTO CORRESPONDING FIELDS OF TABLE
it_tab1
WHERE ztr_uname = p_empno and ztr_date = pa_date.
IF sy-subrc = 0.
WRITE: 'hello'.
loop at it_tab1 into wa_performance.
WRITE: / wa_performance-ZTR_uNAME.
WRITE: / wa_performance-ZTR_FNAME.
endloop.
endif.
Regards
Anji
‎2007 Nov 14 6:00 AM
Hi,
Ur selecting data from table ztr_emp but while displaying the data ur display it from wa_performance. So i think that could be the reason.
Reagrds,
Prashant
‎2007 Nov 14 6:01 AM
IT MIGHT BE BECAUSE OF YOUR SELECT QUERY, IT MIGHT NOT HAVE FETCHED DATAS FROM YOUR ZTABLE......
IT MIGHT HAVE RETURNED SY-SUBRC VALUE T0 4 OR SOMETHING....
OR IT MIGHT BE BECAUSE YOU HAVE SPECIFIED DIFFERENT WORK AREA IN THE WRITE STATEMENT INSTEAD OF GIVING THE INTERNAL TABLE NAME..
‎2007 Nov 14 6:01 AM
Hi,
Please make a check of sy-subrc value.If its 4, nothing will print as per ur coding. If its 0 then, output will be displayed.
Reward points if useful.
Regards,
Subha
‎2007 Nov 14 6:01 AM
Hi write as follows
SELECT * FROM ztr_emp
INTO CORRESPONDING FIELDS OF TABLE
it_tab1
WHERE ztr_uname = p_empno and ztr_date = pa_date.
IF sy-subrc = 0.
WRITE: 'hello'.
loop at it-itab1.
WRITE: / n it_itab1-field name 1, it_itab1-fieldname2.
endloop.
endif.
The mistake which you have done is you are usinga work area for output where there is no data in write staement
you are fetching data into it_itab1 so you need to output the data from it_itab1.
not fromm other work area.
Reward points if usefull..
‎2007 Nov 14 6:02 AM
Hi Shaheen.
You r not getting the o/p because u r not getting any value through ur select query.By debugging u can check,whether or not it is returning any value.
If ur database table contains the data for the correspoding selection criteria and still ur select query is not returning anything ,then do this
change ur parameters to select-options and change ur select query to
SELECT * FROM ztr_emp
INTO CORRESPONDING FIELDS OF TABLE it_tab1
WHERE ztr_uname IN p_empno
AND ztr_date IN pa_date.
Reward if helpful.
Regards,
Rajesh Akarte
‎2007 Nov 14 6:10 AM
Hi
if that SY-SUBRC fails then it won't display any data there
that means above select query fails to retrive data
if it fethes the data then it will display the data means SY-SUBRC successfull
SY-SUBRC having zero or not zero
if it is zero means ur above statement is correct
other wise wrong
‎2007 Nov 14 6:24 AM
Thanks for your responses guys ..... what's about if I want to fill my table with data how can I do it.
‎2007 Nov 14 6:34 AM
If u want to fill the table u can perform the transaction which update the table ztr_emp.
Regards,
Rajesh Akarte