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

Table fields based on Display Variant

Former Member
0 Likes
615

How to get a table to pass to ALV for display with only those fields which are there in the Display Variant???

Please help??

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
579

Hi Shashi,

Try this FM

  • FM returns the modified field catelog based on the selection screen

  • display variant

CALL FUNCTION 'LT_VARIANT_LOAD'

EXPORTING

I_TABNAME = i_detail_name

I_DIALOG = 'N'

IMPORTING

ET_FIELDCAT = i_emailfieldcat1

ET_SORT = i_sort

ET_FILTER = i_filter

CHANGING

CS_LAYOUT = i_emaillayout

CT_DEFAULT_FIELDCAT = i_emailfieldcat

CS_VARIANT = lwa_disvariant

EXCEPTIONS

WRONG_INPUT = 1

FC_NOT_COMPLETE = 2

NOT_FOUND = 3

OTHERS = 4 .

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Here the field Catalog is generated based on fields present in display variant.

3 REPLIES 3
Read only

Former Member
0 Likes
580

Hi Shashi,

Try this FM

  • FM returns the modified field catelog based on the selection screen

  • display variant

CALL FUNCTION 'LT_VARIANT_LOAD'

EXPORTING

I_TABNAME = i_detail_name

I_DIALOG = 'N'

IMPORTING

ET_FIELDCAT = i_emailfieldcat1

ET_SORT = i_sort

ET_FILTER = i_filter

CHANGING

CS_LAYOUT = i_emaillayout

CT_DEFAULT_FIELDCAT = i_emailfieldcat

CS_VARIANT = lwa_disvariant

EXCEPTIONS

WRONG_INPUT = 1

FC_NOT_COMPLETE = 2

NOT_FOUND = 3

OTHERS = 4 .

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Here the field Catalog is generated based on fields present in display variant.

Read only

Former Member
0 Likes
579

what is the difference between your another q?

Read only

0 Likes
579

I don't see much difference, and I think we can merge some user ID names as well.....