Application Development and Automation 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: 
Read only

F4 - Help

Former Member
0 Likes
710

Hello friends,

I have a selection screen with parameters option, and the option needs F4 help and should read values from a table. I have the code for it but my concern is how would it trigger. I mean at the selection screen, for the respective field when i click F4 how will the code trigger.

Shejal.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
655

Hi,

Check this example..

TABLES: T005T.

DATA: BEGIN OF t_t005 OCCURS 0,

land1 TYPE t005-land1,

END OF t_t005.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(6) v_text FOR FIELD P_LAND1.

PARAMETERS: p_land1 TYPE t005-land1.

SELECTION-SCREEN COMMENT 13(35) v_text1.

SELECTION-SCREEN END OF LINE.

INITIALIZATION.

v_text = 'Country'.

v_text1 = ' '.

AT SELECTION-SCREEN OUTPUT.

IF NOT p_land1 IS INITIAL.

SELECT SINGLE * FROM t005t

WHERE spras = sy-langu

AND land1 = p_land1.

IF sy-subrc = 0.

v_text1 = t005t-landx.

ENDIF.

ENDIF.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_land1.

REFRESH: t_t005.

SELECT land1

INTO TABLE t_t005

FROM t005.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = 'T005'

PVALKEY = ' '

retfield = 'LAND1'

dynpprog = sy-repid

DYNPNR = sy-dynnr

dynprofield = 'P_LAND1'

callback_program = sy-repid

value_org = 'S'

TABLES

value_tab = t_t005

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

THanks,

Naren

4 REPLIES 4
Read only

Former Member
0 Likes
656

Hi,

Check this example..

TABLES: T005T.

DATA: BEGIN OF t_t005 OCCURS 0,

land1 TYPE t005-land1,

END OF t_t005.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(6) v_text FOR FIELD P_LAND1.

PARAMETERS: p_land1 TYPE t005-land1.

SELECTION-SCREEN COMMENT 13(35) v_text1.

SELECTION-SCREEN END OF LINE.

INITIALIZATION.

v_text = 'Country'.

v_text1 = ' '.

AT SELECTION-SCREEN OUTPUT.

IF NOT p_land1 IS INITIAL.

SELECT SINGLE * FROM t005t

WHERE spras = sy-langu

AND land1 = p_land1.

IF sy-subrc = 0.

v_text1 = t005t-landx.

ENDIF.

ENDIF.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_land1.

REFRESH: t_t005.

SELECT land1

INTO TABLE t_t005

FROM t005.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = 'T005'

PVALKEY = ' '

retfield = 'LAND1'

dynpprog = sy-repid

DYNPNR = sy-dynnr

dynprofield = 'P_LAND1'

callback_program = sy-repid

value_org = 'S'

TABLES

value_tab = t_t005

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

THanks,

Naren

Read only

Former Member
0 Likes
655

You can use the event

At selection-screen ON VALUE-REQUEST FOR p_field.

Some documentation on that.

Effect

With this addition, the field psel_low_high is either the name of a report parameter or of the form sel-LOW or sel-HIGH , where sel is the name of a selection criterion. The effect of this is twofold:

The pushbutton for F4 (Possible entries) appears beside the appropriate field.

When the user selects this pushbutton or presses F4 for the field, the event is executed. You can thus implement a self-programmed possible entries routine for the input/output fields of the selection screen. If the program contains such an event and the user presses F4 , the system processes this rather than displaying the check table or the fixed values of the Dictionary field - even if the report parameter or the selection option with LIKE or FOR points to a Dictionary field. You can, for example, use the CALL SCREEN statement to display a selection list of possible values. The contents of the field psel_low_high at the end of this processing block are copied to the appropriate input/output field.

This addition is only allowed with report-specific parameters (PARAMETERS ) or selection options (SELECT-OPTIONS ). For database-specific parameters or selection options, you can achieve the same effect by using the addition VALUE-REQUEST FOR ... with the key word PARAMETERS or SELECT-OPTIONS in the include DBxyzSEL (where xyz = name of logical database). In this case, you must program the value help in the database program SAPDBxyz

- Guru

reward points for helpful answers

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
655

The event is triggered when the user presses F4 on the certain field. Here is an example.



report zrich_0001 .

tables: t001.

data: begin of it001 occurs 0,
      bukrs type t001-bukrs,
      butxt type t001-butxt,
      ort01 type t001-ort01,
      land1 type t001-land1,
      end of it001.

select-options s_bukrs for t001-bukrs.

initialization.

  select bukrs butxt ort01 land1 into table it001 from t001.

  sort it001 ascending by bukrs.
  delete adjacent duplicates from it001 comparing bukrs.

at selection-screen on value-request for s_bukrs-low.

  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
       exporting
            retfield    = 'BUKRS'
            dynprofield = 'S_BUKRS'
            dynpprog    = sy-cprog
            dynpnr      = sy-dynnr
            value_org   = 'S'
       tables
            value_tab   = it001.

start-of-selection.


This line says it all.

at selection-screen on value-request for s_bukrs-low.

It means that when the user press F4 on the S_BUKRS select-option field, then the F4 help will be fired.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
655

Thanks for all the help.