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

Small doubt regarding ABAP

Former Member
0 Likes
1,497

Hi,

During aparticular code the internal table is_bil_invoice-IT_PRICE[]

gets populated during VF02.

Now I insetad of doing aselect on VBRP I am planning to use this already populating values

in my code.

Now if I try to look during debug for a particular value as follows:

Data: v_count type N.

v_vount = v_count + 1.

lOop...

:

:

:

x = is_bil_invoice-IT_PRICE[v_count]-kzwi1

:

:

:

endloop...

I get following error "unable to interpret v_count as number." but if I go and put 1 or some numeric value I get the data properly.

How do I solve the above problem ?

Hi,

During aparticular code the internal table is_bil_invoice-IT_PRICE[]

gets populated during VF02.

Now I insetad of doing aselect on VBRP I am planning to use this already populating values

in my code.

Now if I try to look during debug for a particular value as follows:

Data: v_count type N.

v_vount = v_count + 1.

lOop...

:

:

:

x = is_bil_invoice-IT_PRICE[v_count]-kzwi1

:

:

:

endloop...

I get following error "unable to interpret v_count as number." but if I go and put 1 or some numeric value I get the data properly.

How do I solve the above problem ?

10 REPLIES 10
Read only

Former Member
0 Likes
1,457

declare v_count as type I.

data : v_count type I.

Read only

0 Likes
1,457

Can you please post all of the relvant code as it is in your program.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,457

Use type I instead of N.

Read only

Former Member
0 Likes
1,457

HI Tushar,

Define V_COUNT as below..

DATA: V_COUNT.

dont use type N.

Or use type I.

DATA: V_COUNT TYPE I.

Message was edited by: Phani Kiran Nudurupati

Read only

manuel_bassani
Contributor
0 Likes
1,457

Hi Tushar Shah

you should use

Data: v_count type I.

in fact type N is a character type containing only digits 0...9

Type I is integer type and should work in your case.

Regards, Manuel

PS: you wrote


v_vount = v_count + 1.

did you mean


v_Count = v_count + 1.

?

Message was edited by: Manuel Bassani

Read only

Former Member
0 Likes
1,457

declare as type i , type N is alpha-numeric , so it is displaying the error

Type I should not give u any error

Read only

Former Member
0 Likes
1,457

Hi Tusahar,

I think you want to use this in Invoice smartform.

Define V_counter as I . --as suggested by others.

Then you can write program lines with in the loop.

In program lines : V-vounter = V_counter + 1.

Then at your text elements Please check the V_counter at Conditions. (Example : V_counter = 1 ...)

Lanka

Read only

Laxmana_Appana_
Active Contributor
0 Likes
1,457

Hi

Declare v_count like the following way

v_count like sy-tabix. sy-tabix is of type int4.

if you declare as type i , if data exceeds the integer storage limit , you will get another error : overflow.

Laxman

Read only

0 Likes
1,457

The following code is inside the smartform program node. The code is defined as one of the flow logic inside a table.

The code runs for each item of table and accumulates the fireght in variable gv_freight_total and list price in gv_listprice.

Now one of the programmer is using following inside the flow logic for table:

select single * into gs_vbrp from VBRP

where vbeln = is_bil_invoice-hd_ref-BIL_NUMBER

and posnr = gs_it_gen-itm_number.

gv_freight_total = gv_freight_total + gs_vbrp-kzwi3.

gv_listprice = gs_vbrp-kzwi1.

But it seems that there is no need to do the database select on VBRP.

We can use the deep structure is_bil_invoice to get the kzwi3 and kzwi1 value.

This deep structure gets populated as per follows if there is one item we will have

is_bil_invoice-IT_PRICE[1]-KZWI1

If the number of items are two then deep structure will have,

is_bil_invoice-IT_PRICE[1]-KZWI1.

is_bil_invoice-IT_PRICE[2]-KZWI1.

Read only

0 Likes
1,457

Hi Tusahr,

Please note that there is no need to do another select from VBRP. Your Samrtform structure is_bil_invoice will provide you all the freight and other pricing conditions.

Have you copied your invoice from standard smartform LB_INVOICE? Then you can include your own logic at program lines :

READ_KOND_DATA_SUM Under Table Item.

GS_HD_KOND this table is papulated in program lines "READ_KOND_DATA_SUM"

Lanka

Message was edited by: Lanka Murthy