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 get all values in the range of select option into internal table?

Former Member
0 Kudos

Hi,

I need to capture all entries coming in the range of select option into one internal table.

How to do get that?

For E.g

select-options: matnr for mara-matnr.(select option)

IF I enter G0100013507892 as lower value of matnr and G0100014873947 as higher value

and if there are 10,000 materials in the above range, then I want to capture all theses 10000 materails in one internal table. How to do that?

Regards,

Mrunal

8 REPLIES 8

former_member555112
Active Contributor
0 Kudos

Hi,

Just SELECT the materials from MARA using the select-options by matching the MATNR field.

Regards,

Ankur Parab

Former Member
0 Kudos

select matnr from mara into corresponding fields of itab where matnr in so_matnr.

This shd give u all the materials which are a part of selection range u have specified from low to high.

Former Member
0 Kudos

'define ranges

r_matnr for mara-matnr.

'fill the range

r_matnr-low = s_matnr-low.

r_matnr-high = s_matnr-high.

r_matnr-sign = 'I'.

r_matnr-option = 'BT'.

'Now select

select * from MARA into table IT_MARA

where matnr IN R_MATNR.

Hope this helps.

Former Member
0 Kudos

select-options: s_matnr for mara-matnr.(select option)


SELECT matnr FROM MARA into table i_mara
                                         where matnr in s_matnr.

Hope it helps......

0 Kudos

select-options: s_matnr for mara-matnr.(select option)

SELECT matnr FROM MARA into table i_mara

where matnr in s_matnr.

but If I add like above code, then I can get only those materails which are exist in mara,(valid materials)

I need to find the invalid materials which are not exist in MARA but entered on selection screen.

Regards,

Mrunal

0 Kudos

Hello Mrunal Mhaskar ,

What i understand you can do one thing go in debug mode

Try this code : -

LOOP AT s_matnr_ex.

IF s_matnr_ex-low IS NOT INITIAL.

i_matnr-matnr = s_matnr_ex-low.

i_matnr-option = s_matnr_ex-option.

APPEND i_matnr.

CLEAR : i_matnr.

ENDIF.

ENDLOOP.

LOOP AT s_matnr_ex.

IF s_matnr_ex-high IS NOT INITIAL.

i_matnr-matnr = s_matnr_ex-high.

i_matnr-option = s_matnr_ex-option.

APPEND i_matnr.

CLEAR : i_matnr.

ENDIF.

ENDLOOP.

In the i_matnr table high and low values are there.

Regards,

Vandana.

Former Member
0 Kudos

Hi .

use

SELECT matnr FROM MARA into table i_mara

where matnr in s_matnr.

Hope this works.

Please let me know if you still have any issues on this.

Thanks and regards,

Rajeshwar.

vamshi_mohan
Participant
0 Kudos

Get data from the database using select options.

now loop over the range table. Prepare a list respecting the Option value. 'BT', 'EQ', ...... We can start incrementing the LOW value until the High value.

Loop over the list and read the records that are already drawn from the database. We have the invalid records.

Regards,