Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Reading contents of a field from a screen

Hi all,

Is there a way to read the contents of a field in a particular screen. I want to read the data entered into a particular field on a screen into the BADI and implement the logic based on the contents of the field.

Thanks.

Neha.

Former Member
Former Member replied

Hi,

You can use following code

data: it_dynpfields type STANDARD TABLE OF DYNPREAD,
      wa_dynpfields type dynpread.

wa_dynpfields-fieldname = 'CURR_PHASE'.
append wa_dynpfields to it_dynpfields.

CALL FUNCTION 'DYNP_VALUES_READ'
  EXPORTING
    dyname                               = SAPLCRM_1O_MANAG_UI
    dynumb                               = "<screen number where field is defined>
*   TRANSLATE_TO_UPPER                   = ' '
*   REQUEST                              = ' '
*   PERFORM_CONVERSION_EXITS             = ' '
*   PERFORM_INPUT_CONVERSION             = ' '
*   DETERMINE_LOOP_INDEX                 = ' '
*   START_SEARCH_IN_CURRENT_SCREEN       = ' '
*   START_SEARCH_IN_MAIN_SCREEN          = ' '
*   START_SEARCH_IN_STACKED_SCREEN       = ' '
*   START_SEARCH_ON_SCR_STACKPOS         = ' '
*   SEARCH_OWN_SUBSCREENS_FIRST          = ' '
*   SEARCHPATH_OF_SUBSCREEN_AREAS        = ' '
  tables
    dynpfields                           = it_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
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

hope it helps

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question