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 function modules

Former Member
0 Likes
469

Hi,

What exactly is the difference between 'selection-screen variant' and 'layout variant'.

selection-screen variant means values we provide for parameters in selection screen.

Layout variant means, that we get using the function module

'Reuse_alv_variant_default_get'.

Please explain with an example that how can we set a layout variant ?

Thanks,

khadeer.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
438

Hi

try like this.


SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-006.
PARAMETERS       : p_var  LIKE is_variant-variant.
SELECTION-SCREEN : END OF BLOCK b2.


END-OF-SELECTION.
  PERFORM sub_get_variant.
  PERFORM sub_display_alv.


FORM sub_get_variant .
  IF is_variant-variant IS INITIAL.
    IF p_var IS NOT INITIAL.
      is_variant-report = sy-repid.
      is_variant-variant = p_var.
    ENDIF.
  ENDIF.
ENDFORM.                    " SUB_GET_VARIANT


FORM sub_display_alv .
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      i_callback_program = sy-repid
      is_layout          = is_layout
      it_fieldcat        = it_fieldcat
      it_sort            = it_sort
      i_default          = 'X'
      i_save             = 'A'      "This is very important
      is_variant         = is_variant
    TABLES
      t_outtab           = it_final
    EXCEPTIONS
      program_error      = 1
      OTHERS             = 2.
  IF sy-subrc <> 0.
    MESSAGE i398(00) WITH 'Error When Showing ALV'.
    LEAVE LIST-PROCESSING.
  ENDIF.
ENDFORM.                    " SUB_DISPLAY_ALV

in this way in the execution mode the layout you are saving..that will appear in front of you later when you will execute that program in future..

Arunima

3 REPLIES 3
Read only

Former Member
0 Likes
438

Hi Basha,

Many posts are there in SDN search you will get the answers in which one of them is..

Cheers!!

VEnk@

Read only

Former Member
0 Likes
439

Hi

try like this.


SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-006.
PARAMETERS       : p_var  LIKE is_variant-variant.
SELECTION-SCREEN : END OF BLOCK b2.


END-OF-SELECTION.
  PERFORM sub_get_variant.
  PERFORM sub_display_alv.


FORM sub_get_variant .
  IF is_variant-variant IS INITIAL.
    IF p_var IS NOT INITIAL.
      is_variant-report = sy-repid.
      is_variant-variant = p_var.
    ENDIF.
  ENDIF.
ENDFORM.                    " SUB_GET_VARIANT


FORM sub_display_alv .
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      i_callback_program = sy-repid
      is_layout          = is_layout
      it_fieldcat        = it_fieldcat
      it_sort            = it_sort
      i_default          = 'X'
      i_save             = 'A'      "This is very important
      is_variant         = is_variant
    TABLES
      t_outtab           = it_final
    EXCEPTIONS
      program_error      = 1
      OTHERS             = 2.
  IF sy-subrc <> 0.
    MESSAGE i398(00) WITH 'Error When Showing ALV'.
    LEAVE LIST-PROCESSING.
  ENDIF.
ENDFORM.                    " SUB_DISPLAY_ALV

in this way in the execution mode the layout you are saving..that will appear in front of you later when you will execute that program in future..

Arunima

Read only

Former Member
0 Likes
438

Hi Basha,

When you start a program for which selection screens have been defined, the system offers you input fields for database-specific and report-specific selections. To select a certain set of data, you have to enter appropriate values.

If you start a program regularly with identical selections, for example, to create monthly sales statistics, you certainly will not want to enter the same values for the selection criteria over and over again. You can therefore combine the values for all selection criteria in a selection set referred to as a variant.

You can use selection variants to provide default values for selection criteria. You can change the ready for input status of fields, or hide entire fields.

Accessed from a reportu2019s selection screen Reporting (SA38)

The ALV Grid Control displays only the layout icon () but no menu in the toolbar. By clicking this icon, users can change the current layout (basically, they can modify the selection and the order of the columns displayed).

IS_VARIANT = SPACE.

I_SAVE = SPACE.

(default setting)

Hopes this is help for you.

Regards,

Pullaiah