Skip to Content
0
Feb 11, 2011 at 12:26 AM

Help on REUSE_ALV_VARIANT_SAVE

183 Views

Dear All,

I got a task of copying ALV layout variants from one program to other program. A seperate program has been developed the code is as follows:

----


tables:

Ltdxt. " Display variant texts

type-pools: slis.

type-pools: icon. " Description of Type Pool

  • Description of the data type

data: wa_ltdxt type ltdxt.

data: tp_variant type variant.

DATA: v_repid TYPE syrepid.

  • Data - Internal tables *

----


data : ta_ltdxt type standard table of ltdxt .

types: begin of salv.

include structure zmm_alvirfs.

types: end of salv.

types: begin of salvr.

include structure zmm_alvirfsr.

types: end of salvr.

----


  • Data - Structures *

----


data: st_variant type disvariant.

data: st_fieldcat_tab type slis_t_fieldcat_alv.

data: st_sortfields_tab type slis_t_sortinfo_alv.

DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.

Parameter: pa_rep like ltdx-report default 'SOURCE PROGRAM',

pa_rep1 like ltdx-report default 'NEWPROGRAM'.

start-of-selection.

select * into table ta_ltdxt from ltdxt

where report = pa_rep. "SOURCE PROGRAM

loop at ta_ltdxt into wa_ltdxt.

st_variant-REPORT = pa_rep1. " New Program

st_variant-USERNAME = wa_ltdxt-username.

st_variant-VARIANT = wa_ltdxt-variant.

st_variant-text = wa_ltdxt-text.

v_repid = pa_rep.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = v_repid

i_internal_tabname = 'ZMM_ALVIRFSR'

i_inclname = v_repid

CHANGING

ct_fieldcat = gt_fieldcat.

call function 'REUSE_ALV_VARIANT_SAVE'

exporting

  • I_TABNAME_HEADER =

  • I_TABNAME_ITEM =

it_fieldcat = gt_fieldcat

it_sort = st_sortfields_tab

  • IT_FILTER =

i_dialog = ''

i_overwrite = ''

i_user_specific = ''

  • IMPORTING

  • E_EXIT =

changing

cs_variant = st_variant

exceptions

wrong_input = 1

fc_not_complete = 2

foreign_lock = 3

variant_exists = 4

name_reserved = 5

program_error = 6

others = 7.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endloop.

The variants have been copied across but to new program but when the new program is executed with that copied variant

The report is displayed with no grid- just a blank screen (No columns, No Headers, No contents except a select button at left corner).

Could you please advise a solution for this.

Thanks in advance.

Best Regards

Chandra