cancel
Showing results for 
Search instead for 
Did you mean: 

Can i copy ALV Layout variants from one program to another

Former Member
0 Kudos
7,381

Hi there,

I was wondering if anyone could assist me, i have copied a program to a new program, i see that it copied the selection screen variants but didn't copy all the layout variants. Is there anyway that i can copy the layout Variants from the old program to the new program.

Thanks,
Chantal

View Entire Topic
Puneet_Gupta
Contributor
0 Kudos

It can be done using a program. In the program,

Use function REUSE_ALV_VARIANT_SELECT or LVC_VARIANT_SELECT to get the variant from the original program.

And then use function REUSE_ALV_VARIANT_SAVE or LVC_VARIANT_SAVE  to save it to the new program.

- Puneet

Former Member
0 Kudos

Hi Puneet,

Thanks for the reply. When i execute the function modules, i don't seem to be able to find the help on these fields that i must input in, please could you assist;

For Function module REUSE_ALV_VARIANT_SELECT, what would i put in these fields:

  • I_DIALOG
  • I_USER_SPECIFIC
  • I_DEFAULT
  • I_TABNAME_HEADER
  • I_TABNAME_ITEM

For Function module REUSE_ALV_VARIANT_SAVE, what would i put in these fields:

  • I_TABNAME_HEADER
  • I_TABNAME_ITEM
  • I_DIALOG
  • I_OVERWRITE
  • I_USER_SPECIFIC

Thanks,

Regards,

Chantal

Puneet_Gupta
Contributor
0 Kudos

Hi Chantal,

Here are the steps using different function modules:

  • Call function LT_VARIANTS_READ_FROM_LTDX bye passing the old report name to a range of type  LTDX-REPORT. This will return all the variants in the old program in the return table
  • For each variant call the function LT_DBDATA_READ_FROM_LTDX to get the fieldcatalog, sortinfo, layout and filters.
  • Call the function LT_DBDATA_WRITE_TO_LTDX with the new report name in the variant key and the other tables read above.
  • Update table LTDXT with the description of the layout

I have attached a sample logic.

- Puneet

Former Member
0 Kudos

Thanks Puneet

former_member207763
Participant
0 Kudos

Very helpful.

Thanks

Former Member
0 Kudos

Thank you Puneet.

former_member200889
Participant
0 Kudos

Very helpful.

Thanks you.

shadab_sk
Participant
0 Kudos

It works! Thanks a lot

Br,

Shadab