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

data selection from database

Former Member
0 Likes
580

hi friends, can any body tell me when ever the selection criteria in where clause is zero can i get data from database. pls following code

SELECT SINGLE * FROM zproto_jobs

INTO CORRESPONDING FIELDS OF itab_bills

WHERE requestno = itab_bills-requestno AND

requestyear = itab_bills-requestyear.

here request no is a zero and also itab_bills-requestno is a zero. but there is some value for itab_bills-requestyear. can i get data from database.

its urgent pls.

kumar.

4 REPLIES 4
Read only

Former Member
0 Likes
555

u have to code like this

if itab1 is not initial.

select * from mara into corresponding fields of itab2

for all entries in itab1

where matnr = itab1-matnr.

endif.

<b>ur code is complete wrong.

here u are fetching the data from table into itab_bills at the same time u are using in where clause , which is wrong.

SELECT SINGLE * FROM zproto_jobs

INTO CORRESPONDING FIELDS OF itab_bills

WHERE requestno = itab_bills-requestno

AND requestyear = itab_bills-requestyear.</b>

Regards

Prabhu

Read only

Former Member
0 Likes
555

WRITE A IF CONDITION N SPECIFY IF < ITAB> NOT INITIAL IT HELPS U..

INITIAL CHECKS FOR BLANKS.. IF IT IS NOT BLANK IT GETS OTHER DATA ALSO.. IN UR QUES U HAVE VALUE 0 SO THIS SOLVES UR PROBLEM...

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
555

Hi,

You can get the data.

In itab_bills internal table just unpack the requestno and pass it to the select statement.

Read only

Former Member
0 Likes
555

Hi Kumar,

I am absoltely agree with Prabhu. Your selecting the data from data base table into itab_bills and u mentioned in where cluase that internal table, which is controdution.

Reply for quiereis, shall post the updates.

Regards,

KUmar.