ABAP--REUSE ALV GRID DISPLAY的i callback user command的调用跟踪摘抄

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

1、跟踪调用关系列表

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
 主程序类型处理过程名代码单元
1ZHRR0005EVENTEND-OF-SELECTION  
2SAPLSLVC_FULLSCREENFUNCTIONREUSE_ALV_GRID_DISPLAY LSLVC_FULLSCREENU01
3SAPLSLVC_FULLSCREENMODULE (PAI)PAI LSLVC_FULLSCREENI01
4SAPLSLVC_FULLSCREENFormPAI LSLVC_FULLSCREENF01
5CL_GUI_CFWMETHODDISPATHCL_GUI_CFWCL_GUI_CFW====================CM001
6CL_GUI_ALV_GRIDMETHODDISPATHCL_GUI_ALV_GRID 
7SAPLSLVC_FULLSCREENMETHODHANDLE_DOUBLE_CLICKLCL_EVENT_RECEIVERLSLVC_FULLSCREENTOP
8SAPLSLVC_FULLSCREENFORMMETHOD_DOUBLE_CLICK LSLVC_FULLSCREENF02
9SAPLSLVC_FULLSCREENFORMUSER_COMMAND LSLVC_FULLSCREENF01
10ZHRR0005FORMUSER_COMMAND  

 2、各个函数代码摘抄(红色为断点处)
第2步代码摘抄
function reuse_alv_grid_display.                            "#EC *
.....
  if i_screen_start_column is initial and
     i_screen_start_line   is initial and
     i_screen_start_column   is initial and
     i_screen_end_line     is initial.
    gt_grid-flg_popup = space.
    call screen 500.
  else.
    gt_grid-flg_popup = 'X'.
    call screen 700
              starting at i_screen_start_column i_screen_start_line
              ending   at i_screen_end_column i_screen_end_line.
  endif.
.....
endfunction.

第3步代码摘抄
屏幕500
process after input.
  module pai.
module pai input.
 
perform pai.
endmodule.                             " PAI  INPUT

第4步代码摘抄
form pai.
.....
      when '&IC1'.
        if not gt_grid-s_layout-f2code is initial.
          perform method_double_click using l_okcode.
        endif.
      when others.
        if l_okcode(4) eq '%_GC'.
          call method cl_gui_cfw=>dispatch.
          l_okcode = g_temp_ok_code.    "via double_click
        else.
          perform user_command using l_okcode lflg_refresh lflg_exit
                                     ls_stable.
          if lflg_exit = 'X'.
            e_exit_caused_by_caller = 'X'.
            perform exit.
          else.
*           IF LFLG_REFRESH = 'X'.
            if not lflg_refresh is initial.
              if lflg_refresh = 'X'.
                call method gt_grid-grid->refresh_table_display
                  exporting
                    is_stable = ls_stable.
              elseif lflg_refresh = 'S'.
                call method gt_grid-grid->refresh_table_display
                  exporting
                    is_stable      = ls_stable
                    i_soft_refresh = 'X'.
              endif.
              if not gt_grid-i_callback_top_of_page is initial.
                call method gt_grid-grid->list_processing_events
                  exporting
                    i_event_name = 'TOP_OF_PAGE'
                    i_dyndoc_id  = gt_grid-top.
              endif.
              if not gt_grid-i_callback_end_of_list is initial.
                call method gt_grid-grid->list_processing_events
                  exporting
                    i_event_name = 'END_OF_LIST'
                    i_dyndoc_id  = gt_grid-bottom.
              endif.
            endif.
          endif.
        endif.
....
endform.

第5步代码摘抄(CL_GUI_CFW)
METHOD DISPATCH .
   if  IS_SHELLEVENT = 'X' and eventid = 15.
      call method handle_dragdrop_event
        exporting
           SHELLID           = MY_SHELL
           CARGO             = CARGO.
   else.
*   Notify object
    CALL METHOD CFW_SUBSCRIBER-REF->DISPATCH
      EXPORTING
        EVENTID           = EVENTID
        IS_SHELLEVENT     = IS_SHELLEVENT
        CARGO             = CARGO
        IS_SYSTEMDISPATCH = SPACE.
   endif.
   call method pop_event
         exporting current_event = l_event.
...
ENDMETHOD.

