Application Development 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: 

Format of select-option

Former Member
0 Kudos

Hi all,

is it possible to use a select-option in the "using" part of an form routine?

I would like to create a form routine where I can format the select-option into a string to write the result on screen.

I have multiple select-options but want to create a single form routine to handle them all.

For instance, when I write a Debitor select option it looks like:

Debitor IBT00000000010000000004

But I want to show it like this (after calling a form routine which uses a select-option and returns a string):

Debitor between 1 and 4.

When I want to reach the sign part of the select-option in the form routine

I get an DataObject has no structure and therefore got no "sign" component error message.

Can you folks help me with this?

Thanks in advance!

Greetings Fred.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Fred,

The select-option field will be having the form of a internal table.

So, in your routine, read the select-option field internal table with index, then you will have values for SIGN,OPTION,LOW and HIGH.

You can then proceed as per your requirement.

Regards,

Raj

5 REPLIES 5

Former Member
0 Kudos

Hi Fred,

The select-option field will be having the form of a internal table.

So, in your routine, read the select-option field internal table with index, then you will have values for SIGN,OPTION,LOW and HIGH.

You can then proceed as per your requirement.

Regards,

Raj

Former Member
0 Kudos

Hi

you can use the select_option-low and the select_option-high value and you can also table offsets like select_option-low+2(4).

hope this will help you

regards

Lakshmikanth

Former Member
0 Kudos

Hi Fred,

I think I know what you are referring to. Just see the example below:

TYPES ty_matnr TYPE RANGE OF matnr

SELECT-OPTIONS:

s_matnr FOR mara-matnr.

DATA:

it_matnr TYPE ty_matnr WITH HEADER LINE.

REFRESH it_matnr.

LOOP AT s_matnr.

CLEAR it_matnr.

MOVE-CORRESPONDING s_matnr TO it_matnr.

APPEND it_matnr.

ENDLOOP.

PERFORM do_somthing TABLES it_matnr.

FORM do_something TABLES y_matnr TYPE ty_matnr.

  • Do what ever you want here.

ENDFORM.

Regards,

Srikanth

christian_wohlfahrt
Active Contributor
0 Kudos

Hi Fred!

Your problem is the <i>generic</i> interface, I see.

You have to work with the length of the field. I once had a FM for this, but I didn't copy the coding :-(.

Here the logic:

describe the field length.

The first is including / excluding.

The 2nd and 3rd is between / equal...

The rest 'field3((length-3)/2)' and field3+(length-3)/2((length-3)/2) are your fields.

E.g. length 15, so it's field3(6) and field9(6).

Use conversion_exit_alpha_output for display explicit, convert date, time and quantities explicit, too.

Hope you got the picture,

Christian

Former Member
0 Kudos

@all

Thanks for your replies.

@ Christian Wohlfahrt and Rajasekhar Dinavahi,

Thanks go especially to you for your answers.

I have to create an own type with the same structure of a select option and pass that to the form routine.

I already thought that would be the solution, but maybe there was a SAP-standard dynamic datatype to use for this case.

Create a "generic interface" (thanks Christian) is what I am going to do.

Greetings Fred.