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: 

VARI table

Former Member
0 Kudos

Hi all,

I need to write a program which can read the content of VARI table. For this I'm using 'IMPORT'.

I was having a look to the standard code to create variants, to see how the EXPORTs are done. I've tried to import all the objects that I saw on this, but for the moment, the only thing that it seems to work is "IMPORT %_VARI40C". With this I can read the name of the report fields. But, how can I read the content of the fields? Where is defined which objects must be used to read from this type of tables?

Could you please help me on this?

Thanks in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Use Function module RS_VARIANT_VALUES_TECH_DATA to get the variant values by giving a report name and a variant name.

Srinivas

or use RS_VARIANT_CONTENTS

Message was edited by: Srinivas Adavi

13 REPLIES 13

Former Member
0 Kudos

Use Function module RS_VARIANT_VALUES_TECH_DATA to get the variant values by giving a report name and a variant name.

Srinivas

or use RS_VARIANT_CONTENTS

Message was edited by: Srinivas Adavi

0 Kudos

I already know these functions, but I need to know how to read directly from this table.

Thanks a lot anyway for your answer.

0 Kudos

VARI is a cluster table and I don't think you will be able to read them directly from the table using simple select statements. If you look into the code of these function modules, you may find out how they read the table contents.

Any reason why you cannot use the function modules?

Regards,

Srinivas

0 Kudos

I can not use the function modules because the VARI records are stored in a file. I need to be able to interpret the content of the CLUSTD field.

You can not read from a cluster table using a SELECT statements, but you can do it using IMPORT. I tried with every IMPORT/EXPORT that I found in the standard functions, but they don't work. Only works the one I mentioned before which retrieves the name of the fields.

I guess somewhere it must be defined the format of the CLUSTD field and how it must be read using IMPORTs.

I can not create an ABAP in the source systems to export the variants contents to a file in a nice format, and there are so many variants - it will take years to copy and paste all of them. Also, I can not add records to tables directly from the files.

0 Kudos

Hi Inma,

You are right about the SELECT statement on a cluster database (table). There's no use for a SELECT here.

Coming to understanding the way data is stored, when the data was entered into the cluster table, it would have been done through an EXPORT statement. You will need to find out where that EXPORT statement was issued, and use the similar structure for the data recepients in the IMPORT statement.

In a way, you can say that a cluster table can store data of any format(line-type) unlike an ordinary database table which has a particular structure , as defined in the data-dictionary (SE11). And this data is actually stored in the LRAW field of the table in a compressed format.

Unfortunately, the fields and the values that have been stored in the LRAW part are not maintained anywhere, to my knowledge. At best, it might be documented in the program where the EXPORt statement is actually being issued. It may help if you give the code that you are currently using...

Regards,

Anand Mandalika.

0 Kudos

Hi,

It seems to me like you're trying to transport the variants from one system to another. If that's the case, then let me know. I think (not sure) there are some standard reports that might help you do that.

Regards,

Anand Mandalika.

0 Kudos

You can take a look at the program RSTRANSP.

0 Kudos

Hi Anand,

You are right. I'm trying to transport all the variants from some production systems to a development system.

I saw the report RSTRANSP. It seems that with it you can include the variants in a transport request. I think this is not useful for my case.

Do you know any other report which can export the variants to a file or something like that? The idea is to create the variants in the development system with a batch input, reading from the file.

Thanks!

0 Kudos

Hi Inma,

Look at the program RSDBSPVD. This is the program which saves the variant data to the table VARI.

It has two export statements (line 166 and 170). This should help you with what you need.

Cheers,

Brad

0 Kudos

Oops!

Sorry, just re-read your question and realised that you have already tried this.

Brad

0 Kudos

Hi Brad,

Thanks for your answer. These are the IMPORTs that I'm trying to use. But it seems that only '%_VARI40C' works for me.

I've found the way to see the content of a cluster table:

************************************************

DATA DIRTAB LIKE CDIR OCCURS 10 WITH HEADER LINE

IMPORT DIRECTORY INTO <dirtab>

FROM DATABASE <dbtab>(<ar>)

[CLIENT <cli>] ID <key>.

************************************************

I'll let you know if it works.

Regards to all.

0 Kudos

Hello Inma,

I'm unable to comprehend why you are so insistent on getting the data into a file. Also, why is a transport unsuitable in your case ?

Regards,

Anand Mandalika.

0 Kudos

Well... it is not so easy to explain how are the rules here, you know

Anyway... I got it!!!! 😄

With this you can see the format of the VARI cluster table - search help for "Creating a Directory of a Data Cluster".

*************************************************

DATA: BEGIN OF st_key,

report LIKE RSVAR-REPORT,

variant LIKE RSVAR-VARIANT,

END OF st_key.

DATA DIRTAB1 LIKE CDIR OCCURS 10 WITH HEADER LINE.

DATA DIRTAB2 LIKE CDIR OCCURS 10 WITH HEADER LINE.

IMPORT DIRECTORY INTO DIRTAB1 FROM DATABASE

VARI(VB) ID st_key.

IMPORT DIRECTORY INTO DIRTAB2 FROM DATABASE

VARI(VA) ID st_key.

*************************************************

The structure CDIR contain the information related to the IMPORT directory, ie., name, type of field, field length and so on.

Then you are ready to make the IMPORTS. 8-)

Really thanks to all of you for your help.