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: 

FM RS_REFRESH_FROM_SELECTOPTIONS

Former Member
0 Kudos

Hi all,

I'm using FM RS_REFRESH_FROM_SELECTOPTIONS in a report in order to get a value from selection screen.

I need this value in order to populate F4 list for another field according to this value.

Meaning: according to field company code (obligatory) in the selection screen I need to populate F4 list for field plant (all plant associated to the specified company code).


CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
   EXPORTING
      CURR_REPORT = repname
   TABLES
      SELECTION_TABLE = it_sels
   EXCEPTIONS
       NOT_FOUND = 1
       NO_REPORT = 2
       OTHERS       = 3.

The problem is that I don't get the values from the selection screen in it_sels, I only get all the fields from the selection screen but the values are blank.

Any ideas would by appreciated..............

Hagit

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Please go through the below code.

tables: t001k.

  • For Identification Number

DATA: BEGIN OF it_bwkey OCCURS 0,

bwkey LIKE t001k-bwkey,

END OF it_bwkey.

data: v_bukrs(4).

  • For Run date

DATA: BEGIN OF it_bukrs OCCURS 0,

bukrs LIKE t001k-bukrs,

END OF it_bukrs.

DATA it_ret LIKE ddshretval OCCURS 0 WITH HEADER LINE.

SELECTION-SCREEN: BEGIN OF BLOCK main WITH FRAME TITLE text-001.

SELECTION-SCREEN SKIP.

PARAMETERS: p_bukrs(4) TYPE c.

SELECT-OPTIONS s_bwkey FOR t001k-bwkey NO INTERVALS.

SELECTION-SCREEN END OF BLOCK main.

*----


  • Validation Section

*----


INITIALIZATION.

SELECT DISTINCT bukrs FROM t001k INTO TABLE it_bukrs.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_bukrs.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'BUKRS'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'P_BUKRS'

value_org = 'S'

TABLES

value_tab = it_bukrs

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.

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

TABLES: t130r.

DATA: BEGIN OF dynpfields OCCURS 0. "Hilfsstruktur zum auslesen des

INCLUDE STRUCTURE dynpread. "Feldwertes vom Dynpro bei >F4<

DATA: END OF dynpfields.

DATA : sy_repid LIKE sy-repid,

sy_dynnr LIKE sy-dynnr.

CLEAR dynpfields.

REFRESH dynpfields.

dynpfields-fieldname = 'P_BUKRS'.

APPEND dynpfields.

    • Lesen des akt. Wertes von Dynpro

sy_repid = sy-repid.

sy_dynnr = sy-dynnr.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = sy_repid

dynumb = sy_dynnr

TABLES

dynpfields = dynpfields

EXCEPTIONS

OTHERS = 01.

IF sy-subrc = 0.

READ TABLE dynpfields WITH KEY fieldname = 'P_BUKRS'.

IF sy-subrc = 0.

v_bukrs = dynpfields-fieldvalue.

ENDIF.

ENDIF.

SELECT bwkey FROM t001k

INTO TABLE it_bwkey

WHERE bukrs = v_bukrs.

DELETE ADJACENT DUPLICATES FROM it_bwkey.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'BWKEY'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'S_BWKEY'

value_org = 'S'

TABLES

value_tab = it_bwkey

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.

10 REPLIES 10

Former Member
0 Kudos

Well my dear to get the value enter on the Selection screen u dont have to call a FM u just access the variable i.e

loop at s_sels (select option on the selection screen)

hw ever if u want to know all the fields name on the screen that u might use the FM u mention above..

No Rewards Plz..

0 Kudos

Hi Alnoor,

Can't loop on that field becuase it's a parameter and not selection.

Another problem is that the data is not available at the time I choose F4 on the field for which I need the value of the parameter.

Hagit

former_member404244
Active Contributor
0 Kudos

Hi,

try the below code..

data : * Internal table for Selection screen parameters

i_seltable TYPE STANDARD TABLE OF rsparams.

&----


*& Form get_selection_screen

&----


  • Subroutine to get the user selection on selection screen

----


FORM get_selection_screen .

CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'

EXPORTING

curr_report = sy-repid

TABLES

selection_table = i_seltable

EXCEPTIONS

not_found = 01

no_report = 02.

IF sy-subrc NE 0.

REFRESH i_seltable.

