메뉴 건너뛰기

SAP 한국 커뮤니티



SEARCH HELP FUNCTION 이용한 예제

이종원 2007.04.06 21:53 조회 수 : 5344 추천:24

FLOW LOGIC


PROCESS BEFORE OUTPUT.


  MODULE init.


PROCESS AFTER INPUT.


  MODULE user_command_0100.



PROCESS ON VALUE-REQUEST.
  FIELD carrier MODULE value_carrer.
  FIELD connection MODULE value_connection.


 


MAIN PROGRAM.


REPORT  z_basic_test.


TABLES: demof4help.


TYPES: BEGIN OF values,
         carrid TYPE spfli-carrid,
         connid TYPE spfli-connid,
       END OF values.


DATA: carrier(3) TYPE c,
      connection(4) TYPE c,
      ok_code TYPE sy-ucomm.


DATA: progname TYPE sy-repid,
      dynnum   TYPE sy-dynnr,
      dynpro_values TYPE TABLE OF dynpread,
      field_value LIKE LINE OF dynpro_values,
      values_tab TYPE TABLE OF values.


CALL SCREEN 100.
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
  CASE ok_code.
    WHEN 'CANCEL'.
      LEAVE PROGRAM.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*&      Module  VALUE_CARRER  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE value_carrer INPUT.


  CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
       EXPORTING
            tabname     = 'DEMOF4HELP'
            fieldname   = 'CARRIER1'
            dynpprog    = progname
            dynpnr      = dynnum
            dynprofield = 'CARRIER'.


ENDMODULE.                 " VALUE_CARRER  INPUT
*&---------------------------------------------------------------------*
*&      Module  VALUE_CONNECTION  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE value_connection INPUT.
  CALL FUNCTION 'DYNP_VALUES_READ'
       EXPORTING
            dyname             = progname
            dynumb             = dynnum
            translate_to_upper = 'X'
       TABLES
            dynpfields         = dynpro_values.


  READ TABLE dynpro_values INDEX 1 INTO field_value.


  SELECT  carrid connid
    FROM  spfli
    INTO  CORRESPONDING FIELDS OF TABLE values_tab
    WHERE carrid = field_value-fieldvalue.


  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
            retfield    = 'CONNID'
            dynpprog    = progname
            dynpnr      = dynnum
            dynprofield = 'CONNECTION'
            value_org   = 'S'
       TABLES
            value_tab   = values_tab.
ENDMODULE.                 " VALUE_CONNECTION  INPUT
*&---------------------------------------------------------------------*
*&      Module  INIT  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE init OUTPUT.
  progname = sy-repid.
  dynnum   = sy-dynnr.
  CLEAR: field_value, dynpro_values.
  field_value-fieldname = 'CARRIER'.
  APPEND field_value TO dynpro_values.
ENDMODULE.                 " INIT  OUTPUT


* e-abap님에 의해서 게시물 이동되었습니다 (2007-11-05 12:45)