Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Export .. to shared buffer ...

FredericGirod
Active Contributor
0 Kudos

I try to use this command but I don't understand something in the example of the Help. (F1 on shared buffer). (the bold)

TABLES INDX.

TYPES: BEGIN OF ITAB3_TYPE,

CONT(4),

END OF ITAB3_TYPE.

DATA: INDXKEY LIKE INDX-SRTFD VALUE 'KEYVALUE',

F1(4), F2 TYPE P,

ITAB3 TYPE STANDARD TABLE OF ITAB3_TYPE WITH

NON-UNIQUE DEFAULT KEY INITIAL SIZE 2,

WA_INDX TYPE INDX.

  • Fill data fields before CLUSTR

  • before the actual export

INDX-AEDAT = SY-DATUM.
INDX-USERA = SY-UNAME.

  • Export data.

EXPORT F1 FROM F1

F2 FROM F2

ITAB3 FROM ITAB3

TO SHARED BUFFER INDX(ST) FROM WA_INDX ID INDXKEY.

Frédéric

(SAP 4.6C)

9 REPLIES 9

FredericGirod
Active Contributor
0 Kudos

I think the example is wrong.

must replace

INDX-AEDAT = SY-DATUM.

INDX-USERA = SY-UNAME.

by

WA_INDX-AEDAT = SY-DATUM.

WA_INDX-USERA = SY-UNAME.

Frédéric.

Former Member
0 Kudos

Shared memory, from the name itself, we have an idea that this is a memory shared by various applications(atleast I get, let me know if I am wrong).

So if the same program runs concurrently, then there is a possibility that one of the programs will not have the correct data, so when you add time and date, it acts as a timestamp.

I believe that is the idea.

Regards,

Subramanian V.

Former Member
0 Kudos

Hello Frédéric,

The EXPORT TO SHARED BUFFER statement, as the documentation says is used to store the data objects as a cluster in the cross-transaction application buffer.

The variant of this statement that you have used, however, is relevant only when you want to store the details such as USER-ID, DATE and other information along with the actual data. This data is primarily for the importer to know who has exported the data and when.

Whether you specify the information or not is your discretion. It is not mandatory.

Hope the explanation is clear enough. But I still feel that the F1 documentation is better.

Regards,

Anand Mandalika.

0 Kudos

But the example is wrong or I'm wrong ?

move data into INDX has no effect instead of WA_INDX.

Frédéric.

0 Kudos

I feel that the example is right, but I am still not able to figure out what dbtab(ar) means.

Regards,

Subramanian V.

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

<b>About FROM WA_INDX:</b>

After FROM, a work area wa can be specified, which has to have the same data type as the data base table dbtab. When exporting, the current values of the components of wa , which are situated between the fields SRTF2 and CLUSTR, are written in all the rows occupied by the data cluster of the data base table.

If outside classes, the addition FROM wa is not specified and instead a Table work area is declared for the data base table dbtab with the statement TABLES, then, at export, the current values of the components of the table work area dbtab, which are situated between the fields SRTF2 and CLUSTR are written in the rows of the data base table.

<b>About the use of WA_INDX with memory areas:</b>

When storing something in the shared memory, you refer to a data base table, even if the data is not stored in the table itself, but in an accordingly created memory table.

<b>About the table structure:</b>

When storing data clusters in database tables and application buffers of the shared memories, you must specify database tables of a specific structure.

The database table INDX delivered by SAP has the required structure and can be used as a pattern for creating own database tables and for testing purposes. I expressly recommend using your own INDX-type database tables in production systems.

0 Kudos

Hi

Yes that information at the structure for the <i>"change date"</i> and <i>"changed by"</i> is useful when you use <b>IMPORT/EXPORT</b> to database cluster tables. However, generally(!) we do not need themm when we use shared buffer. But I guess, because of the underlying procedure, the pattern is like to the one for cluster tables.

It seems it is like a cluster table what is hold at the memory for shared buffer and in fact <b>"TO/FROM SHARED BUFFER"</b> is just to address it to the definite memory table. And hence all other staff is the same.

*--Serdar

0 Kudos

> The database table INDX delivered by SAP has the

> required structure and can be used as a pattern for

> creating own database tables and for testing

> purposes. I expressly recommend using your own

> INDX-type database tables in production systems.

Why ?

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

Because when everybody works on the same table, you cannot guarantee data consistency. Furthermore, the "free components" of INDX are just an example. You might want to define your own fields with your own specific information. Here comes the full description how such at table must be created. Note the second to the last entry. You are totally free to add components as you like and you are not bound to SAP's INDX-example!

<b>INDX-type structure:</b>

The first field must be a key field named MANDT of type CLNT for the client, if you want to store the data objects client-specifically. For a cross-client storage, this component does not apply.

The second field must be a key field named RELID of type CHAR and length 2. It stores the area ar specification.

The third field must be a key field of type CHAR named SRTFD with a maximum length of 55 characters. It stores the identifier specified in id.

The fourth field must be a key field named SRTF2 of type INT4. It contains the row numbers of a stored data cluster that can extend over several rows and is filled automatically by the system.

Then any number of components with freely selectable names and types may follow. They are provided with values by the specification of FROM wa. Addition TO wa of the IMPORT statement exports these fields again.

The last two components must be named CLUSTR and CLUSTD and be of types INT2 and LRAW of any length. In CLUSTR, the current length of field CLUSTD of each row is stored, while CLUSTD contains the actual data cluster.