2013 Mar 26 1:32 PM
Hello,
I have a class and a method which has an import parameter like
IT_DATA type standard table.
i am tryingto export this table to shared memory (my data reference variable) but i always get error. Is there a way to export dynamic tables to SHMA ?
code is similar to this
DATA: v_area_handle TYPE REF TO zcl_shr_areahandle_area,
v_root TYPE REF TO zcl_shr_areahandle_root.
FIELD-SYMBOLS <fs_data> TYPE ANY.
TRY.
v_area_handle = zcl_shr_areahandle_area=>attach_for_write( ).
CREATE OBJECT v_root AREA HANDLE v_area_handle.
v_area_handle->set_root( v_root ).
*dref is the attribute created in root class.
CREATE DATA v_root->dref AREA HANDLE v_area_handle TYPE IT_DATA.
ASSIGN v_root->dref->* TO <fs_data>.
<fs_data> = it_data[] .
v_area_handle->detach_commit( ).
gives error on detach_commit.
2013 Mar 26 3:55 PM
2013 Mar 27 1:35 AM
no that doesnt fix. i want to use SHMA
myerror is
The exception 'CX_SHM_EXTERNAL_REFERENCE' was raised, but it was not caught
anywhere along
the call hierarchy.
Since exceptions represent error situations and this error was not
adequately responded to, the running ABAP program
'CL_SHM_AREA===================CP' has to be
terminated.
2013 Mar 27 4:33 AM
I don't think that you are using correct procedure and method for passing your table into share area.
Why don't you create a dynamic type's(RTTS) attribute in your share object class such as
COMP TYPE REF TO CL_ABAP_TABLEDESCR
OR
COMP TYPE REF TO DATA
And several class method to initial the property of this component's type and array of data which are going to contain.
Of Cause, the first important thing is make sure that your class is share memory enable.
2013 Mar 27 7:10 AM
hello<
you can use data references in your shared memory enabled class without problem.
But if your source table is dynamically created it doesnt work.
i mean here
CREATE DATA v_root->dref AREA HANDLE v_area_handle TYPE IT_DATA
IT_DATA is dynmic or it is RTTS variable, (to access that data you always use datarefernce get structure and assign to field symbol(
it gives error.
even if you unassing fieldsymbols bfore sending to shma.
2013 Mar 27 8:21 AM
I think, you should try this
CREATE DATA v_area_handle->root->dref AREA HANDLE v_area_handle TYPE IT_DATA.
2013 Mar 28 7:58 AM
Because you should modified the object in the share memory indirectly via share memory class object itself. This is what the problem is occurring in your program. Unless you throw an event to tell the share memory object that your v_root have been bounded to the array of data.
2013 Mar 29 9:11 AM
SORRY man
first i though that it was working
yes
if you cal like that it works
data:
itab type table of mara.
select * from mara into table itab.
call function z001
export
it_data = itab
and data type of it_data is standad table.
well it works like that but in BADI which a parameter is coming as a standard table
didnt work
The type \TYPE=%_T00003S00000118O0000016260 cannot currently be created in the
shared objects memory
2013 Mar 29 9:44 AM
2013 Mar 29 9:50 AM
THE ONLY WAY to make it work is
our source table which we are sending to memory
should be a global type like structure, table, integer etc,...
it doesnt work if it isdynamically created like RTTI
2013 Mar 29 10:53 AM
I think you can solve this by the following, I'm not sure it will work but you can try.
First, The dynamic reference variables (including RTTI) will be set as the one of the BADI implementation class attributes.
Secondly, in your SHMA, you set your constructor class of your share memory area's dynamic properties as the BADI implementation class.
There is some useful reference in here: http://saptechnical.com/Tutorials/Others/SharedMemory/Concept.htm
About how to call SHM dynamically in its constructor class.
2013 Mar 29 10:56 AM
I am expecting that root is dynamic reference, so
"THE ONLY WAY to make it work is
our source table which we are sending to memory
should be a global type like structure, table, integer etc,...
it doesnt work if it isdynamically created like RTTI." ,
May not be the true.