F4 EXIT

F4IF_SHLP_EXIT_EXAMPLE

将其复制至自定义 函数 ZFM_XXX

 

 

FUNCTION zmc_fm_f4_jgbm_f.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  TABLES
*"      SHLP_TAB TYPE  SHLP_DESCT
*"      RECORD_TAB STRUCTURE  SEAHLPRES
*"  CHANGING
*"     VALUE(SHLP) TYPE  SHLP_DESCR
*"     VALUE(CALLCONTROL) LIKE  DDSHF4CTRL STRUCTURE  DDSHF4CTRL
*"----------------------------------------------------------------------


  DATA:BEGIN OF lt_tab OCCURS 0,
       jgbm       TYPE zmcde_jgbm,
       jgbm_long  TYPE zmcde_jgbm_long,
       bbjg       TYPE zmcde_bbjg,
      END OF lt_tab.

  DATA: r_jgbm TYPE RANGE OF zmcde_jgbm WITH HEADER LINE,
        r_jgbm_long TYPE RANGE OF zmcde_jgbm_long WITH HEADER LINE,
        r_bbjg TYPE RANGE OF zmcde_bbjg WITH HEADER LINE,
        ddshselops TYPE ddshselopt.


  IF callcontrol-step = 'SELECT'.

    CLEAR :r_jgbm[],r_jgbm_long[],r_bbjg[].

    LOOP AT shlp-selopt INTO ddshselops.
      CASE ddshselops-shlpfield.
        WHEN 'JGBM'.

          MOVE-CORRESPONDING ddshselops TO r_jgbm.
          APPEND r_jgbm.
        WHEN 'JGBM_LONG'.
          MOVE-CORRESPONDING ddshselops TO r_jgbm_long.
          APPEND r_jgbm_long.
        WHEN 'BBJG'.
          MOVE-CORRESPONDING ddshselops TO r_bbjg.
          APPEND r_bbjg.

      ENDCASE.
    ENDLOOP.

**根据输入参数查询数据
    DATA l_lines TYPE i.
    DATA lt_zmc_cjgbm TYPE TABLE OF zmc_cjgbm WITH HEADER LINE.
    CLEAR :lt_tab[],lt_zmc_cjgbm[].
    CALL FUNCTION 'ZMC_FM_GET_JGBM_ALL'
      EXPORTING
        im_type = 'C'
      TABLES
        et_jgbm = lt_zmc_cjgbm[].


    IF r_jgbm[] IS NOT INITIAL .
      DELETE lt_zmc_cjgbm WHERE jgbm NOT IN r_jgbm[].
    ENDIF.

    LOOP AT lt_zmc_cjgbm.
      CLEAR lt_tab .

      MOVE-CORRESPONDING lt_zmc_cjgbm TO lt_tab .

      CALL FUNCTION 'ZMC_FM_GET_JGBM_NAME'
        EXPORTING
          im_jgbm  = lt_tab-jgbm
        IMPORTING
          em_dtext = lt_tab-jgbm_long.

      IF lt_tab-jgbm_long NOT IN r_jgbm_long.
        CONTINUE.
      ENDIF.

      lt_tab-bbjg = lt_zmc_cjgbm-bbjg.

      APPEND lt_tab.

    ENDLOOP.



*将查询结果回执到屏幕上来
    CALL FUNCTION 'F4UT_RESULTS_MAP'
*       EXPORTING
*         SOURCE_STRUCTURE         =
*         APPLY_RESTRICTIONS       = ' '
      TABLES
        shlp_tab                 = shlp_tab
        record_tab               = record_tab
        source_tab               = lt_tab
      CHANGING
        shlp                     = shlp
        callcontrol              = callcontrol
     EXCEPTIONS
       illegal_structure        = 1
       OTHERS                   = 2
              .
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
*下一个时间点直接转到DISP,否则无法再屏幕上显示帮助列表
    callcontrol-step = 'DISP'.  ""

  ENDIF.






ENDFUNCTION.
View Code

 

posted @ 2024-04-23 16:11  蜡哲图  阅读(10)  评论(0编辑  收藏  举报
目录内容