SAP 动态选择屏幕实例

Posted jackeylove

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SAP 动态选择屏幕实例相关的知识,希望对你有一定的参考价值。

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 动态选择屏幕实例的主要内容,如果未能解决你的问题,请参考以下文章

支持动态或静态片段的不同屏幕尺寸?

element Cascader 级联选择器动态加载实例

通过 Feature Level 动态控制 SAP Spartacus 的页面显示

sap screen design

处理屏幕旋转上的片段重复(带有示例代码)

何时使用活动转换与动态片段的模式