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: 

Variant

Former Member
0 Kudos
464

Hello,

I need your help gurus, I have a variant asociated to a Query, How Can I Copy this Variant to a report, I want to avoid recreate the variant for the report.

Thanks for your Golden help my guru friends.

8 REPLIES 8

Former Member
0 Kudos
393

Even better, How Can I change the values of variant associated with a query from a report.

Thanks.

jogeswararao_kavala
Active Contributor
0 Kudos
393

Hi Enrique,

Have tried FM  ' RS_COPY_SELECTION_SETS '


Jogeswara Rao K



0 Kudos
393

thanks Jogeswara,

Do you know how to change the values of a variant associated to a query?

Can you send me a code you have please?

Thanks so much por sharing your knowledge.

regards.

0 Kudos
393

Hi Enrique,

I use this FM very often, but not tried the way you wanted.

In your case the scenario will be like below:

Execute Tcode SE37 with above FM string --> Give your Query program name in the source and the Z-program name in the Target. Just Execute (Green box). It takes few milli-seconds to transfer the variants (with the values).

Quite likely, there will not be any problem, if both the selection screens, especially the parameters in which values are filled have to be identical in data-types .

Jogeswara Rao K

0 Kudos
393

Do you know how to change the values of a variant associated to a query?

Why code here? This is just like changing variants of any other program.What is the problem you are experiencing?

Jogeswara Rao K

0 Kudos
393

Hi Jogeswara,

Thanks for answer, in the image attached you see that I call a query using a FM, one parameter of this function is a variant parameter, this variant is attached in the query not in my report ZHRPE_TES2.

My problem is that I want to change dinamically the values of the parameters of the variant in order to execute the query so I have different results, for example I would like to change the date range of the variant.

So my problem is how to get the variant, change the values.

I hope you can help me.

Thanks

These are the parameters of the variant for the query.

jogeswararao_kavala
Active Contributor
0 Kudos
393

Hi Enrique,

This resembles the situation I have worked in several of my codes. I did not user the fm 'RSAQ_QUERY_CALL'  for this purpose. I always used submit syntax. I'll try to give you the code. You can draw clues to your situation.

With RSPARAMS



DATA: GIT_RSPARAMS TYPE TABLE OF RSPARAMS.


...........


CALL FUNCTION 'FASU_V_GET_SELECTOPTIONS'
     EXPORTING
       CURR_REPORT     = 'ZHRPE_TES2'
     TABLES
       SELECTION_TABLE = GIT_RSPARAMS.
   IF SY-SUBRC <> 0.
   ENDIF.


...........

" Here you are calling your query using report name AQ....

SUBMIT  AQICZPMKJR======ZPMDLY========      

" Here you are passing the selection values of current program
WITH SELECTION-TABLE GIT_RSPARAMS   

" Default is your Query Variant name
  VIA SELECTION-SCREEN USING SELECTION-SET 'DEFAULT'  
AND RETURN.

Other


     SUBMIT AQICZPMKJR======ZIW28=========

     USING SELECTION-SET 'DEFAULT'
     WITH SP$00014 IN SO_INGRP   
     WITH SP$00018 IN SO_EQUNR
     WITH SP$00007 IN SO_AUSVN

     WITH %LAYOUT = '/LAYOUT'    "Optional line (giving layout value)
     AND RETURN.


"SP$00014 etc are the select-options from the selection-screen of your Query.(get it through F1 help)

"SO_INGRP etc are the select-options from your present code

Hope this helps

Jogeswara Rao K

0 Kudos
393

Hello Jogesware.

Thanks for answering, I have already try submit the query. This was my code.

My problem is that the query I have returns 40 columnas, and the FM LIST_TO_ASCI only recognizes 255 characters, in spite of I declare in my code the type ty_ascii with 1023 when I SUBMIT the query the FM LIST_TO_ASCI accepts 255 characters.

Do you know how to make to recognize more than 255, the 40 columns almost get 1000 characteres.

Thanks for your time my guru friend.

TYPES: BEGIN OF ty_ascii,
      line(1023) TYPE C,
END OF ty_ascii.

   DATA: rspar     TYPE TABLE OF rsparams,
      wa_rspar  LIKE LINE OF rspar.

        wa_rspar-selname = 'SP$00001-LOW'.
      wa_rspar-kind = 'S'.
      wa_rspar-sign = 'I'.
      wa_rspar-option = 'EQ'.
      wa_rspar-low  = '3'.
      APPEND wa_rspar TO rspar.

      wa_rspar-selname = 'SP$00004-LOW'.
      wa_rspar-kind = 'S'.
      wa_rspar-sign = 'I'.
      wa_rspar-option = 'EQ'.
      wa_rspar-low  = '65000006'.
      APPEND wa_rspar TO rspar.

      wa_rspar-selname = 'PNPBEGDA'.
      wa_rspar-kind = 'S'.
      wa_rspar-sign = 'I'.
      wa_rspar-option = 'EQ'.
      wa_rspar-low  = '20140301'.
      APPEND wa_rspar TO rspar.

      wa_rspar-selname = 'PNPENDDA'.
      wa_rspar-kind = 'S'.
      wa_rspar-sign = 'I'.
      wa_rspar-option = 'EQ'.
      wa_rspar-low  = '20140331'.
      APPEND wa_rspar TO rspar.

   SUBMIT AQA0ZPEHR=======ZHR0010ORD==== WITH SELECTION-TABLE rspar
   EXPORTING LIST TO MEMORY AND RETURN LINE-SIZE 1023 .

* Retrieves the Report List from memory
  call function 'LIST_FROM_MEMORY'
       tables
            listobject = it_listobj
       exceptions
            not_found  = 1
            others     = 2.

refresh it_ascii.
IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.
    CALL FUNCTION 'LIST_TO_ASCI'
      TABLES
        listasci                 = it_ascii
        listobject               = it_listobj
      EXCEPTIONS
        empty_list               = 1
        list_index_invalid       = 2
        OTHERS                   = 3.