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

Question regarding SELECT-OPTIONS

Former Member
0 Likes
900

All,

When I create a select-option in my program like:

SELECT-OPTIONS: s_role FOR AGR_DEFINE-AGR_NAME.

It does not work. To make it work I need to define AGR_DEFINE with the tables statement.

My question is why? In my opinion I just make a reference to a dictionary object. The tables statement is more or less used to create a headerline for a used database table. I don't see any relation in that. Still it is needed to make it work. Any ideas?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
873

Hi,

You can make it works in the folling way.

data ZAGR_DEFINE type AGR_DEFINE.

SELECT-OPTIONS: s_role FOR ZAGR_DEFINE-AGR_NAME.

or

data ZAGR_NAME type AGR_DEFINE-AGR_NAME.

SELECT-OPTIONS: s_role FOR ZAGR_NAME.

Svetlin

Message was edited by: Svetlin Rusev

7 REPLIES 7
Read only

Former Member
0 Likes
874

Hi,

You can make it works in the folling way.

data ZAGR_DEFINE type AGR_DEFINE.

SELECT-OPTIONS: s_role FOR ZAGR_DEFINE-AGR_NAME.

or

data ZAGR_NAME type AGR_DEFINE-AGR_NAME.

SELECT-OPTIONS: s_role FOR ZAGR_NAME.

Svetlin

Message was edited by: Svetlin Rusev

Read only

0 Likes
873

Ok, that's a new solution. Still I can't understand why I have to declare the table in order to make a select-option with reference to a dictionary-object.

Read only

0 Likes
873

Hi

Because the system gives some dictionary characteristics of table field, as search help (for example).

Max

Read only

0 Likes
873

This has been the syntax for select-options since the begining. You need the definition of 'FOR' defined before you use it in the select-option.

I guess the interpreter/compiler was designed to understand and inherit the properties of the referred field if you use 'LIKE' or 'TYPE' but not when you are using 'FOR'. Since the LOW and HIGH fields of the select-option inherits the properties of the 'FOR' field, the properties of it are needed to be defined before. Why, I still don't know, but that is the design.

For some strange reason, SYST(or SY) fields reference will work even if you don't define them before. Is there a clue here? System structure/fields seem to be available for referencing but not static database table fields.

Regards,

Srinivas

Read only

0 Likes
873

The answer can be that you are not referencing the field to do this you use the statement LIKE

Read only

0 Likes
873

Thank you all for the quick and usefull replies. I guess it's just designed this way and has to do with the way the interpreter works. From a conceptual point of view however it still does not make much sense to me.

Read only

suresh_datti
Active Contributor
0 Likes
873

try this..

data: w_role type agr_name.

SELECT-OPTIONS: s_role FOR w_role.

good Luck,

Suresh Datti