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

Former Member
0 Kudos
147

Hi,

can anybody explain when we can use the following function modules.

REUSE_ALV_VARIANT_F4,

REUSE_ALV_VARIANT_DEFAULT_GET.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
127

Hi,

REUSE_ALV_VARIANT_F4

Display variant selection dialog box

Possible entries help, if the variant is defined explicitly as an input field on a screen. The selection must be specified by at least partially filling the parameter structure IS_VARIANT.

Go thru in this..

DATA: VAR TYPE DISVARIANT.

PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT.

INITIALIZATION.

VAR-REPORT = SY-REPID.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

EXPORTING

IS_VARIANT = VAR

IMPORTING

ES_VARIANT = VAR.

P_VARI = VAR-VARIANT.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = sy-repid

is_layout = gd_layout

it_fieldcat = fieldcatalog[]

i_save = 'X'

is_variant = VAR

tables

t_outtab = it_ekko

'REUSE_ALV_VARIANT_DEFAULT_GET':

Those variants are different which we can declare in the Selection screen, where as in ALV's report you have to handle the Variants by using FM 'REUSE_ALV_VARIANT_DEFAULT_GET', because in the runtime these variants will be passed to the field catalog. that is the reason you needs to use this FM in ALV's for passing an variant.

Reward Points if found helpfull..

Cheers,

Chandra Sekhar.

10 REPLIES 10

Former Member
0 Kudos
127

Hi

REUSE_ALV_VARIANT_F4 is used to display the variant selection dialog box from which u can select the variant u want.

REUSE_ALV_VARIANT_DEFAULT_GET is ti read the default variant.

Thanks

Vasudha

Former Member
0 Kudos
127

Hi,

REUSE_ALV_VARIANT_F4

Possible entries help, if the variant is defined explicitly as an input field on a screen. The selection must be specified by at least partially filling the parameter structure IS_VARIANT.

REUSE_ALV_VARIANT_DEFAULT_GET

Provides the default variant for the list specified in the structure parameter CS_VARIANT of a program.

Parameters

I_SAVE

CS_VARIANT

Thanks,

Suman

abdulazeez12
Active Contributor
0 Kudos
127

REUSE_ALV_VARIANT_F4

Possible entries help, if the variant is defined explicitly as an input field on a screen. The selection must be specified by at least partially filling the parameter structure IS_VARIANT.

REUSE_ALV_VARIANT_DEFAULT_GET

Provides the default variant for the list specified in the structure parameter CS_VARIANT of a program.

Former Member
0 Kudos
127

HI,

Text :Display variant selection dialog box

Functionality

Possible entries help, if the variant is defined explicitly as an input field on a screen. The selection must be specified by at least partially filling the parameter structure IS_VARIANT.

Go through the following program, you can get the where exactly it is used.

BALVHD01

Reward me if it is useful

Former Member
0 Kudos
127

Hi,

'REUSE_ALV_VARIANT_F4' is used to find out the variants that are already maintained for that report . it is on

at selection-screen like ....

at selection-screen on value-request for p_var.

wa_variant1-report = sy-repid.

call function at selection-screen on value-request for p_var.

wa_variant1-report = sy-repid.

call function 'REUSE_ALV_VARIANT_F4'

exporting

is_variant = wa_variant1

  • I_TABNAME_HEADER =

  • I_TABNAME_ITEM =

  • IT_DEFAULT_FIELDCAT =

i_save = 'A'

i_display_via_grid = 'X'

importing

  • e_exit = v_exit

es_variant = wa_variant2

exceptions

not_found = 1

program_error = 2

others = 3

.

if sy-subrc = 0.

p_var = wa_variant2-variant.

else.

clear wa_variant2.

endif.

and 'REUSE_ALV_VARIANT_DEFAULT_GET' comes in the initialization part to provide a default layout of that report on selection screen.

wa_variant2-report = sy-repid.

call function 'REUSE_ALV_VARIANT_DEFAULT_GET'

exporting

i_save = 'A'

changing