第6步代码摘抄(CL_GUI_ALV_GRID)
METHOD DISPATCH .
      call method cl_gui_cfw=>flush.
      append ls_row to lt_row.
        call method me->map_row_to_roid
          exporting
            it_index_rows = lt_row
          importing
            et_row_no     = lt_roid.
        read table lt_roid into ls_row_no index 1.

      read table m_cl_variant->mt_fieldcatalog into ls_fieldcat
                 with key fieldname = ls_col-fieldname.

      if sy-subrc eq 0.
        if not mr_trace is initial.
          call method mr_trace->add_trace_item
            exporting
              i_trace_item = 'EVENT: DOUBLE_CLICK'
              ir_variant   = m_cl_variant
              it_data      = mt_data
              it_info      = mt_info.
        endif.
        raise event double_click exporting e_row     = ls_row
                                           e_column  = ls_col
                                           es_row_no = ls_row_no.
...
ENDMETHOD.


第7步代码摘抄
  method handle_after_user_command.
    g_after = 'A'.
    perform event_exit_check using e_ucomm
                                   g_after.
    if g_after = 'X'.
      perform method_user_command using e_ucomm.
    endif.

    if not gt_grid-i_callback_top_of_page is initial.
      call method gt_grid-grid->list_processing_events
        EXPORTING
          i_event_name = 'TOP_OF_PAGE'
          i_dyndoc_id  = gt_grid-top.
    endif.
    if not gt_grid-i_callback_end_of_list is initial.
      call method gt_grid-grid->list_processing_events
        EXPORTING
          i_event_name = 'END_OF_LIST'
          i_dyndoc_id  = gt_grid-bottom.
    endif.

    clear g_after.
  endmethod.                    "handle_after_user_command
*
  method handle_data_changed.
    perform method_data_changed using er_data_changed.
  endmethod.                    "handle_data_changed
*
  method handle_top_of_page.
    perform method_top_of_page using e_dyndoc_id.
  endmethod.                    "handle_top_of_page

  method handle_end_of_page.
    perform method_end_of_page.
  endmethod.                    "handle_end_of_page

  method handle_double_click.
    perform method_double_click using g_temp_ok_code.
  endmethod.                    "handle_double_click

第8步代码摘抄
form method_double_click using r_ucomm type sy-ucomm.
  data: l_ucomm type sy-ucomm.
  data: l_save_ucomm   type sy-ucomm.
  data: lflg_refresh(1) type c.
  data: lflg_exit(1) type c.
  data: ls_stable type lvc_s_stbl.
*
  l_ucomm = gt_grid-s_layout-f2code.
  if l_ucomm(1) = '&'.
    call method gt_grid-grid->set_function_code
      changing
        c_ucomm = l_ucomm.
  else.
    if l_ucomm = space.
      l_ucomm = '&IC1'.
    endif.
    l_save_ucomm = l_ucomm.
    perform user_command using l_ucomm
                               lflg_refresh lflg_exit ls_stable.
    if l_ucomm ne l_save_ucomm.
      r_ucomm = l_ucomm.
    else.
      r_ucomm = space.
    endif.
    if lflg_exit = 'X'.
      e_exit_caused_by_caller = 'X'.
      perform exit.
    else.
      if lflg_refresh = 'X'.
        call method gt_grid-grid->refresh_table_display
          exporting
            is_stable = ls_stable.
      elseif lflg_refresh = 'S'.
        call method gt_grid-grid->refresh_table_display
          exporting
            is_stable      = ls_stable
            i_soft_refresh = 'X'.
      endif.
    endif.
  endif.
endform.                               " METHOD_DOUBLE_CLICK

第9步代码摘抄
form user_command using r_ucomm type sy-ucomm
                        r_refresh
                        r_exit
                        rs_stable type lvc_s_stbl.
  data: ls_selfield type slis_selfield.
*
  check not gt_grid-i_callback_user_command is initial.
  check not i_callback_program is initial.

  perform selfield_get using ls_selfield.
  if r_ucomm is initial.
    r_ucomm = '&IC1'.
  endif.

  perform (gt_grid-i_callback_user_command)
                                    in program (i_callback_program)
                                    using r_ucomm
                                          ls_selfield.

  rs_stable-row = ls_selfield-row_stable.
  rs_stable-col = ls_selfield-col_stable.

  r_refresh = ls_selfield-refresh.
  r_exit    = ls_selfield-exit.
endform.                    "user_command

           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow
这里写图片描述
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值