zoukankan      html  css  js  c++  java
  • ALV报表——选择屏幕SELECT-OPTION变量赋值

    ABAP选择屏幕变量赋值

    运行效果:

    代码:

    ************************************************************************
    * Program Name      :
    * Descriptions      :
    * T-Code            :
    * Updates Tables    :
    * Input  Parameters :
    * Output Parameters :
    * Return Codes      :
    * Special Logic     :
    * Includes          :
    ************************************************************************
    * Modification Log
    ************************************************************************
    *   Date   Ver. Programmer   Descriptions
    * -------- ---- ------------ -------------------------------------------
    * 2011 01.01  Original Create
    *
    ************************************************************************
    REPORT ZMMRTEST.
    ***********************************************************************
    * Tables Definitions
    ************************************************************************
    *TABLES:.
    ************************************************************************
    TABLES: mard.
    * Data Definitions
    ************************************************************************
    
    ************************************************************************
    * Includes Module
    ************************************************************************
    
    ************************************************************************
    * Selection Screen
    ************************************************************************
    PARAMETERS: p_werks LIKE marc-werks DEFAULT '2000'.
    SELECT-OPTIONS: s_date FOR sy-datum,  "日期范围
                             s_matnr FOR mard-matnr,
                             s_lgort  FOR mard-lgort.
    
    ************************************************************************
    * Initialization
    ************************************************************************
    INITIALIZATION.
     PERFORM screen_data.
    ************************************************************************
    * At Selection Screen
    ************************************************************************
    AT SELECTION-SCREEN.
    
    ************************************************************************
    * At Selection Screen Output
    ************************************************************************
    AT SELECTION-SCREEN OUTPUT.
    
    ************************************************************************
    * Report Format
    ************************************************************************
    TOP-OF-PAGE.
    
    END-OF-PAGE.
    ************************************************************************
    * Main Process
    ************************************************************************
    START-OF-SELECTION.
    
    END-OF-SELECTION.
    
    FORM screen_data.
      DATA:  lt_mdlg  LIKE mdlg occurs 0 WITH HEADER LINE.
    
      DATA: l_firstday_tm TYPE sy-datum, "本月第一天
                l_lastday_lm TYPE sy-datum, "上个月最后一天
                l_firstday_lm TYPE sy-datum. "上个月第一天
    
      CONCATENATE sy-datum+(6) '01' INTO l_firstday_tm.
      l_lastday_lm = l_firstday_tm - 1.
      CONCATENATE l_lastday_lm+(6) '01' INTO l_firstday_lm.
    
      "上个月范围
      s_date-sign     = 'I'.
      s_date-option = 'BT'.
      s_date-low = l_firstday_lm.
      s_date-high = l_lastday_lm.
      APPEND s_date.CLEAR s_date.
    
      "单一值物料
      s_matnr-sign = 'I'.
      s_matnr-option = 'EQ'.
      s_matnr-low = 'ATBA3002-XX'.
      APPEND s_matnr.CLEAR s_matnr.
    
      s_matnr-sign = 'I'.
      s_matnr-option = 'EQ'.
      s_matnr-low = 'C60011-14-BT'.
      APPEND s_matnr.CLEAR s_matnr.
    
      IF p_werks = '2000'.
        SELECT * INTO TABLE lt_mdlg
                     FROM mdlg
                     WHERE berid = '2000_ND'.
      ELSEIF p_werks = '3000'.
        SELECT * INTO TABLE lt_mdlg
                     FROM mdlg
                     WHERE berid = '3000_ND'.
      ENDIF.
    
      "不包含单一值
      LOOP AT lt_mdlg.
        s_lgort-sign = 'E'.
        s_lgort-option = 'EQ'.
        s_lgort-low = lt_mdlg-lgort.
        APPEND s_lgort.CLEAR s_lgort.
      ENDLOOP.
    
    ENDFORM.
    木叶飞舞之处,火亦生生不息
  • 相关阅读:
    Leo程序员羊皮卷文摘(更新ing)
    ubuntu下的yuv播放器
    浏览器之一
    海量数据处理常用思路和方法(zh)
    我本将心向明月,奈何明月照沟渠
    转载光纤通信之父
    重装系统或是更换电脑之后,Foxmail的恢复
    关于录制Linux视频
    Linux之路(原发表于07年,现在搬到博客)
    Gentoo安装 miniCD+stage3
  • 原文地址:https://www.cnblogs.com/StephenAmell/p/8991229.html
Copyright © 2011-2022 走看看