码迷,mamicode.com
首页 > 其他好文 > 详细

OO ALV 后台运行时错误:Control Framework: Fatal error - GUI cannot be reached

时间:2016-07-21 14:30:47      阅读:786      评论:0      收藏:0      [点我收藏+]

标签:

这个错误的原因,是GUI容器依赖GUI的存在,因为它是在后台运行,没有GUI,因此控制错误。

可以通过做一些编码绕过这个。

* ALV Grid
DATA: R_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: R_CONTROL TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA: G_DOCK TYPE REF TO CL_GUI_DOCKING_CONTAINER.


MODULE STATUS_0100 OUTPUT.

  SET PF-STATUS LISTOUT1.
  SET TITLEBAR LIST1.

IF R_CONTROL IS INITIAL.
* Check whether the program is run in batch or foreground(判断是否后台运行)
    IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL.
* Run in foreground
      CREATE OBJECT R_CONTROL EXPORTING CONTAINER_NAME = CONTAINER_1.
      CREATE OBJECT R_GRID EXPORTING I_PARENT = R_CONTROL.
    ELSE.
* Run in background
      CREATE OBJECT R_GRID EXPORTING I_PARENT = G_DOCK.
    ENDIF.

* Structure ZBA_MARA1 is defined in DDIC as linetype
    CALL METHOD R_GRID->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
       I_STRUCTURE_NAME = MARA
      CHANGING
       IT_OUTTAB = ITAB.
  ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

 

OO ALV 后台运行时错误:Control Framework: Fatal error - GUI cannot be reached

标签:

原文地址:http://www.cnblogs.com/dy-debug/p/5691340.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!