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: 

On-Value Request Event

Former Member
0 Kudos

Hi All,

I have used 'ON VALUE-REQUEST' event for a variable S_CNTRY in the select-options.

SELECT-OPTIONS: S_CNTRY FOR ADRC-REGION OBLIGATORY.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CNTRY-LOW.

PERFORM SEARCH_HELP_REGION CHANGING S_CNTRY.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CNTRY-HIGH.

PERFORM SEARCH_HELP_REGION CHANGING S_CNTRY.

Is the above declaration Ok ? Can I declare in one statement rather than using two separate as 'LOW' and 'HIGH' reapectively.

Further to this , if I want to write a select statement which will take the values of S_CNTRY from 'S_CNTRY-LOW' to 'S_CNTRY-HIGH' , how shall I do that ??

SELECT X Y Z FROM Z-TAB INTO

ITAB WHERE VAR IN ('S_CNTRY-LOW' TO 'S_CNTRY-HIGH').

Is it fine ?

Kindly help....

Thx...

Paul

6 REPLIES 6

abdul_hakim
Active Contributor
0 Kudos

hi

you could use the below code....

No need to specify for LOW and HIGH separately...

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CNTRY.

PERFORM SEARCH_HELP_REGION CHANGING S_CNTRY.

SELECT X Y Z FROM Z-TAB INTO TABLE

ITAB WHERE VAR IN S_CNTRY.

Cheers,

Abdul Hakim

Mark all useful answers..

0 Kudos

For Select-Options , it uses the values S_CNTRY-LOW and S_CNTRY-HIGH , else it is not getting compiled.

So how do I declare the values in the

SELECT X Y Z FROM Z-TAB INTO TABLE

ITAB WHERE VAR IN S_CNTRY

where I need to select the values which are from S_CNTRY-LOW to S_CNTRY-HIGH.

Thx..

Former Member
0 Kudos

Hi,

here u'll have to declare two at selection-screen on value request for both low as well as high values and u can access the value of low while select query for high but can't do the one u mentioned in ur code....

example enclosed:

DATA: progname LIKE sy-repid,

dynnum LIKE sy-dynnr,

dynpro_values TYPE TABLE OF dynpread.

DATA : return_tab LIKE ddshretval OCCURS 0 WITH HEADER LINE.

progname = sy-repid.

dynnum = sy-dynnr.

SELECT * FROM hrp1000 INTO CORRESPONDING FIELDS OF TABLE it_org FOR ALL ENTRIES IN it_objid

WHERE objid = it_objid-objid

AND plvar = '01' AND otype = 'O' .

ENDIF.

SORT it_org BY objid ASCENDING.

DELETE ADJACENT DUPLICATES FROM it_org COMPARING objid.

SORT it_orgunits BY mc_stext.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'ORGUNIT'

dynpprog = progname

dynpnr = dynnum

dynprofield = 'ORGUNIT'

value_org = 'S'

TABLES

value_tab = it_org

return_tab = return_tab

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3 .

IF sy-subrc EQ 0.

READ TABLE it_org INDEX sy-tabix.

IF sy-subrc = 0.

orgunit = it_org-objid.

ENDIF.

ENDIF.

Reward Points if it helps

Regards

Gunjan

venkat_o
Active Contributor
0 Kudos

Hi Paul,

<b>1</b>.

The way U have done is Excellent.You dont need to declare one .This is right way.

<b>2</b>.

Have a look at the below Sample further to get values into ur S_CNTRY-LOW,S_CNTRY-HIGH.

REPORT zvenkat_head MESSAGE-ID zmsg .

TABLES:ekko.

SELECT-OPTIONS :s_bsart FOR ekko-bsart.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_bsart-low.

PERFORM f4_values_restricted USING s_bsart-low.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_bsart-high.

PERFORM f4_values_restricted USING s_bsart-high.

&----


*& Form f4_values_restricted

&----


FORM f4_values_restricted USING bsart.

DATA: BEGIN OF i_t161 OCCURS 0,

bstyp TYPE t161-bstyp,

bsart TYPE t161-bsart,

batxt TYPE t161t-batxt,

END OF i_t161.

CLEAR i_t161[].

CLEAR i_t161.

DATA: w_progname LIKE sy-repid,

w_scr_num LIKE sy-dynnr .

DATA: return_values LIKE ddshretval OCCURS 0 WITH HEADER LINE.

DATA: itab_dynpfields LIKE dynpread OCCURS 0 WITH HEADER LINE,

t_dynpfields LIKE dynpread.

DATA: t_dyname LIKE d020s-prog,

t_dynumb LIKE d020s-dnum.

SELECT abstyp absart b~batxt

FROM t161 AS a INNER JOIN t161t AS b ON abstyp = bbstyp

AND absart = bbsart

INTO TABLE i_t161

WHERE a~bstyp = 'F'

AND b~spras = sy-langu.

IF sy-subrc = 0.

CALL FUNCTION <b>'F4IF_INT_TABLE_VALUE_REQUEST'</b>

EXPORTING

retfield = 'BSART'

dynpprog = w_progname

dynpnr = w_scr_num

dynprofield = 'EKPO-BSART'

value_org = 'S'

TABLES

value_tab = i_t161

return_tab = return_values

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.

ELSE .

bsart = return_values-fieldval.

ENDIF.

ENDIF.

ENDFORM. " f4_values_restricted

I think that it helps u.

<b>Thanks,

Venkat.O</b>

former_member480923
Active Contributor
0 Kudos

Hi,

1) You have to put on Value request separately for the 2 fields i.e. LOW & HIGH

2) Well when you input both low & high values it becomes a range of that value so if you write ....

IN S_CNTRY

it will automatically take it into effect.

Hope thsi helps

Anirban

Former Member
0 Kudos

Hi,

You do not need to use high and low.The range that you have created will take care of all these things.At both the places you just need to pass the range S_CNTRY.

Regards,

Mukesh Kumar