Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Reading contents of a field from a screen

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

former_member156446
Active Contributor
0 Kudos

if you can find a BADI, there would be import parameters export parametrs and changing parameters.. generally import parameters carry the input of the screen...

You did not mention which screen on which program you are referring to say if there exists a Badi for it.

8 REPLIES 8

former_member156446
Active Contributor
0 Kudos

if you can find a BADI, there would be import parameters export parametrs and changing parameters.. generally import parameters carry the input of the screen...

You did not mention which screen on which program you are referring to say if there exists a Badi for it.

0 Kudos

The import parameters does not contain the field value that I want to read. Is there a way to get the field contents even though they are not in the import parameters.

Thanks.

Neha.

0 Kudos

if you know the program name say (SAPLX33F) and the variable you want is t_konv.

then get that into UE like this:

field-symbol: <fs> type any.

assign '((SAPLX33F)t_konv)' to <fs>.

0 Kudos

Hi,

The program name is SAPLCRM_1O_MANAG_UI and the field is CURR_PHASE.

field-symbols: <fs> type any.

assign '((SAPLCRM_1O_MANAG_UI)CURR_PHASE)' to <fs>.

But when I debug <fs> has the value ((SAPLCRM_1O_MANAG_UI)CURR_PHASE) and not the contents of the field.

Am I missing something.

Thanks.

Neha.

0 Kudos

try playing with the ' and (

and its not mandatory that it will be always assign.. some times it wont recognize the program name.

in debug (SAPLCRM_1O_MANAG_UI)CURR_PHASE should work

[ If the name of the field to be assigned is of the form "(program name)field name", the system searches in the global fields of the program with the name "Program name" for the field with the name "Field name". However,it is only found if the program has already been loaded.|http://www.abapprogramming.net/2008/03/sap-abap-syntax-for-assign-part-two.html]

0 Kudos

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

Former Member
0 Kudos

hello Neha

Try the function module DYNP_VALUES_READ, give the program name and screen number as input.

Thanks

Nitin

gautam_totekar
Active Participant
0 Kudos

HI

You can use Import Export parameters of the BADI .

else if you want some other fields from the screen in the BADI..if they are not directly accessible use implicit enhancement in the transaction to Set memory id and then access that memory from BADI..

Try this.