Difference between revisions of "SAP ABAP FIELD EXIT"

From SapWiki
 
Line 7: Line 7:
 
*Ejemplo, validar campo KBSTAT en trn. VK11, VK12 & VK13
 
*Ejemplo, validar campo KBSTAT en trn. VK11, VK12 & VK13
  
  FUNCTION field_exit_kbstat.
+
  <nowiki>FUNCTION field_exit_kbstat.
*"----------------------------------------------------------------------
+
*"----------------------------------------------------------------------
*"*"Interfase local
+
*"*"Interfase local
*"  IMPORTING
+
*"  IMPORTING
*"    REFERENCE(INPUT)
+
*"    REFERENCE(INPUT)
*"  EXPORTING
+
*"  EXPORTING
*"    REFERENCE(OUTPUT)
+
*"    REFERENCE(OUTPUT)
*"----------------------------------------------------------------------
+
*"----------------------------------------------------------------------
  DATA wa_por_niv_sec TYPE zsd_por_niv_sec.
+
  DATA wa_por_niv_sec TYPE zsd_por_niv_sec.
  DATA: w_eval LIKE dynpread-fieldvalue.
+
  DATA: w_eval LIKE dynpread-fieldvalue.
  DATA: w_eval_2 LIKE dynpread-fieldvalue.
+
  DATA: w_eval_2 LIKE dynpread-fieldvalue.
  DATA: w_eval_3 LIKE dynpread-fieldvalue.
+
  DATA: w_eval_3 LIKE dynpread-fieldvalue.
  DATA l_matnr TYPE mara-matnr.
+
  DATA l_matnr TYPE mara-matnr.
  DATA l_spart TYPE mara-spart.
+
  DATA l_spart TYPE mara-spart.
  DATA l_por TYPE zsd_por_niv_sec-por_01.
+
  DATA l_por TYPE zsd_por_niv_sec-por_01.
  DATA l_por_i TYPE konp-kbetr.
+
  DATA l_por_i TYPE konp-kbetr.
  DATA l_input(1).
+
  DATA l_input(1).
  DATA l_sizec LIKE gt_t691i-sizec.
+
  DATA l_sizec LIKE gt_t691i-sizec.
  DATA t185v TYPE t185v.
+
  DATA t185v TYPE t185v.
  DATA ls_t681s TYPE t681s.
+
  DATA ls_t681s TYPE t681s.
  DATA l_kschl TYPE rv13a-kschl.
+
  DATA l_kschl TYPE rv13a-kschl.
  DATA: lw_var(40) TYPE c.
+
  DATA: lw_var(40) TYPE c.
 
  FIELD-SYMBOLS <fs> TYPE any.
 
 
  lw_var = '(SAPMV13A)T681S'.
 
  ASSIGN (lw_var) TO <fs>.
 
  IF sy-subrc = 0 AND <fs> IS ASSIGNED.
 
    MOVE <fs> TO ls_t681s.
 
  ENDIF.
 
 
  IMPORT t185v FROM MEMORY
 
              ID 'SD_COND_MEM_01'.
 
 
  CHECK sy-tcode = 'VK12' OR sy-tcode = 'VK11' OR sy-tcode = 'VK13'.
 
  CHECK sy-title(1) <> 'V'.  "Visualizar
 
 
  GET PARAMETER ID 'VKS' FIELD l_kschl.
 
  CHECK l_kschl = 'ZAB0'
 
      OR l_kschl = 'ZAB1'
 
      OR l_kschl = 'ZAB2'
 
      OR l_kschl = 'ZAB3'
 
      OR l_kschl = 'ZAB4'
 
      OR l_kschl = 'ZAB5'.
 
 
  MOVE input TO l_input.
 
 
  IF l_input IS INITIAL.
 
    MESSAGE e000(0k) WITH 'Error:'
 
                          'debe ingresar valor en Status de tratamiento'.
 
  ENDIF.
 
 
  l_por = 0.
 
  l_por_i = 0.
 
  CLEAR w_eval.
 
 
