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

How can I clear the select option values?

Hello,

I've a ALV report, and I want to know how Can I clear the SELECT OPTION values after send parameters? I have done: cleare P_option[] But this does not allow me select a range in the SELECT OPTION because this removes the values.

I did think use: FREE MEMORY but this remove all parameters into my reports.

Do you have any idia to solve this?

thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

14 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on May 24, 2013 at 05:06 AM

    Hi Luis,

    The Select Options in SAP are treated as internal table of type SELOPT. Since it is an internal table, you cannot clear the contents using CLEAR statement directly. Instead use,

    REFRESH P_OPTION[].

    This will clear the select option.

    Thanks,

    Ankit.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 24, 2013 at 05:26 AM

    hi,

    as ankit said select-options is an internal table .hear the name of select-options You assign also assigned to the internal table with the structure of select-options, with fields sign,option low,high.

    as clear statement clear's workarea and not internal table , so it cant clear select-options too.

    to clear select-options use Refresh statement .

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 24, 2013 at 08:36 AM

    Hi, when u use select option it actualy craetes an internal table with header line that has sign option low and hig values okay.

    now suppose name of my select option is s_matnr.

    so if i write clear: s_matnr it is actually claering only the work area, but u may argue how is it work area, it is because this is a legacy ABAP code that generates itab and wa with same name.

    so, to clear entire content of select option write CLEAR: s_matnr[]. or refresh: s_matnr.

    now, if you want to claer out any on eparticular entry in s_matnr[] or make modifications you can do that too.

    Thanks,

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 24, 2013 at 09:34 AM

    Hi Luis ,

    Try with this below code,

    You can clear the contents of select-options

    TABLES:

    SPFLI.

    SELECT-OPTIONS :

    S_CARRID FOR SPFLI-CARRID.

    START-OF-SELECTION.

    REFRESH:

    S_CARRID.

    I used refresh for s_carrid since internally it is an internal table.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 24, 2013 at 11:17 AM

    Hi Luis,

    Use CLEAR ITAB[].

    This will solve your problem.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 24, 2013 at 02:01 PM

    Hi Luis,

    Use CLEAR : P_option,P_option[].

    Reason : If you are using CLEAR : P_option only then it will clears the work area only.

    If you are using CLEAR : P_option[] only then it will clears the internal table only(but P_option-low or

    P_option-high will have the value). So it is better to use above mentioned code.


    Above scenario is same for REFRESH also.

    Regards,

    Shaiksha Vali.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 27, 2013 at 05:33 AM

    hi Lucis,

    if u want clear selection screen , code should be at selection screen output event./

    sample code.

    at selection-screen output.

    if r_tbt = 'X' .

    clear : p_werks,s_werks-low,p_lgort.

    refresh s_werks.

    perform sub_screen_tbt.

    elseif r_mbt = 'X'.

    clear : p_werks,s_werks-low,p_lgort.

    refresh s_werks.

    perform sub_screen_mbt.

    elseif r_tbm = 'X'.

    clear : p_werks,s_werks-low,p_lgort.

    refresh s_werks.

    perform sub_screen_tbm.

    endif.

    Suresh

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 27, 2013 at 06:06 AM

    I've a ALV report, and I want to know how Can I clear the SELECT OPTION values after send parameters? I have done: cleare P_option[] But this does not allow me select a range in the SELECT OPTION because this removes the values.

    Ok CLEAR p_options[] refresh the whole range, what is your exact requirement, remove one record of the range, then try to manage it as the internal table behind with a DELETE p_option INDEX index, or can you elaborate on your requirement ?

    Regards,

    Raymond

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 24, 2013 at 01:26 AM

    hi,

    Can you please be more specific. May be give your code snippet. That should clarify the issue better.

    Cheers,

    Arindam

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 24, 2013 at 01:30 AM

    Hi Luis,

    Your question is not very clear to me. If you just want to clear the values in a select-option just do:

    CLEAR: P_OPTION[ ], P_OPTION.

    You will need to clear the header line as well as the table content.

    Otherwise, please share a bit of code.

    Cheers,

    Custodio

    @zcust01

    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.