Application Development 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: 

ALV Variant fields

Former Member
0 Kudos
2,686

Wassup !

A need to create a file in same as time as a display an ALV. In selection screen there is a field that the user can load a variant. I need to create the file with the same fields displayed in ALV, How can I discover witch fields will appear in screen.

There is a table for that ?

A FM ?

Thx all.

Point will be rewards. !!

1 ACCEPTED SOLUTION

mnicolai_77
Active Participant
0 Kudos
1,090

hi,

i found this function modules under function group SALV

REUSE_ALV_VARIANT_DEFAULT_GET Read default display variant (description only, w/o field catalog)

REUSE_ALV_VARIANT_SELECT Read a display variant

the first function return the name of the variant,

the second one return fieldcats

i hope is usefull for u.

bye

Marco

8 REPLIES 8

former_member191735
Active Contributor
0 Kudos
1,090

Check out function group SLIS

mnicolai_77
Active Participant
0 Kudos
1,091

hi,

i found this function modules under function group SALV

REUSE_ALV_VARIANT_DEFAULT_GET Read default display variant (description only, w/o field catalog)

REUSE_ALV_VARIANT_SELECT Read a display variant

the first function return the name of the variant,

the second one return fieldcats

i hope is usefull for u.

bye

Marco

0 Kudos
1,090

Thx Nicolai.

It works !!

0 Kudos
1,090

Hey,

I want to download data according to layout set in excel on custom PF status button .

How can i resolve this...

rahul_kamble2
Participant
0 Kudos
1,090

Check the function Module 'LT_DBDATA_READ_FROM_LTDX'

Check this sample code

  • Get the field details to be passed by passing the variant name

DATA: disvariant TYPE disvariant.

i_varkey = disvariant.

CLEAR i_varkey-type.

i_varkey-type = 'F'

CALL FUNCTION 'LT_DBDATA_READ_FROM_LTDX'

EXPORTING

i_tool = 'LT'

is_varkey = i_varkey

TABLES

t_dbfieldcat = i_dbfieldcat

t_dbsortinfo = i_sortinfo

t_dbfilter = i_filter

EXCEPTIONS

not_found = 1

wrong_relid = 2

OTHERS = 3.

After calling this FM the table i_dbfieldcat field NO_OUT will contain 'X' for the fields which should not be displayed in the ALV output.

you can use this table to build your logic.

0 Kudos
1,090

Hello,

I was glad to find information about the reading of display variants fields from field clusters of table LTDX but the code given as example does not pass abap control.

Could you please confirm if compatible with ECC 6 unicode release ?

Any information about the processing of this function would be a great help (does not return anything when tested in se37 test mode).

Thanking you in advance for your cooperation

Best regards

jch

0 Kudos
1,090

Wassup ...

I hope the following code helps ...

{ variante-report = sy-repid.

variante-variant = p_vari.

layout-colwidth_optimize = 'X'.

layout-zebra = 'X'.

IF NOT p_vari IS INITIAL.

CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'

EXPORTING

i_dialog = ' '

it_default_fieldcat = t_fieldcat

i_layout = layout

IMPORTING

ET_FIELDCAT = t_fieldcat

CHANGING

cs_variant = variante

EXCEPTIONS

WRONG_INPUT = 1

FC_NOT_COMPLETE = 2

NOT_FOUND = 3

PROGRAM_ERROR = 4

OTHERS = 5.

ELSE.

LOOP AT t_fieldcat assigning <fs_fieldcat>.

CLEAR: <fs_fieldcat>-no_out.

ENDLOOP.

ENDIF.

CALL FUNCTION 'GET_COMPONENT_LIST'

EXPORTING

program = sy-repid

fieldname = 'T_LISTA'

tables

components = tl_comp.

CLEAR: vl_file.

}

First u get the variant with 'REUSE_ALV_VARIANT_SELECT. After that u discovery with fields will be shown with that variant.

0 Kudos
1,090

Hi,

I have used this FM on 4.7 Enterprise right now i don't

have access to ECC 6.0 system.

Try using the function module through an ABAP program and

Pass the values for the parameter

is_varkey:

i_tool = 'LT'

for the parameter( is_varkey-Structure of type DISVARIANT ) the fields you need to pass are

1. Name of the current program.

2. Name of the display variant.

3. varkey type = 'F'

Regards,

Rahul

Edited by: Rahul kamble on Mar 30, 2008 10:07 PM