* copia de C14Z_DYNP_READ_FIELD, permite leer valores de una línea de tabla
 
  CALL FUNCTION 'Z_C14Z_DYNP_READ_FIELD'
 
    EXPORTING
 
      i_program      = 'SAPMV13A'
 
      i_dynpro      = ls_t681s-dynpronr  "'1305'
 
      i_fieldname    = 'KOMG-MATNR'
 
      i_fieldname_2  = 'KONP-KBETR'
 
      i_fieldname_3  = 'KOMG-SPART'
 
      i_flg_steploop = 'X'
 
      i_flg_request  = 'X'
 
    CHANGING
 
      e_value        = w_eval    "material
 
      e_value_2      = w_eval_2  "porcentaje
 
      e_value_3      = w_eval_3.  "sector
 
 
 
    MOVE w_eval TO l_matnr.
 
 
    CONDENSE w_eval_3.
 
    MOVE w_eval_3 TO l_spart.
 
 
    CONDENSE w_eval_2.
 
    TRANSLATE w_eval_2 USING ',.'.
 
    MOVE w_eval_2 TO l_por_i.
 
 
* insert some logic here
 
 
*
 
 
  IF 1 = 2 .  "dummy, asignación de valor posible a campo
 
    output = 'B'.
 
  ELSE.
 
    output = 'L'.
 
  ENDIF.
 
 
  IF l_input <> output.
 
    MESSAGE e000(0k) WITH 'Error en Status de tratamiento:'
 
                          'Solo se permite valor'
 
                            output.
 
  ENDIF.
 
 
ENDFUNCTION.
 
  
  FUNCTION Z_C14Z_DYNP_READ_FIELD.
+
  FIELD-SYMBOLS <fs> TYPE any.
  *"----------------------------------------------------------------------
+
 
*"*"Interfase local
+
  lw_var = '(SAPMV13A)T681S'.
*"  IMPORTING
+
  ASSIGN (lw_var) TO <fs>.
*"    VALUE(I_PROGRAM) LIKE  D020S-PROG
+
  IF sy-subrc = 0 AND <fs> IS ASSIGNED.
*"    VALUE(I_DYNPRO) LIKE  D020S-DNUM
+
    MOVE <fs> TO ls_t681s.
*"    VALUE(I_FIELDNAME) LIKE  DYNPREAD-FIELDNAME
+
  ENDIF.
*"    REFERENCE(I_FIELDNAME_2) TYPE  DYNPREAD-FIELDNAME OPTIONAL
+
 
*"    REFERENCE(I_FIELDNAME_3) LIKE  DYNPREAD-FIELDNAME OPTIONAL
+
  IMPORT t185v FROM MEMORY
*"    VALUE(I_FLG_STEPLOOP) TYPE  C
+
              ID 'SD_COND_MEM_01'.
*"    VALUE(I_FLG_REQUEST) TYPE  ESP1_BOOLEAN DEFAULT ESP1_FALSE
+
 
*"  EXPORTING
+
  CHECK sy-tcode = 'VK12' OR sy-tcode = 'VK11' OR sy-tcode = 'VK13'.
*"    VALUE(E_STEPL) LIKE  SY-STEPL
+
  CHECK sy-title(1) <> 'V'. "Visualizar
*"    VALUE(E_FLG_FIELD_INPUT) TYPE  ESP1_BOOLEAN
+
 
*"  CHANGING
+
  GET PARAMETER ID 'VKS' FIELD l_kschl.
*"    VALUE(E_VALUE) LIKE  DYNPREAD-FIELDVALUE
+
  CHECK l_kschl = 'ZAB0'
*"    VALUE(E_VALUE_2) LIKE  DYNPREAD-FIELDVALUE OPTIONAL
+
    OR l_kschl = 'ZAB1'
*"    VALUE(E_VALUE_3) LIKE  DYNPREAD-FIELDVALUE OPTIONAL
+
    OR l_kschl = 'ZAB2'
*"----------------------------------------------------------------------
+
    OR l_kschl = 'ZAB3'
+
    OR l_kschl = 'ZAB4'
  DATA: BEGIN OF DYNPTAB OCCURS 1.
+
    OR l_kschl = 'ZAB5'.
          INCLUDE STRUCTURE DYNPREAD.
+
 
  DATA: END OF DYNPTAB.
