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: 

Clear/Refresh SELECT-OPTIONS using FIELD-SYMBOLS

aabhas_wilmar
Contributor
0 Kudos

Hi Experts

I have a SELECT-OPTION GSO_CU03.

At one point in runtime, it's content are:

Table GSO_CU03 Table Type Standard Table[1x4(11)] | I EQ 4100 1| I EQ 4100 2| I EQ 4200

I have to refresh it's content (and refill later on)

I could have used:

REFRESH GSO_CU03.
CLEAR GSO_CU03.

But for some reason I need to use FIELD-SYMBOLS as below:

CONCATENATE GSO_CU03 '[]' INTO lv_so.
      ASSIGN (lv_so) TO <fs_sm01_so>. "the field symbol now contains the table GSO_CU03[]
      REFRESH <fs_sm01_so>. "this refreshes the select-option
      CLEAR <fs_sm01_so>. "this has no effect

As, after assignment the field symbol contains the select-option table without headerline, the clear statement as no effect.

Can anyone help me clearing it's header?

I have tried ways like:

FIELD-SYMBOLS: <fs_sm01_pa>.
  ASSIGN GSO_CU03 TO <fs_sm01_pa>. "this doesn't really assign the work area
  CLEAR <fs_sm01_pa>.

but they won't work.

Please help.

Thanks,

Aabhas K Vishnoi.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Aabhas,

Your coding looks a bit odd, because I'd expect that you give the variable name for the field symbol. However, your pasted code basically shows that you're using the header line of GSO_CU03 as your field name. So I don't think that would work.

Anyhow, apart from that small problem your coding should work as you'd expect, even though I don't quite understand why you need to utilize field symbols for that (based on your comment I assume though that there's some reason that you didn't explain in your posting).

Here's a small test program that shows that clearing the header line of a table works as you'd expect:


REPORT test.

SELECT-OPTIONS:
  s_uname FOR sy-uname.

INITIALIZATION.
  APPEND 'IEQUSER1' TO s_uname.
  APPEND 'IEQUSER2' TO s_uname.

START-OF-SELECTION.
  PERFORM test_clearing_headerline.


*----------------------------------------------------------------------*
FORM test_clearing_headerline.

  FIELD-SYMBOLS <uname>.

  READ TABLE s_uname INDEX 1.
  PERFORM show_uname_selopt USING 'Initial contents'.

  ASSIGN ('S_UNAME') TO <uname>.
  CLEAR s_uname.
  PERFORM show_uname_selopt USING 'Clearing header line via S_UNAME'.

  ASSIGN ('S_UNAME[]') TO <uname>.
  CLEAR <uname>.
  PERFORM show_uname_selopt USING 'Refreshing table via S_UNAME[]'.

ENDFORM. " test_clearing_headerline


*----------------------------------------------------------------------*
FORM show_uname_selopt USING comment TYPE c.

  DATA sel_uname LIKE s_uname.

  WRITE: /, / sy-uline.
  WRITE: / comment.
  WRITE: / 'Header:',
           s_uname-sign, s_uname-option,
           s_uname-low, s_uname-high.
  LOOP AT s_uname INTO sel_uname.
    WRITE: / 'Line', sy-tabix, ':',
             sel_uname-sign, sel_uname-option,
             sel_uname-low, sel_uname-high.
  ENDLOOP.

ENDFORM. " show_uname_selopt

Below is the output you get when running the code:

-


Initial contents

Header: I EQ USER1

Line 1 : I EQ USER1

Line 2 : I EQ USER2

-


Clearing header line via S_UNAME

Header:

Line 1 : I EQ USER1

Line 2 : I EQ USER2

-


Refreshing table via S_UNAME[]

Header:

Best wishes, harald

13 REPLIES 13

Former Member
0 Kudos

Hi,

For clearing Field-Symbols, use "UNASSIGN".

Hope this helps.

Best Regards,

Benedict

0 Kudos

Thanks for your prompt reply.

My intention, however, is to clear the header of the SELECT-OPTION assigned to a FIELD-SYMBOL.

0 Kudos

Hi,

Have you tried clearing the Select-option itselft?

CLEAR GSO_CU03.

Hope this helps.

Benedict

Former Member
0 Kudos

Hi Aabhas,

Your coding looks a bit odd, because I'd expect that you give the variable name for the field symbol. However, your pasted code basically shows that you're using the header line of GSO_CU03 as your field name. So I don't think that would work.

Anyhow, apart from that small problem your coding should work as you'd expect, even though I don't quite understand why you need to utilize field symbols for that (based on your comment I assume though that there's some reason that you didn't explain in your posting).

Here's a small test program that shows that clearing the header line of a table works as you'd expect:


REPORT test.

SELECT-OPTIONS:
  s_uname FOR sy-uname.

INITIALIZATION.
  APPEND 'IEQUSER1' TO s_uname.
  APPEND 'IEQUSER2' TO s_uname.

START-OF-SELECTION.
  PERFORM test_clearing_headerline.


*----------------------------------------------------------------------*
FORM test_clearing_headerline.

  FIELD-SYMBOLS <uname>.

  READ TABLE s_uname INDEX 1.
  PERFORM show_uname_selopt USING 'Initial contents'.

  ASSIGN ('S_UNAME') TO <uname>.
  CLEAR s_uname.
  PERFORM show_uname_selopt USING 'Clearing header line via S_UNAME'.

  ASSIGN ('S_UNAME[]') TO <uname>.
  CLEAR <uname>.
  PERFORM show_uname_selopt USING 'Refreshing table via S_UNAME[]'.

