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: 

how to find values btw select-options

Former Member
0 Kudos

dear all,

My requirement is to find out the values between the given range in the select options. The input is var-low = 1A and var-high = 9ZZZ and option = BT (1A and 9ZZZ are the starting and ending values picked up from the number range)

for example: if input is ex-low = 1 and ex-high = 9 and the values between them are 1,2,3,4,5,6,7,8,9...

like wise i what to find out all the values bettween 1A and 9ZZZ and populate into a separate internal table.

Thanks in advance,

aswin.

9 REPLIES 9

Former Member
0 Kudos

Let your select option is

NUM1.

write condition in where clause like this.

where vbeln in NUM1.

0 Kudos

We could not fetch those values in the table. we are writing a upload program for article master (external number range) where program has to pick the next number with out user's input based on the number range assigned. So in order to utilize all possible combination, we are trying to find out next number say after 1A will come etc.

is there any function module or any logic to find value between the range. please help.

thanks.

0 Kudos

>

> We could not fetch those values in the table. we are writing a upload program for article master (external number range) where program has to pick the next number with out user's input based on the number range assigned. So in order to utilize all possible combination, we are trying to find out next number say after 1A will come etc.

>

> is there any function module or any logic to find value between the range. please help.

>

> thanks.

If you are using a internal number range then you can use the FM 'NUMBER_GET_NEXT' to fetch the next available number, as you are using a external number range I believe you have to find a suitable number yourself using your own programming logic

0 Kudos

Use the FM NUMBER_GET_NEXT and here pass the external number range object and it will give u the next number

Former Member
0 Kudos

hii

use like below code for select options values.

loop at s_vbeln. 
write:/ s_vbeln-sign, 
        s_vbeln-option, 
         s_vbeln-low,
         s_vbeln-high.
clear: s_vbeln.
endloop.

0 Kudos

i tried that also but its looping only one time and its displaying low , high, options and the sign and not the values that come in between the input.

thanks.

0 Kudos

>

> i tried that also but its looping only one time and its displaying low , high, options and the sign and not the values that come in between the input.

>

> thanks.

Aswin can you not use this below piece of code?

DATA: BEGIN OF i_vbeln  OCCURS 10,
        vbeln  TYPE vbeln ,
END OF  i_vbeln.
SELECT-OPTIONS:   s_vbeln FOR vbak-vbeln .

select vbeln from vbak into table i_vbeln where vbeln in s_vbeln.

loop at i_vbeln.
write:i_vbeln-vbeln.
endloop.

Former Member
0 Kudos

HI,

From where ur taking the field i.e from which table

this is syntaxs for selectoption

eg.

select-option s_vbeln for itab_vbak-vbeln

this is the select options for vbeln which is in vbak table

Former Member
0 Kudos

Im not sure of your requirement, but as far as I understand you wanted to find all the numbers in a range and you also wanted to find the next number in it.

you can go throught the sameple code and award point if you find it helpful.

REPORT ZVBELN_SDN.

data: itab_vbak type standard table of vbak WITH HEADER LINE,

wa_vbeln type vbak,

count type i.

SELECTION-SCREEN: begin of BLOCK a WITH FRAME.

SELECT-OPTIONS: s_vbeln for itab_vbak-vbeln.

PARAMETERS: pa_vbeln type vbak-vbeln.

SELECTION-SCREEN: end of block a.

START-OF-SELECTION.

select vbeln from vbak into CORRESPONDING FIELDS OF TABLE itab_vbak

WHERE vbeln IN s_vbeln

ORDER BY vbeln.

loop at itab_vbak where vbeln = pa_vbeln.

count = sy-tabix.

endloop.

count = count + 1.

read table itab_vbak INDEX count into wa_vbeln TRANSPORTING vbeln .

write: 'The next Billing document is ', wa_vbeln-vbeln.