+
  MOVE input TO l_input.
+
 
  DATA: STEPL LIKE SY-STEPL.
+
  IF l_input IS INITIAL.
+
    MESSAGE e000(0k) WITH 'Error:'
* Begin Correction 05.07.2004 751985 ***********************************
+
                          'debe ingresar valor en Status de tratamiento'.
  DATA: request LIKE  d020s-type.
+
  ENDIF.
* End Correction 05.07.2004 751985 *************************************
+
 
+
  l_por = 0.
* Initialization
+
  l_por_i = 0.
  TRANSLATE i_program  TO UPPER CASE.                  "#EC TRANSLANG
+
  CLEAR w_eval.
  " translate i_dynpro    to upper case.
+
 
  TRANSLATE I_FIELDNAME TO UPPER CASE.                  "#EC TRANSLANG
+
* copia de C14Z_DYNP_READ_FIELD, permite leer valores de una línea de tabla
+
  CALL FUNCTION 'Z_C14Z_DYNP_READ_FIELD'
* Get the currently entered value
+
    EXPORTING
  CLEAR E_STEPL.
+
      i_program      = 'SAPMV13A'
  clear e_value_2.
+
      i_dynpro      = ls_t681s-dynpronr  "'1305'
  IF I_FLG_STEPLOOP = 'X'.
+
      i_fieldname    = 'KOMG-MATNR'
*    CALL FUNCTION 'DYNP_GET_STEPL'
+
      i_fieldname_2  = 'KONP-KBETR'
*        IMPORTING
+
      i_fieldname_3  = 'KOMG-SPART'
*              POVSTEPL        = STEPL
+
      i_flg_steploop = 'X'
*        EXCEPTIONS
+
      i_flg_request  = 'X'
*              STEPL_NOT_FOUND = 01.
+
    CHANGING
*    E_STEPL = STEPL.
+
      e_value        = w_eval    "material
    move sy-STEPL to E_STEPL.
+
      e_value_2      = w_eval_2  "porcentaje
    move sy-STEPL to STEPL.
+
      e_value_3      = w_eval_3.  "sector
  ENDIF.
+
 
+
 
  DYNPTAB-FIELDNAME = I_FIELDNAME.
+
    MOVE w_eval TO l_matnr.
  DYNPTAB-STEPL    = STEPL.
+
 
  APPEND DYNPTAB.
+
    CONDENSE w_eval_3.
+
    MOVE w_eval_3 TO l_spart.
* Begin Correction 05.07.2004 751985 ***********************************
+
 
* Check whether the field accepts input
+
    CONDENSE w_eval_2.
  IF ( i_flg_request = 'X' ).
+
    TRANSLATE w_eval_2 USING ',.'.
    request = 'A'.
+
    MOVE w_eval_2 TO l_por_i.
  ELSE.
+
 
    CLEAR: request.
+
* insert some logic here
  ENDIF.                              " IF ( i_flg_request = esp1_true
+
 
+
*
  CALL FUNCTION 'DYNP_VALUES_READ'
+
 
    EXPORTING
+
  IF 1 = 2 . "dummy, asignación de valor posible a campo
      DYNAME              = I_PROGRAM
+
    output = 'B'.
      DYNUMB              = I_DYNPRO
+
  ELSE.
      request              = request
+
    output = 'L'.
    TABLES
+
  ENDIF.
      DYNPFIELDS          = DYNPTAB
+
 
*    TRANSLATE_TO_UPPER  = ' '
+
  IF l_input <> output.
    EXCEPTIONS
+
    MESSAGE e000(0k) WITH 'Error en Status de tratamiento:'
      INVALID_ABAPWORKAREA = 01
+
                          'Solo se permite valor'
      INVALID_DYNPROFIELD  = 02
+
                          output.
      INVALID_DYNPRONAME  = 03
+
  ENDIF.
      INVALID_DYNPRONUMMER = 04
+
 
      INVALID_REQUEST      = 05
+
ENDFUNCTION.
      NO_FIELDDESCRIPTION  = 06
+
 
      UNDEFIND_ERROR      = 07.
