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
697

Hi gurus,

I have a condition where I need to select vkbur, vkgrp, kunnr abd bzirk from knvv for all entries in one of my internal table it_tab01. Now although I have an customer id that is there in both knvv and my internal table it_tab01 but then also nothing is getting copied into it_sales. can you just tell me whats going wrong.

select vkgrp vkbur bzirk kunnr into table it_sales

from knvv

for all entries in it_tab01

where kunnr = it_tab01-custid.

Thanks

Rajeev Gupta

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
668

HI,

The reason could be that the customer id in the it_tab01 is not of the same format as in KNVV...

if that is the case just try using this.

loop aa it_tab01.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = IT_TAB01-CUSTID

IMPORTING

OUTPUT = IT_TAB01-CUSTID.

select single vkgrp vkbur bzirk kunnr into it_sales

from knvv

where kunnr = it_tab01-custid.

IF SY-SUBRC EQ 0.

APPEND IT_SALES.

endloop.

6 REPLIES 6
Read only

Former Member
0 Likes
669

HI,

The reason could be that the customer id in the it_tab01 is not of the same format as in KNVV...

if that is the case just try using this.

loop aa it_tab01.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = IT_TAB01-CUSTID

IMPORTING

OUTPUT = IT_TAB01-CUSTID.

select single vkgrp vkbur bzirk kunnr into it_sales

from knvv

where kunnr = it_tab01-custid.

IF SY-SUBRC EQ 0.

APPEND IT_SALES.

endloop.

Read only

0 Likes
668

thanks for the reply Mahesh, but that is not the case, I tried doing what you told me.

Thanks

rajeev Gupta

Read only

0 Likes
668

hi,

If this logic does not work then you should check with the data in KNVV.. i dont see any other reason apart from this for data not being selected.

Debug the application and get some cust id's and open the table KNVV in se16 and see if you havve values or not..

Thanks

mahesh

Read only

0 Likes
668

Have you run the program in debug and verified the contents of the internal table?

Brian

Read only

Former Member
0 Likes
668

I believe Mahesh is correct that the format of the data might not match.

I had the same problem in a program yesterday, and I resolved the problem in the manner he describes.

Good luck

Brian

Read only

Former Member
0 Likes
668

How is it_tab01 declared?

Rob