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

Field Conversions

Former Member
0 Likes
711

Hello,

we have a currency field containing e.g. 1000-. An output file requires that a '-' sign is in front e.g. '-1000'.

Of course any empty spaces must be deleted so that it doesn't look like '- 1000'.

We could do with CONDENSE etc but have 70 fields with which to do this change.

is there any customizing that can do this or does anyone know of a neat solution?

Thank you,

Rod

Hello,

we have a currency field containing e.g. 1000-. An output file requires that a '-' sign is in front e.g. '-1000'.

Of course any empty spaces must be deleted so that it doesn't look like '- 1000'.

We could do with CONDENSE etc but have 70 fields with which to do this change.

is there any customizing that can do this or does anyone know of a neat solution?

Thank you,

Rod

4 REPLIES 4
Read only

Former Member
0 Likes
680

One way is to use the function moduile:

CLOI_PUT_SIGN_IN_FRONT

Regards,

ravi

Read only

Former Member
0 Likes
680

hi

good

if all the fields are the currency fields the do for one than automatically it ll come for others also.

i dont think there is any customizing program which can help you in this.

thanks

mrutyun^

Read only

0 Likes
680

hi,

If you have declared the variable i.e number in your case as type i ,then you can edit the output with '-' mask in front

If you have decared the number as type c. then you can use this FM

CLOI_PUT_SIGN_IN_FRONT and just pass the variable that holds the negative value.

or else,

If number < 0.

sign = '-'.

else.

sign = '+'.

endif.

concatenate sign number into number.

I suggest to go for FM

Let me know if you need anything else.

Thanks

VENKI

Read only

Former Member
0 Likes
680

hi dWYER,

I was just trying to know what are the actual limitations to ur query ..

if this works cant we handle this through a zfm ??

im just giving a blinder shot ..

regards,

VIjay.

-


DATA : P1 LIKE VBAK-WAERK VALUE '2300',

P2 LIKE VBAK-WAERK VALUE '3300',

RES LIKE VBAK-WAERK,

  • RES2(15).

RES2 LIKE VBAK-WAERK.

RES = P1 - P2.

DATA: TEXT1(1) TYPE C.

SEARCH RES FOR '-'.

IF SY-SUBRC = 0 AND SY-FDPOS <> 0.

SPLIT RES AT '-' INTO RES2 TEXT1.

CONDENSE RES2.

CONCATENATE '-' RES2 INTO RES2.

ELSE.

EXIT.

ENDIF.

WRITE RES2.