+
FUNCTION Z_C14Z_DYNP_READ_FIELD.
* End Correction 05.07.2004 751985 *************************************
+
*"----------------------------------------------------------------------
+
*"*"Interfase local
*  IF i_flg_steploop = 'X'.
+
*"  IMPORTING
*    READ TABLE DYNPTAB WITH KEY FIELDNAME = I_FIELDNAME STEPL = STEPL.
+
*"    VALUE(I_PROGRAM) LIKE  D020S-PROG
*  ELSE.
+
*"    VALUE(I_DYNPRO) LIKE  D020S-DNUM
*    READ TABLE DYNPTAB WITH KEY FIELDNAME = I_FIELDNAME.
+
*"    VALUE(I_FIELDNAME) LIKE  DYNPREAD-FIELDNAME
*  ENDIF.
+
*"    REFERENCE(I_FIELDNAME_2) TYPE  DYNPREAD-FIELDNAME OPTIONAL
+
*"    REFERENCE(I_FIELDNAME_3) LIKE  DYNPREAD-FIELDNAME OPTIONAL
*  read TABLE DYNPTAB with key FIELDNAME = 'KONP-KONWA' STEPL = STEPL.
+
*"    VALUE(I_FLG_STEPLOOP) TYPE  C
*  if sy-subrc = 0 and dynptab-fieldvalue = '%'.
+
*"    VALUE(I_FLG_REQUEST) TYPE  ESP1_BOOLEAN DEFAULT ESP1_FALSE
    READ TABLE DYNPTAB WITH KEY FIELDNAME = I_FIELDNAME STEPL = STEPL.
+
*"  EXPORTING
    if sy-subrc = 0.
+
*"    VALUE(E_STEPL) LIKE  SY-STEPL
      e_value = dynptab-fieldvalue.
+
*"    VALUE(E_FLG_FIELD_INPUT) TYPE  ESP1_BOOLEAN
    endif.
+
*"  CHANGING
    read TABLE DYNPTAB with key FIELDNAME = I_FIELDNAME_2 STEPL = STEPL.
+
*"    VALUE(E_VALUE) LIKE  DYNPREAD-FIELDVALUE
    if sy-subrc = 0.
+
*"    VALUE(E_VALUE_2) LIKE  DYNPREAD-FIELDVALUE OPTIONAL
      e_value_2 = dynptab-fieldvalue.
+
*"    VALUE(E_VALUE_3) LIKE  DYNPREAD-FIELDVALUE OPTIONAL
    endif.
+
*"----------------------------------------------------------------------
*  endif.
+
 
+
  DATA: BEGIN OF DYNPTAB OCCURS 1.
    READ TABLE DYNPTAB WITH KEY FIELDNAME = I_FIELDNAME_3 STEPL = STEPL.
+
          INCLUDE STRUCTURE DYNPREAD.
    if sy-subrc = 0.
+
  DATA: END OF DYNPTAB.
      e_value_3 = dynptab-fieldvalue.
+
 
    endif.
+
  DATA: STEPL LIKE SY-STEPL.
+
 
* Begin Correction 05.07.2004 751985 ***********************************
+
* Begin Correction 05.07.2004 751985 ***********************************
  e_flg_field_input = dynptab-fieldinp.
+
  DATA: request LIKE  d020s-type.
* End Correction 05.07.2004 751985 *************************************
+
* End Correction 05.07.2004 751985 *************************************
+
 
*  e_value = dynptab-fieldvalue.
+
* Initialization
+
  TRANSLATE i_program  TO UPPER CASE.                  "#EC TRANSLANG
ENDFUNCTION.
+
  " translate i_dynpro    to upper case.
 +
  TRANSLATE I_FIELDNAME TO UPPER CASE.                  "#EC TRANSLANG
 +
 
 +
* Get the currently entered value
 +
  CLEAR E_STEPL.
 +
  clear e_value_2.
 +
  IF I_FLG_STEPLOOP = 'X'.
 +
*    CALL FUNCTION 'DYNP_GET_STEPL'
 +
*        IMPORTING
 +
*              POVSTEPL        = STEPL
 +
*        EXCEPTIONS
 +
*              STEPL_NOT_FOUND = 01.
 +