cs_variant = wa_variant2

exceptions

wrong_input = 1

not_found = 2

program_error = 3

others = 4.

if sy-subrc = 0.

p_var = wa_variant2-variant.

else.

p_var = '/DEFAULT'.

endif.

Former Member
0 Kudos
127

If you will press F4 you will get all the variants created for this particular object.

*----


Global Variables

*----


DATA : g_save(1) TYPE c,

g_exit(1) TYPE c,

g_report TYPE sy-repid,

g_var TYPE disvariant,

g_variant TYPE disvariant.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.

PERFORM f4_for_variant.

&----


*& Form f4_for_variant

&----


F4 help for variant

-


FORM f4_for_variant .

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

EXPORTING

is_variant = g_var

i_save = g_save

IMPORTING

e_exit = g_exit

es_variant = g_variant

EXCEPTIONS

not_found = 2.

IF sy-subrc = 2.

MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

IF g_exit = space.

p_vari = g_variant-variant.

ENDIF.

ENDIF.

ENDFORM. " f4_for_variant

Plz give some points if I ws useful

Former Member
0 Kudos
127

Hi Basha,

**REUSE_ALV_VARIANT_F4 -- To initialize variant

**REUSE_ALV_VARIANT_DEFAULT_GET -


It reads default variant

Report zsample123.

tables: sflight.

**-- TYPE-POOLS Definition

**Includes the types and constants of a type group. Since the types and

*constants specified in a type group have global validity, you cannot

*use the statement within a FORM or FUNCTION.

type-pools: slis.

PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT.

**-- ALV variables

*****- Field Catalog structure

data: ls_fieldcat type slis_fieldcat_alv, "Field Catalog list

**--- Field Catalog table

gt_fieldcat type slis_t_fieldcat_alv, "Field Catalog

**--- Layout ( How you would like to see the output )

gs_layout type slis_layout_alv, "List Layout

**-- Report name

g_repid like sy-repid,

g_save(1) type c,

g_exit(1) type c,

g_variant like disvariant,

gx_variant like disvariant.

**-- Flight Info Internal table

data: lt_sflight like sflight occurs 0 with header line.

************************************************************************

  • C-O-N-S-T-A-N-T-S *

************************************************************************

************************************************************************

  • S-E-L-E-C-T-I-O-N S-C-R-E-E-N *

************************************************************************

selection-screen begin of block a with frame title text-100.

select-options: s_carrid for sflight-carrid,

s_connid for sflight-connid,

s_fldate for sflight-fldate default sy-datum.

selection-screen end of block a .

************************************************************************

  • I-N-I-T-I-A-L-I-Z-A-T-I-O-N *

************************************************************************

initialization.

g_repid = sy-repid.

**-- Fill ALV field catalog

perform initialize_fieldcat using gt_fieldcat[].

***-- Build Events

  • perform build_eventtab using gt_events[].

*

**-- Read the default variant

perform initialize_variant.

************************************************************************

  • A-T S-E-L-E-C-T-I-O-N S-C-R-E-E-N *

************************************************************************

at selection-screen on value-request for p_vari.

**-- Display all existing variants

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.

if sy-subrc = 2.

message id sy-msgid type 'S' number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

else.

if g_exit = space.

p_vari = gx_variant-variant.

endif.

endif.

************************************************************************

  • S-T-A-R-T O-F S-E-L-E-C-T-I-O-N *

************************************************************************

start-of-selection.

**-- Read Flight information.

perform read_flight_info.

**-- Fill ALV field catalog and display report.

if not lt_sflight[] is initial.

perform dislay_alv_report.

endif.

======================================================================

  • FORMS / SUB ROUTINES *

*======================================================================

&----


*& Form initialize_fieldcat

&----


  • text

----


  • -->P_GT_FIELDCAT[] text

----


form initialize_fieldcat using l_fieldcat type slis_t_fieldcat_alv.

clear ls_fieldcat.

  • Air line

ls_fieldcat-fieldname = 'CARRID'.

ls_fieldcat-key = 'X'.

