输入列号得到excel对应的字母列
zexcel_cell_column 类型是INT4
FUNCTION ZGET_EXCEL_COL. *"---------------------------------------------------------------------- *"*"本地接口: *" IMPORTING *" REFERENCE(I_COL) TYPE I *" EXPORTING *" REFERENCE(E_COL) TYPE C *"---------------------------------------------------------------------- DATA: LV_UCCPI TYPE I, LV_TEXT TYPE SYCHAR02, LV_MODULE TYPE INT4, LV_COLUMN TYPE ZEXCEL_CELL_COLUMN. LV_COLUMN = I_COL . *--------------------------------------------------------------------* * Check whether column is in allowed range for EXCEL to handle ( 1-16384 ) *--------------------------------------------------------------------* * IF lv_column > 16384 * OR lv_column < 1. * RAISE EXCEPTION TYPE zcx_excel * EXPORTING * error = 'Index out of bounds'. * ENDIF. *--------------------------------------------------------------------* * Build alpha representation of column *--------------------------------------------------------------------* WHILE LV_COLUMN GT 0. LV_MODULE = ( LV_COLUMN - 1 ) MOD 26. LV_UCCPI = 65 + LV_MODULE. LV_COLUMN = ( LV_COLUMN - LV_MODULE ) / 26. LV_TEXT = CL_ABAP_CONV_IN_CE=>UCCPI( LV_UCCPI ). CONCATENATE LV_TEXT E_COL INTO E_COL. ENDWHILE. ENDFUNCTION.