‎2006 Jan 19 1:57 PM
hi,
plz check this below code for value request.
the select command is not getting the values into internal table,plz tell me what went wrong.
tables:agr_users.
parameters:user like agr_users-uname,
role like agr_users-agr_name.
data:begin of itab occurs 0,
user like agr_users-uname,
role like agr_users-agr_name,
end of itab.
at selection-screen on value-request for role.
data:progname type sy-repid,
dynnum TYPE sy-dynnr,
dynpro_values TYPE TABLE OF dynpread,
field_value LIKE LINE OF dynpro_values.
progname = sy-repid.
dynnum = sy-dynnr.
CLEAR: field_value,dynpro_values.
field_value-fieldname = 'USER'.
APPEND field_value to dynpro_values.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = progname
DYNUMB = dynnum
TRANSLATE_TO_UPPER = ' '
REQUEST = ' '
PERFORM_CONVERSION_EXITS = ' '
PERFORM_INPUT_CONVERSION = ' '
DETERMINE_LOOP_INDEX = ' '
TABLES
DYNPFIELDS = dynpro_values
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.
READ TABLE dynpro_values INDEX 1 INTO field_value.
move field_value-fieldvalue to user.
select agr_name from agr_users into table itab
where uname = user.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'AGR_NAME'
PVALKEY = ' '
DYNPPROG = progname
DYNPNR = dynnum
DYNPROFIELD = 'ROLE '
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'C'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
VALUE_TAB = itab
FIELD_TAB =
RETURN_TAB =
DYNPFLD_MAPPING =
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.
ENDIF.
‎2006 Jan 19 2:02 PM
Your Itab has two fields; 'user' and 'role' whereas in your select you are selecting only one field 'agr_name'. Instead, you have to either remove the 'user' field from your itab or add 'uname' to the select.
‎2006 Jan 19 2:02 PM
Your Itab has two fields; 'user' and 'role' whereas in your select you are selecting only one field 'agr_name'. Instead, you have to either remove the 'user' field from your itab or add 'uname' to the select.
‎2006 Jan 19 2:13 PM
hi i had used corresponding in itab,but any way i had changed as u said ,still not working.
‎2006 Jan 19 2:16 PM
PL change itab declaration as below..
data:begin of itab occurs 0,
uname like agr_users-uname,
agr_name like agr_users-agr_name,
end of itab.
Suresh
‎2006 Jan 19 2:18 PM
Make the below change as well
tables:agr_users.
parameters:user like agr_users-uname,
role like agr_users-agr_name.
data:begin of itab occurs 0,
uname like agr_users-uname,
agr_name like agr_users-agr_name,
end of itab.
at selection-screen on value-request for role.
data:progname type sy-repid,
dynnum TYPE sy-dynnr,
dynpro_values TYPE TABLE OF dynpread,
field_value LIKE LINE OF dynpro_values.
progname = sy-repid.
dynnum = sy-dynnr.
CLEAR: field_value,dynpro_values.
field_value-fieldname = 'USER'.
APPEND field_value to dynpro_values.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = progname
DYNUMB = dynnum
TRANSLATE_TO_UPPER = ' '
REQUEST = ' '
PERFORM_CONVERSION_EXITS = ' '
PERFORM_INPUT_CONVERSION = ' '
DETERMINE_LOOP_INDEX = ' '
TABLES
DYNPFIELDS = dynpro_values
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.
READ TABLE dynpro_values INDEX 1 INTO field_value.
move field_value-fieldvalue to user.
select <b>uname agr_name</b> from agr_users into table itab
where uname = user.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'AGR_NAME'
PVALKEY = ' '
DYNPPROG = progname
DYNPNR = dynnum
DYNPROFIELD = 'ROLE '
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'C'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
VALUE_TAB = itab
FIELD_TAB =
RETURN_TAB =
DYNPFLD_MAPPING =
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.
ENDIF.
Regards,
Srikanth
‎2006 Jan 19 2:21 PM
You don't have to change the itab definition, please see my code above, problem will be solved. Just add UNAME to your select statement. In my example code above, I have also fixed the problem of selecting your entry from the ROLE help. As you had it coded, it was not bringing back to the selection screen.
Regards,
Rich Heilman
‎2006 Jan 19 2:25 PM
‎2006 Jan 19 2:41 PM
‎2006 Jan 19 2:44 PM
‎2006 Jan 19 2:49 PM
Please visit this url for information on
'at selection on value request'
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/at_selec.htm
‎2006 Jan 19 2:56 PM
Have you been looking at my example? This is how you tell it to bring the value back to a field on the selection screen. Where ROLE is the name of the selection screen field.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
<b>RETFIELD = 'ROLE'</b>
Please make sure to award points accordingly and mark your post as solved when solved completely. Thanks.
Regards,
Rich Heilman
‎2006 Jan 19 3:46 PM
‎2006 Jan 19 4:01 PM
hi rich,
i will award all the persons who had helped me.but my problem is not solved,i had pasted ur code as it is.it is saying no values returned,i checked the table it is having data.
‎2006 Jan 19 11:41 PM
Change the parameter definition of user to have a default value <b>sy-unam</b>e. I just tested Rich's code after changing the parameter definition. When I pressed F4 in the Role field, all roles for my userid displayed in a pop-up screen.
parameters:user like agr_users-uname <b>default sy-uname</b>,
Bruce
‎2006 Jan 19 11:44 PM
‎2006 Jan 20 2:48 PM
‎2006 Jan 19 2:02 PM
Make the change which is in bold.....
tables:agr_users.
parameters:user like agr_users-uname,
role like agr_users-agr_name.
data:begin of itab occurs 0,
<b>uname like agr_users-uname,
agr_name like agr_users-agr_name,</b>
end of itab.
at selection-screen on value-request for role.
data:progname type sy-repid,
dynnum TYPE sy-dynnr,
dynpro_values TYPE TABLE OF dynpread,
field_value LIKE LINE OF dynpro_values.
progname = sy-repid.
dynnum = sy-dynnr.
CLEAR: field_value,dynpro_values.
field_value-fieldname = 'USER'.
APPEND field_value to dynpro_values.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = progname
DYNUMB = dynnum
TRANSLATE_TO_UPPER = ' '
REQUEST = ' '
PERFORM_CONVERSION_EXITS = ' '
PERFORM_INPUT_CONVERSION = ' '
DETERMINE_LOOP_INDEX = ' '
TABLES
DYNPFIELDS = dynpro_values
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.
READ TABLE dynpro_values INDEX 1 INTO field_value.
move field_value-fieldvalue to user.
select agr_name from agr_users into table itab
where uname = user.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'AGR_NAME'
PVALKEY = ' '
DYNPPROG = progname
DYNPNR = dynnum
DYNPROFIELD = 'ROLE '
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'C'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
VALUE_TAB = itab
FIELD_TAB =
RETURN_TAB =
DYNPFLD_MAPPING =
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.
ENDIF.
Regards,
Srikanth
‎2006 Jan 19 2:08 PM
I've made some modifications to your code. Works good now. Please check the changes in BOLD
report zrich_0003.
tables:agr_users.
parameters:user like agr_users-uname,
role type agr_users-agr_name.
data:begin of itab occurs 0,
user like agr_users-uname,
role like agr_users-agr_name,
end of itab.
at selection-screen on value-request for role.
data:progname type sy-repid,
dynnum TYPE sy-dynnr,
dynpro_values TYPE TABLE OF dynpread,
field_value LIKE LINE OF dynpro_values.
progname = sy-repid.
dynnum = sy-dynnr.
CLEAR: field_value,dynpro_values.
field_value-fieldname = 'USER'.
APPEND field_value to dynpro_values.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = progname
DYNUMB = dynnum
* TRANSLATE_TO_UPPER = ' '
* REQUEST = ' '
* PERFORM_CONVERSION_EXITS = ' '
* PERFORM_INPUT_CONVERSION = ' '
* DETERMINE_LOOP_INDEX = ' '
TABLES
DYNPFIELDS = dynpro_values
* 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.
READ TABLE dynpro_values INDEX 1 INTO field_value.
move field_value-fieldvalue to user.
select <b>uname</b> agr_name from agr_users into table itab
where uname = user.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
<b>RETFIELD = 'ROLE'</b>
* PVALKEY = ' '
DYNPPROG = progname
DYNPNR = dynnum
<b>DYNPROFIELD = 'ROLE'</b>
* STEPL = 0
* WINDOW_TITLE =
* VALUE = ' '
<b> VALUE_ORG = 'S'</b>
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* MARK_TAB =
* IMPORTING
* USER_RESET =
TABLES
VALUE_TAB = itab
* FIELD_TAB =
* RETURN_TAB =
* DYNPFLD_MAPPING =
* 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.
ENDIF.
Regards,
Rich Heilman
‎2006 Jan 19 3:09 PM
Have attached the code, check the line in bold.
REPORT ZKH.
tables:agr_users.
parameters:user like agr_users-uname,
role type agr_users-agr_name.
data:begin of itab occurs 0,user like agr_users-uname,
role like agr_users-agr_name,end of itab.
at selection-screen on value-request for role.
data:progname type sy-repid,
dynnum TYPE sy-dynnr,
dynpro_values TYPE TABLE OF dynpread,
field_value LIKE LINE OF dynpro_values.
progname = sy-repid.
dynnum = sy-dynnr.
CLEAR: field_value,
dynpro_values.
field_value-fieldname = 'USER'.
APPEND field_value to dynpro_values.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = progname DYNUMB = dynnum
*TRANSLATE_TO_UPPER = ' '
* REQUEST = ' '
* PERFORM_CONVERSION_EXITS = ' '
* PERFORM_INPUT_CONVERSION = ' '
* DETERMINE_LOOP_INDEX = ' '
TABLES DYNPFIELDS = dynpro_values
* 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.
READ TABLE dynpro_values INDEX 1 INTO field_value.
move field_value-fieldvalue to user.
select uname agr_name from agr_users into table itab where uname = user.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
<b>RETFIELD = ROLE</b>
* PVALKEY = ' '
DYNPPROG = progname
DYNPNR = dynnum
DYNPROFIELD = 'ROLE'
* STEPL = 0
* WINDOW_TITLE =
* VALUE = ' '
VALUE_ORG = 'S'
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* MARK_TAB =
* IMPORTING
* USER_RESET =
TABLES VALUE_TAB = itab
* FIELD_TAB =
* RETURN_TAB =
* DYNPFLD_MAPPING =
* 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.
ENDIF.
regards
kumar R
‎2006 Jan 19 4:38 PM
In debugging, check if any records are returned to your internal table after the select statement. If not, then the problem is with your select statement, or the value of 'user', not the at selection-screen on value-request event.
‎2006 Jan 19 4:43 PM
This code works absolutly great in my system. Please cut and paste it into your system and test it.
report zrich_0003.
tables:agr_users.
parameters:user like agr_users-uname,
role type agr_users-agr_name.
data:begin of itab occurs 0,
user like agr_users-uname,
role like agr_users-agr_name,
end of itab.
at selection-screen on value-request for role.
data:progname type sy-repid,
dynnum type sy-dynnr,
dynpro_values type table of dynpread,
field_value like line of dynpro_values.
progname = sy-repid.
dynnum = sy-dynnr.
clear: field_value,dynpro_values.
field_value-fieldname = 'USER'.
append field_value to dynpro_values.
call function 'DYNP_VALUES_READ'
exporting
dyname = progname
dynumb = dynnum
tables
dynpfields = dynpro_values.
read table dynpro_values index 1 into field_value.
move field_value-fieldvalue to user.
select uname agr_name
from agr_users into table itab
where uname = user.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'ROLE'
dynpprog = progname
dynpnr = dynnum
dynprofield = 'ROLE'
value_org = 'S'
tables
value_tab = itab.
Make sure that there are values in the table!!!
Regards,
Rich Heilman