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: 

change parameters variant report

Former Member
0 Kudos

Hi abappers,

I want save the data that I obtain with the and pass the values with the FM 'RS_VARIANT_CONTENTS'

CALL FUNCTION 'RS_VARIANT_CONTENTS'                     
         EXPORTING                                             
              REPORT               = 'ZPRU'          
              VARIANT              = p_varint                  
         TABLES                                                
              VALUTAB              = c_varint         
              OBJECTS              = I_OBJECTS      
         EXCEPTIONS                                            
              VARIANT_NON_EXISTENT = 1                         
              VARIANT_OBSOLETE     = 2                         
              OTHERS               = 3.

then with the FM RS_CHANGE_CREATED_VARIANT I want modify the variant, but it no refresh

VARID-report  = '/1BCDWB/DBBKPF'.                           
VARID-variant = p_varint.                                   
VARID-ename   = sy-uname.                                   
VARID-edat    = sy-datum.                                   
VARID-etime   = sy-uzeit.

CALL FUNCTION 'RS_CHANGE_CREATED_VARIANT'             
         EXPORTING                                          
              CURR_REPORT               = 'ZPRU'  
              CURR_VARIANT              = p_varint          
              VARI_DESC                 = VARID             
         TABLES                                             
              VARI_CONTENTS             = c_varint          
              OBJECTS                   = I_OBJECTS         
         EXCEPTIONS                                         
              ILLEGAL_REPORT_OR_VARIANT = 1                 
              ILLEGAL_VARIANTNAME       = 2                 
              NOT_AUTHORIZED            = 3                 
              NOT_EXECUTED              = 4                 
              REPORT_NOT_EXISTENT       = 5                 
              REPORT_NOT_SUPPLIED       = 6                 
              VARIANT_DOESNT_EXIST      = 7                 
              VARIANT_LOCKED            = 8                 
              SELECTIONS_NO_MATCH       = 9                 
              OTHERS                    = 10.

I view that the tcode SE16 use the form:

perform export_variant_static(rsdbspvd) tables   l_dyns_fields 
                                         using    l_vari[]      
                                                  varivdat[]    
                                                  l_varidyn     
                                                  l_vdatdyn     
                                                  l_texpr imex  
                                                  $rkey         
                                                  exp_subrc.    
 perform %_export_vari_clnt in program  (rsvar-report)          
                 using $rkey l_mandt                            
              changing exp_subrc if found.

but I dont understand the process for save the variant of reprot ZPRU,

I want modify the parameter obligatory that it contain on the table internal I_OBJECT

Can you help me, please?

Cordial greetings.

5 REPLIES 5

former_member182371
Active Contributor
0 Kudos

Hi,

check routine:

  • Variante generieren

PERFORM GEN_VAR_NAME USING MCMANDT MCONAME FUNKTION MANDT_KZ VARNAME

RC.

in report:

SAPMACO

pay attention to:

RSPARAMS_TAB-KIND

RSPARAMS_TAB-SELNAME

RSPARAMS_TAB-LOW

APPEND RSPARAMS_TAB.

Best regards.

0 Kudos

Hi Pablo,

I want obtain the place where save the data where said that the select option is optional, Required field and it is invisible ,hide field.

In the table internal I_OBJECTS (include estructure VANZ) I write the parameters are optional and invisible; but now I want change the data on the variant.

I check the code, but no find the place where I changed this values, the FM pass the contents and text of variant but the the optional and invisible ¿where is it?

Thank you for you attention.


CALL FUNCTION 'RS_CHANGE_CREATED_VARIANT'
       EXPORTING
            CURR_REPORT               =  REPORT_NAME
            CURR_VARIANT              =  VARIANT_NAME
            VARI_DESC                 =  VARID_TAB
       TABLES
            VARI_CONTENTS             =  RSPARAMS_TAB
            VARI_TEXT                 =  VARIT_TAB
       EXCEPTIONS
            ILLEGAL_REPORT_OR_VARIANT = 01
            ILLEGAL_VARIANTNAME       = 02
            NOT_AUTHORIZED            = 03
            NOT_EXECUTED              = 04
            REPORT_NOT_EXISTENT       = 05
            REPORT_NOT_SUPPLIED       = 06
            VARIANT_DOESNT_EXIST      = 07
            VARIANT_LOCKED            = 08
            SELECTIONS_NO_MATCH       = 09.

Cordial greetings.

Edited by: lopez fernandez on Jan 26, 2009 2:42 PM

0 Kudos

Hi,

if you want to load a variant in your z report try something like:


REPORT ZZXXX
       NO STANDARD PAGE HEADING LINE-SIZE 255.

TABLES: sflight.
DATA: wa_sflight LIKE sflight.

PARAMETERS: p_carrid TYPE sflight-carrid,
            p_connid TYPE sflight-connid.

INITIALIZATION.

  DATA: g_f_fmcobjh LIKE fmcobjh,
  u_repid LIKE sy-repid.
  u_repid = sy-repid.
  DATA: c_variant LIKE rsvar-variant.
  c_variant = 'VARIANT1'.


  CALL FUNCTION 'RS_VARIANT_EXISTS'
    EXPORTING
      report              = u_repid
      variant             = c_variant
    EXCEPTIONS
      not_authorized      = 1
      no_report           = 2
      report_not_existent = 3
      report_not_supplied = 4
      OTHERS              = 5.

  IF sy-subrc = 0.

    CALL FUNCTION 'RS_SUPPORT_SELECTIONS'
      EXPORTING
        report  = u_repid
        variant = c_variant.

  ENDIF.


START-OF-SELECTION.

  SELECT * FROM sflight INTO wa_sflight WHERE carrid = p_carrid
  AND connid = p_connid.

    WRITE: / wa_sflight-carrid, wa_sflight-connid.

  ENDSELECT.

