请教高手一个alv问题

[复制链接]
查看11 | 回复9 | 2008-2-13 12:43:03 | 显示全部楼层 |阅读模式
同样的代码,在一个程式可以正常运行,而在另一个程式则报错(代码完全相同,copy过去的),什么原因?
debug的时候发现应该是调 REUSE_ALV_FIELDCATALOG_MERGE 的错误
可两个程式完全一样,郁闷
回复

使用道具 举报

千问 | 2008-2-13 12:43:03 | 显示全部楼层
Short text
The ABAP program lines are wider than the internal table.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_READ_SRC_LINE_TOO_LONG', was
not caught in
procedure "K_KKB_FIELDCAT_MERGE" "(FUNCTION)", nor was it propagated by a
RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
There was an attempt to read program "ZTRY2" from the database.
The READ REPORT statement allows you to copy a program text into an
internal table. The occupied line length in the program text must not
exceed the width of the internal table.
The internal table "\FUNCTION=K_KKB_FIELDCAT_MERGE\DATA=L_ABAP_SOURCE[]" is 72
characters wide. The program line is
100 characters wide.
回复

使用道具 举报

千问 | 2008-2-13 12:43:03 | 显示全部楼层
同样的程序,如果没有做到完整的异常处理,在以下情况下可能会抛出异常:
1.数量源不一样
2.client不同,即可能的系统配置不一样
etc.
回复

使用道具 举报

千问 | 2008-2-13 12:43:03 | 显示全部楼层
我是在同一个client上测试的,所以数据,配置都是一样的!
当我取field catelog的时候不用call function REUSE_ALV_FIELDCATALOG_MERGE时,改用自己定义,则显示正常, 是不是call这个function 有什么要求呢?
回复

使用道具 举报

千问 | 2008-2-13 12:43:03 | 显示全部楼层
强烈建议不要图方便而使用 REUSE_ALV_FIELDCATALOG_MERGE去导出fieldcat,经常会不知原因的出错,建议还是自己动动手写进去
回复

使用道具 举报

千问 | 2008-2-13 12:43:03 | 显示全部楼层
看提示信息怪怪的,貌似有一行源代码超过72列了?
建议楼主贴一下代码
回复

使用道具 举报

千问 | 2008-2-13 12:43:03 | 显示全部楼层
恩,才看到,用了REUSE_ALV_FIELDCATALOG_MERGE。
同意楼上的说法,自己写FIELDCATALOG吧,不麻烦
回复

使用道具 举报

千问 | 2008-2-13 12:43:03 | 显示全部楼层
REPORTztry2.
TABLES:ce1gds1,coep.
TYPE-POOLS:slis.
DATA: t_layout TYPE slis_layout_alv,
g_repid LIKE sy-repid,
t_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA: BEGIN OF t_out OCCURS 0,
ww111 LIKE ce1gds1-ww111,"Project order
erlos LIKE ce1gds1-erlos, "Revenue
vv030 LIKE ce1gds1-vv030, "Other income
vv708 LIKE ce1gds1-vv708, "Tpersonnel costs
vv145 LIKE ce1gds1-vv145, "Zpersonnel costs
vv960 LIKE ce1gds1-vv960, "Raw/service material
vv142 LIKE ce1gds1-vv142, "Software costs
vv720 LIKE ce1gds1-vv720, "Depreciation
vv143 LIKE ce1gds1-vv143, "Moverhead
vv131 LIKE ce1gds1-vv131, "Subcon overhead
vv121 LIKE ce1gds1-vv121, "Adm.O.H
vv111 LIKE ce1gds1-vv111, "Sales O.H
vvk20 LIKE ce1gds1-vvk20, "Other costs
vv144 LIKE ce1gds1-vv144, "Other expense
vv722 LIKE ce1gds1-vv722, "Assessment
END OF t_out.
DATA: t_tmp LIKE t_out OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF t_coep OCCURS 0,
objnr LIKE coep-objnr,
kstar LIKE coep-kstar,
wkgbtr LIKE coep-wkgbtr,
END OF t_coep.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_kokrs FOR ce1gds1-kokrs OBLIGATORY NO-EXTENSION,

s_gjahr FOR ce1gds1-gjahr OBLIGATORY NO-EXTENSION,

s_perde FOR ce1gds1-perde OBLIGATORY NO-EXTENSION.
SELECTION-SCREEN:END OF BLOCK b1.
START-OF-SELECTION.
PERFORM get_data.
PERFORM display_data.
FORM get_data.
select * into corresponding fields of table t_out
from ce1gds1
where perde in s_perde
and gjahr in s_gjahr
and ww111''.
ENDFORM.
"get_data
FORM display_data.
g_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = g_repid
i_internal_tabname = 'T_OUT'
i_inclname = g_repid
CHANGING
ct_fieldcat= t_fieldcat.
*********
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_interface_check= ' '
i_callback_program = g_repid
i_grid_title = 'Project income and lose report'
is_layout
= t_layout
it_fieldcat= t_fieldcat[]
i_default
= 'X'
i_save
= 'A'
TABLES
t_outtab = t_out.
ENDFORM.
"display_data
上面代码我在两个程式中运行,一个可以正常显示,一个就报2楼错误,当把CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' 改成自定义时,则可以正常显示
回复

使用道具 举报

千问 | 2008-2-13 12:43:03 | 显示全部楼层
2个程序不同的地方是 program name. 看了下那个function, 有些怀疑出错的程序的程序名是不是过长? 在调用function里面的 concatenate
'TABL'
sy-langu
i_internal_tabname
i_program_name
i_inclname
into c73 separated by space. 这段的时候溢出?
仅仅猜测,你可以改改看看.
回复

使用道具 举报

千问 | 2008-2-13 12:43:03 | 显示全部楼层
还有一个程式是ztry 所以应该不是程式名的问题,刚在网上搜了下,可能是下面所说的原因
http://www.cnblogs.com/qiangsheng/archive/2008/02/05/813514.html
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行