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 can I clear the select option values?

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member

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.

17 REPLIES 17

arindam_m
Active Contributor
0 Kudos

hi,

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

Cheers,

Arindam

custodio_deoliveira
Active Contributor
0 Kudos

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

Former Member

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.

matt
Active Contributor
0 Kudos

Yes you can: CLEAR SELOPT[]

Former Member
0 Kudos

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 .

matt
Active Contributor
0 Kudos

Not correct: clear can be used.

CLEAR SELOPT[]

Former Member
0 Kudos

Could you elaborate.

Former Member
0 Kudos

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,

Former Member
0 Kudos

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.

former_member209119
Active Participant
0 Kudos

Hi Luis,

Use CLEAR  ITAB[].

This will solve your problem.

Former Member
0 Kudos

Hi Luis,

              The selection screen values can only  be cleared in the selection screen events.

I am assuming that you once you have executed your report and when you come back to selection screen you want the value cleared.

So use at selection-screen output.

At selection-screen output.

clear : p_option[ ], p_option.

Hope it helps

Former Member
0 Kudos

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.

0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi Luis,

You can use clear for clearing the table type and structure type both.

Refresh is obsolete now.

Kind Regards,

RK

former_member198834
Participant
0 Kudos

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

raymond_giuseppi
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Luis,

What is your exact requirement? What are you trying to do? When you have already tried with clear statement, everyone is suggesting you to try with the same statement again? Anyhow, what is the requirement? Please make us clear.

Thanks

Purnand