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: 

write stmt (formatting)

former_member206396
Active Participant
0 Kudos

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?

1 ACCEPTED SOLUTION

Former Member
0 Kudos


 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>

5 REPLIES 5

Former Member
0 Kudos

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

Former Member
0 Kudos


 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>

0 Kudos

CALL FUNCTION <b>'CLOI_PUT_SIGN_IN_FRONT'</b>

CHANGING

value = result.

ENDIF.

write: result

Simha_
Employee
Employee
0 Kudos

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>

Former Member
0 Kudos

Use ,

DATA : final(10),
       field(9).

CONCATENATE '-' field INTO final+1.

Regards,

AS