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

basic data retrieval...pls help me out

Former Member
0 Likes
1,000

Hi guys,

help me out with this basic question.

the first select is showing a record, but I dont see that record once the second query is done. the values are not been populated in the itab_konv though i have declared all of them correctly

select vkvbeln vkkunnr vk~vbtyp

vkbukrs_vf vkvkorg vkvtweg vkspart

vknetwr vkwaerk vk~knumv

vkerdat vkernam

kn~name1

into table itabvbak

from vbak as vk

inner join kna1 as kn on knkunnr = vkkunnr

where vk~vbeln = zvbak-vbeln.

if sy-subrc = 0.

select single knumv kschl

into corresponding fields of table itab_konv

from konv

where knumv EQ itabvbak-knumv

AND kposn EQ itabvbak-kposn

AND kschl EQ 'ZMAD'.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
976

Hi

does itabvbak has header? if so is there any value in it? try reading itabvbak and then populate itabvbak-knumv.

or

remove single and use for all entries - this is not required as u r fetching for single kschl.

10 REPLIES 10
Read only

Former Member
0 Likes
976

hi,

just do the following modification and check

select single knumv kschl

into corresponding fields of table itab_konv

from konv

for all entries in itabvbak

where knumv EQ itabvbak-knumv

AND kposn EQ itabvbak-kposn

AND kschl EQ 'ZMAD'.

regards

padma

Read only

0 Likes
976

hi padma,

It says for all entries in itab is not allowed for select single

regards

Read only

0 Likes
976

hi,

Remove single keyword from your select query

this should work

Read only

0 Likes
976

Hi padma thats working thanx.

write : 'zmad is greater than 20% for :' itab_konv-knumv.

does this result in getting the output as the value from that internal table from the fetched record???

Regards

Read only

Former Member
0 Likes
977

Hi

does itabvbak has header? if so is there any value in it? try reading itabvbak and then populate itabvbak-knumv.

or

remove single and use for all entries - this is not required as u r fetching for single kschl.

Read only

0 Likes
976

manjeera

itabvbak does'nt has a header.

regards

Read only

0 Likes
976

Hi Anik

itabvbak doesnt hav header?? then how can u compare this value in where condition without for all entries -??? there shud be syntax error.

i wonder how the records are fetched from 2nd query - tat record must be for blank knumv i guess

and write : ... itab_konv-knumv. ???? - does this has header? if so have you read the table into header? if itab_konv-knumv has value then write statement will definitely print it.

Read only

0 Likes
976

Hey,

thanx i used a work area and i got that ryt now.

I have to add all the amounts for a particular docu condition number which has number of items. So, can i do like this?

select knumv kposn kschl kbetr

into wa_itab_konv

from konv

FOR ALL ENTRIES IN itabvbak

where knumv EQ itabvbak-knumv

AND kposn EQ itabvbak-kposn

AND kschl EQ 'ZMAD'.

append wa_itab_konv to itab_konv.

Data: i_kbetr like konv-kbetr,

i_value type n value 0.

select single kbetr into i_kbetr.

i_value = i_kbetr + i_value.

endselect.

But, this is showing some errors...

Regards

Read only

0 Likes
976

this is wrong..

select single kbetr into i_kbetr.

i_value = i_kbetr + i_value.

endselect.

do like this

Data:v_kbetr like konv-kbetr.

select single kbetr into v_kbetr from knov where condition...

i_value = i_kbetr + i_value.

endselect.

Read only

Former Member
0 Likes
976

Hi Anik,

In Second Select query specify FOR ALL ENTRIES IN itabvbak before the where condition..

Hope this would solve the problem.

Regards

Narin Nandivada.