选择屏幕部分应用

*实现目标
*1.按照选择屏幕的样式来实现。
*2.库存地点和工厂必输
*3.盘点日期设置初始值,要求设置的是选择范围,有上限和下限
*4.给会计年度添加搜索帮助,搜索帮助的范围从1880年-2014年,使用屏幕事件AT SELECTION-SCREEN ON VALUE-REQUEST FOR 。
*5.使用框按照屏幕样式将元素分别列在不同的框中
*6.当‘选择排序方式’打勾了之后,显示两个单选按钮‘按库存凭证排序’和‘按物理排序’;否则不显示
*7.在程序中定义内表,根据你在选择屏幕上维护的筛选条件,在数据库查找符合条件的数据放在内表中。
*---------------------------------begin----------------------------------------------------------------
TABLES:IKPF,ISEG.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001."使用框按照屏幕样式将元素分别列在不同的框中
PARAMETERS:P_WERKS TYPE IKPF-WERKS,
           P_LGORT TYPE IKPF-LGORT.
SELECT-OPTIONS:S_GIDAT FOR IKPF-GIDAT.
SELECT-OPTIONS:S_MATNR FOR ISEG-MATNR.
SELECT-OPTIONS:S_IBLNR FOR IKPF-IBLNR.
SELECT-OPTIONS:S_GJAHR FOR IKPF-GJAHR NO-EXTENSION.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002."使用框按照屏幕样式将元素分别列在不同的框中
PARAMETERS:A TYPE CHAR1 AS CHECKBOX USER-COMMAND F DEFAULT 'X',
           B TYPE CHAR1 RADIOBUTTON GROUP G1 MODIF ID B1,
           C TYPE CHAR1 RADIOBUTTON GROUP G1 MODIF ID B1.
SELECTION-SCREEN END OF BLOCK B2.

AT SELECTION-SCREEN OUTPUT."当‘选择排序方式’打勾了之后,显示两个单选按钮‘按库存凭证排序’和‘按物理排序’;否则不显示
  LOOP AT SCREEN.
    IF A = 'X'.
      IF SCREEN-GROUP1 = 'B1'.
        SCREEN-ACTIVE = 1.
        MODIFY SCREEN.
      ENDIF.
    ELSE.
      IF SCREEN-GROUP1 = 'B1'.
        SCREEN-ACTIVE = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDIF.
  ENDLOOP.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_GJAHR-LOW."给会计年度添加搜索帮助,搜索帮助的范围从1880年-2014年
  PERFORM DATA_GET USING S_GJAHR-LOW.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_GJAHR-HIGH."给会计年度添加搜索帮助,搜索帮助的范围从1880年-2014年
  PERFORM DATA_GET USING S_GJAHR-HIGH.

START-OF-SELECTION."在程序中定义内表,根据你在选择屏幕上维护的筛选条件,在数据库查找符合条件的数据放在内表中。
  IF B = 'X'.
    PERFORM SORT_LABST.
  ENDIF.
  IF C = 'X'.
    PERFORM SORT_MATNR.
  ENDIF.

FORM DATA_GET USING DATE1.

  DATA:DATE TYPE WORKFLDS-GKDAY.
  CALL FUNCTION 'F4_DATE'
    EXPORTING
      DATE_FOR_FIRST_MONTH         = SY-DATUM
    IMPORTING
      SELECT_DATE                  = DATE
    EXCEPTIONS
      CALENDAR_BUFFER_NOT_LOADABLE = 1
      DATE_AFTER_RANGE             = 2
      DATE_BEFORE_RANGE            = 3
      DATE_INVALID                 = 4
      FACTORY_CALENDAR_NOT_FOUND   = 5
      HOLIDAY_CALENDAR_NOT_FOUND   = 6
      PARAMETER_CONFLICT           = 7
      OTHERS                       = 8.
  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.

  IF SY-SUBRC = 0.
    DATE1 =  DATE.
  ENDIF.
ENDFORM.
*-------------------------------------------------由于盘点表没数据,换了库存表------------------------------------------
FORM SORT_MATNR .
  SELECT MARD~MATNR, MAKTX,WERKS,LGORT,LABST INTO TABLE @DATA(LT_MATNR)  FROM MARD  INNER JOIN MAKT ON MARD~MATNR = MAKT~MATNR UP TO 10 ROWS.
  SORT LT_MATNR BY MATNR LABST.

  LOOP AT LT_MATNR INTO DATA(LS_MATNR).
    WRITE:/ LS_MATNR-MATNR,LS_MATNR-LABST.
  ENDLOOP.
ENDFORM.

FORM SORT_LABST .
  SELECT MARD~MATNR, MAKTX,WERKS,LGORT,LABST INTO TABLE @DATA(LT_MATNR1)  FROM MARD  INNER JOIN MAKT ON MARD~MATNR = MAKT~MATNR UP TO 10 ROWS.
  SORT LT_MATNR1 BY LABST MATNR.

  LOOP AT LT_MATNR1 INTO DATA(LS_MATNR1)  .
    WRITE:/ LS_MATNR1-LABST,LS_MATNR1-MATNR.
  ENDLOOP.
ENDFORM.

选择屏幕部分应用_第1张图片

选择屏幕部分应用_第2张图片

选择屏幕部分应用_第3张图片

 

你可能感兴趣的:(选择屏幕部分应用)