ENDFORM. " test_clearing_headerline


*----------------------------------------------------------------------*
FORM show_uname_selopt USING comment TYPE c.

  DATA sel_uname LIKE s_uname.

  WRITE: /, / sy-uline.
  WRITE: / comment.
  WRITE: / 'Header:',
           s_uname-sign, s_uname-option,
           s_uname-low, s_uname-high.
  LOOP AT s_uname INTO sel_uname.
    WRITE: / 'Line', sy-tabix, ':',
             sel_uname-sign, sel_uname-option,
             sel_uname-low, sel_uname-high.
  ENDLOOP.

ENDFORM. " show_uname_selopt

Below is the output you get when running the code:

-


Initial contents

Header: I EQ USER1

Line 1 : I EQ USER1

Line 2 : I EQ USER2

-


Clearing header line via S_UNAME

Header:

Line 1 : I EQ USER1

Line 2 : I EQ USER2

-


Refreshing table via S_UNAME[]

Header:

Best wishes, harald

0 Kudos

Hi Harald,

Thanks for your efforts on creating an example program.

However, that doesn't solve my problem. In your program, you have still used the SELECT-OPTION name (identifier) s_uname to clear it.

FORM test_clearing_headerline.
...
...

  ASSIGN ('S_UNAME') TO <uname>.
  CLEAR s_uname. "I can't put the select-option name in my code. I will know it only on run-time
  PERFORM show_uname_selopt USING 'Clearing header line via S_UNAME'.
...
...
ENDFORM. 

Awaiting a solution...

Best wishes,

Aabhas

0 Kudos

FIELD-SYMBOLS: <fs_sm01_pa>.
  ASSIGN GSO_CU03 TO <fs_sm01_pa>. "this doesn't really assign the work area
  CLEAR <fs_sm01_pa>.

In the above code the field symbols refers to headerline right?

If clear fieldsymbol doesnot work then just equate ur field symbols with blank values and since select option is being pointed by FS so it will have blank values thus having same effect as clear.

try like this

<fs_sm01_pa>-low = ' '.

<fs_sm01_pa>-high = ' '.

Edited by: Kartik Tarla on Oct 6, 2009 9:07 AM

0 Kudos

Hi Kartik,

Thanks for your reply.

>In the above code the field symbols refers to headerline right?

Not really, the field symbol contains the value GSO_CU03 and not the structure as you (and I) expected.

><fs_sm01_pa>-low = ' '.

LOW doesn't exists for the reason stated above, therefore a SYNTAX error occurs.

Thanks,

Aabhas

0 Kudos

Can u explain your reqt a bit more so that we may provide you with some workarounds

0 Kudos

Hi Kartik,

The scenario is:

I am creating a workbench which is a huge dynpro application with many subscreens, and numerous SELECT-OPTIONS. I can't really explain how huge it is, but consider it a complex application with multiple tabs and many selection elements.

At one place I need to refresh the screen, dynamically, and fill the screen with values gathered from somewhere. A next step would restore the same.

I have used RS_REFRESH_FROM_SELECTOPTIONS, a bit of logic and a bit of tricks using field-symbols to achieve the refresh of select options and clearing of parameters. However, the select-option header are not cleared and are causing problem in what I want to achieve next (a set of selections).

That's the requirement.

and Precisely, I want to clear the SELECT-OPTIONS header. I wouldn't like to hardcode clear statement for each select-option. Therefore I am assigning it to a field symbol at runtime.

Hope it makes sense.

Thanks,

Aabhas

0 Kudos

Hi Aabhas,

I feel so silly, my coding had a typing error that I didn't fix. Below is the fixed version, where I also added another call to show the initial contents to prove that the output routine doesn't do any modification. When changing the sample program to the code shown below, the output is still as I initially pasted (with twice the data for the initial output though) it, i.e. the table header line of the select option is cleared as one would expect.


  READ TABLE s_uname INDEX 1.
  PERFORM show_uname_selopt USING 'Initial contents'.
  PERFORM show_uname_selopt USING 'Initial contents'.  " Output routine doesn't change S_UNAME

  ASSIGN ('S_UNAME') TO <uname>.
  CLEAR <uname>.  " Clears the header line of S_UNAME as one would expect
  PERFORM show_uname_selopt USING 'Clearing header line via S_UNAME'.

  ASSIGN ('S_UNAME[]') TO <uname>.
  CLEAR <uname>.
  PERFORM show_uname_selopt USING 'Refreshing table via S_UNAME[]'.

Best wishes, harald

0 Kudos

Wow Harald... That worked!

Silly about me, I never tried using paranthesis and didn't click to me even after looking at your code, perhaps I gave up a bit early.

Thanks, that's what I needed, I will now figure out how to restore the data into select-option headers from the PARAM table. Shoule be easy...

Thanks again,

Cheers,

Aabhas

venkat_o
Active Contributor
0 Kudos

Hi Aabhas, <li>Please debug the below portion of your code.

CONCATENATE GSO_CU03 '[]' INTO lv_so.
      ASSIGN (lv_so) TO <fs_sm01_so>.
<li>After ASSIGN First of all, You do not get <fs_sm01_so> table with header. If there is no header why do u want to clear the header. Thanks Venkat.O

0 Kudos

Hi Venkat,

Thanks for your reply.

>After ASSIGN First of all, You do not get <fs_sm01_so> table with header. If there is no header why do u want to clear the header.

That's right. But I am not interested in clearing the field-symbol. I, somehow, want to clear the header line of the referred SELECT-OPTION

Thanks,

Aabhas