ls_fieldcat-col_pos = 1.

ls_fieldcat-seltext_s = 'Airline'.

ls_fieldcat-seltext_l = 'Airline'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Flight Number

ls_fieldcat-fieldname = 'CONNID'.

ls_fieldcat-key = 'X'.

ls_fieldcat-col_pos = 2.

ls_fieldcat-seltext_s = 'Flight Number'.

ls_fieldcat-seltext_l = 'Flight Number'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Flight date

ls_fieldcat-fieldname = 'FLDATE'.

ls_fieldcat-key = 'X'.

ls_fieldcat-col_pos = 3.

ls_fieldcat-seltext_s = 'Flight date'.

ls_fieldcat-seltext_l = 'Flight date'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Airfare

ls_fieldcat-fieldname = 'PRICE'.

ls_fieldcat-col_pos = 4.

ls_fieldcat-do_sum = 'X'.

ls_fieldcat-seltext_s = 'Airfare'.

ls_fieldcat-seltext_l = 'Airfare'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Local Currency

ls_fieldcat-fieldname = 'CURRENCY'.

ls_fieldcat-col_pos = 5.

ls_fieldcat-seltext_s = 'Local Currency'.

ls_fieldcat-seltext_l = 'Local Currency'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Plane Type

ls_fieldcat-fieldname = 'PLANETYPE'.

ls_fieldcat-col_pos = 6.

ls_fieldcat-seltext_s = 'Plane type'.

ls_fieldcat-seltext_l = 'Plane type'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Maximum capacity

ls_fieldcat-fieldname = 'SEATSMAX'.

ls_fieldcat-col_pos = 7.

ls_fieldcat-seltext_s = 'Max. seats'.

ls_fieldcat-seltext_l = 'Max. seats'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Occupied seats

ls_fieldcat-fieldname = 'SEATSOCC'.

ls_fieldcat-col_pos = 8.

ls_fieldcat-seltext_s = 'Seats occupied'.

ls_fieldcat-seltext_l = 'Seats occupied'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Total

ls_fieldcat-fieldname = 'PAYMENTSUM'.

ls_fieldcat-col_pos = 9.

ls_fieldcat-do_sum = 'X'.

ls_fieldcat-seltext_s = 'Total amount'.

ls_fieldcat-seltext_l = 'Total amount'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Total

ls_fieldcat-fieldname = 'PAYMENTSUM'.

ls_fieldcat-col_pos = 9.

ls_fieldcat-do_sum = 'X'.

ls_fieldcat-seltext_s = 'Total amount'.

ls_fieldcat-seltext_l = 'Total amount'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Max. Capacity, Buss. Class

ls_fieldcat-fieldname = 'SEATSMAX_B'.

ls_fieldcat-col_pos = 10.

ls_fieldcat-seltext_s = 'Max.Buss.class cap.'.

ls_fieldcat-seltext_l = 'Max.Buss.class cap.'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Max. occupancy, Buss. Class

ls_fieldcat-fieldname = 'SEATSOCC_B'.

ls_fieldcat-col_pos = 11.

ls_fieldcat-seltext_s = 'Max.Bus.CL.occupied'.

ls_fieldcat-seltext_l = 'Max.Bus.CL.occupied'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Max. Capacity, First. Class

ls_fieldcat-fieldname = 'SEATSMAX_F'.

ls_fieldcat-col_pos = 12.

ls_fieldcat-seltext_s = 'Max.Buss.class cap.'.

ls_fieldcat-seltext_l = 'Max.Buss.class cap.'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Max. occupancy, First. Class

ls_fieldcat-fieldname = 'SEATSOCC_F'.

ls_fieldcat-col_pos = 13.

ls_fieldcat-seltext_s = 'Max.Bus.CL.occupied'.

ls_fieldcat-seltext_l = 'Max.Bus.CL.occupied'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

ENDFORM. " initialize_fieldcat

&----


*& Form read_flight_info

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM read_flight_info .

refresh lt_sflight.