ENDIF.

ENDFORM. " get_selection_screen

&----


*& Form display_selection_criteria

&----


  • Subroutine to display the selction criteria in the output

----


FORM display_selection_criteria .

CALL FUNCTION 'RS_LIST_SELECTION_TABLE'

EXPORTING

report = sy-repid

seltext = c_x

newpage = space

TABLES

sel_tab = i_seltable

EXCEPTIONS

sel_tab_empty = 1

OTHERS = 2.

IF sy-subrc <> 0.

REFRESH i_seltable.

ENDIF.

ENDFORM. " display_selection_criteria

Reward if hlpful.

Regards,

nagaraj

0 Kudos

Hi Nagaraj,

I still get no values in i_seltable even after calling the second FM.

thanks,

Hagit

0 Kudos

Hi hagit,

whatever u write in the code is absolutely correct..I have got the correct result from the two FM'S which i gave....It should come my friend..plz check that u r passing correct program name...

Regards,

Nagaraj

0 Kudos

Hi Nagaraj,

The program name is correct.

I get all the fields from the selection screen but all values are initial.

Thanks,

Hagit

0 Kudos

Hi,

R you giving any values on the selection-screen or not?I u give values in the selection screen then it will come in the internal table.

Regards,

Nagaraj

Former Member
0 Kudos

Hi,

Please go through the below code.

tables: t001k.

  • For Identification Number

DATA: BEGIN OF it_bwkey OCCURS 0,

bwkey LIKE t001k-bwkey,

END OF it_bwkey.

data: v_bukrs(4).

  • For Run date

DATA: BEGIN OF it_bukrs OCCURS 0,

bukrs LIKE t001k-bukrs,

END OF it_bukrs.

DATA it_ret LIKE ddshretval OCCURS 0 WITH HEADER LINE.

SELECTION-SCREEN: BEGIN OF BLOCK main WITH FRAME TITLE text-001.

SELECTION-SCREEN SKIP.

PARAMETERS: p_bukrs(4) TYPE c.

SELECT-OPTIONS s_bwkey FOR t001k-bwkey NO INTERVALS.

SELECTION-SCREEN END OF BLOCK main.

*----


  • Validation Section

*----


INITIALIZATION.

SELECT DISTINCT bukrs FROM t001k INTO TABLE it_bukrs.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_bukrs.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'BUKRS'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'P_BUKRS'

value_org = 'S'

TABLES

value_tab = it_bukrs

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.

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

TABLES: t130r.

DATA: BEGIN OF dynpfields OCCURS 0. "Hilfsstruktur zum auslesen des

INCLUDE STRUCTURE dynpread. "Feldwertes vom Dynpro bei >F4<

DATA: END OF dynpfields.

DATA : sy_repid LIKE sy-repid,

sy_dynnr LIKE sy-dynnr.

CLEAR dynpfields.

REFRESH dynpfields.

dynpfields-fieldname = 'P_BUKRS'.

APPEND dynpfields.

    • Lesen des akt. Wertes von Dynpro

sy_repid = sy-repid.

sy_dynnr = sy-dynnr.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = sy_repid

dynumb = sy_dynnr

TABLES

dynpfields = dynpfields

EXCEPTIONS

OTHERS = 01.

IF sy-subrc = 0.

READ TABLE dynpfields WITH KEY fieldname = 'P_BUKRS'.

IF sy-subrc = 0.

v_bukrs = dynpfields-fieldvalue.

ENDIF.

ENDIF.

SELECT bwkey FROM t001k

INTO TABLE it_bwkey

WHERE bukrs = v_bukrs.

DELETE ADJACENT DUPLICATES FROM it_bwkey.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'BWKEY'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'S_BWKEY'

value_org = 'S'

TABLES

value_tab = it_bwkey

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.

0 Kudos

Thank's Valangini, it's working great

0 Kudos

Velangini,

in this example you gave you got only the value from the LOW field: AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_bwkey-low.

I need to get the value of the entire range on the SELECT-OPTIONS parameter.

I'm trying to retrieve values on the event "AT SELECTION-SCREEN ON VALUE REQUEST FOR" .

At this time I use the function module RS_REFRESH_FROM_SELECTOPTIONS, but it doesn't give me the values on the screen, just the values that have been entered (like when you click enter, or other button on the screen).

Thanks!