1 DATA: zs(15). 2 DATA: xs(15). 3 DATA: str(30). 4 DATA: len TYPE i VALUE 0. 5 DATA: cis TYPE i VALUE 0. 6 DATA: ss(2). 7 DATA: rr(1). 8 DATA: strr(15). 9 DATA: change(30) TYPE c VALUE '1壹2贰3叁4肆5伍6陆7柒8捌9玖0零'. 10 *data dxstr(80). 11 CLEAR dxstr. 12 MOVE val TO str. 13 SHIFT str LEFT DELETING LEADING space. 14 SHIFT str LEFT DELETING LEADING '0'. 15 SPLIT str AT '.' INTO zs xs. 16 len = strlen( zs ). CLEAR strr. cis = len - 1. 17 DO len TIMES. 18 MOVE zs+cis(1) TO rr. 19 CONCATENATE strr rr INTO strr. 20 cis = cis - 1. 21 ENDDO. 22 cis = 0. 23 DO len TIMES. 24 MOVE strr+cis(1) TO ss. 25 TRANSLATE ss USING change. 26 CASE cis. 27 WHEN 0. 28 IF ss = '零'. 29 CONCATENATE '元' dxstr INTO dxstr. 30 ELSE. 31 CONCATENATE ss '元' dxstr INTO dxstr. 32 ENDIF. 33 WHEN 1. 34 IF ss = '零'. 35 CONCATENATE ss dxstr INTO dxstr. 36 ELSE. 37 CONCATENATE ss '拾' dxstr INTO dxstr. 38 ENDIF. 39 WHEN 2. 40 IF ss = '零'. 41 CONCATENATE ss dxstr INTO dxstr. 42 ELSE. 43 CONCATENATE ss '佰' dxstr INTO dxstr. 44 ENDIF. 45 WHEN 3. 46 IF ss = '零'. 47 CONCATENATE ss dxstr INTO dxstr. 48 ELSE. 49 CONCATENATE ss '仟' dxstr INTO dxstr. 50 ENDIF. 51 WHEN 4. 52 IF ss = '零'. 53 CONCATENATE '万' dxstr INTO dxstr. 54 ELSE. 55 CONCATENATE ss '万' dxstr INTO dxstr. 56 ENDIF. 57 WHEN 5. 58 IF ss = '零'. 59 CONCATENATE ss dxstr INTO dxstr. 60 ELSE. 61 CONCATENATE ss '拾' dxstr INTO dxstr. 62 ENDIF. 63 WHEN 6. 64 IF ss = '零'. 65 CONCATENATE ss dxstr INTO dxstr. 66 ELSE. 67 CONCATENATE ss '佰' dxstr INTO dxstr. 68 ENDIF. 69 WHEN 7. 70 IF ss = '零'. 71 CONCATENATE ss dxstr INTO dxstr. 72 ELSE. 73 CONCATENATE ss '仟' dxstr INTO dxstr. 74 ENDIF. 75 WHEN 8. 76 IF ss = '零'. 77 CONCATENATE '亿' dxstr INTO dxstr. 78 ELSE. 79 CONCATENATE ss '亿' dxstr INTO dxstr. 80 ENDIF. 81 WHEN 9. 82 IF ss = '零'. 83 CONCATENATE ss dxstr INTO dxstr. 84 ELSE. 85 CONCATENATE ss '拾' dxstr INTO dxstr. 86 ENDIF. 87 WHEN 10. 88 IF ss = '零'. 89 CONCATENATE ss dxstr INTO dxstr. 90 ELSE. 91 CONCATENATE ss '百' dxstr INTO dxstr. 92 ENDIF. 93 WHEN 11. 94 IF ss = '零'. 95 CONCATENATE ss dxstr INTO dxstr. 96 ELSE. 97 CONCATENATE ss '仟' dxstr INTO dxstr. 98 ENDIF. 99 ENDCASE. 100 cis = cis + 1. 101 ENDDO. 102 CLEAR ss. 103 IF xs <> '00'. 104 MOVE xs+0(1) TO ss. 105 TRANSLATE ss USING change. 106 IF ss <> '零'. 107 CONCATENATE dxstr ss '角' INTO dxstr. 108 ENDIF. 109 MOVE xs+1(1) TO ss. 110 TRANSLATE ss USING change. 111 IF ss <> '零'. 112 CONCATENATE dxstr ss '分' INTO dxstr. 113 ENDIF. 114 ELSE. 115 CONCATENATE dxstr '整' INTO dxstr. 116 ENDIF. 117 REPLACE '零零零' WITH '零' INTO dxstr. 118 REPLACE '零零零' WITH '零' INTO dxstr. 119 REPLACE '零零零' WITH '零' INTO dxstr. 120 REPLACE '零零' WITH '零' INTO dxstr. 121 REPLACE '零零' WITH '零' INTO dxstr. 122 REPLACE '零零' WITH '零' INTO dxstr. 123 REPLACE '零万' WITH '万' INTO dxstr. 124 REPLACE '零元' WITH '元' INTO dxstr. 125 REPLACE '零亿' WITH '亿' INTO dxstr. 126 REPLACE '亿万' WITH '亿' INTO dxstr. 127 CONDENSE dxstr NO-GAPS. 128 IF dxstr = '整'. 129 dxstr = ''. 130 ENDIF.View Code
标签:CONCATENATE,ss,INTO,大写,ELSE,ABAP,ENDIF,SAP,dxstr From: https://www.cnblogs.com/coderfarmer/p/16805522.html