2016 Jan 09 12:53 PM
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.
2016 Jan 11 4:22 AM
Hi,
Parameter documentation
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
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.
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..
2016 Jan 09 1:06 PM
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
2016 Jan 10 6:51 AM
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.
2016 Jan 11 4:29 AM
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!!
2016 Jan 11 12:01 PM
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.
2016 Jan 12 4:46 AM
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.
2016 Jan 11 4:22 AM
Hi,
Parameter documentation
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
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.
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..
2016 Jan 11 5:07 AM
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
2016 Jan 11 11:59 AM
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.