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

Help on Report Layout Variant.

Former Member
0 Likes
1,277

Hello,

I have a requirement as stated below:

I have a custom report and it displays say 15 fields. I have created a variant for it to display only 10 fields.

Now, is there a Function Module or a report that will give me details of these 10 fields that I have chosen.

Basically I want to know if there is a FM that gives details of a report layout variant by just passing the report name and the variant name etc?

Thank,

Ketan.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
955

Hi,

In ALV report declare following variable.

data : g_variant like disvariant, "user-variant

g_exit(1) type c,

g_save(1) type c,

gx_variant like disvariant.

parameters : p_vari like disvariant-variant.

  • ----------------------------------------------------------------------

  • SELECTION SCREEN ON VALUE REQUEST ************************************

  • ----------------------------------------------------------------------

at selection-screen on value-request for p_vari.

call function 'REUSE_ALV_VARIANT_F4'

EXPORTING

is_variant = g_variant

i_save = g_save

IMPORTING

e_exit = g_exit

es_variant = gx_variant

EXCEPTIONS

not_found = 2.

Then pass gx_variant to 'REUSE_ALV_LIST.....' function in

IS_VARIANT = gx_variant parameter.

Hope this will help.

Hello,

I have a requirement as stated below:

I have a custom report and it displays say 15 fields. I have created a variant for it to display only 10 fields.

Now, is there a Function Module or a report that will give me details of these 10 fields that I have chosen.

Basically I want to know if there is a FM that gives details of a report layout variant by just passing the report name and the variant name etc?

Thank,

Ketan.

5 REPLIES 5
Read only

Former Member
0 Likes
955

Table VARI would give you the variants per program and the following FM can be used to get the details of the variant.

RS_VARIANT_CONTENTS_RFC

Read only

Former Member
0 Likes
956

Hi,

In ALV report declare following variable.

data : g_variant like disvariant, "user-variant

g_exit(1) type c,

g_save(1) type c,

gx_variant like disvariant.

parameters : p_vari like disvariant-variant.

  • ----------------------------------------------------------------------

  • SELECTION SCREEN ON VALUE REQUEST ************************************

  • ----------------------------------------------------------------------

at selection-screen on value-request for p_vari.

call function 'REUSE_ALV_VARIANT_F4'

EXPORTING

is_variant = g_variant

i_save = g_save

IMPORTING

e_exit = g_exit

es_variant = gx_variant

EXCEPTIONS

not_found = 2.

Then pass gx_variant to 'REUSE_ALV_LIST.....' function in

IS_VARIANT = gx_variant parameter.

Hope this will help.

Read only

Former Member
0 Likes
955

Hi,

Addition to previous mail.

g_variant-report = s_repid.

g_variant-username = sy-uname.

before calling function 'REUSE_ALV_VARIANT_F4'

otherwise it will not give you the available layout.

Regards,

- Umesh

Read only

Laxmana_Appana_
Active Contributor
0 Likes
955

Hi Ketan,

check this FM : REUSE_ALV_VARIANT_SELECT

sample code :

DATA: g_variant LIKE disvariant.

CONSTANTS:

g_x VALUE 'X'.

DATA: g_fieldcat_tab TYPE slis_t_fieldcat_alv.

DATA: g_layout TYPE slis_layout_alv.

DATA: g_fieldcat_tab TYPE slis_t_fieldcat_alv.

DATA: g_sortfields_tab TYPE slis_t_sortinfo_alv.

DATA: g_filter_tab TYPE slis_t_filter_alv.

IF NOT g_variant-variant IS INITIAL.

CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'

EXPORTING

i_dialog = ' '

i_user_specific = g_x

i_default = ' '

  • I_TABNAME_HEADER =

  • I_TABNAME_ITEM =

it_default_fieldcat = g_fieldcat_tab[]

i_layout = g_layout

IMPORTING

  • E_EXIT =

et_fieldcat = g_fieldcat_tab[]

et_sort = g_sortfields_tab[]

et_filter = g_filter_tab[]

CHANGING

cs_variant = g_variant

EXCEPTIONS

wrong_input = 1

fc_not_complete = 2

not_found = 3

program_error = 4

OTHERS = 5.

IF sy-subrc IS INITIAL.

ENDIF.

ENDIF.

Regards

Appana

Read only

Former Member
0 Likes
955

Hi Kishan,

The FM which you have mentioned doesnt give us the list of fields actually selected. I guess they give you information about the selection screen fields.

I need information about the fields displayed in the report output.

Anyway thanks for your help.

Ketan.