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

SAP 动态选择屏幕实例

时间:2020-06-09 00:06:12      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:类型   when   for   oop   arc   ons   创建时间   code   refresh   

DATA:BEGIN OF gs_sel,
       werks TYPE marc-werks, "工厂
       matnr TYPE mara-matnr, "物料
       mtart TYPE mara-mtart, "物料类型
       beskz TYPE marc-beskz, "采购类型
       ersda TYPE mara-ersda, "创建时间
     END OF gs_sel.


SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE TEXT-001.
PARAMETERS:p_but1  RADIOBUTTON GROUP g1 DEFAULT X USER-COMMAND cm1,
           p_but2  RADIOBUTTON GROUP g1,
           p_chek1 AS CHECKBOX DEFAULT X.
SELECTION-SCREEN END OF BLOCK blk1.

SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS:
    s_werks FOR gs_sel-werks MODIF ID ty1 OBLIGATORY DEFAULT gco_9020,"工厂
    s_matnr FOR gs_sel-matnr MODIF ID ty1,"物料
    s_mtart FOR gs_sel-mtart MODIF ID ty2, "物料类型
    s_beskz FOR gs_sel-beskz MODIF ID ty2, "采购类型
    s_ersda FOR gs_sel-ersda MODIF ID ty2. "创建时间
SELECTION-SCREEN END OF BLOCK blk2.

AT SELECTION-SCREEN OUTPUT.
  IF p_but2 IS NOT INITIAL.
    PERFORM frm_get_date.
  ENDIF.

  LOOP AT SCREEN.
    CASE screen-group1.
      WHEN TY1.
        IF screen-name = S_MATNR-LOW.
          IF p_but1 IS NOT INITIAL.
            screen-required = 2.
          ENDIF.
        ENDIF.

      WHEN TY2.
        IF p_but2 IS INITIAL.
          screen-active = 0.
        ELSE.
          screen-active = 1.
          IF screen-name = S_ERSDA-LOW.
            screen-required = 2.
          ENDIF.
        ENDIF.
    ENDCASE.
    MODIFY SCREEN.
  ENDLOOP.

AT SELECTION-SCREEN ON s_ersda.
  IF p_but2 IS NOT INITIAL AND
    sy-ucomm <> CM1 AND s_ersda IS INITIAL.
    MESSAGE e001(00) WITH TEXT-003.
  ENDIF.

AT SELECTION-SCREEN ON s_matnr.
  IF p_but1 IS NOT INITIAL AND
     sy-ucomm <> CM1 AND s_matnr IS INITIAL.
    MESSAGE e001(00) WITH TEXT-003.
  ENDIF.


*&---------------------------------------------------------------------*
*&                FRM_GET_DATE
*&---------------------------------------------------------------------*
FORM frm_get_date.
*  REFRESH:s_ersda.
  DELETE  s_ersda[]  WHERE  sign  EQ  space .
  s_ersda-high = sy-datum.
  CALL FUNCTION RP_CALC_DATE_IN_INTERVAL
    EXPORTING
      date      = s_ersda-high
      days      = 00
      months    = 1
      signum    = -
      years     = 00
    IMPORTING
      calc_date = s_ersda-low.
  APPEND s_ersda.

ENDFORM.

技术图片

 

 技术图片

 

SAP 动态选择屏幕实例

标签:类型   when   for   oop   arc   ons   创建时间   code   refresh   

原文地址:https://www.cnblogs.com/JackeyLove/p/13069255.html

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