clear lt_sflight.

**-- Read data from SFLIGHT table

select *

from SFLIGHT

into table lt_sflight

where carrid in s_carrid

and connid in s_connid

and fldate in s_fldate.

if sy-subrc <> 0.

message e208(00) with text-101.

endif.

ENDFORM. " read_flight_info

&----


*& Form dislay_alv_report

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM dislay_alv_report .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = g_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

I_STRUCTURE_NAME = 'sflight'

  • IS_LAYOUT =

IT_FIELDCAT = gt_fieldcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

I_DEFAULT = 'X'

I_SAVE = 'A'

IS_VARIANT = GX_VARIANT

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = lt_sflight

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDFORM. " dislay_alv_report

&----


*& Form initialize_variant

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM initialize_variant .

g_save = 'A'.

clear g_variant.

g_variant-report = g_repid.

gx_variant = g_variant.

call function 'REUSE_ALV_VARIANT_DEFAULT_GET'

exporting

i_save = g_save

changing

cs_variant = gx_variant

exceptions

not_found = 2.

if sy-subrc = 0.

p_vari = gx_variant-variant.

endif.

ENDFORM. " initialize_variant

************************************************************************

**REUSE_ALV_VARIANT_DEFAULT_GET -- It reads default variant

REPORT ZBC_ALV_EXAMPLE.

************************************************************************

  • D-A-T-A D-E-C-L-A-R-A-T-I-O-N-S *

************************************************************************

tables: sflight.

**-- TYPE-POOLS Definition

**Includes the types and constants of a type group. Since the types and

*constants specified in a type group have global validity, you cannot

*use the statement within a FORM or FUNCTION.

type-pools: slis.

PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT.

**-- ALV variables

*****- Field Catalog structure

data: ls_fieldcat type slis_fieldcat_alv, "Field Catalog list

**--- Field Catalog table

gt_fieldcat type slis_t_fieldcat_alv, "Field Catalog

**--- Layout ( How you would like to see the output )

gs_layout type slis_layout_alv, "List Layout

**-- Report name

g_repid like sy-repid,

g_save(1) type c,

g_exit(1) type c,

g_variant like disvariant,

gx_variant like disvariant.

**-- Flight Info Internal table

data: lt_sflight like sflight occurs 0 with header line.

************************************************************************

  • C-O-N-S-T-A-N-T-S *

************************************************************************

************************************************************************

  • S-E-L-E-C-T-I-O-N S-C-R-E-E-N *

************************************************************************

selection-screen begin of block a with frame title text-100.

select-options: s_carrid for sflight-carrid,

s_connid for sflight-connid,

s_fldate for sflight-fldate default sy-datum.

selection-screen end of block a .

************************************************************************

  • I-N-I-T-I-A-L-I-Z-A-T-I-O-N *

************************************************************************

initialization.

g_repid = sy-repid.

**-- Fill ALV field catalog

perform initialize_fieldcat using gt_fieldcat[].

***-- Build Events

  • perform build_eventtab using gt_events[].

*

**-- Read the default variant

perform initialize_variant.

************************************************************************

  • A-T S-E-L-E-C-T-I-O-N S-C-R-E-E-N *

************************************************************************

at selection-screen on value-request for p_vari.

**-- Display all existing variants

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.

if sy-subrc = 2.

message id sy-msgid type 'S' number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

else.

if g_exit = space.

p_vari = gx_variant-variant.

endif.

endif.

************************************************************************

  • S-T-A-R-T O-F S-E-L-E-C-T-I-O-N *

************************************************************************

start-of-selection.

**-- Read Flight information.

perform read_flight_info.

**-- Fill ALV field catalog and display report.

if not lt_sflight[] is initial.

perform dislay_alv_report.

endif.

======================================================================

  • FORMS / SUB ROUTINES *

*======================================================================

&----


*& Form initialize_fieldcat

&----


  • text

----


  • -->P_GT_FIELDCAT[] text

----


form initialize_fieldcat using l_fieldcat type slis_t_fieldcat_alv.

