<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ALV USING FM (layout) in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-fm-layout/m-p/3633855#M875183</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi kodandarami reddy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Thanks for such a quick reply&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 19 Apr 2008 07:24:18 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-04-19T07:24:18Z</dc:date>
    <item>
      <title>ALV USING FM (layout)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-fm-layout/m-p/3633850#M875178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;what is the purpose ''slis_layout_alv".Please explain briefly  and with sample code.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Apr 2008 04:29:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-fm-layout/m-p/3633850#M875178</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-19T04:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: ALV USING FM (layout)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-fm-layout/m-p/3633851#M875179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SLIS_LAYOUT_ALV&lt;/STRONG&gt; is a structure which contains&lt;/P&gt;&lt;P&gt;--&amp;gt;slis_layout_main.&lt;/P&gt;&lt;P&gt;--&amp;gt;slis_layout_alv_spec.&lt;/P&gt;&lt;P&gt;structures.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Actually these structure contains the formatting options of the ALV Display&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again slis_layout_alv_spec. include contains&lt;/P&gt;&lt;P&gt;--&amp;gt;slis_layout_alv_spec0.&lt;/P&gt;&lt;P&gt;--&amp;gt;slis_layout_alv_spec1&lt;/P&gt;&lt;P&gt;includes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In &lt;STRONG&gt;slis_layout_alv_spec0&lt;/STRONG&gt; we contain the following fields&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;no_col                   head no headings
no_hotspot                headings not as hotspot
zebra                      striped pattern
no_vline                   columns separated by space
 no_hline                  rows separated by space 
cell_merge                 not suppress field replication
edit                        for grid only
edit_mode                  or grid only
 numc_sum                 totals for NUMC-Fields possib.
 no_input                  only display fields
 f2code                    sy-ucomm,   
reprep                     report report interface active
no_keyfix                   do not fix keycolumns
expand_all                  Expand all positions
no_author                  No standard authority check
 def_status                 default status  space or 'A'
 item_text                   Text for item button
