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: 

FROM DATABASE INDX: What is this and how this it work?

Former Member
0 Kudos

Hi,

I have the following statements in one of the programs that I am modifying:

INDX_KEY-FLAG = 'SP'.

INDX_KEY-USERA = SY-UNAME.

IMPORT DATA_TABLE FROM DATABASE INDX(SD) ID INDX_KEY.

What does the last statement mean? How is it able to fill the table DATA_TABLE, and where is the data taken from?

Points will be rewarded and responses will be greatly appreciated.

Thanks,

John

4 REPLIES 4

raja_thangamani
Active Contributor
0 Kudos

This will get the values from the table INDX with the parameter id value in the field INDX_KEY and values will be stored in variable DATA_TABLE .

GO to SE16 give the table name INDX

In the field SRTFD enter the value in the field INDX_KEY ..

If you press execute you will find an entry...

<i>*Reward each useful answer</i>

Raja T

Message was edited by:

Raja Thangamani

0 Kudos

How can I view the cluster or find where it was exported from?

Thanks,

John

0 Kudos

Unfourtunately you can can not view the contents of the cluster directly with out using import statement.

Thanks,

Naren

Former Member
0 Kudos

If DATABASE is specified, the data cluster that was written to the database table dbtab in the area ar and under the identification specified in id using the statement EXPORT is imported. The database table dbtab must be set up in the same way as described for the EXPORT statement . For id, a flat, character-type data object is expected that contains the identification of the data cluster, and the two-digit area ar must be specified directly.

After TO, a work area wa that has the same data type as the database table dbtab can be specified. During import, the values of the database fields that are between the fields SRTF2 and CLUSTR are assigned to the components of wa with the same name.

If the database table dbtab is client-dependent, a flat, character-type field cl can be specified after the addition CLIENT. This field contains a client identification. If the addition is not specified, the current client is used.

Outside of classes, the addition TO wa can be omitted. Instead, a table work area for the database table dbtab can be declared using the statement TABLES. Then, during the import, the values of the database fields that are between the fields SRTF2 and CLUSTR are assigned to the component with the same name in the table work area dbtab. In addition, outside of classes, the specification id can be replaced by the obsolete specification obs_id.

Example

The table that is imported into the internal table itab is the table exported under the name tab and the identification " TABLE" into the area "XY" of the database table INDX supplied by SAP (see the additions medium of the statement EXPORT). However, the components - which can be selected as required - are assigned to the structure wa_indx.

TYPES: 
  BEGIN OF tab, 
    col1 TYPE i, 
    col2 TYPE i, 
  END OF tab. 

DATA: 
  wa_indx TYPE indx, 
  wa_itab TYPE tab, 
  cl      TYPE mandt VALUE '100', 
  itab    TYPE STANDARD TABLE OF tab. 

IMPORT tab = itab 
  FROM DATABASE indx(xy) 
  TO   wa_indx 
  CLIENT cl 
  ID 'TABLE'. 

WRITE: wa_indx-aedat, wa_indx-usera, wa_indx-pgmid. 
ULINE. 
LOOP AT itab INTO wa_itab. 
  WRITE: / wa_itab-col1, wa_itab-col2. 
ENDLOOP.

Rgds,

Naren