【ABAP】代码单行长度超长Dump

发布时间 2023-10-13 13:56:56作者: color_story

  问题:The ABAP program lines are wider than the internal table.

       ALV自动转换成fieldcat,通过内表转换,如果代码长度超过72位,会系统Dump。

  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name         = sy-repid
      i_internal_tabname     = 'LS_RECORD'
      i_inclname             = sy-repid
    CHANGING
      ct_fieldcat            = gt_fieldcat[]
    EXCEPTIONS
      inconsistent_interface = 1
      program_error          = 2.

  原因:函数K_KKB_FIELDCAT_MERGE,365行处转换问题

  rssource-line长度设定72位,因此ABAP代码宽度不能超过72字符长度

* source container
  data:
        l_abap_source like rssource occurs 0 with header line.

 

*    class cx_sy_read_src_line_too_long definition load.
*    data: ex_too_long type ref to  cx_sy_read_src_line_too_long.
*    try.
    read report l_prog_tab_local into l_abap_source.
*      catch cx_sy_read_src_line_too_long into ex_too_long.
*    endtry.
    check sy-subrc eq 0.