Skip to Content
author's profile photo Former Member
Former Member

Select options help

Hi All

I need to count the the no. entered in select options

for example

SELECT-OPTIONS S_FORM FOR ZMFORM-NFORM. "numeric type

so when user enter 1 to 1000

i need to store 1000 lines to my internal table

do i need to count or is there any simple or better procedure

Thanks

Taran

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 01, 2007 at 12:20 PM

    Tarun,

    In your case the select-options parameter which is S_FORM is it self an internal table with fields sign, low, high, option.

    Simply apply the following sample code for your case.

    SELECT-OPTIONS S_FORM FOR kna1-kunnr. "numeric type

    data: v_count type i.

    describe table s_form lines v_count.

    Write:/ 'The number of entries made in the select optiond is:', v_count.

    Hope this will serve your purpose.

    Do reward if found use full.

    Cheers,

    Rama

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 01, 2007 at 12:38 PM

    hi,

    you can try this below logic

    tables:lips.

    select-options: POSNR for lips-POSNR.

    data:begin of it occurs 0,

    n1 type lips-posnr,

    end of it.

    data:v1 type i,

    v2 type i,

    v3 type i.

    at selection-screen on posnr.

    move posnr-low to v1.

    move posnr-high to v2.

    v3 = v2 - v1.

    do v3 times.

    v1 = v1 + 1.

    move v1 to it-n1.

    append it.

    clear:it.

    enddo.

    start-of-selection.

    move posnr-low to it-n1.

    append it.

    sort it by n1.

    loop at it.

    write:/ it-n1.

    endloop.

    thanks.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 01, 2007 at 12:23 PM

    First of all this should be a parameter and not a select-options, or you should have a select-options with no extension and no-intervals, as at most you are going to get only one value (I think).

    There are many ways of doing this.

    when reading the table itself

    select * into itab up to n_records ......

    when building your internal table itself records.

    loop at all_data.

    move-corresponding all_data to itab.

    if syst-tabix le n_records.

    append itab.

    endif.

    endloop.

    If you for the first n records, then you can do

    loop at itab to n_records

    endloop.

    if you want to last n records, then you can do

    data : l_startrow type i.

    describe table itab lines l_startrow.

    subtract n_records from l_startrow.

    loop at itab from l_startrow.

    endloop.

    Albert

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.