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

Keep previous values for Select-Options

I am using macros to populate my selections with the previously entered values. Everything works fine until I want to delete the previous selections for so_snp via the Trash Can button. The selections come back. The issue seems to be that the selections are deleted from the so_snp range but then the AT SELECTION-SCREEN OUTPUT executes makro_get_range which re-populates the so_snp selection from the data stored in the buffer because so_snp is initial. How do I get the AT SELECTION-SCREEN code to execute first so that the makro_set_range can clear out the shared buffer for '/SAPAPO/PT_PLAN_SNP'. I have included excerpts from my ABAP program.

Any help would be appreciated. I struggled with this all day long.

Best regards,

Sandy

DEFINE makro_get_range.

  • initialization

clear:

lv_line,

lv_key.

  • import SET/GET-parameter from shared buffer

if &2[] is initial.

concatenate sy-uname &1 '_T' into lv_key.

import &2[] from shared buffer indx(st) id lv_key.

if sy-subrc eq 0.

read table &2 index 1.

endif.

endif.

if &2 is initial.

get parameter id &1 field &2.

if sy-subrc ne 0 and &2 is initial.

refresh &2[].

endif.

if not &2 is initial

and &2[] is initial.

append &2.

endif.

endif.

END-OF-DEFINITION.

DEFINE makro_set_range.

  • initialization

clear:

lv_line,

lv_key.

concatenate sy-uname &1 '_T' into lv_key.

  • export SET/GET-parameter to shared buffer

describe table &2[] lines lv_line.

if lv_line gt 1.

export &2[] to shared buffer indx(st) id lv_key.

else.

delete from shared buffer indx(st) id lv_key.

set parameter id &1 field &2.

endif.

END-OF-DEFINITION.

SELECT-OPTIONS so_snp FOR /sapapo/matloc-planner_snp.

AT SELECTION-SCREEN OUTPUT.

makro_get_range '/SAPAPO/PT_PLAN_SNP' so_snp.

AT SELECTION-SCREEN.

makro_set_range '/SAPAPO/PT_PLAN_SNP' so_snp.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Oct 21, 2005 at 10:58 PM

    Can you set a flag to indicate that it needs to be done only once like below?

    AT SELECTION-SCREEN OUTPUT.
    IF v_flag_get_done_once IS INITIAL.
    *-- get the values from the shared buffer
      makro_get_range '/SAPAPO/PT_PLAN_SNP' so_snp.
      v_flag_get_done_once = 'X'.
    ELSE.
    *-- user manipulated the selection screen values, so 
    *   don't do it again. Do Nothing.
    ENDIF.

    Srinivas

    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.