Skip to Content
0
Former Member
Oct 21, 2005 at 09:18 PM

Keep previous values for Select-Options

40 Views

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.