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: 

F4 event on selection screen

former_member737583
Participant
0 Kudos

I know that when I press F4 button on selection screen on field then I can use:

AT SELECTION-SCREEN ON VALUE-REQUEST FOR psel_low_high,

when I press enter I can use event

AT SELECTION-SCREEN OUTPUT.

but I need an event which is fired befor end of F4 and pressing enter.

What I want to archieve?

I asked in this topic: on a special behaviour (read topic to more information).

Now I need to extend this case to situation when modified text appears after finished F4 request.

I hope I explain my problem clear.

Thx in advance

Tomek

Off course I reward any helpfull clue.

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Here is a sample program which should give you some idea.



REPORT ZRICH_0002 .



data: dynfields type table of dynpread with header line.
data: return type table of ddshretval with header line.

selection-screen begin of block b1 with frame title text-001 .
selection-screen begin of line.
PARAMETERS: P_BUKRS type T001-BUKRS.
selection-screen comment 30(20) BUTXT for field p_bukrs.
selection-screen end of line.
selection-screen end of block b1.

at selection-screen output.

if butxt is initial.
   select single butxt into butxt
         from t001
        where bukrs = p_bukrs.
endif.


at selection-screen on value-request for p_bukrs.

  call function 'F4IF_FIELD_VALUE_REQUEST'
       exporting
            tabname           = 'T001'
            fieldname         = 'BUKRS'
            dynpprog          = sy-cprog
            dynpnr            = sy-dynnr
            dynprofield       = 'P_BUKRS'
       tables
            return_tab        = return
       exceptions
            field_not_found   = 1
            no_help_for_field = 2
            inconsistent_help = 3
            no_values_found   = 4
            others            = 5.

  read table return with key fieldname = 'P_BUKRS'.

* Add it back to the dynpro.
  dynfields-fieldname = return-retfield.
  dynfields-fieldvalue =  return-fieldval.
  append dynfields.

* Get the company code from db and add to dynpro
  data: xt001 type t001.

  clear xt001.
  select single * into xt001
         from t001
        where bukrs = return-fieldval.

  dynfields-fieldname = 'BUTXT'.
  dynfields-fieldvalue = xt001-butxt.
  append dynfields.


* Update the dynpro values.
  call function 'DYNP_VALUES_UPDATE'
       exporting
            dyname     = sy-cprog
            dynumb     = sy-dynnr
       tables
            dynpfields = dynfields
       exceptions
            others     = 8.

start-of-selection.

Regards,

Rich Heilman

5 REPLIES 5

Former Member
0 Kudos

Hi

If The text you want to update is like a parameter you can update it in the AT SELECTION-SCREEN ON VALUE-REQUEST by fm DYNP_VALUES_UPDATE:

DATA: COUNT TYPE I.

PARAMETERS: P_BUKRS LIKE T001-BUKRS.

SELECTION-SCREEN SKIP.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(30) TEXT MODIF ID INT.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN SKIP.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BUKRS.

DATA: DYNAME LIKE D020S-PROG,

DYNUMB LIKE D020S-DNUM.

DATA: DYNPFIELDS LIKE STANDARD TABLE OF DYNPREAD WITH HEADER LINE.

DYNUMB = SY-REPID.

DYNUMB = SY-DYNNR.

COUNT = COUNT + 1.

DYNPFIELDS-FIELDNAME = 'TEXT'.

MOVE COUNT TO DYNPFIELDS-FIELDVALUE(20).

APPEND DYNPFIELDS.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

DYNAME = DYNAME

DYNUMB = DYNUMB

TABLES

DYNPFIELDS = DYNPFIELDS.

Max

Former Member
0 Kudos

Use the <b>DYNP_VALUES_UPDATE</b> FM. Once the F4 is seleced the values will returned to the return_tab. After that use the above FM to modify the screen.

sample code:

ws_dyname = 'ZSRO_MASTER_DATA'.

ws_dynumb = '0301'.

ws_dynpfld-fieldname ='PPDESC'.

ws_dynpfld-fieldvalue = ty_aa-name_textc.

APPEND ws_dynpfld TO i_dnpfld.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

dyname = ws_dyname

dynumb = ws_dynumb

TABLES

dynpfields = i_dnpfld

EXCEPTIONS

invalid_abapworkarea = 1

invalid_dynprofield = 2

invalid_dynproname = 3

invalid_dynpronummer = 4

invalid_request = 5

no_fielddescription = 6

undefind_error = 7

OTHERS = 8.

IF sy-subrc <> 0.

ENDIF.

Regards,

Prakash.

Former Member
0 Kudos

Hi,

use dynpro_value_update function module

for ur requirement

Regards

amole

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Here is a sample program which should give you some idea.



REPORT ZRICH_0002 .



data: dynfields type table of dynpread with header line.
data: return type table of ddshretval with header line.

selection-screen begin of block b1 with frame title text-001 .
selection-screen begin of line.
PARAMETERS: P_BUKRS type T001-BUKRS.
selection-screen comment 30(20) BUTXT for field p_bukrs.
selection-screen end of line.
selection-screen end of block b1.

at selection-screen output.

if butxt is initial.
   select single butxt into butxt
         from t001
        where bukrs = p_bukrs.
endif.


at selection-screen on value-request for p_bukrs.

  call function 'F4IF_FIELD_VALUE_REQUEST'
       exporting
            tabname           = 'T001'
            fieldname         = 'BUKRS'
            dynpprog          = sy-cprog
            dynpnr            = sy-dynnr
            dynprofield       = 'P_BUKRS'
       tables
            return_tab        = return
       exceptions
            field_not_found   = 1
            no_help_for_field = 2
            inconsistent_help = 3
            no_values_found   = 4
            others            = 5.

  read table return with key fieldname = 'P_BUKRS'.

* Add it back to the dynpro.
  dynfields-fieldname = return-retfield.
  dynfields-fieldvalue =  return-fieldval.
  append dynfields.

* Get the company code from db and add to dynpro
  data: xt001 type t001.

  clear xt001.
  select single * into xt001
         from t001
        where bukrs = return-fieldval.

  dynfields-fieldname = 'BUTXT'.
  dynfields-fieldvalue = xt001-butxt.
  append dynfields.


* Update the dynpro values.
  call function 'DYNP_VALUES_UPDATE'
       exporting
            dyname     = sy-cprog
            dynumb     = sy-dynnr
       tables
            dynpfields = dynfields
       exceptions
            others     = 8.

start-of-selection.

Regards,

Rich Heilman

0 Kudos

Thx guys, I solved my problem with your advices. I revarder all persons with points.

Cheers

Tomek