countfname&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;slis_layout_alv_spec1&lt;/STRONG&gt; contains&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;no_sumchoice                    no choice for summing up
no_totalline(                       no total line
no_subchoice                     no choice for subtotals
no_subtotals                     no subtotals possible
 no_unit_splitting                no sep. tot.lines by inh.units
totals_before_items            diplay totals before the items
totals_only                         show only totals
totals_text                          text for 1st col. in total line
subtotals_text                     text for 1st col. in subtotals&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Actually these structure contains the formatting options of the ALV Display&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;report zbnstest. 
************************************************************************ 
* TABLES AND DATA DECLARATION. 
************************************************************************ 
*TABLES: mara,makt.",marc. 
data syrepid like sy-repid. 
data sydatum(10). " LIKE sy-datum. 
data sypagno(3) type n. 
  

* WHEN USING MORE THAN ONE TABLE IN ALV WE NEEED TO DECLARE THE TYPE 
* GROUP (TYPE-POOLS---------&amp;gt;SLIS) 
type-pools : slis. 
  

************************************************************************ 
* INTERNAL TABLE DECLARATION. 
************************************************************************ 
* INTERNAL TABLE TO HOLD THE VALUES FROM THE MARA TABLE 
data: begin of t_mara occurs 0, 
matnr like mara-matnr, 
meins like mara-meins, 
mtart like mara-mtart, 
matkl like mara-matkl, 

end of t_mara. 

* INTERNAL TABLE TO HOLD THE CONTENTS FROM THE EKKO TABLE 
data : begin of t_marc occurs 0, 
matnr like mara-matnr, 
werks like marc-werks, 
minbe like marc-minbe. 
data: end of t_marc. 

* INTERNAL TABLE TO HOLD THE VALUES FROM MAKT TABLE. 
data : begin of t_makt occurs 0, 
matnr like mara-matnr, 
maktx like makt-maktx, 
spras like makt-spras, 
end of t_makt. 

* INTERNAL TABLE WHICH ACTUALLY MERGES ALL THE OTHER INTERNAL TABLES. 
data: begin of itab1 occurs 0, 
matnr like mara-matnr, 
meins like mara-meins, 
maktx like makt-maktx, 
spras like makt-spras, 
werks like marc-werks, 
minbe like marc-minbe, 
end of itab1. 
  

* THE FOLLOWING DECLARATION IS USED FOR DEFINING THE FIELDCAT 
* AND THE LAYOUT FOR THE ALV. 
* HERE AS slis_t_fieldcat_alv IS A INTERNAL TABLE WITHOUT A HEADER LINE 
* WE EXPLICITELY DEFINE AN INTERNAL TABLE OF THE SAME STRUCTURE AS THAT 
* OF slis_t_fieldcat_alv BUT WITH A HEADER LINE IN THE DEFINITION. 
* THIS IS DONE TO MAKE THE CODE SIMPLER. 
* OTHERWISE WE MAY HAVE TO DEFINE THE STRUCTURE AS IN THE NORMAL SAP 
* PROGRAMS. 
* IN THE FIELDCATALOG TABLE WE ACTUALLY PASS THE FIELDS FROM ONE OR 
* MORE TABLES AND CREATE A STRUCTURE 
* IN THE LAYOUT STRUCTURE WE BASICALLY DEFINE THE FORMATTING OPTIONS 
* LIKE DISPLAY IN THE ZEBRA PATTERN ,THE HOTSPOT OPTIONS ETC. 
data: fieldcatalog type slis_t_fieldcat_alv with header line, 
fieldlayout type slis_layout_alv.
  

* DECLARING THE EVENTTABLE INTERNL TABLE FOR USING EVENTS LIKE 
* TOP-OF-PAGE ETC. 
data : eventstab type slis_t_event with header line. 

* DECLARING AN INTERNAL TABLE TO HOLD THE DATA FOR THE TOP-OF-PAGE 
data : heading type slis_t_listheader with header line. 
data : heading1 type slis_t_listheader with header line. 
data : heading2 type slis_t_listheader with header line. 
data : heading3 type slis_t_listheader with header line. 
data : heading4 type slis_t_listheader with header line. 
data : heading5 type slis_t_listheader with header line. 
data : heading6 type slis_t_listheader with header line. 
data : heading7 type slis_t_listheader with header line. 
data : heading8 type slis_t_listheader with header line. 
  

* STRUCTURE TO PASS THE COLOR ATTRIBUTES FOR DISPLAY. 
data : colorstruct type slis_coltypes. 
************************************************************************ 
* INITIALIZATION. * 
************************************************************************ 
initialization. 
syrepid = sy-repid. 
sypagno = sy-pagno. 
clear fieldcatalog. 
  

************************************************************************ 
* START-OF-SELECTION. * 
************************************************************************ 
start-of-selection. 
* SUBROUTINE TO POPULATE THE COLORSTRUCT 
perform fill_colorstruct using colorstruct. 
* SUBROUTINE TO POPULATE THE FIELDS OF THE FIELD CATALOGUE 
perform populate_fieldcatalog. 
* SUBROUTINE TO SELECT DATA FROM VARIOUS TABLES AND POPULATE IT IN THE 
* INTERNAL TABLE. 
perform selectdata_and_sort. 
* SUBROUTINE TO POPULATE THE LAYOUT STRUCTURE. 
perform populate_layout using fieldlayout. 
* SUBROUTINE TO CALL THE FUNCTION MERGE TO ENSURE PROPER DISPLAY. 
perform merge_fieldcatalog. 
* SUBROUTINE TO POPULATE THE EVENTSTAB. 
perform fill_eventstab tables eventstab. 
* SUBROUTINE TO POPULATE THE HEADING TABLES. 
perform fill_headingtable tables heading using 'HEADING'. 
perform fill_headingtable tables heading1 using 'HEADING1'. 
perform fill_headingtable tables heading2 using 'HEADING2'. 
perform fill_headingtable tables heading3 using 'HEADING3'. 
perform fill_headingtable tables heading4 using 'HEADING4'. 
perform fill_headingtable tables heading5 using 'HEADING5'. 
perform fill_headingtable tables heading6 using 'HEADING6'. 
perform fill_headingtable tables heading7 using 'HEADING7'. 
perform fill_headingtable tables heading8 using 'HEADING8'. 

* SUBROUTINE TO DISPLAY THE LIST. 
perform display_alv_list. 
  
  

************************************************************************ 
* FORMS 
************************************************************************ 
* IN THIS SUBROUTINE WE POPULATE THE FIELDCATALOG TABLE WITH THE NAMES 
* OF THE TABLE,FIELDNAME,WHETHER IT IS KEY FIELD OR NOT,HEADING AND 
* COLUMN JUSTIFICATION. 
form populate_fieldcatalog. 
perform fill_fields_of_fieldcatalog tables fieldcatalog 
using 'ITAB1' 'MATNR' 'X' . 
perform fill_fields_of_fieldcatalog tables fieldcatalog 
using 'ITAB1' 'MEINS' ' '. 
perform fill_fields_of_fieldcatalog tables fieldcatalog 
using 'ITAB1' 'MAKTX' ' ' . 
perform fill_fields_of_fieldcatalog tables fieldcatalog 
using 'ITAB1' 'MTART' ' ' . 
perform fill_fields_of_fieldcatalog tables fieldcatalog 
using 'ITAB1' 'MATKL' ' ' . 
perform fill_fields_of_fieldcatalog tables fieldcatalog 
using 'ITAB1' 'SPRAS' ' ' . 
perform fill_fields_of_fieldcatalog tables fieldcatalog 
using 'ITAB1' 'WERKS' ' ' . 
perform fill_fields_of_fieldcatalog tables fieldcatalog 
using 'ITAB1' 'MINBE' ' ' . 
endform. " POPULATE_FIELDCATALOG 
  

*---------------------------------------------------------------------* 
* FORM FILL_FIELDS_OF_FIELDCATALOG * 
*---------------------------------------------------------------------* 
* ........ * 
*---------------------------------------------------------------------* 
* --&amp;gt; FIELDCATALOG * 
* --&amp;gt; P_TABNAME * 
* --&amp;gt; P_FIELDNAME * 
* --&amp;gt; P_KEY * 
* --&amp;gt; P_KEY * 
*---------------------------------------------------------------------* 
form fill_fields_of_fieldcatalog tables fieldcatalog 
structure fieldcatalog 
using p_tabname 
p_fieldname 
p_key. 
* p_no_out. 
fieldcatalog-tabname = p_tabname. 
fieldcatalog-fieldname = p_fieldname. 
fieldcatalog-key = p_key. 
fieldcatalog-emphasize = '1234'. 
*fieldcatalog-no_out = p_no_out. 
append fieldcatalog. 
endform. " FILL_FIELDSOFFIELDCATALOG 
  

*---------------------------------------------------------------------* 
* FORM POPULATE_LAYOUT * 
*---------------------------------------------------------------------* 
* ........ * 
*---------------------------------------------------------------------* 
* --&amp;gt; FIELDLAYOUT * 
*---------------------------------------------------------------------* 
form populate_layout using fieldlayout type slis_layout_alv. 
fieldlayout-f2code = '&amp;amp;ETA' . 
fieldlayout-zebra = 'X'. 
* FOR THE WINDOW TITLE. 
fieldlayout-window_titlebar = 'ALV with Events'. 

fieldlayout-colwidth_optimize = 'X'. 
fieldlayout-no_vline = ' '. 
*fieldlayout-no_input = 'X'. 
fieldlayout-confirmation_prompt = ''. 
fieldlayout-key_hotspot = 'X'. 
* This removes the column headings if the flag is set to 'X' 
fieldlayout-no_colhead = ' '. 
*fieldlayout-hotspot_fieldname = 'MAKTX'. 
fieldlayout-detail_popup = 'X'. 
* fieldlayout-coltab_fieldname = 'X'. 
endform. " POPULATE_LAYOUT 

*---------------------------------------------------------------------* 
* FORM SELECTDATA_AND_SORT * 
*---------------------------------------------------------------------* 
* ........ * 
*---------------------------------------------------------------------* 
form selectdata_and_sort. 
select matnr meins mtart matkl from mara 
into corresponding fields of t_mara 
up to 500 rows . 

select matnr maktx spras from makt 
into corresponding fields of t_makt 
where matnr = t_mara-matnr and 
spras = sy-langu. 

select matnr werks minbe from marc 
into corresponding fields of t_marc 
where matnr = t_mara-matnr. 
append t_marc. 
endselect. 
append t_makt. 
endselect. 
append t_mara. 
endselect. 
perform populate_itab1. 
sort itab1 by matnr. 
endform. " SELECTDATA_AND_SORT 

*---------------------------------------------------------------------* 
* FORM MERGE_FIELDCATALOG * 
*---------------------------------------------------------------------* 
* ........ * 
*---------------------------------------------------------------------* 
form merge_fieldcatalog. 
call function 'REUSE_ALV_FIELDCATALOG_MERGE' 
exporting 
i_program_name = syrepid 
i_internal_tabname = 'ITAB1' 
* i_structure_name = 'COLORSTRUCT' 
* I_CLIENT_NEVER_DISPLAY = 'X' 
i_inclname = syrepid 
changing 
ct_fieldcat = fieldcatalog[] 
exceptions 
inconsistent_interface = 1 
program_error = 2 
others = 3. 
endform. " MERGE_FIELDCATALOG 
  

* IN THIS FUNCTION THE MINIMUM PARAMETERS THAT WE NEED TO PASS IS AS 
* FOLLOWS:- 
* i_callback_program --&amp;gt; CALLING PROGRAM NAME 
* i_structure_name --&amp;gt; STRUCTURE NAME. 
* is_layout --&amp;gt; LAYOUT NAME. 
* it_fieldcat ---&amp;gt; BODY OF THE FIELD CATALOGUE INTERNAL TABLE 
form display_alv_list. 
call function 'REUSE_ALV_LIST_DISPLAY' 
exporting 
* I_INTERFACE_CHECK = ' ' 
i_callback_program = syrepid 
* I_CALLBACK_PF_STATUS_SET = ' ' 
* I_CALLBACK_USER_COMMAND = ' ' 
i_structure_name = 'ITAB1' 
is_layout = fieldlayout 
it_fieldcat = fieldcatalog[] 
* IT_EXCLUDING = 
* IT_SPECIAL_GROUPS = 
* IT_SORT = 
* IT_FILTER = 
* IS_SEL_HIDE = 
* I_DEFAULT = 'X' 
* THE FOLLOWING PARAMETER IS SET AS 'A' INORDER TO DISPLAY THE STANDARD 
* TOOL BAR 
i_save = 'A' 
* IS_VARIANT = ' ' 
it_events = eventstab[] 
* IT_EVENT_EXIT = 
* IS_PRINT = 
* 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 = itab1 
exceptions 
program_error = 1 
others = 2. 
endform. " DISPLAY_ALV_LIST 
*&amp;amp;---------------------------------------------------------------------* 
*&amp;amp; Form POPULATE_ITAB1 
*&amp;amp;---------------------------------------------------------------------* 
* text 
*----------------------------------------------------------------------* 
* --&amp;gt; p1 text 
* &amp;lt;-- p2 text 
*----------------------------------------------------------------------* 
form populate_itab1. 
loop at t_mara. 
loop at t_makt where matnr = t_mara-matnr. 
loop at t_marc where matnr = t_mara-matnr. 
move-corresponding t_mara to itab1. 
move-corresponding t_makt to itab1. 
move-corresponding t_marc to itab1. 
append itab1. 
endloop. 
endloop. 
endloop. 
endform. " POPULATE_ITAB1 
*&amp;amp;---------------------------------------------------------------------* 
*&amp;amp; Form FILL_EVENTSTAB 
*&amp;amp;---------------------------------------------------------------------* 
* text 
*----------------------------------------------------------------------* 
* --&amp;gt;P_EVENTSTAB text * 
*----------------------------------------------------------------------* 
form fill_eventstab tables p_eventstab structure eventstab. 
* WHEN THE FOLLOWING FUNCTION IS CALLED THE SYSTEM POPULATES THE 
* INTERNAL TABLE EVENTSTAB WITH A LIST OF EVENTS NAME. 
* AS SHOWN BELOW WHEN USING I_LIST_TYPE = 0 THE FUNCTION RETURNS 14 
* EVENTS NAME. 
call function 'REUSE_ALV_EVENTS_GET' 
exporting 
i_list_type = 0 
importing 
et_events = p_eventstab[] 
exceptions 
list_type_wrong = 1 
others = 2. 

* BY CALLING THE ABOVE FUNCTION WE FIRST POPULATE THE EVENTSTAB WITH 
* THE PREDEFINED EVENTS AND THEN WE MOVE THE FORM NAME AS SHOWN BELOW. 
* WE ASSIGN A FORM NAME TO THE EVENT AS REQUIRED BY THE USER. 
* FORM NAME CAN BE ANYTHING.THE PERFORM STATEMENT FOR THIS FORM 
* IS DYNAMICALY CALLED. 

read table p_eventstab with key name = slis_ev_top_of_page. 
if sy-subrc = 0 . 
move 'TOP_OF_PAGE' to p_eventstab-form. 
append p_eventstab. 
endif. 

read table p_eventstab with key name = slis_ev_top_of_coverpage. 
if sy-subrc = 0 . 
move 'TOP_OF_COVERPAGE' to p_eventstab-form. 
append p_eventstab. 
endif. 

read table p_eventstab with key name = slis_ev_end_of_coverpage . 
if sy-subrc = 0 . 
move 'END_OF_COVERPAGE' to p_eventstab-form. 
append p_eventstab. 
endif. 

read table p_eventstab with key name = slis_ev_foreign_top_of_page. 
if sy-subrc = 0 . 
move 'FOREIGN_TOP_OF_PAGE' to p_eventstab-form. 
append p_eventstab. 
endif. 

read table p_eventstab with key name = slis_ev_foreign_end_of_page. 
if sy-subrc = 0 . 
move 'FOREIGN_END_OF_PAGE' to p_eventstab-form. 
append p_eventstab. 
endif. 

read table p_eventstab with key name = slis_ev_list_modify. 
if sy-subrc = 0 . 
move 'LIST_MODIFY' to p_eventstab-form. 
append p_eventstab. 
endif. 

read table p_eventstab with key name = slis_ev_top_of_list. 
if sy-subrc = 0 . 
move 'TOP_OF_LIST' to p_eventstab-form. 
append p_eventstab. 
endif. 

read table p_eventstab with key name = slis_ev_end_of_page. 
if sy-subrc = 0 . 
move 'END_OF_PAGE' to p_eventstab-form. 
append p_eventstab. 
endif. 

read table p_eventstab with key name = slis_ev_end_of_list . 
if sy-subrc = 0 . 
move 'END_OF_LIST' to p_eventstab-form. 
append p_eventstab. 
endif. 
endform. " FILL_EVENTSTAB 
*&amp;amp;---------------------------------------------------------------------* 
*&amp;amp; Form FILL_HEADINGTABLE 
*&amp;amp;---------------------------------------------------------------------* 
* text 
*----------------------------------------------------------------------* 
* --&amp;gt;P_HEADING text * 
*----------------------------------------------------------------------* 
form fill_headingtable tables p_heading structure heading 
using tablename. 
case tablename. 
when 'HEADING'. 
p_heading-typ = 'H'. 
concatenate 
' REPORT NAME:-' syrepid 
' ABB Industry Pte Ltd' into p_heading-info. 
append p_heading. 
write sy-datum using edit mask '__/__/____' to sydatum. 

concatenate 
' DATE:-' sydatum ' USER: ' sy-uname 'PAGE NO:' sypagno 
into p_heading-info. 
append p_heading. 
when 'HEADING1'. 
p_heading-typ = 'H'. 
p_heading-info = 'TOP-OF-COVER-PAGE'. 
append p_heading. 
when 'HEADING2'. 
p_heading-typ = 'H'. 
p_heading-info = 'END-OF-COVER-PAGE'. 
append p_heading. 
when 'HEADING3'. 
p_heading-typ = 'H'. 
p_heading-info = 'FOREIGN-TOP-OF-PAGE'. 
append p_heading. 
when 'HEADING4'. 
p_heading-typ = 'H'. 
p_heading-info = 'FOREIGN-END-OF-PAGE'. 
append p_heading. 
* WHEN 'HEADING5'. 
* P_HEADING-TYP = 'H'. 
* P_HEADING-INFO = 'LIST-MODIFY'. 
* APPEND P_HEADING. 
when 'HEADING6'. 
p_heading-typ = 'H'. 
p_heading-info = 'END-OF-PAGE'. 
append p_heading. 
when 'HEADING7'. 
p_heading-typ = 'H'. 
p_heading-info = 'END-OF-LIST'. 
append p_heading. 
when 'HEADING8'. 
p_heading-typ = 'H'. 
p_heading-info = 'TOP-OF-LIST'. 
append p_heading. 
endcase. 
endform. " FILL_HEADINGTABLE 

*---------------------------------------------------------------------* 
* FORM TOP_OF_PAGE * 
*---------------------------------------------------------------------* 
* ........ * 
*---------------------------------------------------------------------* 
form top_of_page. 
call function 'REUSE_ALV_COMMENTARY_WRITE' 
exporting 
it_list_commentary = heading[] 
exceptions 
others = 1. 
endform. 
*&amp;amp;---------------------------------------------------------------------* 
*&amp;amp; Form FILL_COLORSTRUCT 
*&amp;amp;---------------------------------------------------------------------* 
* text 
*----------------------------------------------------------------------* 
* --&amp;gt;P_COLORSTRUCT text * 
*----------------------------------------------------------------------* 
form fill_colorstruct using p_colorstruct type slis_coltypes . 
p_colorstruct-heacolfir-col = 6. 
p_colorstruct-heacolfir-int = 1. 
p_colorstruct-heacolfir-inv = 1. 
endform. " FILL_COLORSTRUCT 

*---------------------------------------------------------------------* 
* FORM TOP_OF_COVERPAGE * 
*---------------------------------------------------------------------* 
* ........ * 
*---------------------------------------------------------------------* 
form top_of_coverpage. 
call function 'REUSE_ALV_COMMENTARY_WRITE' 
exporting 
it_list_commentary = heading1[] 
exceptions 
others = 1. 
endform. 

*---------------------------------------------------------------------* 
* FORM END_OF_COVERPAGE * 
*---------------------------------------------------------------------* 
* ........ * 
*---------------------------------------------------------------------* 
form end_of_coverpage. 
call function 'REUSE_ALV_COMMENTARY_WRITE' 
exporting 
it_list_commentary = heading2[] 
exceptions 
others = 1. 
endform. 

*---------------------------------------------------------------------* 
* FORM FOREIGN_TOP_OF_PAGE * 
*---------------------------------------------------------------------* 
* ........ * 
*---------------------------------------------------------------------* 
form foreign_top_of_page. 
call function 'REUSE_ALV_COMMENTARY_WRITE' 
exporting 
it_list_commentary = heading3[] 
exceptions 
others = 1. 

endform. 

*---------------------------------------------------------------------* 
* FORM FOREIGN_END_OF_PAGE * 
*---------------------------------------------------------------------* 
* ........ * 
*---------------------------------------------------------------------* 
form foreign_end_of_page. 
call function 'REUSE_ALV_COMMENTARY_WRITE' 
exporting 
it_list_commentary = heading4[] 
exceptions 
others = 1. 
endform. 

*---------------------------------------------------------------------* 
* FORM LIST_MODIFY * 
*---------------------------------------------------------------------* 
* ........ * 
*---------------------------------------------------------------------* 
*FORM LIST_MODIFY. 
* CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' 
* EXPORTING 
* IT_LIST_COMMENTARY = HEADING5[] 
* EXCEPTIONS 
* OTHERS = 1. 
*ENDFORM. 

*---------------------------------------------------------------------* 
* FORM END_OF_PAGE * 
*---------------------------------------------------------------------* 
* ........ * 
*---------------------------------------------------------------------* 
form end_of_page. 
call function 'REUSE_ALV_COMMENTARY_WRITE' 
exporting 
it_list_commentary = heading6[] 
exceptions 
others = 1. 
endform. 

*---------------------------------------------------------------------* 
* FORM END_OF_LIST * 
*---------------------------------------------------------------------* 
* ........ * 
*---------------------------------------------------------------------* 
form end_of_list. 
call function 'REUSE_ALV_COMMENTARY_WRITE' 
exporting 
it_list_commentary = heading7[] 
exceptions 
others = 1. 
endform. 

*---------------------------------------------------------------------* 
* FORM TOP_OF_LIST * 
*---------------------------------------------------------------------* 
* ........ * 
*---------------------------------------------------------------------* 
form top_of_list. 
call function 'REUSE_ALV_COMMENTARY_WRITE' 
exporting 
it_list_commentary = heading8[] 
exceptions 
others = 1. 
endform.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if helpful&lt;/P&gt;&lt;P&gt;raam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Apr 2008 04:32:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-fm-layout/m-p/3633851#M875179</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-19T04:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: ALV USING FM (layout)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-fm-layout/m-p/3633852#M875180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Layout: Apply the options like zebra,colors for all the fields&lt;/P&gt;&lt;P&gt;Have a look on the following code,u can get idea&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES VBAK.&lt;/P&gt;&lt;P&gt;TYPE-POOLS SLIS.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Data Declaration&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;TYPES: BEGIN OF T_VBAK,&lt;/P&gt;&lt;P&gt;      VBELN TYPE VBAK-VBELN,&lt;/P&gt;&lt;P&gt;      ERDAT TYPE VBAK-ERDAT,&lt;/P&gt;&lt;P&gt;      ERNAM TYPE VBAK-ERNAM,&lt;/P&gt;&lt;P&gt;      AUDAT TYPE VBAK-AUDAT,&lt;/P&gt;&lt;P&gt;      VBTYP TYPE VBAK-VBTYP,&lt;/P&gt;&lt;P&gt;      NETWR TYPE VBAK-NETWR,&lt;/P&gt;&lt;P&gt;      VKORG TYPE VBAK-VKORG,&lt;/P&gt;&lt;P&gt;      VKGRP TYPE VBAK-VKGRP,&lt;/P&gt;&lt;P&gt;      LINE_COLOR(4) TYPE C,&lt;/P&gt;&lt;P&gt;      END OF T_VBAK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: IT_VBAK TYPE STANDARD TABLE OF T_VBAK INITIAL SIZE 0,&lt;/P&gt;&lt;P&gt;      WA_VBAK TYPE T_VBAK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;ALV Data Declaration&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;      &lt;STRONG&gt;GD_LAYOUT TYPE SLIS_LAYOUT_ALV&lt;/STRONG&gt;,&lt;/P&gt;&lt;P&gt;      GD_REPID TYPE SY-REPID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;PERFORM DATA_RETRIEVAL.&lt;/P&gt;&lt;P&gt;PERFORM BLD_FLDCAT.&lt;/P&gt;&lt;P&gt;PERFORM BLD_LAYOUT.&lt;/P&gt;&lt;P&gt;PERFORM DISPLAY_ALV_REPORT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Build Field Catalog for ALV Report&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;FORM BLD_FLDCAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FLDCAT-FIELDNAME = 'VBELN'.&lt;/P&gt;&lt;P&gt;FLDCAT-SELTEXT_M = 'Sales Document'.&lt;/P&gt;&lt;P&gt;FLDCAT-COL_POS = 0.&lt;/P&gt;&lt;P&gt;*FLDCAT-EMPHASIZE = 'C411'.&lt;/P&gt;&lt;P&gt;FLDCAT-OUTPUTLEN = 20.&lt;/P&gt;&lt;P&gt;FLDCAT-KEY = 'X'.&lt;/P&gt;&lt;P&gt;APPEND FLDCAT TO FLDCAT.&lt;/P&gt;&lt;P&gt;CLEAR FLDCAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FLDCAT-FIELDNAME = 'ERDAT'.&lt;/P&gt;&lt;P&gt;FLDCAT-SELTEXT_L = 'Record Date created'.&lt;/P&gt;&lt;P&gt;FLDCAT-COL_POS = 1.&lt;/P&gt;&lt;P&gt;FLDCAT-KEY = 'X'.&lt;/P&gt;&lt;P&gt;APPEND FLDCAT TO FLDCAT.&lt;/P&gt;&lt;P&gt;CLEAR FLDCAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FLDCAT-FIELDNAME = 'ERNAM'.&lt;/P&gt;&lt;P&gt;FLDCAT-SELTEXT_L = 'Cteated Object Person Name'.&lt;/P&gt;&lt;P&gt;APPEND FLDCAT TO FLDCAT.&lt;/P&gt;&lt;P&gt;CLEAR FLDCAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FLDCAT-FIELDNAME = 'AUDAT'.&lt;/P&gt;&lt;P&gt;FLDCAT-SELTEXT_M = 'Document Date'.&lt;/P&gt;&lt;P&gt;FLDCAT-COL_POS = 3.&lt;/P&gt;&lt;P&gt;FLDCAT-EMPHASIZE = 'C110'.&lt;/P&gt;&lt;P&gt;APPEND FLDCAT TO FLDCAT.&lt;/P&gt;&lt;P&gt;CLEAR FLDCAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FLDCAT-FIELDNAME = 'VBTYP'.&lt;/P&gt;&lt;P&gt;FLDCAT-SELTEXT_L = 'SD Document category'.&lt;/P&gt;&lt;P&gt;FLDCAT-COL_POS = 4.&lt;/P&gt;&lt;P&gt;APPEND FLDCAT TO FLDCAT.&lt;/P&gt;&lt;P&gt;CLEAR FLDCAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FLDCAT-FIELDNAME = 'NETWR'.&lt;/P&gt;&lt;P&gt;FLDCAT-SELTEXT_L = 'Net Value of the SO in Document Currency'.&lt;/P&gt;&lt;P&gt;FLDCAT-COL_POS = 5.&lt;/P&gt;&lt;P&gt;FLDCAT-OUTPUTLEN = 60.&lt;/P&gt;&lt;P&gt;FLDCAT-DO_SUM = 'X'.&lt;/P&gt;&lt;P&gt;FLDCAT-DATATYPE = 'CURR'.&lt;/P&gt;&lt;P&gt;APPEND FLDCAT TO FLDCAT.&lt;/P&gt;&lt;P&gt;CLEAR FLDCAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FLDCAT-FIELDNAME = 'VKORG'.&lt;/P&gt;&lt;P&gt;FLDCAT-SELTEXT_L = 'Sales Organization'.&lt;/P&gt;&lt;P&gt;FLDCAT-COL_POS = 6.&lt;/P&gt;&lt;P&gt;APPEND FLDCAT TO FLDCAT.&lt;/P&gt;&lt;P&gt;CLEAR FLDCAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FLDCAT-FIELDNAME = 'VKGRP'.&lt;/P&gt;&lt;P&gt;FLDCAT-SELTEXT_M = 'Sales Group'.&lt;/P&gt;&lt;P&gt;FLDCAT-COL_POS = 7.&lt;/P&gt;&lt;P&gt;FLDCAT-EMPHASIZE = 'C801'.&lt;/P&gt;&lt;P&gt;APPEND FLDCAT TO FLDCAT.&lt;/P&gt;&lt;P&gt;CLEAR FLDCAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Build Layout for ALV Grid Report&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;FORM BLD_LAYOUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;GD_LAYOUT-NO_INPUT = 'X'.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;GD_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;GD_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GD_LAYOUT-CONFIRMATION_PROMPT = 'X'.  &amp;#147; This asks the confirmation before leaving the screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Display report using ALV grid&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;FORM DISPLAY_ALV_REPORT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GD_REPID = SY-REPID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;P&gt; EXPORTING&lt;/P&gt;&lt;P&gt;   I_CALLBACK_PROGRAM                = GD_REPID&lt;/P&gt;&lt;P&gt;   &lt;STRONG&gt;IS_LAYOUT                         = GD_LAYOUT&lt;/STRONG&gt;   I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'&lt;/P&gt;&lt;P&gt;   I_GRID_TITLE                      = 'SALES DOCUMENT HEADER'&lt;/P&gt;&lt;P&gt;   IT_FIELDCAT                       = FLDCAT[]&lt;/P&gt;&lt;P&gt;   I_SAVE                            = 'X'&lt;/P&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;    T_OUTTAB                          = IT_VBAK&lt;/P&gt;&lt;P&gt; EXCEPTIONS&lt;/P&gt;&lt;P&gt;   PROGRAM_ERROR                     = 1&lt;/P&gt;&lt;P&gt;   OTHERS                            = 2.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Retrieve data from VBAK table and populate itab IT_VBAK&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;FORM DATA_RETRIEVAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA LD_COLOR(1) TYPE C.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT VBELN ERDAT ERNAM AUDAT VBTYP NETWR VKORG&lt;/P&gt;&lt;P&gt;UP TO 20 ROWS&lt;/P&gt;&lt;P&gt;FROM VBAK&lt;/P&gt;&lt;P&gt;INTO TABLE IT_VBAK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT IT_VBAK INTO WA_VBAK.&lt;/P&gt;&lt;P&gt;LD_COLOR = LD_COLOR + 1.&lt;/P&gt;&lt;P&gt;IF LD_COLOR = 8.&lt;/P&gt;&lt;P&gt;  LD_COLOR = 1.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;CONCATENATE 'C' LD_COLOR '10' INTO WA_VBAK-LINE_COLOR.&lt;/P&gt;&lt;P&gt;MODIFY IT_VBAK FROM WA_VBAK.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM TOP_OF_PAGE.&lt;/P&gt;&lt;P&gt;DATA: T_HEADER TYPE SLIS_T_LISTHEADER,&lt;/P&gt;&lt;P&gt;      W_HEADER TYPE SLIS_LISTHEADER.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;W_HEADER-TYP = 'H'.&lt;/P&gt;&lt;P&gt;W_HEADER-INFO = 'WELCOME HEADER LIST'.&lt;/P&gt;&lt;P&gt;APPEND W_HEADER TO T_HEADER.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;W_HEADER-TYP = 'S'.&lt;/P&gt;&lt;P&gt;W_HEADER-KEY = 'REPORT:'.&lt;/P&gt;&lt;P&gt;W_HEADER-INFO = SY-REPID.&lt;/P&gt;&lt;P&gt;APPEND W_HEADER TO T_HEADER.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;W_HEADER-TYP = 'S'.&lt;/P&gt;&lt;P&gt;W_HEADER-KEY = 'DATE:'.&lt;/P&gt;&lt;P&gt;CONCATENATE SY-DATUM&lt;EM&gt;6(2) ' / ' SY-DATUM&lt;/EM&gt;4(2) ' / ' SY-DATUM(4) INTO W_HEADER-INFO.&lt;/P&gt;&lt;P&gt;APPEND W_HEADER TO T_HEADER.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    IT_LIST_COMMENTARY       = T_HEADER.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward,if useful.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Chandu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Apr 2008 04:52:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-fm-layout/m-p/3633852#M875180</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-19T04:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: ALV USING FM (layout)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-fm-layout/m-p/3633853#M875181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi chandu,&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    thanks for your reply,&lt;/P&gt;&lt;P&gt;I did not &lt;STRONG&gt;understand&lt;/STRONG&gt; below statement &lt;STRONG&gt;functionality&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;"GD_LAYOUT-WINDOW_TITLEBAR"&lt;/P&gt;&lt;P&gt;Could you please explain me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2) Another requirement is  all column headings must be in bold.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;saritha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Apr 2008 05:49:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-fm-layout/m-p/3633853#M875181</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-19T05:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: ALV USING FM (layout)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-fm-layout/m-p/3633854#M875182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WIDOW_TITLEBAR parameter is used to display the text in window.&lt;/P&gt;&lt;P&gt;Just activate it and observe the headings in window titlebar.&lt;/P&gt;&lt;P&gt;Then you can easily understand.&lt;/P&gt;&lt;P&gt;Ex:- If u search "alv reports" in google,then it will display "alv reports" text which u entered in google,on window as title.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward,if useful.&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;Chandu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Apr 2008 06:01:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-fm-layout/m-p/3633854#M875182</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-19T06:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: ALV USING FM (layout)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-fm-layout/m-p/3633855#M875183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi kodandarami reddy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Thanks for such a quick reply&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Apr 2008 07:24:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-fm-layout/m-p/3633855#M875183</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-19T07:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: ALV USING FM (layout)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-fm-layout/m-p/3633856#M875184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;
Hi Saritha,
Lets discuss about the Layout Structure of type &lt;STRONG&gt;SLIS_ALV_LAYOUT&lt;/STRONG&gt;.

&lt;STRONG&gt;Definition:&lt;/STRONG&gt; It contains fields for settinig graphical properties of the grid, displaying exceptions, calculating totals and enabling specific interaction options.
The structure has somany fields as fellow SDNs mention.I dont want to go all of the fields. We discuss main important functions.
&lt;PRE&gt;&lt;CODE&gt;
"Define Layout structure
w_layout  TYPE slis_alv_layout.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;PRE&gt;&lt;CODE&gt;
"Display Options
"---------------
w_layout-colwidth_optimize ='X'.
"optimzes the column width so that all contents are displayed completely.
w_layout-zebra = 'X'.
"Alternating cell color (zebra pattern) for print output
w_layout-max_linesize = '300'.
"value set: 0, 80 - 1020. Maximum list width (to change the default of 250)
w_layout-no_colhead = 'X'.
"column headers are not output
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;PRE&gt;&lt;CODE&gt;
"Traffic Lights(Exceptions)
"-------------------------
To get traffic lights on the output for a field.
"1
"Define internal table which is displayed on output with one field  of type C.
DATA:
     begin of t_lights Occurs O,
       matnr  type mard-matnr,
       werks  type mard-werks,
       lgort  type mard-lgort,
       lights type char1,"Variable is needs to be declared
      end of t_lights.
"While building internal table with data populate this field with corresponding values 1(red traffic light) or 2(yellow traffic light) or 3(green  traffic light).
"Pass the lights field name defined in the interna table through layout structure .
w_laout-lights_fieldname = 'LIGHTS'.
w_laout-lights_tabname = 'T_LIGHTS'.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;PRE&gt;&lt;CODE&gt;
"Total and Subtotal texts
w_layout-totals_text      = 'G.Total'."the string passed is output after the total indicated by '*', if the first column is wide enough.
w_layout-subtotals_text = 'Sub Total'."the string passed is output after the subtotal indicated by '*', if the column is wide enough and the first column is not a subtotal criterion.
w_layout-numc_sum = 'X'." NUMC fields can be totalled. If this flag is set, the total can be controlled via the FIELDCAT-NO_SUM parameter per NUMC column.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;PRE&gt;&lt;CODE&gt;
"Row Selection on Grid.
"--------------------------
"Define one variable in the final internal table which is displayed of type C.
"Pass that variable the following way.
w_layout-box_fieldname = 'SELECT'.
w_layout-box_tabname  = 'I_TAB'.expand_fieldname
"if the list has checkboxes at the start of records (for selecting several records), this parameter contains the internal output table field name indicated by the checkbox selection column.
"Expanding
"------------
"if hierarchical-sequential list items are to be expandable and collapsable, the internal header table must contain an additional CHAR(1) field which contains the expansion status of the header entry.
w_layout-expand_fieldname  = 'EXPAND'."Only relevant for hierarchical-sequential lists
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;PRE&gt;&lt;CODE&gt;
"Coloring Rows
"-----------------
"Define internal table which is displayed on output with one field with length 3 of type C.
DATA:
     begin of t_color Occurs O,
       matnr  type mard-matnr,
       werks  type mard-werks,
       lgort  type mard-lgort,
       color type char3,"Variable is needs to be declared
      end of t_color.
"While filling internal table with data, fill Color variable with the corresponding data in the given manner.
"'Cxy':
"C = color (all codes must start with 'C')
"x = color number ('1'-'9')
"y = bold ('0' = off, '1' = on)

w_layout-info_fieldname = 'COLOR'. "Pass the variable defined in the internal table for Color.
&lt;/CODE&gt;&lt;/PRE&gt;

Those are the main functions used using Layout structure.

1.&lt;STRONG&gt;GD_LAYOUT-WINDOW_TITLEBAR&lt;/STRONG&gt; its simple to understand to know what it is .. 
If you know sy-title system field .what it does. window_titlebar is, changing that field value manually which is displayed on output down the application toolbar.
2.&lt;STRONG&gt;Columns headings bold&lt;/STRONG&gt;
   if u use ALV Grid control, u can set or unset using SMALLTITLE field in the Layout structure. Structures are different slightly for both ..

I hope that it helps u to understand more abt Layout ..

Thanks and Regards,
Venkat.O
&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Apr 2008 08:02:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-fm-layout/m-p/3633856#M875184</guid>
      <dc:creator>venkat_o</dc:creator>
      <dc:date>2008-04-19T08:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: ALV USING FM (layout)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-fm-layout/m-p/3633857#M875185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi venkat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     thanks.&lt;/P&gt;&lt;P&gt;could you please send sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And regarding &lt;STRONG&gt;grid control&lt;/STRONG&gt; for &lt;STRONG&gt;column names to be bold&lt;/STRONG&gt; i did not get you..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;saritha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Apr 2008 11:43:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-fm-layout/m-p/3633857#M875185</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-19T11:43:46Z</dc:date>
    </item>
  </channel>
</rss>