*    E_STEPL = STEPL.
 +
    move sy-STEPL to E_STEPL.
 +
    move sy-STEPL to STEPL.
 +
  ENDIF.
 +
 
 +
  DYNPTAB-FIELDNAME = I_FIELDNAME.
 +
  DYNPTAB-STEPL    = STEPL.
 +
  APPEND DYNPTAB.
 +
 
 +
* Begin Correction 05.07.2004 751985 ***********************************
 +
* Check whether the field accepts input
 +
  IF ( i_flg_request = 'X' ).
 +
    request = 'A'.
 +
  ELSE.
 +
    CLEAR: request.
 +
  ENDIF.                              " IF ( i_flg_request = esp1_true
 +
 
 +
  CALL FUNCTION 'DYNP_VALUES_READ'
 +
    EXPORTING
 +
      DYNAME              = I_PROGRAM
 +
      DYNUMB              = I_DYNPRO
 +
      request              = request
 +
    TABLES
 +
      DYNPFIELDS          = DYNPTAB
 +
*    TRANSLATE_TO_UPPER  = ' '
 +
    EXCEPTIONS
 +
      INVALID_ABAPWORKAREA = 01
 +
      INVALID_DYNPROFIELD  = 02
 +
      INVALID_DYNPRONAME  = 03
 +
      INVALID_DYNPRONUMMER = 04
 +
      INVALID_REQUEST      = 05
 +
      NO_FIELDDESCRIPTION  = 06
 +
      UNDEFIND_ERROR      = 07.
 +
* End Correction 05.07.2004 751985 *************************************
 +
 
 +
*  IF i_flg_steploop = 'X'.
 +
*    READ TABLE DYNPTAB WITH KEY FIELDNAME = I_FIELDNAME STEPL = STEPL.
 +
*  ELSE.
 +
*    READ TABLE DYNPTAB WITH KEY FIELDNAME = I_FIELDNAME.
 +
*  ENDIF.
 +
 
 +
*  read TABLE DYNPTAB with key FIELDNAME = 'KONP-KONWA' STEPL = STEPL.
 +
*  if sy-subrc = 0 and dynptab-fieldvalue = '%'.
 +
    READ TABLE DYNPTAB WITH KEY FIELDNAME = I_FIELDNAME STEPL = STEPL.
 +
    if sy-subrc = 0.
 +
      e_value = dynptab-fieldvalue.
 +
    endif.
 +
    read TABLE DYNPTAB with key FIELDNAME = I_FIELDNAME_2 STEPL = STEPL.
 +
    if sy-subrc = 0.
 +
      e_value_2 = dynptab-fieldvalue.
 +
    endif.
 +
*  endif.
 +
 
 +
    READ TABLE DYNPTAB WITH KEY FIELDNAME = I_FIELDNAME_3 STEPL = STEPL.
 +
    if sy-subrc = 0.
 +
      e_value_3 = dynptab-fieldvalue.
 +
    endif.
 +
 
 +
* Begin Correction 05.07.2004 751985 ***********************************
 +
  e_flg_field_input = dynptab-fieldinp.
 +
* End Correction 05.07.2004 751985 *************************************
 +
 
 +
*  e_value = dynptab-fieldvalue.
 +
 
 +
ENDFUNCTION.</nowiki>

Latest revision as of 21:03, 4 April 2020

  • NOTA: Para poder activar los Field Exits debemos tener el parámetro abap/fieldexit = YES seteado en el servidor (Transacción RZ10).
  • Crear field exit:
  1. ejecutar reporte RSMODPRF
  2. Crear módulo de función con nombre FIELD_EXIT_*
  • Ejemplo, validar campo KBSTAT en trn. VK11, VK12 & VK13
