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_CONTENTS Not Returning Values

Former Member
0 Kudos

Folks,

I am using the below code to pick up the values of a variant that I have saved on a custom program and screen that I have written. The values seem to save fine as I can see them in the VARI table and when I run the below code it comes back with SY-SUBRC = 0 but the table lt_valutab is still empty?

Is there anything else I can check to solve this problem?

    CALL FUNCTION 'RS_VARIANT_CONTENTS'
      EXPORTING
        report                      = w_report
        variant                     = sel_variant
      TABLES
        valutab                     = lt_valutab
     EXCEPTIONS
       variant_non_existent        = 1
       variant_obsolete            = 2
       OTHERS                      = 3.
    IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF. 

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Folks,

Thanks for your help but unfortunatly neither has worked.

If I test my variant with the standard program RS_VARIANT_VALUES it still doesn't bring back any values so that suggests to me that the values weren't stored correctly but as I said everything on the VARI table looks correct.

Is there anything else I can check on the backend to ensure that the data in the variant was stored alright?

17 REPLIES 17

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos

Also pass the MOVE_OR_WRITE param to the FM.

kesavadas_thekkillath
Active Contributor
0 Kudos

Hi,

First check it by executing from se37. Make sure that w_report , sel_variant are correctly passed.

@sandeep - move_or_write is for internal/external date representation formats.

0 Kudos

@Keshav : That's absolutely right but sometimes it works may be due to conversion exits or the way data is stored.

Former Member
0 Kudos

Hi Folks,

Thanks for your help but unfortunatly neither has worked.

If I test my variant with the standard program RS_VARIANT_VALUES it still doesn't bring back any values so that suggests to me that the values weren't stored correctly but as I said everything on the VARI table looks correct.

Is there anything else I can check on the backend to ensure that the data in the variant was stored alright?

0 Kudos

Hello Colm,

as I said everything on the VARI table looks correct

How can you be so confident? The contents of the variant are stored in the VARI-CLUSTD which is of type LRAW you can't check the exact contents of the variant.

BR,

Suhas

0 Kudos

Fair point!

What I should have said is:

When I Save my variant with the RS_CREATE_VARIANT FM the SY-SUBRC that comes back is 0 and there is an entry in the VARI table for my report and variant name and there is data in the CLUSTD field of the table.

So my question is, apart from this RS_VARIANT_CONTENTS is there anyway I can check the value of that data in the VARI table?

0 Kudos

Hello Colm,

You can do one thing! You can check the variants maintained against the program.

SE38 --> Program Name --> Variants --> Change.

Let me know your observations.

BR,

Suhas

0 Kudos

I receive the error message:

Program ZEINT_UKMS_MAINTENANCE_TOOL has no selection screens

Message no. DB244

Would this have something to do with the fact that this is a custom program and the variant I have saved is on a subscreen??

0 Kudos

This message was moderated.

0 Kudos

Hi

I have solved it

We have to use this FM  [b]RS_VARIANT_SELECTIONS_DESCR[/b] to get all fields


you can use these fields name to import the values from table VARI where are they stored in VARI in cluster table,

The result

and then we can import the values,

P.S this used if you have old variant and you can not import the old fields name and old value,

in this situation, don't repair them by using RSVARDOC_610, the old data will be lost, if you have change the parameters name.

Vielen Dank nochmal.

Gruß

Ibo

Former Member
0 Kudos

I found my own work around to the issue. Thanks for your help

Only joking, I wouldn't close the thread without giving how I solved it, only really selfish people do that!

The reason my variants weren't being saved was because I had input fields on my subscreen that the user typed the data into and when I saved the variant it was passing those values through and saving them correctly.

However, when I went to read it, because I had no main selection screen that matched the values on the variant, the FM couldn't pull the values back.

Therefore my workaround was to create hidden parameters on my main selection screen that corresponded to the input values, when the user input the values I moved them to the parameters and then saved the variant and when I was loading the variant I loaded them into the parameters and then moved them out to the input fields on my subscreen.

0 Kudos

Not Active Contributor

Hello.

Could you please write how you can do it?

I have a same problem. I have to create my own FM with own screens… I can’t  get variant values by RS_VARIANT_CONTENTS ….Where have you created hidden parameters?...in FM or program?...because I can’t create hidden parameters in FM. I suppose I should create hidden PARAMETERS on REPORT….and than call that REPORT…How have you created hidden PARAMETERS ?

0 Kudos

"How have you created hidden PARAMETERS"

I created them in my program, which has my screen, and defined it using the NO-DISPLAY addition.

PARAMETERS p_name TYPE xfeld NO-DISPLAY.

0 Kudos

Thanks a lot !

Former Member
0 Kudos

Hi,

   

    I need to display variants data for a report. Report is of parameter and variants of select-options. so i am using Fm 'RS_VARIANT_CONTENTS' but i am able to display the data for only 1 variant and should display in ALV. How can i fetch 2 or 3 variants data at a time in the ALV.

   SELECT-OPTIONS : 

REPORT  FOR RSVAR-REPORT NO INTERVALS NO-EXTENSION OBLIGATORY,
VARIANT FOR RSVAR-VARIANT.

   LOOP AT IT_REP_VAR WHERE VARIANT IN VARIANT.

  CALL FUNCTION 'RS_VARIANT_CONTENTS'
    EXPORTING
      REPORT               = IT_REP_VAR-REPORT
      VARIANT              = IT_REP_VAR-VARIANT
    TABLES
      VALUTAB              = TAB_VALUE
    EXCEPTIONS
      VARIANT_NON_EXISTENT = 1
      VARIANT_OBSOLETE     = 2
      OTHERS               = 3.
  IF SY-SUBRC = 0.
  ENDIF.
 
ENDLOOP.

I tried FM 'RS_VARIANT_LIST' also but its not filtering the Variants....

can any one help me out.

Thanks inadvance,

Mohana

0 Kudos

I have a same problem(...for 2 month((....if haven't solved it I think you should create a new Discussion

0 Kudos

Hi,

Still my problem has not solved. I have to display all the variants data in ALV like

Field Name  Type I/E Option Var1 Var2 Var3..... based on the Variants given in select-options. But now i am able to display all the Variants data only in Var1 position.