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: 

RS_VARIANT_EXIST - BI - ABAP - Query Question

Former Member
0 Kudos

Hi All,

Does anyone know anything about RS_VARIANT_EXISTS. I am using this function in my program to check whether a variant exists for my query. I have created a variant and executed the query through RSRT for the same variant and it works. When I execute the function module it gives ma an error saying 'Report not in library'

Does anyone know about this function module?

Thanks in advance.

Alex(Arthur Samson)

11 REPLIES 11

Former Member
0 Kudos

Hi

see the doc of this fun module

Short Text

Checks whether variant exists

This function module checks whether a variant exists for a given report.

Parameters

REPORT

VARIANT

R_C

Exceptions

NOT_AUTHORIZED

NO_REPORT

REPORT_NOT_EXISTENT

REPORT_NOT_SUPPLIED

Function Group

SVAR

Regards

Anji

0 Kudos

Anji,

Thank for your info. I have seen all the above said. I am not able to get the reason why I get the error. Next I have to run it in debug mode and figure why it is doing this. I just want to find a quick fix so I can avoid going thru the debug process.

Thanks,

Alex.

0 Kudos

Anji,

The actual issue comes when I try to delete the variant using RS_VARIANT_DELETE function. It gives an error 'REPORT_NOT_EXISTENT' with Message ID 'DB' and number '628'.

and Report not in library error.

Thanks,

Alex.

Former Member
0 Kudos

Hi,

Are you doing in this way?

DATA: h_repid LIKE rsvar-report.

DATA: h_variant LIKE rsvar-variant.

h_repid = sy-repid.

h_variant = 'U_'.

CALL FUNCTION 'RS_VARIANT_EXISTS'

EXPORTING

report = h_repid

variant = h_variant

IMPORTING

r_c = h_subrc.

Reward if it helps,

Satish

0 Kudos

Satish,

It is not about how I am doing it. What you have given is just the basics to call a function module, which I am doing (hopefully all who wants to invoke a function will do it). The question is WHY I am getting the error message though the query is executable and available.

Have you used this function or simillar to execute a BI query using ABAP in the background and generate the output as .CSV, if so it will be easy to help me.

Thanks for your info.

Alex.

naimesh_patel
Active Contributor
0 Kudos

This FM checks for the Variant for the report.

See what is there in your SY-CPROG... if it is start with '!Q...' than replace '!' with 'A' in the report name and use the FM.

Like:

l_prog = sy-cprog.
if l_prog+0(1) = '!'.
  l_prog+0(1) = 'A'.
endif.

Then use the FM.

Regards,

Naimesh Patel

0 Kudos

Naimesh,

SY-CPROG has the name of my program. It does not have any !Q or anything like that. There is something about the query that is causing this problem. It is hard for me to figure it out since the query is workiing and executing perfectly in the BEX. If you have done simillar to this, that is executing BI Query using ABAP in background it would be helpful to see the properties thru RSRT and compare with mine.

Thanks,

Alex.

0 Kudos

Ok do one thing...

1. Run your query online.. create a new VARIANT with some wired name say 'ZXCVBNNMM'. Save it.

2. Now go to SE16, table VARI.. put this variant in the field VARIANT = 'ZXCVBNNMM'. RUn it..

You will have the program name of your query here.

So, now you have 2 options:

1: Select single form VARI where program name and variant

2. USE FM ..RS_VARIANT_EXISTS with these parameters.

Regards,

Naimesh Patel

0 Kudos

Naimesh,

The variant is not in table VARI. But it exists and works when executing the query. I could use it in RSRT. Also RSRT technical information will give you the generated program name for the query.

Thanks,

Alex.

0 Kudos

Naimesh,

The table whre the query variants are stored is RSRVARIANT. I could get the info from there as well. Thanks fo rthe direction, I will dig further in and see what I findout.

Thanks,

Alex(Arthur Samson)

Former Member
0 Kudos

closing it.