• ALV 顶栏的按钮设定


    *&---------------------------------------------------------------------*
    *& Report  ZHJ_TEST01
    *&
    *&---------------------------------------------------------------------*
    *&
    *&
    *&---------------------------------------------------------------------*
    
    REPORT  zhj_test01.
    tables: cepct,t001,adrc,glpca,ztfi_pc_area,sscrfields,faglflext.
    
    data: g_bukrs_name(100) type c,
          g_budat_name(100) type c,
          g_query(1) type c.
    data:g_dynnr like sy-dynnr value '100'.
    
    SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
    SELECTION-SCREEN: BEGIN OF BLOCK blk WITH FRAME TITLE text-001.
    PARAMETERS: p_bukrs LIKE glpca-rbukrs DEFAULT '2101',
                p_gjahr LIKE glpca-ryear DEFAULT sy-datum(4).
    SELECT-OPTIONS: s_monat FOR glpca-poper NO-EXTENSION.
    SELECTION-SCREEN: END OF BLOCK blk.
    SELECTION-SCREEN END OF SCREEN 100.
    
    *SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
    *SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-001.
    *PARAMETERS: p_bukrsc LIKE glpca-rbukrs DEFAULT '2101'.
    *SELECTION-SCREEN: END OF BLOCK b2.
    *SELECTION-SCREEN END OF SCREEN 200.
    SELECTION-SCREEN: FUNCTION KEY 1,
                      FUNCTION KEY 2.
    SELECTION-SCREEN: BEGIN OF TABBED BLOCK sub FOR 15 LINES,
                      END OF BLOCK sub.
    
    *AT SELECTION-SCREEN.
    *  PERFORM sub_select_screen.
    
    *&---------------------------------------------------------------------*
    *& VALUE REQUEST :
    *&---------------------------------------------------------------------*
    
    *&---------------------------------------------------------------------*
    *& INITIALIZATION :
    *&---------------------------------------------------------------------*
    INITIALIZATION.
      sscrfields-functxt_01 = text-002.
      sscrfields-functxt_02 = text-003.
      sub-prog = sy-repid.
      sub-dynnr = g_dynnr.
      PERFORM sub_initialization.
    
    *&---------------------------------------------------------------------*
    *& START-OF-SELECTION:
    *&---------------------------------------------------------------------*
    START-OF-SELECTION.
      IF g_query EQ 'A'.
    *    PERFORM sub_get_data.
    *    PERFORM sub_data_process.
      ELSEIF g_query EQ 'B'.
    *    PERFORM sub_maintenace_view.
      ENDIF.
    *&---------------------------------------------------------------------*
    *&      Form  SUB_SELECT_SCREEN
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *  -->  p1        text
    *  <--  p2        text
    *----------------------------------------------------------------------*
    form SUB_SELECT_SCREEN .
    case sy-dynnr.
        when 100.
            case sscrfields-ucomm.
              when 'FC02'.
                sub-dynnr = 200.
              when others.
    *            perform sub_sreen_data_check.
    *            perform sub_check_bukrs using p_bukrs.
    *            perform sub_check_authority using p_bukrs.
    *            perform sub_check_config.
                g_query = 'A'."A
            endcase.
        when 200.
          case sscrfields-ucomm.
            when 'FC01'.
              sub-dynnr = 100.
            when others.
    *          perform sub_screen_check_bukrs.
    *          perform sub_check_bukrs using p_bukrsc.
    *          perform sub_check_authority using p_bukrsc.
              g_query = 'B'."B
          endcase.
      endcase.
    endform.                    " SUB_SELECT_SCREEN
    *&---------------------------------------------------------------------*
    *&      Form  SUB_INITIALIZATION
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *  -->  p1        text
    *  <--  p2        text
    *----------------------------------------------------------------------*
    form SUB_INITIALIZATION .
    * clear:g_bukrs_name,g_budat_name,gt_area,gt_prctr,gt_data,gt_result,
    *        gt_excel_output,gt_merge.
    *  refresh:gt_area,gt_prctr,gt_data,gt_result,gt_excel_output,gt_fieldcat,
    *          gt_merge.
    endform.                    " SUB_INITIALIZATION

    上面是用那个方法实现的.

    下面是用OO实现的

    *&---------------------------------------------------------------------*
    *& Report  ZHJ_TEST02
    *&
    *&---------------------------------------------------------------------*
    *&
    *&
    *&---------------------------------------------------------------------*
    
    REPORT  ZHJ_TEST02.
    
    *&---------------------------------------------------------------------*
    *& VALUE REQUEST :
    *&---------------------------------------------------------------------*
    
    *&---------------------------------------------------------------------*
    *& INITIALIZATION :
    *&---------------------------------------------------------------------*
    
    
    *tables: cepct,t001,adrc,glpca,ztfi_pc_area,sscrfields,faglflext.
    
    *REPORT demo_sel_screen_function_key.
    
    TABLES sscrfields.
    
    SELECTION-SCREEN BEGIN OF SCREEN 1100.
    PARAMETERS: p_carrid TYPE s_carr_id,
                p_cityfr TYPE s_from_cit.
    SELECTION-SCREEN: FUNCTION KEY 1,
                      FUNCTION KEY 2.
    SELECTION-SCREEN END OF SCREEN 1100.
    
    AT SELECTION-SCREEN.
      CASE sscrfields-ucomm.
          WHEN'FC01'.
          p_carrid = 'LH'.
          p_cityfr = 'Frankfurt'.
        WHEN 'FC02'.
          p_carrid = 'UA'.
          p_cityfr = 'Chicago'.
      ENDCASE.
    
    CLASS start DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS main.
    ENDCLASS.
    
    CLASS start IMPLEMENTATION.
      METHOD main.
    
        sscrfields-functxt_01 = 'LH'.
        sscrfields-functxt_02 = 'UA'.
    
        CALL SELECTION-SCREEN 1100 ."STARTING AT 10 10.
    
      ENDMETHOD.
    ENDCLASS.
    
    START-OF-SELECTION.
      start=>main( ).
  • 相关阅读:
    Oracle 安装安全补丁过程中出现的问题
    Oracle 设置日志模式
    Oracle 设置archivelog错误解决方案
    sum() over() 函数的使用
    C盘清理,移动node 依赖和缓存文件
    ol设置最佳可视范围和限制缩放
    flex弹性布局模式下文字超出显示省略号
    查看svn本地账户和密码
    flutter apk启动闪退问题
    More than one file was found with OS independent path 'lib/armeabi-v7a/libflutter.so'
  • 原文地址:https://www.cnblogs.com/huangjianisgood/p/3205177.html
Copyright © 2020-2023  润新知