Skip to Content
author's profile photo Former Member
Former Member

DYNP_VALUES_READ vs SELECT-OPTIONS

Hi.

In my program I have two SELECT-OPTIONS params. Second's one data should be filtered by first ones values. For this I'm usin AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_p1-low and high events.

I've found some threads about how to get values from SELECT-OPTIONS using DYNP_VALUES_READ but none of these threads said how to get SIGN and OPTION fields values.

best regards

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Sep 28, 2006 at 01:06 PM

    Hi,

    Have a look at the below code , I think this will solve ur problem.

    F4 help for registration number and account number

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

    PERFORM regnr_f4help CHANGING so_regnr-low.

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

    PERFORM regnr_f4help CHANGING so_regnr-high.

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

    PERFORM acnbf_f4help CHANGING so_acnbf-low.

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

    PERFORM acnbf_f4help CHANGING so_acnbf-high.

    &----


    *

    *& Form regnr_f4help

    &----


    • To provide F4 help for select option so_regnr(registration no.)

    ----


    FORM regnr_f4help CHANGING value(p_so_regnr) LIKE t5kb1-regnr .

    MOVE wi_t5kb1[] TO wi_valreq_regnr[].

    DELETE ADJACENT DUPLICATES FROM wi_valreq_regnr.

    CLEAR wg_retval.

    wg_retval = 'REGNR'.

    *F4 help

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    retfield = wg_retval

    value_org = 'S'

    TABLES

    value_tab = wi_valreq_regnr[]

    return_tab = wi_reitab_regnr[]

    EXCEPTIONS

    parameter_error = 1

    no_values_found = 2

    OTHERS = 3.

    IF sy-subrc <> 0.

    CLEAR p_so_regnr.

    ENDIF.

    *Update Screen feild

    READ TABLE wi_reitab_regnr INTO ws_return_regnr INDEX 1.

    IF sy-subrc = 0.

    p_so_regnr = ws_return_regnr-fieldval.

    ELSE.

    CLEAR p_so_regnr.

    ENDIF.

    ENDFORM. " regnr_f4help

    &----


    *& Form acnbf_f4help

    &----


    • To provide F4 help for select option so_acnbf(account no.)

    ----


    FORM acnbf_f4help CHANGING value(p_so_acnbf) LIKE t5kb1-acnbf.

    CLEAR wg_retval.

    wg_retval = 'ACNBF'.

    IF so_regnr IS NOT INITIAL. "01

    CLEAR wi_acnbf.

    *F4 help when registration number is present

    SELECT regnr

    acnbf

    FROM t5kb1

    INTO TABLE wi_valreq_acnbf

    WHERE regnr = ws_return_regnr-fieldval.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    retfield = wg_retval

    value_org = 'S'

    TABLES

    value_tab = wi_valreq_acnbf[]

    return_tab = wi_reitab_acnbf[]

    EXCEPTIONS

    parameter_error = 1

    no_values_found = 2

    OTHERS = 3.

    IF sy-subrc <> 0.

    CLEAR p_so_acnbf.

    ENDIF.

    *Update screen field

    READ TABLE wi_reitab_acnbf INTO ws_return_acnbf INDEX 1.

    IF sy-subrc = 0.

    p_so_acnbf = ws_return_acnbf-fieldval.

    ELSE.

    CLEAR p_so_acnbf.

    ENDIF.

    ELSE. "01

    CLEAR wi_valreq_acnbf.

    REFRESH wi_valreq_acnbf.

    *F4 help when registration number is not present

    SELECT acnbf

    FROM t5kb1

    INTO TABLE wi_acnbf .

    SORT wi_acnbf BY acnbf .

    DELETE ADJACENT DUPLICATES FROM wi_acnbf.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    retfield = wg_retval

    value_org = 'S'

    TABLES

    value_tab = wi_acnbf[]

    return_tab = wi_reitab_acnbf[]

    EXCEPTIONS

    parameter_error = 1

    no_values_found = 2

    OTHERS = 3.

    IF sy-subrc <> 0.

    CLEAR p_so_acnbf.

    ENDIF.

    *Update screen field

    READ TABLE wi_reitab_acnbf INTO ws_return_acnbf INDEX 1.

    IF sy-subrc = 0.

    p_so_acnbf = ws_return_acnbf-fieldval.

    ELSE.

    CLEAR p_so_acnbf.

    ENDIF.

    ENDIF. "01

    ENDFORM. " acnbf_f4help

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2006 at 04:11 PM

    Mateusz,

    Please check the sample program:

    &----


    *& Report YSAMPLE *

    *& *

    &----


    *& Giving our own description for a field in F4 help *

    &----


    REPORT ysample .

    TABLES: eanl, ehaud.

    DATA: BEGIN OF i_anlage OCCURS 0,

    anlage TYPE anlage,

    sparte TYPE sparte,

    vstelle TYPE vstelle,

    END OF i_anlage.

    DATA: BEGIN OF i_premise OCCURS 0,

    vstelle TYPE vstelle,

    END OF i_premise.

    DATA: i_ret_tab_anlage LIKE ddshretval OCCURS 0 WITH HEADER LINE.

    DATA: lt_dynpfields_analge LIKE dynpread OCCURS 0 WITH HEADER LINE.

    DATA: lws_haus TYPE haus,

    lws_anlage TYPE anlage.

    DATA: i_field_tab TYPE dfies OCCURS 0 WITH HEADER LINE.

    PARAMETERS: p_conn TYPE ehaud-haus,

    p_anlage TYPE anlage.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_anlage.

    CLEAR: i_anlage, i_premise, i_ret_tab_anlage, lt_dynpfields_analge,

    lws_haus, lws_anlage.

    REFRESH: i_anlage, i_premise, i_ret_tab_anlage, lt_dynpfields_analge.

    lt_dynpfields_analge-fieldname = 'P_CONN'.

    APPEND lt_dynpfields_analge.

    CLEAR lt_dynpfields_analge.

    CALL FUNCTION 'DYNP_VALUES_READ'

    EXPORTING

    dyname = sy-repid

    dynumb = sy-dynnr

    translate_to_upper = 'X'

    TABLES

    dynpfields = lt_dynpfields_analge

    EXCEPTIONS

    invalid_abapworkarea = 1

    invalid_dynprofield = 2

    invalid_dynproname = 3

    invalid_dynpronummer = 4

    invalid_request = 5

    no_fielddescription = 6

    invalid_parameter = 7

    undefind_error = 8

    double_conversion = 9

    stepl_not_found = 10

    OTHERS = 11.

    IF sy-subrc EQ 0.

    READ TABLE lt_dynpfields_analge INDEX 1.

    ENDIF.

    lws_haus = lt_dynpfields_analge-fieldvalue.

    IF NOT lws_haus IS INITIAL.

    SELECT vstelle FROM evbs INTO TABLE i_premise

    WHERE haus = lws_haus.

    ELSE.

    SELECT vstelle FROM evbs INTO TABLE i_premise.

    ENDIF.

    IF sy-subrc EQ 0.

    SELECT anlage sparte vstelle

    FROM eanl

    INTO CORRESPONDING FIELDS OF TABLE i_anlage

    FOR ALL ENTRIES IN i_premise

    WHERE vstelle = i_premise-vstelle AND

    sparte = '11' AND

    loevm <> 'X'.

    ENDIF.

    i_field_tab-tabname = 'I_ANLAGE'.

    i_field_tab-fieldname = 'ANLAGE'.

    i_field_tab-reftable = 'I_ANLAGE'.

    i_field_tab-reffield = 'ANLAGE'.

    i_field_tab-position = 1.

    i_field_tab-offset = 0.

    i_field_tab-leng = 15.

    i_field_tab-intlen = 10.

    i_field_tab-outputlen = 15.

    i_field_tab-scrtext_m = 'Installation No.'.

    i_field_tab-scrtext_l = 'Installation No.'.

    APPEND i_field_tab.

    i_field_tab-tabname = 'I_ANLAGE'.

    i_field_tab-fieldname = 'SPARTE'.

    i_field_tab-reftable = 'I_ANLAGE'.

    i_field_tab-reffield = 'SPARTE'.

    i_field_tab-position = 2.

    i_field_tab-leng = 15.

    i_field_tab-offset = 10.

    i_field_tab-intlen = 2.

    i_field_tab-outputlen = 15.

    i_field_tab-scrtext_m = 'Division'.

    i_field_tab-scrtext_l = 'Division'.

    APPEND i_field_tab.

    i_field_tab-tabname = 'I_ANLAGE'.

    i_field_tab-fieldname = 'VSTELLE'.

    i_field_tab-reftable = 'I_ANLAGE'.

    i_field_tab-reffield = 'VSTELLE'.

    i_field_tab-position = 3.

    i_field_tab-leng = 15.

    i_field_tab-offset = 12.

    i_field_tab-intlen = 10.

    i_field_tab-outputlen = 15.

    i_field_tab-scrtext_m = 'Premise'.

    i_field_tab-scrtext_l = 'Premise'.

    APPEND i_field_tab.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    retfield = 'ANLAGE'

    value_org = 'S'

    TABLES

    value_tab = i_anlage

    field_tab = i_field_tab

    return_tab = i_ret_tab_anlage

    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.

    CLEAR i_anlage.

    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

    EXPORTING

    input = i_ret_tab_anlage-fieldval

    IMPORTING

    output = lws_anlage.

    READ TABLE i_anlage WITH KEY anlage = lws_anlage.

    IF sy-subrc EQ 0.

    eanl-anlage = i_anlage-anlage.

    p_anlage = eanl-anlage.

    ENDIF.

    CLEAR: lws_haus, i_field_tab, i_anlage, i_ret_tab_anlage,

    i_premise, lt_dynpfields_analge.

    REFRESH: i_field_tab[], i_anlage[], i_ret_tab_anlage[],

    i_premise[], lt_dynpfields_analge[].

    ENDIF.

    Regards,

    Prakash.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.