Code: Alles auswählen.
REPORT ZPTEST7.
TABLES: VARID.
DATA: VTAB LIKE RSPARAMS OCCURS 0 WITH HEADER LINE.
PARAMETERS: REPORT LIKE VARID-REPORT.
PARAMETERS: VARIANT LIKE VARID-VARIANT.
START-OF-SELECTION.
SELECT * FROM VARID WHERE REPORT EQ REPORT AND VARIANT EQ VARIANT.
* Variante einlesen
CALL FUNCTION 'RS_VARIANT_CONTENTS'
EXPORTING
REPORT = VARID-REPORT
VARIANT = VARID-VARIANT
TABLES
VALUTAB = VTAB
EXCEPTIONS
VARIANT_NON_EXISTENT = 1
VARIANT_OBSOLETE = 2
OTHERS = 3.
* bestimmtes Feld ändern
LOOP AT VTAB WHERE SELNAME EQ 'PAR_FILE'.
VTAB-LOW = 'C:\test.xml'.
MODIFY VTAB.
ENDLOOP.
* Variante geändert speichern
CALL FUNCTION 'RS_CHANGE_CREATED_VARIANT'
EXPORTING
CURR_REPORT = VARID-REPORT
CURR_VARIANT = VARID-VARIANT
VARI_DESC = VARID
TABLES
VARI_CONTENTS = VTAB
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.
ENDSELECT.
hört sich erstmal gut an, allerdings haben wir den gar nicht in unserem System?! (SAP ECC 6.0, Basis Release 701/0013), auch in unserem IDES gibt's den nicht.ChrisB hat geschrieben: also rein von der Bezeichnung her, würde ich mal auf RS_VARIANT_CONTENTS_255 tippen. Ausprobiert bzw. genau geprüft habe ich es aber noch nicht...
Code: Alles auswählen.
REPORT ZPTEST7.
TABLES: VARID.
DATA: VTAB LIKE RSPARAMS OCCURS 0 WITH HEADER LINE.
PARAMETERS: REPORT LIKE VARID-REPORT.
PARAMETERS: VARIANT LIKE VARID-VARIANT.
START-OF-SELECTION.
SELECT * FROM VARID WHERE REPORT EQ REPORT AND VARIANT EQ VARIANT.
* Variante einlesen
CALL FUNCTION 'RS_VARIANT_CONTENTS'
EXPORTING
REPORT = VARID-REPORT
VARIANT = VARID-VARIANT
EXECUTE_DIRECT = 'X'
TABLES
VALUTAB = VTAB
EXCEPTIONS
VARIANT_NON_EXISTENT = 1
VARIANT_OBSOLETE = 2
OTHERS = 3.
* alles löschen außer Dateiname
LOOP AT VTAB WHERE SELNAME NE 'PAR_FILE'.
DELETE VTAB.
ENDLOOP.
* bestimmtes Feld ändern
LOOP AT VTAB WHERE SELNAME EQ 'PAR_FILE'.
VTAB-LOW = 'C:\test.xml'.
MODIFY VTAB.
ENDLOOP.
* Variante geändert speichern
CALL FUNCTION 'RS_CHANGE_CREATED_VARIANT'
EXPORTING
CURR_REPORT = VARID-REPORT
CURR_VARIANT = VARID-VARIANT
VARI_DESC = VARID
TABLES
VARI_CONTENTS = VTAB
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.
ENDSELECT.