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 Criteria

Former Member
0 Likes
823

Hello friends,

I am writing a select querry,and this querry is not fetching any data.

SELECT kunnr

kdgrp

INTO TABLE it_knvv

FROM knvv

WHERE kunnr = it_zzsd0010-kunnr.

I looked into Debug mode and for it_zzsd0010-kunnr there is data in KNVV-kunnr.

But i observed that

KNVV-KUNNR = 10 char and

ZZSD0010-KUNNR = 8 char. does it matter?

Shejal.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
789

yes..

Check the field it_zzsd0010-kunnr if it is padded with zeros...Otherwise you have to use the function module which I have mentioned in my earlier reply..

Thanks,

Naren

7 REPLIES 7
Read only

Former Member
0 Likes
789

Hi,

Is the customer a number or a alpha numeric...

If it just number...try using the FM CONVERSION_EXIT_ALPHA_INPUT to modify the customer to internal format and then use if the KNVV select...

Thanks,

Naren

Read only

0 Likes
789

Thanks Naren, But do u think is it because of the the length of char.

Both are KUNNR and are 10 char length, IN KNVV-KUNNR the data has leading zeros to make it to 10 char length and in ZZSD0010 table the Kunnr field is 10 char length but it does not always have 10 char.

Shejal.

Read only

Former Member
0 Likes
789

Hi ,

iT MATTERS THATS THE REASON WHY YOU ARE NOT ABLE TO FETCH DATA.

try this.

DATA : V_zero3(10) type c value '0000000000',

v_count(3) type n,

v_count2(3) type n ,

v_zerot(10).

LOOP AT it_zzsd0010.

SHIFT it_zzsd0010-KUNNR LEFT DELETING LEADING '0'.

v_count = strlen( it_zzsd0010-KUNNR ).

v_count2 = 10 - v_count.

if not v_count2 is initial.

move v_zero3+0(v_count2) to v_zerot.

else .

v_zerot = ' '.

endif.

concatenate v_zerot it_zzsd0010-KUNNR into it_zzsd0010-KUNNR.

MODIFY it_zzsd0010.

ENDLOOP.

SELECT kunnr

kdgrp

INTO TABLE it_knvv

FROM knvv

WHERE kunnr = it_zzsd0010-kunnr.

rewards points if helpful.

Thanks

venki

Read only

Former Member
0 Likes
789

Hi ,

iT MATTERS THATS THE REASON WHY YOU ARE NOT ABLE TO FETCH DATA.

try this.

DATA : V_zero3(10) type c value '0000000000',

v_count(3) type n,

v_count2(3) type n ,

v_zerot(10).

LOOP AT it_zzsd0010.

SHIFT it_zzsd0010-KUNNR LEFT DELETING LEADING '0'.

v_count = strlen( it_zzsd0010-KUNNR ).

v_count2 = 10 - v_count.

if not v_count2 is initial.

move v_zero3+0(v_count2) to v_zerot.

else .

v_zerot = ' '.

endif.

concatenate v_zerot it_zzsd0010-KUNNR into it_zzsd0010-KUNNR.

MODIFY it_zzsd0010.

ENDLOOP.

SELECT kunnr

kdgrp

INTO TABLE it_knvv

FROM knvv

WHERE kunnr = it_zzsd0010-kunnr.

rewards points if helpful.

Thanks

venki

Read only

Former Member
0 Likes
790

yes..

Check the field it_zzsd0010-kunnr if it is padded with zeros...Otherwise you have to use the function module which I have mentioned in my earlier reply..

Thanks,

Naren

Read only

0 Likes
789

Thanks everyone.

Shejal

Read only

0 Likes
789

Hi,

If you dont want to use the function module,you can use the the code below:(no need calculate and concatenate).

OVERLAY will take care of appending variable number of zeros.

data: lc_overlay(10) value '0000000000'.

Shift kunnr right deleting trailing space.

OVERLAY kunnr with lc_overlay.

Mark points if you find answer useful.

Regs,

Ags..