会计报表里的数据处理
1、会计里的报表都要将数据已000.000.00,00或者-000.000.00,00的形式在ALV上显示,这样取出来的数必须要卓处理
*&---------------------------------------------------------------------* *& Form CHANGE_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* form CHANGE_DATA . loop at tb_result. clear prt_result. move-corresponding tb_result to prt_result. perform num2char using tb_result-start1 changing prt_result-start1. perform num2char using tb_result-start2 changing prt_result-start2. perform num2char using tb_result-end1 changing prt_result-end1. perform num2char using tb_result-end2 changing prt_result-end2. append prt_result. endloop. endform. " CHANGE_DATA *&--------------------------------------------------------------------* *& Form NUM2CHAR *&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* * -->FNUM text * -->SRET text *---------------------------------------------------------------------* FORM num2char USING fnum like tb_result-end1 CHANGING sret. WRITE fnum NO-ZERO TO sret. IF fnum < 0. CONCATENATE '-' sret INTO sret. ENDIF. if sret CO '0.'. sret = ' '. endif. CONDENSE sret NO-GAPS. ENDFORM.
这里面的 prt_result 里的字段都是文本类型,sert 也是文本类型。
注意:这里的WRITE 不能用move 或者 = 号代替。