ABAP报表返回选择屏幕时回到上次的页签

如下,报表选择屏幕有三个页签:

*----------------------------------------------------------------------*                                         
CONSTANTS: gc_push1(5) TYPE C VALUE 'PUSH1',
           gc_push2(5) TYPE C VALUE 'PUSH2',
           gc_push3(5) TYPE C VALUE 'PUSH3'.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK B11 WITH FRAME TITLE T011.
   SELECT-OPTIONS : s_werks FOR vbap-werks,                            
                    s_matkl FOR t023t-matkl.
SELECTION-SCREEN END OF BLOCK B11.
SELECTION-SCREEN END OF SCREEN 100.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK B21 WITH FRAME TITLE T021.
   SELECT-OPTIONS : s_werks2 FOR vbap-werks,                           
                    s_lgort2 FOR vbap-lgort,
                    s_matkl2 FOR t023t-matkl.
SELECTION-SCREEN END OF BLOCK B21.
SELECTION-SCREEN END OF SCREEN 200.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN.
  SELECTION-SCREEN BEGIN OF BLOCK b31 WITH FRAME TITLE T031.
    SELECT-OPTIONS: s_werks3 FOR vbap-werks,
                    s_matnr3 FOR mara-matnr,
                    s_lgort3 FOR vbap-lgort.
  SELECTION-SCREEN END OF BLOCK B31.
SELECTION-SCREEN END OF SCREEN 300.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
SELECTION-SCREEN: BEGIN OF TABBED BLOCK blk1 for 16 LINES,
                  TAB (20) gct_1 USER-COMMAND push1 DEFAULT SCREEN 100,
                  TAB (20) gct_2 USER-COMMAND push2 DEFAULT SCREEN 200,
                  TAB (20) gct_3 USER-COMMAND push3 DEFAULT SCREEN 300,
                  END OF BLOCK blk1.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
INITIALIZATION.
  PERFORM fm_init.

*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
AT SELECTION-SCREEN OUTPUT.
  PERFORM fm_set_screen.

*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
AT SELECTION-SCREEN.
  PERFORM fm_authority_check.
  PERFORM fm_screen_check.
  PERFORM fm_process_screen.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
START-OF-SELECTION.
  PERFORM fm_alv.

*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
END-OF-SELECTION.

*----------------------------------------------------------------------*

首先,在FORM fm_init中取内存中上次用到的页签,如果是第一次,则默认设置为subscreen:100

*----------------------------------------------------------------------*
FORM fm_init.
  T011 = '检索参数'.
  T021 = '检索参数'.
  T031 = '检索参数'.
  gct_1 = '按单***'.
  gct_2 = '按单***'.
  gct_3 = '按库***'.

*  获取上次用的子屏幕
  IMPORT gv_dynnr TO gv_dynnr FROM MEMORY ID 'ZSDD_025'.
  blk1-prog = sy-repid.
  IF gv_dynnr = space.
    blk1-dynnr = 100.
    gv_push = gc_push1.
    blk1-activetab = gc_push1.
  ELSE.
    blk1-dynnr = gv_dynnr.
    IF gv_dynnr = 300.
      gv_push = gc_push3.
      blk1-activetab = gc_push3.
    ENDIF.
    IF gv_dynnr = 200 .
      gv_push = gc_push2.
      blk1-activetab = gc_push2.
    ENDIF.
    IF gv_dynnr = 100 .
      gv_push = gc_push1.
      blk1-activetab = gc_push1.
    ENDIF.
  ENDIF.
ENDFORM.
*----------------------------------------------------------------------*

然后在FORM fm_screen_checkF8(ONLI)执行的时候,将当前页签编号写入内存:

*----------------------------------------------------------------------*
FORM fm_screen_check.
  IF sscrfields-ucomm = gc_push1 OR sscrfields-ucomm = gc_push2 OR sscrfields-ucomm = gc_push3.
    gv_push = sscrfields-ucomm.
  ENDIF.

*  CHECK sy-fleng = 18.

* F8的时候将页签编号存到内存
  IF sscrfields-ucomm = 'ONLI'.
*   按单***
    IF gv_push = gc_push1 OR gv_push = space.
      gv_dynnr = 100.
      gv_push = gc_push1.
      EXPORT gv_dynnr FROM gv_dynnr TO MEMORY ID 'ZSDD_025'.
    ENDIF.

*   按单***
    IF gv_push = gc_push2.
      gv_dynnr = 200.
      gv_push = gc_push2.
      EXPORT gv_dynnr FROM gv_dynnr TO MEMORY ID 'ZSDD_025'.
    ENDIF.

*    按库***
    IF gv_push = gc_push3.
      gv_dynnr = 300.
      gv_push = gc_push3.
      EXPORT gv_dynnr FROM gv_dynnr TO MEMORY ID 'ZSDD_025'.
    ENDIF.
  ENDIF.

ENDFORM.
*----------------------------------------------------------------------*

完成.

<style></style>
上一篇:jQuery实现下拉框默认选中


下一篇:如何通过任何列中的索引值和值搜索pandas数据框