FUNCTION field_exit_kbstat.
*"----------------------------------------------------------------------
*"*"Interfase local
*"  IMPORTING
*"     REFERENCE(INPUT)
*"  EXPORTING
*"     REFERENCE(OUTPUT)
*"----------------------------------------------------------------------
  DATA wa_por_niv_sec TYPE zsd_por_niv_sec.
  DATA: w_eval LIKE dynpread-fieldvalue.
  DATA: w_eval_2 LIKE dynpread-fieldvalue.
  DATA: w_eval_3 LIKE dynpread-fieldvalue.
  DATA l_matnr TYPE mara-matnr.
  DATA l_spart TYPE mara-spart.
  DATA l_por TYPE zsd_por_niv_sec-por_01.
  DATA l_por_i TYPE konp-kbetr.
  DATA l_input(1).
  DATA l_sizec LIKE gt_t691i-sizec.
  DATA t185v TYPE t185v.
  DATA ls_t681s TYPE t681s.
  DATA l_kschl TYPE rv13a-kschl.
  DATA: lw_var(40) TYPE c.

  FIELD-SYMBOLS <fs> TYPE any.

  lw_var = '(SAPMV13A)T681S'.
  ASSIGN (lw_var) TO <fs>.
  IF sy-subrc = 0 AND <fs> IS ASSIGNED.
    MOVE <fs> TO ls_t681s.
  ENDIF.

  IMPORT t185v FROM MEMORY
              ID 'SD_COND_MEM_01'.

  CHECK sy-tcode = 'VK12' OR sy-tcode = 'VK11' OR sy-tcode = 'VK13'.
  CHECK sy-title(1) <> 'V'.  "Visualizar

  GET PARAMETER ID 'VKS' FIELD l_kschl.
  CHECK l_kschl = 'ZAB0'
     OR l_kschl = 'ZAB1'
     OR l_kschl = 'ZAB2'
     OR l_kschl = 'ZAB3'
     OR l_kschl = 'ZAB4'
     OR l_kschl = 'ZAB5'.

  MOVE input TO l_input.

  IF l_input IS INITIAL.
    MESSAGE e000(0k) WITH 'Error:'
                          'debe ingresar valor en Status de tratamiento'.
  ENDIF.

  l_por = 0.
  l_por_i = 0.
  CLEAR w_eval.

* copia de C14Z_DYNP_READ_FIELD, permite leer valores de una línea de tabla
  CALL FUNCTION 'Z_C14Z_DYNP_READ_FIELD'
    EXPORTING
      i_program      = 'SAPMV13A'
      i_dynpro       = ls_t681s-dynpronr   "'1305'
      i_fieldname    = 'KOMG-MATNR'
      i_fieldname_2  = 'KONP-KBETR'
      i_fieldname_3  = 'KOMG-SPART'
      i_flg_steploop = 'X'
      i_flg_request  = 'X'
    CHANGING
      e_value        = w_eval     "material
      e_value_2      = w_eval_2  "porcentaje
      e_value_3      = w_eval_3.  "sector


    MOVE w_eval TO l_matnr.

    CONDENSE w_eval_3.
    MOVE w_eval_3 TO l_spart.

    CONDENSE w_eval_2.
    TRANSLATE w_eval_2 USING ',.'.
    MOVE w_eval_2 TO l_por_i.

* insert some logic here

*

  IF 1 = 2 .  "dummy, asignación de valor posible a campo
    output = 'B'.
  ELSE.
    output = 'L'.
  ENDIF.

  IF l_input <> output.
    MESSAGE e000(0k) WITH 'Error en Status de tratamiento:'
                          'Solo se permite valor'
                           output.
  ENDIF.

ENDFUNCTION.

FUNCTION Z_C14Z_DYNP_READ_FIELD.
*"----------------------------------------------------------------------
*"*"Interfase local
*"  IMPORTING
*"     VALUE(I_PROGRAM) LIKE  D020S-PROG
*"     VALUE(I_DYNPRO) LIKE  D020S-DNUM
*"     VALUE(I_FIELDNAME) LIKE  DYNPREAD-FIELDNAME
*"     REFERENCE(I_FIELDNAME_2) TYPE  DYNPREAD-FIELDNAME OPTIONAL
*"     REFERENCE(I_FIELDNAME_3) LIKE  DYNPREAD-FIELDNAME OPTIONAL
*"     VALUE(I_FLG_STEPLOOP) TYPE  C
*"     VALUE(I_FLG_REQUEST) TYPE  ESP1_BOOLEAN DEFAULT ESP1_FALSE
*"  EXPORTING
*"     VALUE(E_STEPL) LIKE  SY-STEPL
*"     VALUE(E_FLG_FIELD_INPUT) TYPE  ESP1_BOOLEAN
*"  CHANGING
*"     VALUE(E_VALUE) LIKE  DYNPREAD-FIELDVALUE
*"     VALUE(E_VALUE_2) LIKE  DYNPREAD-FIELDVALUE OPTIONAL
*"     VALUE(E_VALUE_3) LIKE  DYNPREAD-FIELDVALUE OPTIONAL
*"----------------------------------------------------------------------

  DATA: BEGIN OF DYNPTAB OCCURS 1.
          INCLUDE STRUCTURE DYNPREAD.
  DATA: END OF DYNPTAB.

  DATA: STEPL LIKE SY-STEPL.

