Application Development and Automation 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: 
Read only

Save a variant in a custom module-pool.

Former Member
0 Likes
1,422

Hi all,

i hope there is someone that can help me.

My problem is: i've to save a variant in a module-pool custom SAPMZ...ecc.

Is there a function module or a routine or some specific ABAP istruction to save a variant?

I ask this because in my custom module-pool i've insert input field in main dynpro.

Thanks a lot,

regards,

Alex.

1 ACCEPTED SOLUTION
Read only

MarcinPciak
Active Contributor
0 Likes
956

Hi,

Check this out: The message is not formated anymore. To see the code in readable form, copy it in two parts and paste in new post, then select Preview of the message but don't post it. This is due to some problems with posting too long messages encountered recently on this forum.

Anyhow this code will help you in maintaing variants in module pool.

Regards

Marcin

Hi all,

i hope there is someone that can help me.

My problem is: i've to save a variant in a module-pool custom SAPMZ...ecc.

Is there a function module or a routine or some specific ABAP istruction to save a variant?

I ask this because in my custom module-pool i've insert input field in main dynpro.

Thanks a lot,

regards,

Alex.

3 REPLIES 3
Read only

Former Member
0 Likes
956

Hi ,

You can use SHD0 tcode for transaction variants.

Thanks,

suma.

Read only

Former Member
0 Likes
956

Please use below code it works for me:

What I did was copy the function group SVAR. When it asked what function module to copy just select

'RS_VARIANT_SAVE_FROM_SELSCREEN' and renamed it to 'ZS_VARIANT_SAVE_FROM_SELSCR'.

*************************************************************************************************************

DATA: lv_screen LIKE sy-dynnr.

CLEAR: t_rkey, t_screen.

REFRESH: t_rkey, t_screen.

t_rkey-report = sy-repid.

APPEND t_rkey.

t_screen-program = sy-repid.

t_screen-dynnr = '0101'.

t_screen-type = 4.

APPEND t_screen.

lv_screen = '0101'.

EXPORT lv_screen TO MEMORY ID 'MZ_COMISSION_REPORT_F02_SCREEN'.

CALL FUNCTION 'ZS_VARIANT_SAVE_FROM_SELSCR'

EXPORTING

curr_report = sy-repid

vari_report = sy-repid

IMPORTING

variant = w_variant

TABLES

p_screens = t_screen

  • p_sscr = t_selctab

  • p_vari = t_vari

EXCEPTIONS

illegal_variant_name = 1

not_authorized = 2

no_report = 3

report_not_existent = 4

report_not_supplied = 5

OTHERS = 6.

t_rkey-variant = w_variant.

MODIFY t_rkey INDEX 1.

CALL FUNCTION 'RS_RWSET_SAVE_VARIANT'

EXPORTING

rkey = t_rkey

TABLES

selctab = t_selctab.

***********************************************************************************************

Then in program LZSVARF07 function save_as_variant find where it's transfering the screen.

READ TABLE variscreens WITH KEY dynnr = sy-dynnr.

IF sy-subrc NE 0.

IMPORT lv_screen FROM MEMORY ID 'MZ_COMISSION_REPORT_F02_SCREEN'.

IF lv_screen IS INITIAL.

variscreens-dynnr = sy-dynnr.

ENDIF.

ENDIF.

PERFORM fill_varidyn TABLES p_dynsfields

USING $rkey space. "Kein import von DYNSFIELDS

Good luck!

Edited by: Alex Nguyen on May 2, 2009 1:36 AM

Edited by: Alex Nguyen on May 5, 2009 5:26 PM

Read only

MarcinPciak
Active Contributor
0 Likes
957

Hi,

Check this out: The message is not formated anymore. To see the code in readable form, copy it in two parts and paste in new post, then select Preview of the message but don't post it. This is due to some problems with posting too long messages encountered recently on this forum.

Anyhow this code will help you in maintaing variants in module pool.

Regards

Marcin