Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to avoid memory freeing in dynamic programs

Hello,

i have written a abap code statement which dynamically generates a transient abap program!

This dynamic generated program has a return structure, which will be filled inside the dynamic program.

After calling the program from a normal abap program, the return structure has the status "freed stack".

The reason is clear: the resources of the program are "freed" after completion of the program.

What can I do to avoid this process and use the data received from the dynamic generated program?

Thanx in advance...

Florian

Former Member
Former Member replied

Hi Florian,

I solved the Problem by copying the old reference variable in a global new referrence variable:

data: lo_data_ref TYPE REF TO CL_ABAP_DATADESCR.

lo_data_ref ?= CL_ABAP_DATADESCR=>describe_by_data_ref(
              p_data_ref = ADD_EVENT_DATA ).

          CREATE DATA wd_this->mr_bo_data type HANDLE lo_data_ref.

          assign  wd_this->mr_bo_data->* to <ls_add_event_data>.

          assign ADD_EVENT_DATA->* to <ls_add_event_data_copy>.

          <ls_add_event_data> = <ls_add_event_data_copy>.

ADD_EVENT_DATA is the local old refernce variable which was ´freed.

BR, Edgar

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question