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: 

Quantity field.

Former Member
0 Kudos

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

former_member708410
Contributor
0 Kudos

HI,

Data:temp like bseg-wrbtr.

temp = x.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

0 Kudos

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

0 Kudos

use ...

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

condense v_field.

0 Kudos

hi,

could you correct me on this.

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

condense amexbdcsav1-amount.

thanks and Regards

0 Kudos

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.

0 Kudos

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

0 Kudos

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.

0 Kudos

hello,

I have typed manullay its not working with me.

I am in 4.6 will this make any difference.

0 Kudos

that might be the reason.

0 Kudos

how are you populating the character field with quantity ..

initially. RU getting the amount from any file ..

Former Member
0 Kudos

Self answered