欢迎来到萧静默的博客

书山有路勤为径,学海无涯苦作舟。

同屏幕直接显示ALV

REPORT 111.
DATA: LO_DOCK TYPE REF TO CL_GUI_DOCKING_CONTAINER.
DATA: LO_GRID TYPE REF TO CL_GUI_ALV_GRID.

PARAMETERS P_CARRID TYPE SPFLI-CARRID DEFAULT 'AA'.

AT SELECTION-SCREEN OUTPUT.
  SELECT *
  FROM SPFLI
  WHERE CARRID = @P_CARRID
  INTO TABLE @DATA(LT_SPFLI)
        UP TO 30 ROWS.

  CREATE OBJECT LO_DOCK
    EXPORTING
      SIDE      = CL_GUI_DOCKING_CONTAINER=>DOCK_AT_RIGHT       "DOCKING停靠位置
      EXTENSION = 900                                           "DOCKING宽度
      REPID     = SY-REPID
      DYNNR     = SY-DYNNR.

  IF LO_GRID IS INITIAL.
    CREATE OBJECT LO_GRID
      EXPORTING
        I_PARENT          = LO_DOCK      "获取lo_dock到lo_grid
      EXCEPTIONS
        ERROR_CNTL_CREATE = 1
        ERROR_CNTL_INIT   = 2
        ERROR_CNTL_LINK   = 3
        ERROR_DP_CREATE   = 4.
  ENDIF.

  CALL METHOD LO_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
      I_STRUCTURE_NAME              = 'SPFLI'
    CHANGING
      IT_OUTTAB                     = LT_SPFLI
    EXCEPTIONS
      INVALID_PARAMETER_COMBINATION = 1
      PROGRAM_ERROR                 = 2
      TOO_MANY_LINES                = 3
      OTHERS                        = 4.

 

 

 

posted @ 2022-09-07 17:13  萧静默  阅读(193)  评论(0编辑  收藏  举报