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

Dynp_values_read

Former Member
0 Likes
6,498

Hi ,

Could someone help me in understanding this.

I just have some basic knowledge on function modules and still very new to abap. I am trying to execute the function module DYNP_VALUES_READ independently before using  in a program. I understood the purpose of the function module (captures screen values and dynamically processes for the next screen) but having trouble in giving import parameters.

This looks very complex and has 2 mandatory input parameters-

dy-name =

DYNUMB =

tables parameter

DYNPFIELDS.

Not able to understand what to give as import parameters and what to expect as output.

Thanks,

Macky.

1 ACCEPTED SOLUTION
Read only

Chintu6august
Contributor
3,869

Hi,

Parameter documentation

  • Import parameter:
  • DYNAME: Name of program (of calling screen)

Meaning: Name of program from which the function module is

called. Do not set any SY-fields, because these

are filled dynamically during the call of function

modules.

Value set: None

Pre allocation: None

  • DYNUMB: Number of calling screen
Meaning:   Number of screen from which the function module is
called. Do not set SY-DYNNR.
sy-dynnr gesetzt werden.
Value set: None
Preallocation: None

TRANSLATE_TO_UPPER: For conversion to upper case


Meaning: If set, then the field contents read will be

converted to upper case letters, even if lower case

id defined for the domain in the Data Dictionary.

If not set, then the field contents will be treated

according to the definition of the domain in the

Data Dictionary.

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

check the following document to understand the significance of it's parameters

http://scn.sap.com/docs/DOC-47486

thanks..

8 REPLIES 8
Read only

Former Member
0 Likes
3,869

Hi Mack,

Here an example of code you have to use.

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'.

         

               "Use your value here

  endif.

I hope this solved your problem.

Regards

Read only

0 Likes
3,868

Hi Laso.

Thanks for your reply.

I am trying to create a program which holds the value of a material number from mara given on screen. Below is the program that I have return:

parameters: matnr type mara-matnr.

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  = 'MATNR'.

  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.

write: / it_fields-fieldname,

            it_fields-fieldvalue.

when i enter a value for material number and execute it, i am not getting a value for field value. Where am I making a mistake.  I am guessing that the structure it_fields holds the name of MATNR and also the value.

Read only

0 Likes
3,868

I have modified your code...please check now values are coming.

parameters: matnr type mara-matnr.

data: lv_progname    type progname,
      lv_dynnr       type sychar04,
      lt_fields      like dynpread occurs 0 with header line.



AT SELECTION-SCREEN. " since this FM must be called in PAI
  lv_progname = sy-repid.
  lv_dynnr = sy-dynnr.
  clear lt_fields.
  refresh lt_fields.
  lt_fields-fieldname  = 'MATNR'.
  append lt_fields.


  call function 'DYNP_VALUES_READ'
       exporting
            dyname               = lv_progname
            dynumb               = lv_dynnr
       tables
           dynpfields           = lt_fields.

  read table lt_fields index 1.


START-OF-SELECTION.

write: / lt_fields-fieldname,
            lt_fields-fieldvalue.

thanks!!

Read only

0 Likes
3,868

Hi Chintu,

Thanks for your reply and explanation but I did not get the desired output.

Could you please explain below :


With the statement (lt_fields-fieldname  = 'MATNR'.) I am believing that the structure it_fields is holding the details below:

fieldname = Material Number,

fieldvalue = 100. (input).


I thought the screen attributes are bring captured in the structure it_dynpfields with the above mentioned values.

I think I did not get the use of the sturcture dypread/dypfields.


What values is that structure capturing then? Please explain.


Read only

0 Likes
3,868

yes.. but the FM we are using must be called in PAI i.e after user interaction or user command..

in your code you were calling it without using any report event.

Read only

Chintu6august
Contributor
3,870

Hi,

Parameter documentation

  • Import parameter:
  • DYNAME: Name of program (of calling screen)

Meaning: Name of program from which the function module is

called. Do not set any SY-fields, because these

are filled dynamically during the call of function

modules.

Value set: None

Pre allocation: None

  • DYNUMB: Number of calling screen
Meaning:   Number of screen from which the function module is
called. Do not set SY-DYNNR.
sy-dynnr gesetzt werden.
Value set: None
Preallocation: None

TRANSLATE_TO_UPPER: For conversion to upper case


Meaning: If set, then the field contents read will be

converted to upper case letters, even if lower case

id defined for the domain in the Data Dictionary.

If not set, then the field contents will be treated

according to the definition of the domain in the

Data Dictionary.

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

check the following document to understand the significance of it's parameters

http://scn.sap.com/docs/DOC-47486

thanks..

Read only

Former Member
0 Likes
3,867

Hi Macky,

Can you pass the matnr value into the desired structure.

refresh lt_fields.

  lt_fields-fieldname  = 'MATNR'.

  lt)fields-fieldvalue   = matnr.

  append lt_fields.


Here you are pass the matnr value into the matnr parameter but you didn't pass that value to this table.


Please check the structure before you pass the value in every FM.


Thanks,

Satya

Read only

0 Likes
3,867

Hi Satya,

Thanks for your reply.


With the statement (lt_fields-fieldname  = 'MATNR'.) I am believing that the structure it_fields is holding the details below:

fieldname = Material Number,

fieldvalue = 100. (input).


I thought the screen attributes are bring captured in the structure it_dynpfields with the above mentioned values.

I think I did not get the use of the sturcture dypread/dypfields.


What values is that structure capturing then? Please explain.