clear ls_fieldcat.

  • Air line

ls_fieldcat-fieldname = 'CARRID'.

ls_fieldcat-key = 'X'.

ls_fieldcat-col_pos = 1.

ls_fieldcat-seltext_s = 'Airline'.

ls_fieldcat-seltext_l = 'Airline'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Flight Number

ls_fieldcat-fieldname = 'CONNID'.

ls_fieldcat-key = 'X'.

ls_fieldcat-col_pos = 2.

ls_fieldcat-seltext_s = 'Flight Number'.

ls_fieldcat-seltext_l = 'Flight Number'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Flight date

ls_fieldcat-fieldname = 'FLDATE'.

ls_fieldcat-key = 'X'.

ls_fieldcat-col_pos = 3.

ls_fieldcat-seltext_s = 'Flight date'.

ls_fieldcat-seltext_l = 'Flight date'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Airfare

ls_fieldcat-fieldname = 'PRICE'.

ls_fieldcat-col_pos = 4.

ls_fieldcat-do_sum = 'X'.

ls_fieldcat-seltext_s = 'Airfare'.

ls_fieldcat-seltext_l = 'Airfare'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Local Currency

ls_fieldcat-fieldname = 'CURRENCY'.

ls_fieldcat-col_pos = 5.

ls_fieldcat-seltext_s = 'Local Currency'.

ls_fieldcat-seltext_l = 'Local Currency'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Plane Type

ls_fieldcat-fieldname = 'PLANETYPE'.

ls_fieldcat-col_pos = 6.

ls_fieldcat-seltext_s = 'Plane type'.

ls_fieldcat-seltext_l = 'Plane type'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Maximum capacity

ls_fieldcat-fieldname = 'SEATSMAX'.

ls_fieldcat-col_pos = 7.

ls_fieldcat-seltext_s = 'Max. seats'.

ls_fieldcat-seltext_l = 'Max. seats'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Occupied seats

ls_fieldcat-fieldname = 'SEATSOCC'.

ls_fieldcat-col_pos = 8.

ls_fieldcat-seltext_s = 'Seats occupied'.

ls_fieldcat-seltext_l = 'Seats occupied'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Total

ls_fieldcat-fieldname = 'PAYMENTSUM'.

ls_fieldcat-col_pos = 9.

ls_fieldcat-do_sum = 'X'.

ls_fieldcat-seltext_s = 'Total amount'.

ls_fieldcat-seltext_l = 'Total amount'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Total

ls_fieldcat-fieldname = 'PAYMENTSUM'.

ls_fieldcat-col_pos = 9.

ls_fieldcat-do_sum = 'X'.

ls_fieldcat-seltext_s = 'Total amount'.

ls_fieldcat-seltext_l = 'Total amount'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Max. Capacity, Buss. Class

ls_fieldcat-fieldname = 'SEATSMAX_B'.

ls_fieldcat-col_pos = 10.

ls_fieldcat-seltext_s = 'Max.Buss.class cap.'.

ls_fieldcat-seltext_l = 'Max.Buss.class cap.'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Max. occupancy, Buss. Class

ls_fieldcat-fieldname = 'SEATSOCC_B'.

ls_fieldcat-col_pos = 11.

ls_fieldcat-seltext_s = 'Max.Bus.CL.occupied'.

ls_fieldcat-seltext_l = 'Max.Bus.CL.occupied'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Max. Capacity, First. Class

ls_fieldcat-fieldname = 'SEATSMAX_F'.

ls_fieldcat-col_pos = 12.

ls_fieldcat-seltext_s = 'Max.Buss.class cap.'.

ls_fieldcat-seltext_l = 'Max.Buss.class cap.'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

  • Max. occupancy, First. Class

ls_fieldcat-fieldname = 'SEATSOCC_F'.

ls_fieldcat-col_pos = 13.

ls_fieldcat-seltext_s = 'Max.Bus.CL.occupied'.

ls_fieldcat-seltext_l = 'Max.Bus.CL.occupied'.

