07-27-2006 12:06 PM
hai SDNs,
i am doing subraction in my report. when i am outputting the value to the list..
if the result is negative.. when i write the commnad
write 😕 result.
it is priting the '-' sign at the end. how to print it before the result.
eg.
5 - 10 = ?
it is printing : 5-
but i need : -5 how?
07-27-2006 12:08 PM
CLOI_PUT_SIGN_IN_FRONT
or
FUNCTION Z_CONVERT_NEGATIVE_SIGN.
*"--------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(DMBTR) LIKE VBAK-NETWR
*" VALUE(WAERS) LIKE BSID-WAERS DEFAULT 'NTD'
*" EXPORTING
*" VALUE(ZMBTR) TYPE CHAR16
*"--------------------------------------------------------
*For transport missing function group ZBD1 .
IF DMBTR > 0.
WRITE DMBTR TO ZMBTR RIGHT-JUSTIFIED CURRENCY WAERS.
ELSE.
DMBTR = ABS( DMBTR ).
WRITE DMBTR TO ZMBTR RIGHT-JUSTIFIED CURRENCY WAERS.
ZMBTR+0(1) = '-'.
CONDENSE ZMBTR NO-GAPS.
WRITE ZMBTR TO ZMBTR RIGHT-JUSTIFIED.
ENDIF.
ENDFUNCTION.
Cheers,
Thomas.
<b>Please mark points if helpful</b>
07-27-2006 12:08 PM
hi,
Use <b>concatenate</b> statment for the same... FM 'CLOI_PUT_SIGN_IN_FRONT' will also work
Message was edited by: Santosh Kumar P
07-27-2006 12:08 PM
CLOI_PUT_SIGN_IN_FRONT
or
FUNCTION Z_CONVERT_NEGATIVE_SIGN.
*"--------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(DMBTR) LIKE VBAK-NETWR
*" VALUE(WAERS) LIKE BSID-WAERS DEFAULT 'NTD'
*" EXPORTING
*" VALUE(ZMBTR) TYPE CHAR16
*"--------------------------------------------------------
*For transport missing function group ZBD1 .
IF DMBTR > 0.
WRITE DMBTR TO ZMBTR RIGHT-JUSTIFIED CURRENCY WAERS.
ELSE.
DMBTR = ABS( DMBTR ).
WRITE DMBTR TO ZMBTR RIGHT-JUSTIFIED CURRENCY WAERS.
ZMBTR+0(1) = '-'.
CONDENSE ZMBTR NO-GAPS.
WRITE ZMBTR TO ZMBTR RIGHT-JUSTIFIED.
ENDIF.
ENDFUNCTION.
Cheers,
Thomas.
<b>Please mark points if helpful</b>
07-27-2006 12:09 PM
CALL FUNCTION <b>'CLOI_PUT_SIGN_IN_FRONT'</b>
CHANGING
value = result.
ENDIF.
write: result
07-27-2006 12:09 PM
Hi,
Use this F.M <b> 'CLOI_PUT_SIGN_IN_FRONT'</b>
data: p(2) type c.
p = '2-'
CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
CHANGING
value = p.
write: i.
Cheers,
Simha.
<b>Reward if it helps...</b>
07-27-2006 12:11 PM
Use ,
DATA : final(10),
field(9).
CONCATENATE '-' field INTO final+1.
Regards,
AS