Posted: Mon Feb 25, 2008 4:28 pm Post subject: Create variant dynamically
Code:
REPORT z_dyn_variant.
DATA: jvari_desc LIKE varid,
rc LIKE sy-subrc,
variant_text LIKE varit-vtext,
jvt LIKE varit OCCURS 0 WITH HEADER LINE,
selpa LIKE rsparams OCCURS 0 WITH HEADER LINE,
parms LIKE rsparams OCCURS 0 WITH HEADER LINE,
objs LIKE vanz OCCURS 0 WITH HEADER LINE.
PARAMETERS: p_var LIKE rsvar-variant. "NAME OF VARIANT
LOOP AT parms.
CHECK parms-low NE space OR parms-high NE space.
READ TABLE objs WITH KEY name = parms-selname.
WRITE : /2 parms-selname, objs-text,
45 parms-kind,
parms-sign,
parms-option,
parms-low,
parms-high.
NEW-LINE.
ENDLOOP.
SKIP.
ENDIF.
some other approach....
Code:
* This function module selects the Selection Screen contents
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = sy-repid
TABLES
selection_table = loc_int_tab
EXCEPTIONS
not_found = 1
no_report = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE i000 WITH 'Error in RS_REFRESH_FROM_SELECTOPTIONS'(029).
LEAVE LIST-PROCESSING.
ENDIF.
* Craete the variant VAR1
CALL FUNCTION 'RS_CREATE_VARIANT'
EXPORTING
curr_report = sy-repid
curr_variant = wf_variant
vari_desc = loc_varid
TABLES
vari_contents = loc_int_tab
vari_text = loc_varit
EXCEPTIONS
illegal_report_or_variant = 1
illegal_variantname = 2
not_authorized = 3
not_executed = 4
report_not_existent = 5
report_not_supplied = 6
variant_exists = 7
variant_locked = 8
OTHERS = 9.
IF sy-subrc 0.
MESSAGE i000 WITH 'Error while creating dynamic variant'(028).
LEAVE LIST-PROCESSING.
ENDIF.
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.