Application Development and Automation 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: 
Read only

Accessing data from a cluster table

Former Member
0 Likes
1,868

HI,

I have tried accessing data from a cluster table but was unable to do it. I tired using the statement IMPORT but, every time i run it, the staement fails and i am not able to work with it.

I even tried using the example in the keyword help, but was of little use.

Can some one help me on this front.

Regards,

Rishav

1 ACCEPTED SOLUTION
Read only

former_member585060
Active Contributor
0 Likes
1,370

Hi,



" To post data to cluster

EXPORT tab = itab
  TO DATABASE indx(XY) 
  ID 'TABLE'.

'or

EXPORT itab TO DATABASE indx(xy) ID ' TABLE'.


' To access data from cluster table

IMPORT tab = itab        " here itab should the internal table with same structure as the cluster table else data will not get download
  FROM DATABASE indx(xy) 
  ID 'TABLE'.                           " ID should be the same when passing with the EXPORT same


or 

'you can use this way

IMPORT itab FROM DATABASE indx(xy) ID 'TABLE'.



Regards

Bala Krishna

9 REPLIES 9
Read only

Former Member
0 Likes
1,370

Dear Rishav,

If you are working with Cluster table e.g. BSEG then its not possible to select only once at the time of data selection. you need to select data from cluster table in a loop and use accordingly. If this is not possible for you then find alternative transeparent table.

Feel free to ask if you have any doubt.

Regards,

Vijay

Read only

0 Likes
1,370

Hi Vijay,

I am not using BSEG but a table SMW3_BDOC2 and still i am not able to access the data.

TABLES : SMW3_BDOC2.

DATA : ls_rawdata TYPE /1CRMG0/BUPA_MAIN.

DATA : lv_bdoc_id TYPE SMOG_TID.

get the data id----


SELECT SINGLE BDOC_ID FROM SMW3_BDOC INTO lv_bdoc_id WHERE BDOC_TYPE = 'BUPA_MAIN'.

IF sy-subrc = 0.

select data from the cluster----

IMPORT /1CRMG0/BUPA_MAIN TO LS_rawdata FROM DATABASE SMW3_BDOC2(10) ID lv_bdoc_id.

ElSE.

WRITE : 'Data not retrieved'.

ENDIF.

Could you please tell me how to use the statement.

Read only

0 Likes
1,370

Hi,

Check this code. Even this is failing

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 '800',

itab TYPE STANDARD TABLE OF tab.

IMPORT tab = itab

FROM DATABASE indx(10)

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.

Read only

0 Likes
1,370

Hi Vijay,

I wanna read the cluster table how to do that, I have come across some FM HR_FORMS_TIM_GET_B2_RESULTS which will read the B2 cluster which I require, But I don't know how to access that data.

can you please put some code for the same.

Thanks in Advance,

Gaurav Patwari

Read only

former_member585060
Active Contributor
0 Likes
1,371

Hi,



" To post data to cluster

EXPORT tab = itab
  TO DATABASE indx(XY) 
  ID 'TABLE'.

'or

EXPORT itab TO DATABASE indx(xy) ID ' TABLE'.


' To access data from cluster table

IMPORT tab = itab        " here itab should the internal table with same structure as the cluster table else data will not get download
  FROM DATABASE indx(xy) 
  ID 'TABLE'.                           " ID should be the same when passing with the EXPORT same


or 

'you can use this way

IMPORT itab FROM DATABASE indx(xy) ID 'TABLE'.



Regards

Bala Krishna

Read only

0 Likes
1,370

the problem of reading the cluster is solved.

We actually need to know the Type of cluster we want to import.

Eg:

IMPORT tab = itab

FROM DATABASE indx(10)

TO wa_indx

CLIENT cl

ID 'TABLE'.

The Tab marked in Bold and underlied must be known to the person who is importung the data.

then we mention the Database name and then the ID(in the database table ) required to fetch the data.

Read only

0 Likes
1,370

Hi,

how can you know the structure of the tab  ??

This is where I am stuck. can anyone throw some light on this please..?

Thanks,

Saikat

Read only

0 Likes
1,370

Hi Saikat,

You need to figure out where the EXPORT TO DATABASE is done and look at that code to see what the structure of the cluster data is.  You can't tell by looking at the data, only the programs that use the table will show you.

Jim

Read only

0 Likes
1,370

Thanks Jim, but we took a different approach for the requirement. But yes, your answer is spot on.

Regards,

Saikat