* Begin Correction 05.07.2004 751985 ***********************************
  DATA: request LIKE  d020s-type.
* End Correction 05.07.2004 751985 *************************************

* Initialization
  TRANSLATE i_program   TO UPPER CASE.                   "#EC TRANSLANG
  " translate i_dynpro    to upper case.
  TRANSLATE I_FIELDNAME TO UPPER CASE.                   "#EC TRANSLANG

* Get the currently entered value
  CLEAR E_STEPL.
  clear e_value_2.
  IF I_FLG_STEPLOOP = 'X'.
*    CALL FUNCTION 'DYNP_GET_STEPL'
*         IMPORTING
*              POVSTEPL        = STEPL
*         EXCEPTIONS
*              STEPL_NOT_FOUND = 01.
*    E_STEPL = STEPL.
    move sy-STEPL to E_STEPL.
    move sy-STEPL to STEPL.
  ENDIF.

  DYNPTAB-FIELDNAME = I_FIELDNAME.
  DYNPTAB-STEPL     = STEPL.
  APPEND DYNPTAB.

* Begin Correction 05.07.2004 751985 ***********************************
* Check whether the field accepts input
  IF ( i_flg_request = 'X' ).
    request = 'A'.
  ELSE.
    CLEAR: request.
  ENDIF.                               " IF ( i_flg_request = esp1_true

  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      DYNAME               = I_PROGRAM
      DYNUMB               = I_DYNPRO
      request              = request
    TABLES
      DYNPFIELDS           = DYNPTAB
*     TRANSLATE_TO_UPPER   = ' '
    EXCEPTIONS
      INVALID_ABAPWORKAREA = 01
      INVALID_DYNPROFIELD  = 02
      INVALID_DYNPRONAME   = 03
      INVALID_DYNPRONUMMER = 04
      INVALID_REQUEST      = 05
      NO_FIELDDESCRIPTION  = 06
      UNDEFIND_ERROR       = 07.
* End Correction 05.07.2004 751985 *************************************

*  IF i_flg_steploop = 'X'.
*    READ TABLE DYNPTAB WITH KEY FIELDNAME = I_FIELDNAME STEPL = STEPL.
*  ELSE.
*    READ TABLE DYNPTAB WITH KEY FIELDNAME = I_FIELDNAME.
*  ENDIF.

*  read TABLE DYNPTAB with key FIELDNAME = 'KONP-KONWA' STEPL = STEPL.
*  if sy-subrc = 0 and dynptab-fieldvalue = '%'.
    READ TABLE DYNPTAB WITH KEY FIELDNAME = I_FIELDNAME STEPL = STEPL.
    if sy-subrc = 0.
      e_value = dynptab-fieldvalue.
    endif.
    read TABLE DYNPTAB with key FIELDNAME = I_FIELDNAME_2 STEPL = STEPL.
    if sy-subrc = 0.
      e_value_2 = dynptab-fieldvalue.
    endif.
*  endif.

    READ TABLE DYNPTAB WITH KEY FIELDNAME = I_FIELDNAME_3 STEPL = STEPL.
    if sy-subrc = 0.
      e_value_3 = dynptab-fieldvalue.
    endif.

* Begin Correction 05.07.2004 751985 ***********************************
  e_flg_field_input = dynptab-fieldinp.
* End Correction 05.07.2004 751985 *************************************

*  e_value = dynptab-fieldvalue.

ENDFUNCTION.