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

FM DYNP_VALUES_READ

Former Member
0 Likes
3,754

Hi,

Here is some relevant code:

data: i_dynp_read type table of dynpread.

IMPORT W_PERNR FROM MEMORY ID 'CATSPERNR'.

IF SY-SUBRC = 0.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = 'SAPLCATS'

DYNUMB = '2002'

TABLES

DYNPFIELDS = i_dynp_read

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.

ENDIF.

I am trying to return the values from the top part of the screen in CAT2, which holds the personnel number and time entry dates. Sy-subrc returns 0 but I never get any data in my table i_dynp_read.

Anybody have any ideas

thanks.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,866

You must first add the fields to the internal table...




  data: dynfields type table of dynpread with header line.

*  Here add the fields that you want to read from 
* the screen
  dynfields-fieldname = 'P_ATNAM'.
  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.

Regards,

Rich Heilman

You must first add the fields to the internal table...




  data: dynfields type table of dynpread with header line.

*  Here add the fields that you want to read from 
* the screen
  dynfields-fieldname = 'P_ATNAM'.
  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.

Regards,

Rich Heilman

9 REPLIES 9
Read only

Former Member
0 Likes
1,866

Here is a sample prog, see if it of any use.

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.

This is what the documentation says,

<b>Table parameter:

DYNPFIELDS: Table to read the current screen values.

Meaning: Before the call of the function module, the table

contains the name of the screen fields to be read.

After the call, it also contains the values read

and the step loop lines, if it is a step loop

screen.</b>

Regards,

ravi

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,867

You must first add the fields to the internal table...




  data: dynfields type table of dynpread with header line.

*  Here add the fields that you want to read from 
* the screen
  dynfields-fieldname = 'P_ATNAM'.
  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.

Regards,

Rich Heilman

Read only

0 Likes
1,866

First thing is you should give occur n specifiction for the internal table declaration. Secondly append the required fileds to that internal table.

If you do this, your internal table will get populated with the required data.

Read only

0 Likes
1,866

Hi,

I have done this now, and I get sy-subrc of 2. Which is

cannot find feild

for the dates in cat2 I am appending field names or

DATEFROM

DATETO

are these correct.

Read only

0 Likes
1,866

I would say that they are....

CATSFIELDS-DATEFROM

CATSFIELDS-DATETO

Regards,

Rich Heilman

Read only

0 Likes
1,866

Try something like this.




  data: dynfields type table of dynpread with header line.

*  Here add the fields that you want to read from 
* the screen
  dynfields-fieldname = 'CATSFIELDS-DATEFROM'.
  append dynfields.
  dynfields-fieldname = 'CATSFIELDS-DATETO'.
  append dynfields.

  call function 'DYNP_VALUES_READ'
       exporting
            dyname               = <program_name>
            dynumb               = <screen_number>
            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.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,866
  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.
Read only

venkata_ramisetti
Active Contributor
0 Likes
1,866

Hi

You have to populate the internal table dynpfields before calling the FM.

You have to use code similar to the below

data: repid like sy-repid.

dynpfields-fieldname = 'PNAME'.

append dynpfields.

repid = sy-repid.

call function 'DYNP_VALUES_READ'

exporting

dyname = repid

dynumb = sy-dynnr

tables

dynpfields = dynpfields

exceptions

others.

read table dynpfields index 1.

pname = dynpfields-fieldvalue.

Thanks,

Ramakrishna

Read only

Former Member
0 Likes
1,866

Hi,

The same code i have writen, i am pasting my code.. see that one

DATA : L_DYNPFIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = 'SAPLCATS'

DYNUMB = '2002'

TABLES

DYNPFIELDS = L_DYNPFIELDS.

Here i am getting the values.. so try this code. you willget the results..

Regards

Sudheer