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

ALV DISPLAY-choose layout button

Former Member
0 Likes
1,764

Hi,

i have an alv report which displays 10 fields from an internal table, now i need to add the choose layout which must include 5 fields other than the existing 10 fields and display the report, with what has been chosen.how can i do this?

Hi,

i have an alv report which displays 10 fields from an internal table, now i need to add the choose layout which must include 5 fields other than the existing 10 fields and display the report, with what has been chosen.how can i do this?

10 REPLIES 10
Read only

Former Member
0 Likes
1,241

In the application toolbar of ALV , there will be a layout button to choose the display of fields , checkout if it is helpfule to you

Read only

alex_m
Active Contributor
0 Likes
1,241

You can add or delete the fields are existing in output, u cant include new feilds other than in the output.

Read only

Former Member
0 Likes
1,241

Hi Niranjan,

First of all you should have those fields in the internal table ready.

IN the field catalog,make those fields initially not visible by

NO_OUT = 'X'.

then you can chose those fields from the alv toolbar when needed.

Regards,

Ravi

Read only

0 Likes
1,241

Hi Ravi,

Thanks.

this NO_OUT = 'X', where should i set this, is it a property of FIELDCATLOG internal table or some other property.

And if some field is chosen that has NO_OUT = 'X' ,then how do i make it to get displayed, is it using the sy-ucom of teh layout button, if so how?

Read only

0 Likes
1,241

you have to set that in fieldcatalog for that field

wa_fieldcatalog-no_out = 'X'.

Read only

0 Likes
1,241

In the fieldcatolg

For the fields u dont wnat to display se the

<b>wa_fieldcatalog-NO_out = 'X'.</b>

EG:

 fieldcatalog-fieldname   = 'MENGE'.
  fieldcatalog-seltext_m   = 'PO quantity'.
  fieldcatalog-no_out      = 'X'.
  fieldcatalog-col_pos     = 5.
  append fieldcatalog to fieldcatalog.
  clear  fieldcatalog.

Refer this link

http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_enhanced.htm

Reward if this helps.

Read only

0 Likes
1,241

k i will set this property.

but once the fields are chosen in the layout, should i explicitly remove the 'X' of NO_OUT for that field to get displayed or is it a property of ALV that it will automatically display the selected fields.

Read only

0 Likes
1,241

No need in the layout u have to choose the fields for dispaly and it will automatically dispaly the fields.

Then save layout.

Read only

Former Member
0 Likes
1,241

In addtion to Rav's reply u have to do the follwoing so taht u can save the layput

  • The following is where a user can enter a display variant

  • the no display can be used if the grid output is not to

  • be controlled by the users variant.

PARAMETERS p_layout LIKE disvariant-variant.
 DATA:     gd_layout    type slis_layout_alv.

  w_layout-grid_title = sy-title.
  w_layout-zebra      = 'X'
  w_layout-sel_mode   = 'B'.
  w_layout-cwidth_opt = 'X'
  w_variant-handle    = p_layout.
  w_variant-report    = sy-repid.

 call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
            i_callback_program      = gd_repid
            i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
            i_callback_user_command = 'USER_COMMAND'
*            i_grid_title           = outtext
            is_layout               = gd_layout
            it_fieldcat             = fieldcatalog[]
*            it_special_groups       = gd_tabgroup
            it_events               = gt_events  
            is_print                = gd_prntparams  
            i_save                  = 'X'
            is_variant = w_variant
      tables
            t_outtab                = it_ekko
       exceptions
            program_error           = 1
            others                  = 2.
  if sy-subrc <> 0.

Read only

Former Member
0 Likes
1,241

Hi Niranjan,

i often use a Layout-Variant in selection-screen like this:

SELECTION-SCREEN: BEGIN OF LINE.

SELECTION-SCREEN: COMMENT 01(31) T_VARIAN FOR FIELD P_VARIAN.

PARAMETERS: P_VARIAN LIKE DISVARIANT-VARIANT.

SELECTION-SCREEN: END OF LINE.

*

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARIAN.

*

DATA: I_VARIANT LIKE DISVARIANT.

DATA: E_VARIANT LIKE DISVARIANT.

*

I_VARIANT-REPORT = SY-REPID.

*

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

EXPORTING

IS_VARIANT = I_VARIANT

I_SAVE = 'A'

IMPORTING

ES_VARIANT = E_VARIANT

EXCEPTIONS

NOT_FOUND = 1

PROGRAM_ERROR = 2

OTHERS = 3.

*

IF SY-SUBRC <> 0.

MESSAGE I010 WITH 'Es sind keine Varianten angelegt'.

CLEAR: P_VARIAN.

ELSE.

P_VARIAN = E_VARIANT-VARIANT.

ENDIF.

*

INITIALIZATION.

*

T_VARIAN = 'Anzeigevariante'.

*

  • Selektierte Variante zuordnen

VARIANT-VARIANT = P_VARIAN.

*

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

...

IS_VARIANT = VARIANT

...

*

Regards, Dieter