关闭

Get the F4 help of a fiel based on the avlue of another help For Mulitple selection Field(联动的搜索帮助)

标签: Serach helpF4 help for multipleDYNP_VALUES_READF4IF_INT_TABLE_VALUE
275人阅读 评论(0) 收藏 举报
分类:

...

TABLES: tvko.
SELECT-OPTIONS: s_bukrs FOR tvko-bukrs,
                s_vkorg FOR tvko-vkorg.
*custom F4 help for Sales Org.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_vkorg-low.
  PERFORM form_f4help_vkorg.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_vkorg-high.
  PERFORM form_f4help_vkorg.

*&---------------------------------------------------------------------
*
*&      Form  form_f4help_vkorg
*&---------------------------------------------------------------------
*
*       text
*----------------------------------------------------------------------
*
FORM form_f4help_vkorg .

  DATA: BEGIN OF ty_vkorg,
          vkorg TYPE tvko-vkorg,
        END OF ty_vkorg.
  DATA: lt_dynpfields TYPE TABLE OF dynpread,
        ls_dynpfields TYPE dynpread,
        l_bukrs_low   TYPE tvko-bukrs,
        l_bukrs_high  TYPE tvko-bukrs,
        li_tab        LIKE TABLE OF ty_vkorg,
        li_ret       LIKE TABLE OF ddshretval.

  CLEAR: ls_dynpfields, lt_dynpfields.
  REFRESH: lt_dynpfields.

*1)Add the fields to be fetched from the screen to dynpread table.
  ls_dynpfields-fieldname = 'S_BUKRS-LOW'.
  APPEND ls_dynpfields TO lt_dynpfields.
  CLEAR: ls_dynpfields.
  ls_dynpfields-fieldname = 'S_BUKRS-HIGH'.
  APPEND ls_dynpfields TO lt_dynpfields.

*2)Fetch the values from the screen
  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname               = sy-repid
      dynumb               = sy-dynnr
    TABLES
      dynpfields           = lt_dynpfields
    EXCEPTIONS
      invalid_abapworkarea = 1
      invalid_dynprofield  = 2
      invalid_dynproname   = 3
      invalid_dynpronummer = 4
      invalid_request      = 5
      no_fielddescription  = 6
      invalid_parameter    = 7
      undefind_error       = 8
      double_conversion    = 9
      stepl_not_found      = 10
      OTHERS               = 11.

  READ TABLE lt_dynpfields INTO ls_dynpfields
                WITH KEY fieldname = 'S_BUKRS-LOW'.
  IF sy-subrc = 0.
    l_bukrs_low = ls_dynpfields-fieldvalue.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input  = l_bukrs_low
      IMPORTING
        output = l_bukrs_low.
  ENDIF.

  READ TABLE lt_dynpfields INTO ls_dynpfields
              WITH KEY fieldname = 'S_BUKRS-HIGH'.
  IF sy-subrc = 0.
    l_bukrs_high = ls_dynpfields-fieldvalue.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input  = l_bukrs_high
      IMPORTING
        output = l_bukrs_high.
  ENDIF.

*3)Select the data from the database table
  SELECT    vkorg  FROM  tvko INTO TABLE li_tab
        WHERE  bukrs  >= l_bukrs_low
          AND   bukrs <= l_bukrs_high.

*4) Display the data in the F4 help
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'VKORG'
      dynpprog        = sy-repid
      dynpnr          = '1000'
      dynprofield     = 'S_VKORG'
      window_title    = text-t01
      value_org       = 'S'
    TABLES
      value_tab       = li_tab
      return_tab      = li_ret
    EXCEPTIONS
      parameter_error = 1
      no_values_found
      =2
      OTHERS          = 3.


ENDFORM.                    " form_f4help_vkorg


 

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:117697次
    • 积分:2890
    • 等级:
    • 排名:第12320名
    • 原创:170篇
    • 转载:83篇
    • 译文:3篇
    • 评论:3条
    最新评论