07-23-2008 10:13 PM
hi,
i am doing a table read as follows
select distinct kunnr into workarea from vbpa where parvw = 'WE'.
append workarea to itab.
endselect
trying to fetch distinct customer numbers which are ship to parties. this work area contains just one field , kunnr of type kna1-kunnr and itab is a table of workarea type.
it so happens that in my system , i have two types of kunnrs, all numbers and few like ABC7788. now when an entry such as ABC7788 is encountered, runtime error occurs as
unable to interpret ABC7788 as number !! runtime error convt_no_number !!
why this error occurs ? my data is in that format only and i am using the same field of the DB table !! is SAP trying to do any conevrsion here ? why ? pl advise ..thks
07-24-2008 7:20 AM
Hi,
Even i had tried it out...its not giving any error for me.
Even i both type of records i.e kunnr as numerical and char...still am able to fetch and append the record with the same select stmt.
select distinct kunnr from vbpa into table itab up to 1000 rows
where PARVW = 'WE'.
Copy paste..ur Declaration & Data fetching part.....so that we can find out wats the problem
07-23-2008 10:43 PM
Try this way.
data: vl_kunnr type vbpa-kunnr.
select distinct kunnr
into vl_kunnr
from vbpa
where parvw = 'WE'.
if sy-subrc eq 0.
workarea-kunnr = vl_kunnr.
append workarea to itab.
clear: vl_kunnr.
endif.
07-23-2008 10:48 PM
thanks Jay,
but here we r bypassing that value ABC7788, isn't it ? I dont think i want to do that. bcos i was told that there can be customers with such numebrs for their KUNNR field !! so the value is genuine.
my question is, the databaase table KNA1 contains this value, also the table VBPA. and its type is KUNNR !! so when i try to read it and assign to the itab, why does it fail ?? where is the conversion taking place bcos of which i get the error convt_no_number !!
07-23-2008 10:58 PM
Hi,
Are you sure the error is because of this statement. KUNNR is of type CHAR. Even if it was an integer, you are just appending not collecting. Check where exactly it is raising error.
Also, why do you want to use SELECT ... ENDSELECT. You can select into table.
Regards,
Srilatha.
07-23-2008 11:18 PM
Yes Srilatha, I tried with 2 versions of this statement..
SELECT DISTINCT KUNNR INTO TABLE ITAB FROM VBPA.....
and the other which which I mentioned earlier..
In first case (just the select statement ) it is giving runtime error in the select statenment
and in the second case(select endselect), it gives error at the append statement !!
so what i feel is when the value is moved to the itab, something is wrong. not able to figure out what !
07-24-2008 6:39 AM
Hi,
May be you declared work area with single field of type I, thats why it is giving runtime error, please check once.
If that is the case declare work area with type referring to vbpa-kunnr type which is char 10 so it is accepting char values also.
and declare table with same type and do as per your requirement.
Hope this will helps you,
Regard,
Aswini.
07-24-2008 6:49 AM
hey,
can you please paste the code as to how you declared your work areas and internal tables.
this would help us in getting a clear picture.
As far as i know SAP should not throw any dump for your coding, so i am requesting for the code.
Regards,
RK
07-24-2008 7:20 AM
Hi,
Even i had tried it out...its not giving any error for me.
Even i both type of records i.e kunnr as numerical and char...still am able to fetch and append the record with the same select stmt.
select distinct kunnr from vbpa into table itab up to 1000 rows
where PARVW = 'WE'.
Copy paste..ur Declaration & Data fetching part.....so that we can find out wats the problem
07-24-2008 1:19 PM
here u go..
TYPES: BEGIN OF X_ITAB,
KUNNR TYPE KNA1-KUNNR,
END OF X_ITAB.
DATA: WA_ITAB TYPE X_ITAB,
I_TAB TYPE TABLE OF X_TAB.
COMMIT WORK.
SELECT KUNNR INTO WA_ITAB FROM VBPA WHERE PARVW = 'WE'.
APPEND WA_ITAB TO I_TAB.
ENDSELECT.
does this help ??
07-24-2008 1:26 PM
KUNNR has a conversion routine ..
instead declare your internal table as :
TYPES: BEGIN OF X_ITAB,
KUNNR(10) ,
END OF X_ITAB.
07-24-2008 1:48 PM
cool srinivas..thanks..that worked...but i am getting an overflow error in the same append statement for a vaue such as 0006000000. but we have defined kunnr(10) !! why so ??