zoukankan      html  css  js  c++  java
  • SAP 实例 10 List Box with value list from input help

    *&---------------------------------------------------------------------*
    *& Report  DEMO_DROPDOWN_LIST_BOX                                      *
    *&---------------------------------------------------------------------*
    
    REPORT demo_dropdown_list_box.
    
    * Dynpro Interfaces
    
    TABLES sdyn_conn.
    DATA   ok_code TYPE sy-ucomm.
    
    * Local class definition
    
    CLASS dynpro_utilities DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS value_help.
    ENDCLASS.
    
    * Local class implementation
    
    CLASS dynpro_utilities IMPLEMENTATION.
      METHOD value_help.
        TYPES: BEGIN OF carrid_line,
                 carrid   TYPE spfli-carrid,
                 carrname TYPE scarr-carrname,
               END OF carrid_line.
        DATA carrid_list TYPE STANDARD TABLE OF carrid_line.
        SELECT carrid, carrname
                    FROM scarr
                    INTO CORRESPONDING FIELDS OF TABLE @carrid_list.
        CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
             EXPORTING
                  retfield        = 'CARRID'
                  value_org       = 'S'
             TABLES
                  value_tab       = carrid_list
             EXCEPTIONS
                  parameter_error = 1
                  no_values_found = 2
                  OTHERS          = 3.
        IF sy-subrc <> 0.
          ...
        ENDIF.
      ENDMETHOD.
    ENDCLASS.
    
    * Event Blocks and Dialog Modules
    
    START-OF-SELECTION.
      CALL SCREEN 100.
    
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SCREEN_100'.
    ENDMODULE.
    
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    
    MODULE user_command_0100 INPUT.
      CASE ok_code.
        WHEN 'SELECTED'.
          MESSAGE i888(sabapdemos) WITH sdyn_conn-carrid.
      ENDCASE.
    ENDMODULE.
    
    MODULE create_dropdown_box INPUT.
      dynpro_utilities=>value_help( ).
    ENDMODULE.

    Description

    The static dynpro number of dynpro 100 is 100. The screen contains a single input field, namely the component SDYN_CONN-CARRID. Its attribute dropdown is "Listbox", the output length is 20, the attribute value list is empty, and it is assigned function code SELECTED. The functions BACK, EXIT, and CANCEL are defined in the GUI status with the function type E. The screen flow logic is as follows:

    PROCESS BEFORE OUTPUT.
      MODULE status_0100.
    PROCESS AFTER INPUT.
      MODULE cancel AT EXIT-COMMAND.
      MODULE user_command_0100.
    PROCESS ON VALUE-REQUEST.
      FIELD sdyn_conn-carrid MODULE create_dropdown_box.

    The user is not allowed to enter values in the screen field. When the user selects the input field on dynpro 100, the system displays a list box. The Value list attribute is empty, so the system launches the input mechanism. In this case, the event block PROCESS ON VALUE-REQUEST is defined in the screen flow logic which overrides all other mechanisms. The system fills a two-column internal table in the corresponding dialog module and passes it to the input help using the function module F4IF_INT_TABLE_VALUE_REQUEST. The system inserts the two columns of the table into the list box.

    If the user chooses a row from the list box, the event PAI is triggered with the function code SELECTED, and the value in the first column of the internal table is copied to the input field. 

  • 相关阅读:
    证券交易买进卖出手续费公式
    iOS学习之 plist文件的读写
    蓝桥杯——基础练习之字母图形
    SNMP协议具体解释
    Android开发框架SmartAndroid2.0 强劲框架
    隐藏快捷方式扩展名(.lnk)
    Filter及FilterChain的使用具体解释
    uva 1393
    深入浅出Windows BATCH
    科大讯飞2014公布会看点二:智能语音装进车载车机!
  • 原文地址:https://www.cnblogs.com/JackeyLove/p/13490024.html
Copyright © 2011-2022 走看看