写一个功能把
*&----------------------------------------------------------------------*
*& 符号(l_temp2)移动,千分位加符号(l_temp4)
*&----------------------------------------------------------------------*
FORM move_dig CHANGING p_temp.
DATA: l_temp1(17) TYPE c,
l_temp2(2) TYPE c VALUE '-',
l_temp3(1) TYPE c,
l_temp4(1) TYPE c VALUE ',',
i_len TYPE i,
i_len1 TYPE i,
i_count TYPE i,
i_count1 TYPE i,
c1(17) TYPE c,
c2(17) TYPE c,
c3(2) TYPE c.
IF p_temp < 0.
SPLIT p_temp AT '-' INTO l_temp1 l_temp3.
CONCATENATE l_temp2 l_temp1 INTO p_temp.
CONDENSE p_temp NO-GAPS.
i_len = strlen( p_temp ).
MOVE '-' TO c3.
ELSE.
CONDENSE p_temp NO-GAPS.
i_len = strlen( p_temp ).
MOVE '+' TO c3.
ENDIF.
* When '+'
IF c3 = '+' AND i_len > 3.
i_count = i_len DIV 3.
DO i_count TIMES.
i_len1 = i_len - 3.
MOVE p_temp+i_len1(3) TO c1.
CONCATENATE l_temp4 c1 c2 INTO c2.
MOVE i_len1 TO i_len.
CLEAR i_len1.
ENDDO.
* Last Record
i_count = i_len MOD 3.
IF i_count > 0.
MOVE p_temp+0(i_count) TO c1.
CONCATENATE c1 c2 INTO c2.
ELSE.
SHIFT c2.
ENDIF.
MOVE c2 TO p_temp.
* clear p_temp.
CLEAR i_count.
ENDIF.
************
* When '-'
IF c3 = '-' AND i_len > 4.
SHIFT p_temp.
i_len = strlen( p_temp ).
i_count = i_len DIV 3.
DO i_count TIMES.
i_len1 = i_len - 3.
MOVE p_temp+i_len1(3) TO c1.
CONCATENATE l_temp4 c1 c2 INTO c2.
MOVE i_len1 TO i_len.
CLEAR i_len1.
ENDDO.
* Last record
i_count = i_len MOD 3.
IF i_count > 0.
MOVE p_temp+0(i_count) TO c1.
CONCATENATE c1 c2 INTO c2.
ELSE.
SHIFT c2.
CONCATENATE '-' c2 INTO c2.
ENDIF.
CONCATENATE '-' c2 INTO c2.
MOVE c2 TO p_temp.
CLEAR i_count.
ENDIF.
ENDFORM. " move_dig