append ls_fieldcat to l_fieldcat.

clear ls_fieldcat.

ENDFORM. " initialize_fieldcat

&----


*& Form read_flight_info

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM read_flight_info .

refresh lt_sflight.

clear lt_sflight.

**-- Read data from SFLIGHT table

select *

from SFLIGHT

into table lt_sflight

where carrid in s_carrid

and connid in s_connid

and fldate in s_fldate.

if sy-subrc <> 0.

message e208(00) with text-101.

endif.

ENDFORM. " read_flight_info

&----


*& Form dislay_alv_report

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM dislay_alv_report .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = g_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

I_STRUCTURE_NAME = 'sflight'

  • IS_LAYOUT =

IT_FIELDCAT = gt_fieldcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

I_DEFAULT = 'X'

I_SAVE = 'A'

IS_VARIANT = GX_VARIANT

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = lt_sflight

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDFORM. " dislay_alv_report

&----


*& Form initialize_variant

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM initialize_variant .

g_save = 'A'.

clear g_variant.

g_variant-report = g_repid.

gx_variant = g_variant.

call function 'REUSE_ALV_VARIANT_DEFAULT_GET'

exporting

i_save = g_save

changing

cs_variant = gx_variant

exceptions

not_found = 2.

if sy-subrc = 0.

p_vari = gx_variant-variant.

endif.

ENDFORM. " initialize_variant

Former Member
0 Kudos
127

REUSE_ALV_VARIANT_F4

Display variant selection dialog box for F4 help it will you to show the possible entries for that variant

REUSE_ALV_VARIANT_DEFAULT_GET

Provides the default variant for the

parameter CS_VARIANT of a program.

Former Member
0 Kudos
128

Hi,

REUSE_ALV_VARIANT_F4

Display variant selection dialog box

Possible entries help, if the variant is defined explicitly as an input field on a screen. The selection must be specified by at least partially filling the parameter structure IS_VARIANT.

Go thru in this..

DATA: VAR TYPE DISVARIANT.

PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT.

INITIALIZATION.

VAR-REPORT = SY-REPID.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

EXPORTING

IS_VARIANT = VAR

IMPORTING

ES_VARIANT = VAR.

P_VARI = VAR-VARIANT.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = sy-repid

is_layout = gd_layout

it_fieldcat = fieldcatalog[]

i_save = 'X'

is_variant = VAR

tables

t_outtab = it_ekko

'REUSE_ALV_VARIANT_DEFAULT_GET':

Those variants are different which we can declare in the Selection screen, where as in ALV's report you have to handle the Variants by using FM 'REUSE_ALV_VARIANT_DEFAULT_GET', because in the runtime these variants will be passed to the field catalog. that is the reason you needs to use this FM in ALV's for passing an variant.

Reward Points if found helpfull..

Cheers,

Chandra Sekhar.

Former Member
0 Kudos
127

Hi,

REUSE_ALV_VARIANT_F4

Display variant selection dialog box

Possible entries help, if the variant is defined explicitly as an input field on a screen. The selection must be specified by at least partially filling the parameter structure IS_VARIANT.

Go thru in this..

DATA: VAR TYPE DISVARIANT.

PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT.

INITIALIZATION.

VAR-REPORT = SY-REPID.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

EXPORTING

IS_VARIANT = VAR

IMPORTING

ES_VARIANT = VAR.

P_VARI = VAR-VARIANT.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = sy-repid

is_layout = gd_layout

it_fieldcat = fieldcatalog[]

i_save = 'X'

is_variant = VAR

tables

t_outtab = it_ekko

'REUSE_ALV_VARIANT_DEFAULT_GET':

Those variants are different which we can declare in the Selection screen, where as in ALV's report you have to handle the Variants by using FM 'REUSE_ALV_VARIANT_DEFAULT_GET', because in the runtime these variants will be passed to the field catalog. that is the reason you needs to use this FM in ALV's for passing an variant.

Reward Points if found helpfull..

Cheers,

Chandra Sekhar.