Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Help please

Former Member
0 Likes
993

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
969

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

9 REPLIES 9
Read only

Former Member
0 Likes
970

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

Read only

former_member386202
Active Contributor
0 Likes
969

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

Read only

Former Member
0 Likes
969

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..

Read only

Former Member
0 Likes
969

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

Read only

Former Member
0 Likes
969

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..

Read only

rajesh_akarte2
Active Participant
0 Likes
969

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

Read only

Former Member
0 Likes
969

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

Read only

Former Member
0 Likes
969

Thanks for your responses guys ..... what's about if I want to fill my table with data how can I do it.

Read only

0 Likes
969

If u want to fill the table u can perform the transaction which update the table ztr_emp.

Regards,

Rajesh Akarte