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

Read Screen Values for Select options

Former Member
0 Likes
1,962

DYNP_VALUES_READ only works to read parameter value.

How to read screen values for select options?

3 REPLIES 3
Read only

Former Member
0 Likes
908

HI,

You need to append the LOW and HIGH field names to the DYNPFIELDS strucutre.

lets say, your Select-option field name is S_LIFNR, then you need to append S_LIFNR-LOW and S_LIFNR-HIGH

Regards

Sudheer

Read only

Former Member
0 Likes
908

hi

good

go through this example and try to implement accordingly in your report

Select-options let's say S_KUNNR is actually a table which contains values as

{LOW, HIGH, SIGN, OPTION}

1. {LOW1, HIGH1, SIGN1, OPTION1}

2. {LOW2, HIGH2, SIGN2, OPTION2}

3. {LOW3, HIGH3, SIGN3, OPTION3}

At any time user may edit only first entry.

Now use RS_SELECTIONSCREEN_READ to get the entry which user has entered directly.

Modify first line of S_KUNNR with values read. And you have the all multiple values in S_KUNNR.

reward point if helpful.

thanks

mrutyun^

Read only

Former Member
0 Likes
908

Hi Sanika,

Check 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), v_bukrs1(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.

Select-options: s_bukrs for t001k-bukrs.

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 s_bukrs-low.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'BUKRS'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'S_BUKRS-LOW'

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_bukrs-high.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'BUKRS'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'S_BUKRS-HIGH'

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 = 'S_BUKRS-LOW'.

APPEND dynpfields.

dynpfields-fieldname = 'S_BUKRS-HIGH'.

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 = 'S_BUKRS-LOW'.

IF sy-subrc = 0.

v_bukrs = dynpfields-fieldvalue.

ENDIF.

READ TABLE dynpfields WITH KEY fieldname = 'S_BUKRS-HIGH'.

IF sy-subrc = 0.

v_bukrs1 = dynpfields-fieldvalue.

ENDIF.

ENDIF.

SELECT bwkey FROM t001k

INTO TABLE it_bwkey

WHERE bukrs ge v_bukrs and

bukrs le v_bukrs1.

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.