Skip to Content
avatar image
Former Member

DYNP_VALUES_READ

Hi

Can any body tell me how to use FM "DYNP_VALUES_READ'

Regards

Adams

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 27, 2006 at 12:11 PM

    Hi Adams,

    The FM reads the values from a dynpro. This function can be used to read the values from a report's selection screen too.

    An eg:

    DATA: xdynpfields TYPE STANDARD TABLE OF dynpread WITH HEADER LINE,

    dyname LIKE d020s-prog.

    dyname = sy-repid.

    xdynpfields-fieldname = 'LGNUM'.

    APPEND xdynpfields.

    xdynpfields-fieldname = 'PDC'.

    APPEND xdynpfields.

    CALL FUNCTION 'DYNP_VALUES_READ'

    EXPORTING

    dyname = dyname

    dynumb = '1000'

    translate_to_upper = 'X'

    TABLES

    dynpfields = xdynpfields

    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.

    LOOP AT xdynpfields.

    IF xdynpfields-fieldname = 'LGNUM'.

    lgnum = xdynpfields-fieldvalue.

    lagp-lgnum = lgnum.

    ELSEIF xdynpfields-fieldname = 'PDC'.

    pdc = xdynpfields-fieldvalue.

    ENDIF.

    ENDLOOP.

    ENDIF.

    Reward points if helpful,

    Regards,

    Sumana

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 27, 2006 at 11:31 AM

    See the fm documentaion for the example usage:

    Example:

    data: dyname like d020s-prog value 'TESTPROG',

    dynumb like d020s-dnum value '100'.

    data: begin of dynpfields occurs 3.

    include structure dynpread.

    data: end of dynpfields.

    move 'TABNAME' to dynpfields-fieldname.

    append dynpfields.

    move 'FIELDNAME' to dynpfields-fieldname.

    append dynpfields.

    call function 'DYNP_VALUES_READ'

    exporting

    dyname = dymame

    dynumb = dynumb

    translate_to_upper = 'X'

    tables

    dynpfields = dynpfields

    exceptions

    invalid_abapworkarea = 01

    invalid_dynprofield = 02

    invalid_dynproname = 03

    invalid_dynpronummer = 04

    invalid_request = 05

    no_fielddescription = 06

    undefind_error = 07.

    Regards,

    Ravi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 27, 2006 at 11:33 AM

    hi,

    Please go thru the code..

    this is for Getting File and providing the F4 help..

    data:lv_progname type progname,

    lv_dynnr type sychar04,

    lt_fields like dynpread occurs 0 with header line.

    lv_progname = sy-repid.

    lv_dynnr = sy-dynnr.

    clear lt_fields.

    refresh lt_fields.

    lt_fields-fieldname = 'P_DOS'.

    append lt_fields.

    call function 'DYNP_VALUES_READ'

    exporting

    dyname = lv_progname

    dynumb = lv_dynnr

    tables

    dynpfields = lt_fields

    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.

    read table lt_fields index 1.

    if lt_fields-fieldvalue = 'X'.

    call function 'KD_GET_FILENAME_ON_F4'

    changing

    file_name = p_datfl.

    endif.

    TTR

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 27, 2006 at 11:33 AM
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 27, 2006 at 11:34 AM

    REPORT ZVV.

    tables tcurt.

    DATA DYFIELDS LIKE DYNPREAD OCCURS 1 WITH HEADER LINE.

    PARAMETERS: P_WAERS LIKE TCURT-WAERS, "Currency

    P_LTEXT LIKE TCURT-LTEXT, "Long Text

    P_KTEXT LIKE TCURT-KTEXT. "Short Text

    *----


    *--- Example of updating value of another field on the screen -


    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_WAERS.

    CLEAR: DYFIELDS[], DYFIELDS.

    *--- select currency

    CALL FUNCTION 'HELP_VALUES_GET'

    EXPORTING

    fieldname = 'WAERS'

    tabname = 'TCURT'

    IMPORTING

    SELECT_VALUE = P_WAERS.

    *--- get long text for the selected currency

    SELECT SINGLE LTEXT FROM TCURT

    INTO DYFIELDS-FIELDVALUE

    WHERE SPRAS = SY-LANGU

    AND WAERS = P_WAERS.

    IF SY-SUBRC <> 0.

    CLEAR DYFIELDS-FIELDVALUE.

    ENDIF.

    *--- update another field

    DYFIELDS-FIELDNAME = 'P_LTEXT'.

    APPEND DYFIELDS.

    CALL FUNCTION 'DYNP_VALUES_UPDATE'

    EXPORTING

    DYNAME = SY-CPROG

    DYNUMB = SY-DYNNR

    tables

    dynpfields = DYFIELDS .

    *----


    *--- Example of reading value of another field -


    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_KTEXT.

    *--- read another field

    CLEAR: DYFIELDS[], DYFIELDS.

    DYFIELDS-FIELDNAME = 'P_WAERS'.

    APPEND DYFIELDS.

    CALL FUNCTION 'DYNP_VALUES_READ'

    EXPORTING

    DYNAME = SY-CPROG

    DYNUMB = SY-DYNNR

    TABLES

    DYNPFIELDS = DYFIELDS .

    READ TABLE DYFIELDS INDEX 1.

    *--- get short text and update current field

    SELECT SINGLE KTEXT FROM TCURT

    INTO P_KTEXT

    WHERE SPRAS EQ SY-LANGU

    AND WAERS EQ DYFIELDS-FIELDVALUE.

    *----


    regards

    vinod

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 27, 2006 at 11:44 AM

    Hi,

    DYNP_VALUES_READ will Read the values from a dynpro. This function can be used to read the values from a report's selection screen also .

    See the FM below . In that,

    dyname is used to store the program name.

    dynumb for Screen no.

    dynpfields is the Table for reading current screen values .

    data: v_prog like D020S-PROG,

    v_scrno like D020S-DNUM.

    data: itab like dynpread occurs 0.

    CALL FUNCTION 'DYNP_VALUES_READ'

    EXPORTING

    DYNAME = v_prog

    DYNUMB = v_scrno

    • TRANSLATE_TO_UPPER = ' '

    • REQUEST = ' '

    • PERFORM_CONVERSION_EXITS = ' '

    • PERFORM_INPUT_CONVERSION = ' '

    • DETERMINE_LOOP_INDEX = ' '

    TABLES

    DYNPFIELDS = itab

    • 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 <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    regs

    Rakesh

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 27, 2006 at 11:47 AM

    Hi,

    Check the sample code..

    REPORT  ZTEST_F4HELP                              .
    
    *---Report with selection screen and to display the list of
    * possible entries for field 'B' as per the value in field 'A'.
    
    
    parameters: p_vbeln type vbak-vbeln,
                p_posnr type vbap-posnr.
    
    at selection-screen on value-request for p_posnr.
    
    
      data: begin of help_item occurs 0,
              posnr type vbap-posnr,
              matnr type vbap-matnr,
              arktx type vbap-arktx,
            end of help_item.
    
      data: dynfields type table of dynpread with header line.
    
    
      dynfields-fieldname = 'P_VBELN'.
      append dynfields.
    
      call function 'DYNP_VALUES_READ'
           exporting
                dyname               = sy-cprog
                dynumb               = sy-dynnr
                translate_to_upper   = 'X'
           tables
                dynpfields           = dynfields
           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.
    
    
      read table dynfields with key fieldname = 'P_VBELN'.
    
      p_vbeln = dynfields-fieldvalue.
    
    
      call function 'CONVERSION_EXIT_ALPHA_INPUT'
           exporting
                input  = p_vbeln
           importing
                output = p_vbeln.
    
      select posnr matnr arktx into table help_item
                     from vbap
                          where vbeln = p_vbeln.
    
    
    
      call function 'F4IF_INT_TABLE_VALUE_REQUEST'
           exporting
                retfield    = 'POSNR'
                dynprofield = 'P_POSNR'
                dynpprog    = sy-cprog
                dynpnr      = sy-dynnr
                value_org   = 'S'
           tables
                value_tab   = help_item.

    Regards

    vijay

    Add comment
    10|10000 characters needed characters exceeded