CX_SY_READ_SRC_LINE_TOO_LONG 调用 REUSE_ALV_FIELDCATALOG_MERGE 时出错

CX_SY_READ_SRC_LINE_TOO_LONG error while calling REUSE_ALV_FIELDCATALOG_MERGE

我想使用 'reuse_alv_fieldcatalog_merge' 填充 table 并按屏幕。但是它给出了这样的错误:

"The ABAP program lines are wider than the internal table."

我检查了设置和 Downwards-Comp。 line length (72) 部分没有任何迹象。所以问题不是由这个引起的。我留下我的代码。如果你能帮上忙,我会很高兴。

TYPE-POOLS slis .

TABLES : vbrk, vbrp.

DATA : BEGIN OF gt_table OCCURS 0,
  vbeln  LIKE vbrk-vbeln,
  waerk  LIKE vbrk-waerk,
  kunag  LIKE vbrk-kunag,
  fkart  LIKE vbrk-fkart,
  fktyp  LIKE vbrk-fktyp,
  vbtyp  LIKE vbrk-vbtyp,
  vkorg  LIKE vbrk-vkorg,
  vtweg  LIKE vbrk-vtweg,
  fkdat  LIKE vbrk-fkdat,
  posnr  LIKE vbrp-posnr,
  vrkme  LIKE vbrp-vrkme,
  matnr  LIKE vbrp-matnr,
  werks  LIKE vbrp-werks,
  fkimg  LIKE vbrp-fkimg,
  ntgew  LIKE vbrp-ntgew,
  brgew  LIKE vbrp-brgew,
  gewei  LIKE vbrp-gewei,
  brtwr  LIKE vbrp-brtwr,
  name1  LIKE kna1-name1,
      END OF gt_table.

SELECT-OPTIONS : so_vbeln FOR vbrk-vbeln,
                 so_fkart FOR vbrk-fkart,
                 so_fktyp FOR vbrk-fktyp,
                 so_vbtyp FOR vbrk-vbtyp,
                 so_vkorg FOR vbrk-vkorg,
                 so_vtweg FOR vbrk-vtweg,
                 so_fkdat FOR vbrk-fkdat,
                 so_vrkme FOR vbrp-vrkme,
                 so_matnr FOR vbrp-matnr,
                 so_werks FOR vbrp-werks.

DATA : i_fcat TYPE slis_t_fieldcat_alv .
DATA : wa_fcat LIKE LINE OF i_fcat .

START-OF-SELECTION .
  PERFORM get_data .
  PERFORM create_fcat_merge .

END-OF-SELECTION .
  PERFORM disp_alv .

FORM get_data .
  SELECT a~vbeln a~waerk a~kunag a~fkart a~fktyp a~vbtyp a~vkorg a~vtweg a~fkdat b~posnr b~vrkme
         b~matnr b~werks b~fkimg b~ntgew b~brgew b~gewei b~brtwr c~name1

      INTO TABLE gt_table

      FROM vbrk AS a INNER JOIN vbrp  AS b ON a~vbeln = b~vbeln
                     INNER JOIN kna1  AS c ON c~kunnr = a~kunag

      WHERE a~vbeln IN so_vbeln AND
            a~fkart IN so_fkart AND
            a~fktyp IN so_fktyp AND
            a~vbtyp IN so_vbtyp AND
            a~vkorg IN so_vkorg AND
            a~vtweg IN so_vtweg AND
            a~fkdat IN so_fkdat AND
            b~vrkme IN so_vrkme AND
            b~matnr IN so_matnr AND
            b~werks IN so_werks.
ENDFORM.

FORM disp_alv .
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program = sy-repid
      it_fieldcat        = i_fcat
    TABLES
      t_outtab           = gt_table.


ENDFORM.

FORM create_fcat_merge .
  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name     = sy-repid
      i_internal_tabname = 'gt_table'
      i_inclname         = sy-repid
    CHANGING
      ct_fieldcat        = i_fcat.
ENDFORM.

您的 SELECT 行宽度超过 72 个字符:

SELECT a~vbeln a~waerk a~kunag a~fkart a~fktyp a~vbtyp a~vkorg a~vtweg a~fkdat b~posnr b~vrkme

分成两行:

SELECT a~vbeln a~waerk a~kunag a~fkart a~fktyp a~vbtyp a~vkorg a~vtweg 
       a~fkdat b~posnr b~vrkme

还有一个问题:

  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name     = sy-repid
      i_internal_tabname = 'gt_table'

'gt_table' 必须大写(只是为了防止下一次转储):

 i_internal_tabname = 'GT_TABLE'

PS.: 我猜你只是在玩,有更多最新的工具可以创建 ALV 列表。