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: 

Question about F4

Former Member
0 Kudos
104

Hi all,

I got a question about search help (F4). Can I trigger any PAI or PBO at the point after I press on the F4, select a value and the value being populate on the screen field? I'm in a sub screen. What I need is when I select certain entries from the F4, I need some other fields to be disabled right after the F4 selection is being populate on the screen. Can this be done?

Thanks in advance.

6 REPLIES 6

Former Member
0 Kudos
81

Hi Mil,

We have a separarte event in Dialog programming..

PROCESS ON VALUE-REQUEST.

FIELD <screen-field> MODULE f4_field.

Thanks and Best Regards,

Vikas Bittera.

0 Kudos
81

Hi,

For disable fields from input by



Create a PBO module as follows.

MODULE init_screen.

MODULE init_screen OUTPUT.
LOOP AT SCREEN.
IF SCREEN-NAME = 'FIELD1' OR SCREEN-NAME = 'FIELD2'.
                                              " Put all your field checks here
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDLOOP.
ENDMODULE.

0 Kudos
81

First of all, thanks for the replies but I need to clarify something. I know how an F4 works and I know how to disable fields. What I actually need is the field to be disabled directly after CERTAIN values are selected from the F4. Example, in my F4, I have A, B & C. If I select C, I need both field 1 & field 2 in my screen to be disabled, but if I select A or B, both fields are still enable.

I just need to know the point whereby I can put my logic after the value from the F4 is input on the screen. It seems like after the F4 FM is fired, and after the selection is made, no PBO or PAI is fired after that. Do I need to fire a PBO on my own?

0 Kudos
81

Try this - it should work exactly the same in the dialog "value-request" POV, but was easier to knock up a free-standing report for you to try out... enter the field you want locked (i.e. P_F2 or P_F3) in the first field and hit F4...

Jonathan

report zlocal_jc_f4_locking.

parameters:
  p_f1(10)              type c,
  p_f2(10)              type c,
  p_f3(10)              type c.

at selection-screen on value-request for p_f1.
  perform f4_help.

*&---------------------------------------------------------------------*
*&      Form  f4_help
*&---------------------------------------------------------------------*
form f4_help.

  data:
    l_dyname           like d020s-prog,
    l_dynumb           like d020s-dnum,
    ls_dynpfields      like dynpread,
    lt_dynpfields      like dynpread occurs 10.

  l_dynumb = sy-dynnr.
  l_dyname = sy-repid.

  ls_dynpfields-fieldname  = 'P_F1'.
  append ls_dynpfields to lt_dynpfields.
*" Get the value keyed into P_F1:

  call function 'DYNP_VALUES_READ'
    exporting
      dyname     = l_dyname
      dynumb     = l_dynumb
    tables
      dynpfields = lt_dynpfields
    exceptions
      others     = 1.

  check sy-subrc is initial.

*" See what user typed in P_F1
  read table lt_dynpfields into ls_dynpfields
    with key fieldname = 'P_F1'.

  if ls_dynpfields-fieldvalue = 'P_F2'.

    ls_dynpfields-fieldname  = 'P_F2'.
    ls_dynpfields-fieldvalue = 'set P_F2'.
    append ls_dynpfields to lt_dynpfields.

    ls_dynpfields-fieldname  = 'P_F3'.
    ls_dynpfields-fieldvalue = space. "clear it
    append ls_dynpfields to lt_dynpfields.
*" And lock the field P_F2 and unlock others
    loop at screen.
      if screen-name = 'P_F2'.
        screen-input = '0'.
      else.
        screen-input = '1'.
      endif.
      modify screen.
    endloop.

  else.

    ls_dynpfields-fieldname  = 'P_F3'.
    ls_dynpfields-fieldvalue = 'set P_F3'.
    append ls_dynpfields to lt_dynpfields.

    ls_dynpfields-fieldname  = 'P_F2'.
    ls_dynpfields-fieldvalue = space. "clear it
    append ls_dynpfields to lt_dynpfields.

*" And lock the field P_F3 and unlock others
    loop at screen.
      if screen-name = 'P_F3'.
        screen-input = '0'.
      else.
        screen-input = '1'.
      endif.
      modify screen.
    endloop.
  endif.

*" Pop a variable value back into screen
  call function 'DYNP_VALUES_UPDATE'
    exporting
      dyname     = l_dyname
      dynumb     = l_dynumb
    tables
      dynpfields = lt_dynpfields
    exceptions
      others     = 1.

endform.                                                    "f4_help

Former Member
0 Kudos
81

former_member223537
Active Contributor
0 Kudos
81

<b>Yes you are right.</b>

After user select a record from F4 help, no event is fired.

You need to ask user to hit enter key & capture the Ok code set for that field & program accordingly.