SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Change values of a program variant



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Programming Techniques | Приемы программирования
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sat Sep 22, 2007 5:50 pm    Post subject: Change values of a program variant Reply with quote

Code:
REPORT Z_TEST_VARIANTS .
*Data definition
DATA: V_REPORT LIKE RSVAR-REPORT, " Prog name
V_VARIANT LIKE RSVAR-VARIANT. " Prog variant
DATA: I_VALUTAB LIKE RSPARAMS OCCURS 0 WITH HEADER LINE,
" Variants Parameter table
I_OBJECTS LIKE VANZ OCCURS 0 WITH HEADER LINE,
" Variants property
I_DESC LIKE VARID. " Variants description

START-OF-SELECTION.
**Here to set you report/program name
V_REPORT = 'ZDREWM0022_NEWTST'.
**Here to set variant name
V_VARIANT = 'TEST'.
**Get variant's property information
CALL FUNCTION 'RS_VARIANT_CONTENTS'
EXPORTING
REPORT = V_REPORT
VARIANT = V_VARIANT
TABLES
VALUTAB = I_VALUTAB
OBJECTS = I_OBJECTS
EXCEPTIONS
VARIANT_NON_EXISTENT = 1
VARIANT_OBSOLETE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
*-->ERROR
ENDIF.
* Edit internal table ,Set what u want to change
**This change the variant's value
LOOP AT I_VALUTAB WHERE SELNAME = 'P_MATNR'.
I_VALUTAB-LOW = 'aaaaaa'.
MODIFY I_VALUTAB.
ENDLOOP.
* This change the variant's property,but you can only change
* some properties,like NO_IMPORT,SPAGPA,OBLI etc.
LOOP AT I_OBJECTS WHERE NAME = 'P_MATNR'.
I_OBJECTS-OBLI = 'X'.
*--->Below can't changed
I_OBJECTS-INVISIBLE = 'X'.
MODIFY I_OBJECTS.
ENDLOOP.
**Change the variant
CALL FUNCTION 'RS_CHANGE_CREATED_VARIANT'
EXPORTING
CURR_REPORT = V_REPORT
CURR_VARIANT = V_VARIANT
VARI_DESC = I_DESC
TABLES
VARI_CONTENTS = I_VALUTAB
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.
IF SY-SUBRC <> 0.
*-->ERROR
ENDIF.
**************************************************
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Programming Techniques | Приемы программирования All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.