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: 

Copy variants between programs

Former Member
0 Kudos

Hi!

I've copied a Z program into an another Z program in the development system. Unfortunately there are a lot of variants to the old program in the productive system. Because these variants are only in the productive syste I could not copy them.

After the new program is transported into the productive system I have to restore the variants also.

I see a few ways to it, but I don't have experience in it yet, and I don't know, which one is possible to solve:

- download from the old and upload the variants to the new program

- copy them using a standard program/FM

If you know a solution, feel free to share it with me.

Thank you

Tamá

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Use program RGRVARI1 or

RGRVARIX.

9 REPLIES 9

Former Member
0 Kudos

Use program RGRVARI1 or

RGRVARIX.

0 Kudos

"Use program RGRVARI1 or RGRVARIX."

Unfortunately these programs do not exist in our system, not in a 4.6c and not in an ECC6. You can send the source for me, if it will really work.

Eric: thank you for the FM, but it can copy variants only within 1 program and not between programs.

0 Kudos

Hi

This is a my utility program to copy a variant between two programs:

REPORT ZUT_COPY_VARIANT .
SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-T01.
PARAMETERS: P_REP1 LIKE  RSVAR-REPORT OBLIGATORY,
            P_REP2 LIKE  RSVAR-REPORT OBLIGATORY.
SELECTION-SCREEN END OF BLOCK BL1.

DATA  BEGIN OF DYNPFIELDS OCCURS 1.
        INCLUDE STRUCTURE DYNPREAD.
DATA  END   OF DYNPFIELDS.


DATA: TEXT_1(100),
      TEXT_2(100).

DATA: ANSWER.

AT SELECTION-SCREEN.

  IF P_REP1 = P_REP2.
    MESSAGE E208(00) WITH 'Programmi di orig. e destin. identici'(E02).
  ENDIF.


  MESSAGE W208(00) WITH 'Verificare omogeneità scherm. selez.'(W01).

AT SELECTION-SCREEN ON P_REP1.
  PERFORM CHECK_REPORT USING P_REP1.

AT SELECTION-SCREEN ON P_REP2.
  PERFORM CHECK_REPORT USING P_REP2.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_REP1.
  PERFORM F4_REPORT USING 'P_REP1'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_REP2.
  PERFORM F4_REPORT USING 'P_REP2'.



START-OF-SELECTION.

  TEXT_1 = 'Tutte le varianti del report &'(001).
  REPLACE '&' WITH P_REP1 INTO TEXT_1.

  TEXT_2 = 'saranno copiate nel report &'(002).
  REPLACE '&' WITH P_REP2 INTO TEXT_2.


  CALL FUNCTION 'POPUP_TO_CONFIRM_WITH_MESSAGE'
       EXPORTING
            DIAGNOSETEXT1 = TEXT_1
            DIAGNOSETEXT2 = TEXT_2
            TEXTLINE1     = 'Eseguire copia varianti?'(003)
            TITEL         = 'Copiare Varianti'(004)
       IMPORTING
            ANSWER        = ANSWER.

  CHECK ANSWER = 'J'.

  CALL FUNCTION 'RS_COPY_SELECTION_SETS'
    EXPORTING
      SOURCE_REPORT        = P_REP1
      TARGET_REPORT        = P_REP2
*   DEVC                 =
*   CHANGE_ENAME         = 'X'
   EXCEPTIONS
     VARIANT_LOCKED       = 1
     OTHERS               = 2
            .
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ELSE.
    MESSAGE S208(00) WITH 'Varianti copiate positivamente'(S01).
  ENDIF.
*&---------------------------------------------------------------------*
*&      Form  CHECK_REPORT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_REP  text
*----------------------------------------------------------------------*
FORM CHECK_REPORT USING    P_REP.
  SELECT SINGLE NAME FROM TRDIR INTO P_REP WHERE NAME = P_REP.
  IF SY-SUBRC <> 0.
    MESSAGE E368(00) WITH P_REP 'inesistente o inattivo'(E01).
  ENDIF.
ENDFORM.                    " CHECK_REPORT
*&---------------------------------------------------------------------*
*&      Form  F4_REPORT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_PARAM  text
*----------------------------------------------------------------------*
FORM F4_REPORT USING    P_PARAM.
  FIELD-SYMBOLS: <REPORT> TYPE ANY.


  ASSIGN (P_PARAM) TO <REPORT>.

  REFRESH DYNPFIELDS.
  CLEAR DYNPFIELDS.

  DYNPFIELDS-FIELDNAME  = P_PARAM.
  APPEND DYNPFIELDS.

  CALL FUNCTION 'DYNP_VALUES_READ'
       EXPORTING
            DYNAME     = SY-CPROG
            DYNUMB     = SY-DYNNR
       TABLES
            DYNPFIELDS = DYNPFIELDS
       EXCEPTIONS
            OTHERS.

  IF SY-SUBRC = 0.
    READ TABLE DYNPFIELDS INDEX 1.
    <REPORT> = DYNPFIELDS-FIELDVALUE.
  ENDIF.

  PERFORM PROGRAM_DIRECTORY                                 "#EC *
        USING <REPORT>
              'X'.
ENDFORM.                                                    " F4_REPORT

*---------------------------------------------------------------------*
*       FORM PROGRAM_DIRECTORY                                        *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  PROGRAMM                                                      *
*  -->  F4_CALL                                                       *
*---------------------------------------------------------------------*
FORM PROGRAM_DIRECTORY USING PROGRAMM LIKE RS38M-PROGRAMM
                             F4_CALL.
  DATA: L_PROGRAMM LIKE RS38M-PROGRAMM.

  L_PROGRAMM = PROGRAMM.

  IF L_PROGRAMM = SPACE.
    SUBMIT RSABADAB AND RETURN VIA SELECTION-SCREEN
                    WITH F4_CALL =    F4_CALL.
  ELSE.
    SUBMIT RSABADAB AND RETURN VIA SELECTION-SCREEN
                    WITH REPNAME CP   L_PROGRAMM
                    WITH F4_CALL =    F4_CALL.
  ENDIF.

  GET PARAMETER ID 'RID' FIELD PROGRAMM.                    "#EC *

ENDFORM.

Max

0 Kudos

This program should help RSTRANSP

0 Kudos

sorry, I was wrong. The FM you have to use for saving the variant is RS_CREATE_VARIANT (same function group). (I know, because I did exactly the same in an earlier project.) However I cannot remember with which FM did I read the variants and cannot find it now...

All I remember that it was the same function group...

JozsefSzikszai
Active Contributor
0 Kudos

check function group SVAR. You can use the FM RS_VARIANT_COPY in this group.

(hope you mean report variants...)

Former Member
0 Kudos

Use FM:

RS_COPY_SELECTION_SETS

0 Kudos

Thanks a lot. It worked flawless.

Regards,

Sebastiá

Former Member
0 Kudos

And once again, the day is saved, thanks to the PowerMax boy!