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

at selection on value request

Former Member
0 Likes
1,880

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,854

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.

20 REPLIES 20
Read only

Former Member
0 Likes
1,855

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.

Read only

0 Likes
1,854

hi i had used corresponding in itab,but any way i had changed as u said ,still not working.

Read only

0 Likes
1,854

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

Read only

0 Likes
1,854

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

Read only

0 Likes
1,854

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

Read only

0 Likes
1,854

than how to bring that back.

Read only

0 Likes
1,854

Please see the code in my last post, it is a complete working version of your program. Check out the <b>BOLDED</b> code.

Regards,

Rich Heilman

Read only

0 Likes
1,854

hi than how to bring that back to the selection screen.

Read only

0 Likes
1,854

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

Read only

0 Likes
1,854

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

Read only

0 Likes
1,854

Babita, If your problem is solved, please award points for helpful answers and mark your post as solved. Thanks.

Regards,

Rich Heilman

Read only

0 Likes
1,854

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.

Read only

0 Likes
1,854

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

Read only

0 Likes
1,854

I thought that it was understood to enter a value in the USER field, and then do F4 on ROLE. I guess not.

Regards,

Rich Heilman

Read only

0 Likes
1,854

Problem solved? If so, please close your thread and award points accordingly. Thanks.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,854

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

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,854

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

Read only

Former Member
0 Likes
1,854

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

Read only

Former Member
0 Likes
1,854

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.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,854

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