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

select statement

Former Member
0 Likes
303

hi all ,

I wrote code like this ,

When ever I am reading the table ilist1 , max1 = ilist1-zzmax_cpi value I am getting value 0.In the ilist1 showing ALL THE VALUES.

SELECT *

INTO TABLE wknvv FROM knvv

WHERE vkorg IN sales_or

AND vtweg IN dist_cha

AND spart IN div

AND vkbur IN sales_of .

IF NOT wknvv[] IS INITIAL.

SELECT vbeln auart kunnr zzmax_cpi INTO table ilist1 FROM vbak

for all entries in wknvv

WHERE

vbtyp = 'G'

AND kunnr = wknvv-kunnr

AND auart IN contr_ty.

IF NOT ilist1[] IS INITIAL.

SELECT vbeln posnr abgru ZZASSET_TAG INTO table wvbap FROM vbap

for all entries in ilist1

WHERE vbeln = ilist1-vbeln

AND abgru = ''.

SELECT * INTO table wveda FROM veda

for all entries in ilist1

WHERE vbeln = ilist1-vbeln

AND vposn = wvbap-posnr

AND vkuegru = ''

AND venddat IN dates .

ENDIF.

ENDIF.

SORT: ilist1 BY kunnr,wvbap BY vbeln.

LOOP AT wknvv .

read table ilist1 with key kunnr = wknvv-kunnr BINARY SEARCH .

max1 = ilist1-zzmax_cpi.

if sy-subrc = 0 and max1 is not initial.

read table wvbap with key vbeln = ilist1-vbeln BINARY SEARCH .

if sy-subrc = 0.

read table wvbap with key vbeln = ilist1-vbeln BINARY SEARCH .

endif.

IF sy-subrc = 0.

MOVE-CORRESPONDING wvbap TO wlist .

MOVE-CORRESPONDING wveda TO wlist .

MOVE-CORRESPONDING wknvv TO wlist .

APPEND wlist.

ENDIF .

endif.

ENDLOOP.

1 REPLY 1
Read only

Former Member
0 Likes
265

Hi,

Try checking the data types for the two fields .. May be u are trying to move a decimal vield in to a integer field..

Reward points!!!