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

amount value error while reading itab

Former Member
0 Likes
1,349

Hi all.

I am reading internal table which has been created by upload of excel. the amount field in the excel was in two format one was '2552.09' and other was '2552' when i transfer to betrg feild it is correct for '2552.09' but for '2552' is '25.52' .

How i can resolve this. It may be 25.00 or 25 as value in excel but i need that sould be same as 25.00 in betrg field

pls suggest me a solution

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,307

Hi

When you are reading betrg value from excel, move it into char format betrg field in your internal table then you create a function module and convert it into required format like ( decimal notation formats )

N.NNN,NN

N,NNN.NN

N NNN NNN,NN

and also provide this decimal notation foarmt in selection screen, at that time of data upload based on decimal notation and delimiter, convert it into required format in that function module. once the data is converted required format move the betrg field it into your actual internal table.

Regards

Karthik

13 REPLIES 13
Read only

Former Member
0 Likes
1,307

Hi,

Before moving it to betrg field , move it to type p varaible with decimals 2 and then move it to betrg.

Read only

Former Member
0 Likes
1,307

loop at the table which you have uploaded from excel,

and pass the amount fields to field of type p decimals 2

then you pass this p field to betrg .

endloop

Read only

0 Likes
1,307

i tried to covert it in temp type p decimals 2 . but there also value 567 became 5.67 but i want it should be 567.00 ..

pls suggest something

thanks

Read only

venkat_o
Active Contributor
0 Likes
1,307

Hi, <li>Define BETRG field in Internal table with type C length 18, then upload. Thanks Venkat.O

Read only

Former Member
0 Likes
1,308

Hi

When you are reading betrg value from excel, move it into char format betrg field in your internal table then you create a function module and convert it into required format like ( decimal notation formats )

N.NNN,NN

N,NNN.NN

N NNN NNN,NN

and also provide this decimal notation foarmt in selection screen, at that time of data upload based on decimal notation and delimiter, convert it into required format in that function module. once the data is converted required format move the betrg field it into your actual internal table.

Regards

Karthik

Read only

0 Likes
1,307

i didnt understant how to impliment wht you said . My problem has not resolved yet

Read only

0 Likes
1,307

ajay,

you would be using some FM to upload data to some internal table. in this internal table, define fields as strings or char type data.

define a temp variable of type P decimals 2.

then when you pass the internal table to some other final table, for the amount field,

first pass it to the temp variable. then pass this temp variable to the actual field of type betrg.

data: p1 type i value '576',
      p2 type p DECIMALS 2,
      p3 TYPE betrg.

"p3 from p2 and p2  from p1
p3 = p2 = p1.

WRITE / : p1, p2 , p3.

Read only

0 Likes
1,307

field in internal table is of betrg type. but its not working for them if the value is absolut. it converts 2456 into 24.56 .

Read only

0 Likes
1,307

change the field to string,

and then upload

Read only

0 Likes
1,307

Thanks Saumyaprakash.

it_data TYPE STANDARD TABLE OF alsmex_tabline,

data : l_amt_text(20) type c .

data : l_betrg type pa0009-betrg.

fM i m using is 'ALSM_EXCEL_TO_INTERNAL_TABLE'

LOOP AT it_data INTO wa_data.

CASE wa_data-col.

WHEN '0015'.

l_amt_text = wa_data-value.

REPLACE ',' in l_amt_text WITH ''.

CONDENSE l_amt_text .

break 259411 .

l_betrg = l_amt_text .

this is sample pice of my code whicj is not working

Read only

0 Likes
1,307

hello Ajay

Move your field into char type then covert it into required format for that create a function module use decimal notation and separtor for identifaition which format you wants to convert

Regards

Karthik

Read only

0 Likes
1,307

even string has not worked.

Read only

0 Likes
1,307

put a break point where you are assigning it to the l_betrg and see both values