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 Valiation

Former Member
0 Likes
758

My requirement goes as follows:

When I am doing a BDC, if the Amount in the flat file which is for ex: 5,500.45 should get converted to 5.500,00 in SAP. Can someone help me finding out the solution for this. Is there any Funciton Module or some logic for this?

Thanks!!!!!!

Nitish.

1 ACCEPTED SOLUTION
Read only

anversha_s
Active Contributor
0 Likes
713

hi,

1,234,567.89  => 1.234.567,89.


data: l_amnt(100) type c.

l_amnt = '1.234.567,89'.

replace all occurrences of ',' in l_amnt with '#'.

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

replace all occurrences of '#' in l_amnt with '.'.

write : l_amnt.

Rgds

Anver

My requirement goes as follows:

When I am doing a BDC, if the Amount in the flat file which is for ex: 5,500.45 should get converted to 5.500,00 in SAP. Can someone help me finding out the solution for this. Is there any Funciton Module or some logic for this?

Thanks!!!!!!

Nitish.

6 REPLIES 6
Read only

anversha_s
Active Contributor
0 Likes
714

hi,

1,234,567.89  => 1.234.567,89.


data: l_amnt(100) type c.

l_amnt = '1.234.567,89'.

replace all occurrences of ',' in l_amnt with '#'.

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

replace all occurrences of '#' in l_amnt with '.'.

write : l_amnt.

Rgds

Anver

Read only

0 Likes
713

Thanks for the response. I still have things to clarify. Suppose there is a value in the flat file like for ex: 100000, then in that case what will be the o/p according to your logic?

As per my requirement it shld be like this:

100000 ==> 1.00.000,00

Can u please look into this & provide me with the solution?

Thanks!!!!

Nitish

Read only

0 Likes
713

Hi,

check the following code.

CASE l_dec.

WHEN 'X'. "N,NNN.NN

REPLACE ALL OCCURRENCES OF ',' IN p_comp_qty WITH ' '.

CONDENSE p_comp_qty NO-GAPS.

WHEN ' '. "N.NNN,NN

REPLACE ALL OCCURRENCES OF '.' IN p_comp_qty WITH ' '.

REPLACE ',' IN p_comp_qty WITH '.'.

CONDENSE p_comp_qty NO-GAPS.

WHEN 'Y'. "N NNN NNN,NN

REPLACE ',' IN p_comp_qty WITH '.'.

CONDENSE p_comp_qty NO-GAPS.

WHEN OTHERS.

RETURN.

ENDCASE.

hope its useful...

Sarath

Read only

0 Likes
713

Hi Anver,

The code which you gave works fine in ECC 6.0 but when I am trying to execute the same in 4.6 C it is throwing error. Can u please suggest on how to proceed with this?

Thanks!!!!!!

Nitish

Read only

former_member188829
Active Contributor
0 Likes
713

declare that field as a CURR

Read only

Former Member
0 Likes
713

hi,

parameters : val like vbap-netpr.
data: val2(13) type c.

val = trunc( val ).        "--->use this 
write:/ val.
write val to val2.
replace '.' with ',' into val2.
replace ',' with '.' into val2.
write:/ val2.

check ur input as 5,500.45

regards

vijay.