Application Development 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: 

runtime error number conversion..

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

10 REPLIES 10

former_member156446
Active Contributor
0 Kudos

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.

0 Kudos

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 !!

0 Kudos

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.

0 Kudos

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 !

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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 ??

0 Kudos

KUNNR has a conversion routine ..

instead declare your internal table as :

TYPES: BEGIN OF X_ITAB,

KUNNR(10) ,

END OF X_ITAB.

0 Kudos

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 ??