• 输入列号得到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.
  • 相关阅读:
    动态查找>红黑树(RedBlack Tree)
    JSF>表格设置行的颜色
    获取某一天之前或者之后多少天的日期
    java基础>jdbc数据库操作
    java基础>Exception
    数据结构>优先队列(堆)
    java基础>I/O
    java基础>线程 生产者消费者问题
    java基础>泛型
    动态规划>可靠性设计
  • 原文地址:https://www.cnblogs.com/caizjian/p/9486956.html
Copyright © 2020-2023  润新知