on 03-24-2010 1:34 PM
Hi All,
Problem: I have to create a variant for a customised report through code and save it.So that it creates a variant(with values) in the selectionscreen .
Solutions that are tried:
1.Opted for transaction code SHD0,but failed as we can create a transaction variant for the standard transaction code through SHD0.
2.Opted for a function module RS_VARIANT_SAVE_FROM_SELSCREEN but this does not take values (select-option or parameter values as string) as string in p_varivdat under tables.
for example:
wa_rsparams-selname = 'S_BSART'.
wa_rsparams-sign = 'I'.
wa_rsparams-loW = 'ZLPA'.
APPEND wa_rsparams TO it_rsparams.
CLEAR wa_rsparams.
and passed it_rsparams into the function module under tables p_varivdat.
but the low values which was been declared in the function module was integer value.
Can anybody help me to solve the issue?
Thanks,
Bhavani
I've done something similar. This development retrieves a specific variant loading the selections into an internal table. The logic modifies the selections in the internal table, and then updates the variant with the modified selections. My program submits a separate program to build a ztable using the modified variant. Then the ztable is read by an ALV grid display program. Hope this helps.
Get existing variant:
CALL FUNCTION 'RS_VARIANT_CONTENTS'
EXPORTING
report = 'ZSCR_ORD_BLD'
variant = 'ZVA06RLT'
move_or_write = 'W'
valutab = i_valtab
EXCEPTIONS
variant_non_existent = 1
variant_obsolete = 2
OTHERS = 3.
Loop through table to modify as needed:
LOOP AT i_valtab INTO wa_valtab.
CASE wa_valtab-selname.
WHEN 'P_FUTDAT'.
MOVE '99991231' TO wa_valtab-low.
MODIFY i_valtab FROM wa_valtab.
WHEN 'P_ZTABLE'.
CLEAR wa_valtab-low.
MODIFY i_valtab FROM wa_valtab.
WHEN 'P_ZTEMP'.
wa_valtab-low = 'X'.
MODIFY i_valtab FROM wa_valtab.
WHEN 'S_MATNR'.
wa_valtab-sign = 'I'.
wa_valtab-option = 'EQ'.
wa_valtab-low = p_matnr.
MODIFY i_valtab FROM wa_valtab.
ENDCASE.
ENDLOOP.
Update variant with modified table
CALL FUNCTION 'RS_CHANGE_CREATED_VARIANT'
EXPORTING
curr_report = 'ZSCR_ORD_BLD'
curr_variant = 'ZVA06RLT'
vari_desc = wa_varid
TABLES
vari_contents = i_valtab
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check fm RS_CREATE_VARIANT
Just search in se37 for RS_VARIANT*
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.