END-OF-SELECTION.

The key here is fm RS_SUPPORT_SELECTIONS

Regarding structure VANZ i´ve tried but i havent been able to do anything with it yet.

Best regards.

0 Kudos

Hi,

this report makes P_CARRID obligatory in the report of the above answer (ZZXXX):


REPORT  ZZYYY.

* interne Tabellen
DATA: BEGIN OF rsparams_tab OCCURS 10.
        INCLUDE STRUCTURE rsparams.
DATA: END   OF rsparams_tab.

DATA: BEGIN OF varit_tab OCCURS 10.
        INCLUDE STRUCTURE varit.
DATA: END   OF varit_tab.

DATA: BEGIN OF varit_obj OCCURS 10.
        INCLUDE STRUCTURE vanz.
DATA: END   OF varit_obj.


DATA: BEGIN OF varid_tab OCCURS 10.                         "#EC *
        INCLUDE STRUCTURE varid.                            "#EC *
DATA: END   OF varid_tab.                                   "#EC *

DATA: report_name  LIKE rsvar-report  VALUE 'RSMCBTCH',
      variant_name LIKE rsvar-variant,
      rc LIKE sy-subrc,
      variant_txt  LIKE varit-vtext.

report_name = 'ZZXXX'.
variant_name = 'VARIANT1'.

CALL FUNCTION 'RS_VARIANT_EXISTS'
  EXPORTING
    report              = report_name
    variant             = variant_name
  IMPORTING
    r_c                 = rc
  EXCEPTIONS
    not_authorized      = 01
    no_report           = 02
    report_not_existent = 03
    report_not_supplied = 04.
IF sy-subrc <> 0.
* Rückkehrcode setzen
*  RC = 8.
  WRITE: / 'ERROR, VARIANT DOES NOT EXIST'.
ENDIF.

* Variante generieren
REFRESH varit_tab.
REFRESH rsparams_tab.
CLEAR   varit_tab.
CLEAR   rsparams_tab.
CLEAR   varid_tab.

varid_tab-mandt        = sy-mandt.
varid_tab-report       = report_name.
varid_tab-variant      = variant_name.
varid_tab-flag1        = space.
varid_tab-flag2        = space.
varid_tab-transport    = space.
varid_tab-environmnt   = 'A'.       "Variante gilt für Batch und Dialog
varid_tab-protected    = space.
varid_tab-secu         = space.
varid_tab-version      = '1'.
varid_tab-ename        = sy-uname.
varid_tab-edat         = sy-datum.
varid_tab-etime        = sy-uzeit.
varid_tab-aename       = space.
varid_tab-aedat        = space.
varid_tab-aetime       = space.
varid_tab-mlangu       = sy-langu.

varit_tab-mandt      = sy-mandt.
varit_tab-langu      = sy-langu.
varit_tab-report     = report_name.
varit_tab-variant    = variant_name.
varit_tab-vtext      = variant_txt.

rsparams_tab-kind    = 'P'.
rsparams_tab-selname = 'P_CARRID'.
rsparams_tab-low     = 'IB'.
APPEND rsparams_tab.
rsparams_tab-selname = 'P_CONNID'.
rsparams_tab-low     = '9998'.
APPEND rsparams_tab.


varit_obj-name = 'P_CARRID'.
varit_obj-kind = 'P'.
*VARIT_OBJ-OLEN
*VARIT_OBJ-FROM
*VARIT_OBJ-TO
*VARIT_OBJ-PROTECTED
*VARIT_OBJ-APPENDAGE
varit_obj-vname = 'P_CARRID'.
varit_obj-vtype = 'P'.
*VARIT_OBJ-TEXT
*VARIT_OBJ-INVISIBLE = 'X'.
*VARIT_OBJ-SCREENNR
*VARIT_OBJ-NO_IMPORT
*VARIT_OBJ-SPAGPA
varit_obj-obli = 'X'.
*VARIT_OBJ-NOINT
APPEND varit_obj.

IF rc = 0.
  CALL FUNCTION 'RS_CHANGE_CREATED_VARIANT'
    EXPORTING
      curr_report               = report_name
      curr_variant              = variant_name
      vari_desc                 = varid_tab
    TABLES
      vari_contents             = rsparams_tab
      vari_text                 = varit_tab
      OBJECTS                   = varit_obj
    EXCEPTIONS
      illegal_report_or_variant = 01
      illegal_variantname       = 02
      not_authorized            = 03
      not_executed              = 04
      report_not_existent       = 05
      report_not_supplied       = 06
      variant_doesnt_exist      = 07
      variant_locked            = 08
      selections_no_match       = 09.

ENDIF.

the key here is varit_obj

Best regards.

0 Kudos

Hi Pablo,

I change the data and I pass the value to FM into table internal OBJECTS but the data need , I believe, save on the BBDD, because when I want view the variant, It no change.

I debubing the tcode se16 with a table and I view that it is used the sentence EXPORT (to save to memory) and IMPORT (to get to memory) .

It is necesary?

Then when I used the FM


CALL FUNCTION 'RS_CHANGE_CREATED_VARIANT'
    EXPORTING
      curr_report               = report_name
      curr_variant              = variant_name
      vari_desc                 = varid_tab
    TABLES
      vari_contents             = rsparams_tab
      vari_text                 = varit_tab
      OBJECTS                   = varit_obj
    EXCEPTIONS
      illegal_report_or_variant = 01
      illegal_variantname       = 02
      not_authorized            = 03
      not_executed              = 04
      report_not_existent       = 05
      report_not_supplied       = 06
      variant_doesnt_exist      = 07
      variant_locked            = 08
      selections_no_match       = 09.

the next step is save on the database?

Cordial greetings.