ABAP-负号前置

1.创建一个CONVERSION_EXIT_ZXXX_OUTPUT的函数,ZXXX可自定义

 1 FUNCTION conversion_exit_z001_output.
 2 *"----------------------------------------------------------------------
 3 *"*"本地接口:
 4 *"  IMPORTING
 5 *"     REFERENCE(INPUT)
 6 *"  EXPORTING
 7 *"     REFERENCE(OUTPUT)
 8 *"----------------------------------------------------------------------
 9 
10   DATA: output1(20),
11         output2(20),
12         outnum(16) TYPE p DECIMALS 2.
13   outnum = input.
14   IF input >= 0.
15     WRITE outnum TO output1.
16   ELSE.
17     outnum = outnum * ( -1 ).
18     WRITE outnum TO output1.
19     CONCATENATE '-' output1 INTO output1.
20   ENDIF.
21 
22   CONDENSE output1 NO-GAPS.
23   WRITE output1 TO output2 RIGHT-JUSTIFIED.
24   output = output2.
25   CLEAR: output2.
26
27 ENDFUNCTION.

2.将Fieldcat的edit_mask字段赋值为’==ZXXX’。ZXXX参考定义的函数名称

posted @ 2023-08-28 11:46  TigerMan  阅读(122)  评论(0编辑  收藏  举报