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

value request for select options

Former Member
0 Likes
5,066

Hi ,

I want to include value request for selection options in apab program

Pls give me a sample code

6 REPLIES 6
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,961

Hi,

Try this sample code.

tables kna1.

data:

begin of t_values occurs 2,

value like kna1-begru,

end of t_values,

t_return like ddshretval occurs 0 with header line.

select-options s_begru for kna1-begru.

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

refresh t_values.

t_values = 'PAR*'.

append t_values.

t_values = 'UGG'.

append t_values.

call function 'F4IF_INT_TABLE_VALUE_REQUEST'

exporting

retfield = 'BEGRU'

value_org = 'S'

tables

value_tab = t_values

return_tab = t_return

exceptions

parameter_error = 1

no_values_found = 2

others = 3.

if sy-subrc = 0.

read table t_return index 1.

s_begru-low = t_return-fieldval.

endif.

Read only

former_member156446
Active Contributor
0 Likes
1,961

if its a sap standard field ur using for that select-option u already have one.. if not u can creat a search help and add it to ur code.

create an elementary search help say ZSH

select-option: so_abc for Ztab-name matchcode object ZSH.

Award if usefull

Read only

Former Member
0 Likes
1,961

select-options : s_opt for <>

on value-request for s_opt-low.

<code>

on value-request for s_opt-high

<code>

Read only

Former Member
0 Likes
1,961

hi,

T SELECTION-SCREEN ON VALUE-REQUEST

The event is triggered when the user calls the F4 help for the field field. If no corresponding event block has been defined, no possible values help or values list from the Dictionary is displayed. If a corresponding event block exists, it takes precedence over the default possible values help mechanism. It is then up to the programmer to ensure in the event block that an appropriate list of values is displayed, and that the user can choose a value from it.

No event block AT SELECTION-SCREEN ON VALUE-REQUEST can be created for input fields on the selection screen that are declared within the logical database used. You cannot override the input help mechanism of the logical database within the executable program. You can define separate help within the logical database program using the VALUE-REQUEST option in the PARAMETERS and SELECT-OPTIONSstatements.

Example

  • INCLUDE DBXYZSEL

...

PARAMETERS PL_TYPE LIKE SAPLANE-PLANETYPE VALUE-REQUEST.

...

REPORT SAPDBXYZ DEFINING DATABASE XYZ.

...

TABLES SAPLANE.

...

FORM PL_TYPE_VAL.

...

CALL FUNCTION ...

...

ENDFORM.

AT SELECTION-SCREEN ON HELP-REQUEST

If the data type of an input field declared in an executable program is defined in the ABAP Dictionary, the documentation of the underlying data element is automatically displayed if the user positions the cursor in that field and presses F1. To create help for input fields that have no Dictionary reference, or to override the help normally linked to the field, you can create an event block for the event

AT SELECTION-SCREEN ON HELP-REQUEST FOR <field>

The event is triggered when the user calls the F1 help for the field <field>. If no corresponding event block has been defined, the help from the ABAP Dictionary is displayed, or none at all if the field has no Dictionary reference. If a corresponding event block exists, it takes precedence over the default help mechanism. It is then up to the programmer to ensure that appropriate help is displayed.

You cannot declare the event block AT SELECTION-SCREEN ON HELP-REQUEST for input fields on the selection screen that are declared within a logical database. You cannot override the help mechanism of a logical database within the program. You can define separate help within the logical database program using the HELP-REQUEST option in the PARAMETERS and SELECT-OPTIONS statements.

REPORT SELECTION_SCREEN_F1_DEMO.

PARAMETERS: P_CARR_1 TYPE S_CARR_ID,

P_CARR_2 TYPE S_CARR_ID.

AT SELECTION-SCREEN ON HELP-REQUEST FOR P_CARR_2.

CALL SCREEN 100 STARTING AT 10 5

ENDING AT 60 10.

This program declares a selection screen with two parameters that both refer to the data element S_CARR_ID in the ABAP Dictionary. The documentation from the ABAP Dictionary is used for P_CARR_1, and a help screen 100 is called for P_CARR_2. The help screen is defined in the Screen Painter as a modal dialog box with next screen 0. It contains the help text defined as help texts. The screen does not require any flow logic.

Read only

Former Member
1,961

Check the following code to get the F4 help.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR X1.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'field1'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = itab

RETURN_TAB = IT_RETURN.

IF SY-SUBRC = 0.

READ TABLE IT_RETURN INDEX 1.

MOVE IT_RETURN-FIELDVAL TO X1.

ENDIF.

Reward Points if useful.

Read only

Former Member
0 Likes
1,961

Hi,

I have one suggestion.

What you can do is to get the SAP standard search-help for the fieldname(domain) of the input you are going to use as select option.

ex: say you want values for matnr (table mara).

so go to se11.

get mara table.

then click the tab "entry help/check" .

(search help for matnr is : mat1)

here u will find a coloum specifying search helps.

Get this search help name.

Now say you are declaring

select-options : p_matnr for mara-matnr.

here you can add...

select-options : p_matnr for mara-matnr MATCHCODE OBJECT MAT1 .

this will get u the values for the select-options field.