03-31-2017 4:30 PM
From its description and its inline code comments, the function module SBUF_OBJ_RESET_OBJECT appears to be the right guy to delete shared buffer import/export areas. (I know, there is a built-in statement "delete from shared buffer", but I need an RFC, since I have to do this operation on other systems/servers - so the function module seems to be a perfect match).
Unfortunately, the following report yields a NOK Why?
report zz_test_delete_indx.
constants: gc_id type c length 55 value 'ZCL_PARAMTESTHUHU'.
data gv_test type string value 'Huhu'.
export gv_test from gv_test to shared buffer indx(zb) id gc_id.
data: gv_key type rsobjkey.
concatenate sy-mandt 'ZB' gc_id into gv_key.
call function 'SBUF_OBJ_RESET_OBJECT'
* destination iv_server
exporting
buff_id = 0 " Import/Export Buffer
inv_code = 'DEL_HERE_DIRECT'
tabname = 'INDX'
key = gv_key
key_l = strlen( gv_key )
exceptions
c_func_error = 1
* system_failure = 97 message gv_msg
* communication_failure = 98 message gv_msg
others = 99.
clear gv_test.
import gv_test to gv_test from shared buffer indx(zb) id gc_id.
if gv_test is initial.
format color col_positive.
write: / 'OK, RESET worked'.
else.
format color col_negative.
write: / 'NOK, RESET didn''t work, still reading ''' no-gap, gv_test no-gap, ''' from buffer.'.
endif.
04-03-2017 9:22 AM
Solved it myself. It works when using code DEL_HERE_GENERIC instead of DEL_HERE_DIRECT, and leaving away the parameter KEY_L. My worries were that "generic" meant that all the entries for this tabkey would be deleted, but they were unjustified: If a KEY is given, then only those entries whose key starts with that parameter will be deleted.