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

LAYOUT alv

Former Member
0 Likes
646

Im using 'REUSE_ALV_GRID_DISPLAY' in my report. And in the selection screen as per client requirement i gave SELECT layout using 'REUSE_ALV_VARIANT_F4'.

Now if user select any layout from selection ,the output alv should be open in that layout. So in the 'REUSE_ALV_GRID_DISPLAY' where to mention that layout? and how?

Plz help.

Thanks in advance.

5 REPLIES 5
Read only

Former Member
0 Likes
599

Hi Kaushik,

See in exporting parameters below for the funcion i have mentioned about the layout----


> IS_LAYOUT = l _layout

See this below in the function.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = sy-repid

I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'

I_CALLBACK_USER_COMMAND = 'VAL'

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

IS_LAYOUT = l_layout

IT_FIELDCAT = lt_fieldcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

IT_SORT = l_sort

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = 'X '

  • IS_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

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = ITAB_FINAL

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. "sub_DISP

Read only

Former Member
0 Likes
599

Hi again,

Declare layout as at top of program.

DATA: l_layout TYPE slis_layout_alv.

reward if useful.

Read only

asik_shameem
Active Contributor
0 Likes
599

Hi

the FM REUSE_ALV_VARIANT_F4 itself will assign the layout which is mentioned in exporting parameters.

Go thru in this..

DATA: VAR TYPE DISVARIANT.

<b>PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT.</b>

INITIALIZATION.

<b>VAR-REPORT = SY-REPID.</b>

AT SELECTION-SCREEN ON VALUE-REQUEST FOR <b>P_VARI.</b>

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

EXPORTING

IS_VARIANT = <b>VAR</b>

IMPORTING

ES_VARIANT =<b> VAR</b>.

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 = <b>VAR</b>

tables

t_outtab = it_ekko

.

Read only

0 Likes
599

Thanks SHAM

Message was edited by:

KaushiK©Datta

Read only

0 Likes
599

Hi,

I will give u the entire pgm.

go thru n find wat the prob is.

REPORT ZAK_ALV1 .

type-pools: slis. "ALV Declarations

DATA: VAR TYPE DISVARIANT.

*Data Declaration

TYPES: BEGIN OF t_ekko,

SEl, "stores which row user has selected

ebeln TYPE ekpo-ebeln,

ebelp TYPE ekpo-ebelp,

statu TYPE ekpo-statu,

aedat TYPE ekpo-aedat,

matnr TYPE ekpo-matnr,

menge TYPE ekpo-menge,

meins TYPE ekpo-meins,

netpr TYPE ekpo-netpr,

peinh TYPE ekpo-peinh,

END OF t_ekko.

DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,

wa_ekko TYPE t_ekko.

*ALV data declarations

data: fieldcatalog type slis_t_fieldcat_alv with header line,

gd_layout type slis_layout_alv,

gd_repid like sy-repid.

DATA: GT_EVENTS TYPE slis_t_event,

WA_EVENT TYPE slis_alv_event.

PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT.

INITIALIZATION.

VAR-REPORT = SY-REPID.

*Start-of-selection.

START-OF-SELECTION.

perform data_retrieval.

perform build_fieldcatalog.

perform build_layout.

perform display_alv_report.

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.

&----


*& Form BUILD_FIELDCATALOG

&----


  • Build Fieldcatalog for ALV Report

----


form build_fieldcatalog.

fieldcatalog-fieldname = 'EBELN'.

fieldcatalog-seltext_m = 'Purchase Order'.

fieldcatalog-col_pos = 0.

fieldcatalog-outputlen = 15.

fieldcatalog-emphasize = 'X'.

fieldcatalog-key = 'X'.

fieldcatalog-hotspot = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'EBELP'.

fieldcatalog-seltext_m = 'PO Item'.

fieldcatalog-col_pos = 1.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'STATU'.

fieldcatalog-seltext_m = 'Status'.

fieldcatalog-key = 'X'.

fieldcatalog-col_pos = 2.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'AEDAT'.

fieldcatalog-seltext_m = 'Item change date'.

fieldcatalog-col_pos = 3.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'MATNR'.

fieldcatalog-seltext_m = 'Material Number'.

fieldcatalog-col_pos = 4.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'MENGE'.

fieldcatalog-seltext_m = 'PO quantity'.

fieldcatalog-col_pos = 5.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'MEINS'.

fieldcatalog-seltext_m = 'Order Unit'.

fieldcatalog-col_pos = 6.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'NETPR'.

fieldcatalog-seltext_m = 'Net Price'.

fieldcatalog-col_pos = 7.

fieldcatalog-outputlen = 15.

fieldcatalog-do_sum = 'X'. "Display column total

fieldcatalog-datatype = 'CURR'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'PEINH'.

fieldcatalog-seltext_m = 'Price Unit'.

fieldcatalog-col_pos = 8.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

endform. " BUILD_FIELDCATALOG

&----


*& Form BUILD_LAYOUT

&----


  • Build layout for ALV grid report

----


form build_layout.

gd_layout-box_fieldname = 'SEL'.

"set field name to store row selection

gd_layout-edit = 'X'. "makes whole ALV table editable

gd_layout-zebra = 'X'.

  • gd_layout-no_vline = 'X'.

gd_layout-window_titlebar = ' LAYOUT TITLE'.

  • gd_layout-confirmation_prompt = 'X'.

  • gd_layout-detail_popup = 'X'.

endform. " BUILD_LAYOUT

&----


*& Form DISPLAY_ALV_REPORT

&----


  • Display report using ALV grid

----


form display_alv_report.

gd_repid = sy-repid.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = gd_repid

I_BACKGROUND_ID = 'SIWB_WALLPAPER'

  • i_callback_top_of_page = 'TOP-OF-PAGE'

  • i_callback_user_command = 'DISPLAY'

i_grid_title = 'EMPLOYEE REPORTING'

is_layout = gd_layout

it_fieldcat = fieldcatalog[]

IT_EVENTS = GT_EVENTS

i_save = 'X'

is_variant = VAR

tables

t_outtab = it_ekko.

endform. " DISPLAY_ALV_REPORT

&----


*& Form DATA_RETRIEVAL

&----


  • Retrieve data form EKPO table and populate itab it_ekko

----


form data_retrieval.

select ebeln ebelp statu aedat matnr menge meins netpr peinh

up to 10 rows from ekpo

into corresponding fields of table it_ekko.

endform. " DATA_RETRIEVAL

reward if it helps.