10-21-2005 10:18 PM
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.
10-21-2005 11: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
10-21-2005 11: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