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

Quantity field.

Former Member
0 Likes
1,470

Hi experts.

I have Character field in my program.

ex x(13).

This is acutally contains amount.

Now I need to update data base table using this field.

But data base table is WRBTR type.

It results me dump.

I tried using type N.but decimals are trunctaed.

I tired with type P results in dump.

I need to have extact values in Db table.

so that.I can sumup afterwards.

I cannot chnage the Char field in program.Becuase the field I am getting from interface file.

Kindly give me some solutions

Thanks

13 REPLIES 13
Read only

Former Member
0 Likes
1,432

HI,

Data:temp like bseg-wrbtr.

temp = x.

Read only

Former Member
0 Likes
1,432

You have to first define a new field that matches your table field's data element.

data: l_amount like table_name-WRBTR.

l_amount = x. "ABAP engine automatically converts the data

Now, update the database table with l_amount.

Read only

Former Member
0 Likes
1,432

Please look that char field v_x does not contain any ','(comas)

Look at below code .. this works fine for me ... (no dump)

data : v_data type WRBTR.

data : v_x(13) value '12345.67'.

move v_x to v_data.

write 😕 v_data.

Read only

0 Likes
1,432

Thanks for you anwer.

I have rewarded for you answer.

I have one more question.

I have commas to in that field.

Kindly tell me how to proceed

Read only

0 Likes
1,432

use ...

replace all occurrences of ',' in v_field with ' '.

condense v_field.

Read only

0 Likes
1,432

hi,

could you correct me on this.

replace all occurrances of ',' in amexbdcsav1-amount with ' '.

condense amexbdcsav1-amount.

thanks and Regards

Read only

0 Likes
1,432

amexbdcsav1-amount should be the character field ...

and not the amount field ...

replace all occurrences of ',' in amexbdcsav1-amount with ' '.

condense amexbdcsav1-amount.

after this use move ...

data : v_data type WRBTR.

data : v_x(13) value '12,345.67'.

replace all occurrences of ',' in v_x with ' '.

condense v_x.

move v_x to v_data.

Read only

0 Likes
1,432

yes it is caracter field.

But I am getting error when i am doing the sytax check.

occurrences of ',' in not expected.

Here is my code.

replace all occurrences of ',' in amexbdcsav1-amount with ' '.

condense amexbdcsav1-amount.

W_QUNT = amexbdcsav1-amount.

WA_ZAMEXTRAVEXP-WRBTR = W_QUNT.

Kindly help me.

Thanks and regards

Read only

0 Likes
1,432

Iam getting the o/p with the same statement ..

don't copy / paste .. type in manually ... this might work ...

replace all occurrences of ',' in v_x with ' '.

condense v_x.

Read only

0 Likes
1,432

hello,

I have typed manullay its not working with me.

I am in 4.6 will this make any difference.

Read only

0 Likes
1,432

that might be the reason.

Read only

0 Likes
1,432

how are you populating the character field with quantity ..

initially. RU getting the amount from any file ..

Read only

Former Member
0 Likes
1,432

Self answered