‎2006 Nov 13 8:27 PM
Hi Good Guys,
my problem:
My Report is like below:
*Stucture definition
types: begin of tab,
field_1 type table-field1,
field_2 type table_field2
...
end of tab.
*internal table definition
Data: i_tab type standard table of tab.
*Selection
Select * from table-xyz
into corresponding fields of table i_tab
where ....
endselect.
*Outprint
I wanted to make outprint like this;
loop at i_tab.
write: .....
endloop.
*My BOSS prefers outprint with ALV Grid Layout
Question ?
Can you please help me out. I would appreciate detailed step by step infos. on what to do.
Example:
1. how to create a Structure of my i_tab
2. how the print out would come out as ALV Grid Layout
Yours Ara (From Germany)
‎2006 Nov 13 8:39 PM
Hi. This is very simple, here is an outline of a very simple ALV grid using the funciton module, there are other ways, but this is the least complex. You simply put data into your internal table, and build the field catalog, then call the function module.
report zrich_0004
no standard page heading.
type-pools slis.
data: fieldcat type slis_t_fieldcat_alv.
data: begin of imara occurs 0,
matnr type mara-matnr,
maktx type makt-maktx,
end of imara.
* Selection Screen
selection-screen begin of block b1 with frame title text-001 .
select-options: s_matnr for imara-matnr .
selection-screen end of block b1.
start-of-selection.
perform get_data.
perform write_report.
************************************************************************
* Get_Data
************************************************************************
form get_data.
select mara~matnr makt~maktx
into corresponding fields of table imara
from mara
inner join makt
on mara~matnr = makt~matnr
where mara~matnr in s_matnr
and makt~spras = sy-langu.
endform.
************************************************************************
* WRITE_REPORT
************************************************************************
form write_report.
perform build_field_catalog.
* CALL ABAP LIST VIEWER (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = fieldcat
tables
t_outtab = imara.
endform.
************************************************************************
* BUILD_FIELD_CATALOG
************************************************************************
form build_field_catalog.
data: fc_tmp type slis_t_fieldcat_alv with header line.
clear: fieldcat. refresh: fieldcat.
clear: fc_tmp.
fc_tmp-reptext_ddic = 'Material Number'.
fc_tmp-fieldname = 'MATNR'.
fc_tmp-tabname = 'IMARA'.
fc_tmp-outputlen = '18'.
fc_tmp-col_pos = 2.
append fc_tmp to fieldcat.
clear: fc_tmp.
fc_tmp-reptext_ddic = 'Material'.
fc_tmp-fieldname = 'MAKTX'.
fc_tmp-tabname = 'IMARA'.
fc_tmp-outputlen = '40'.
fc_tmp-col_pos = 3.
append fc_tmp to fieldcat.
endform.Regards,
Rich Heilman
‎2006 Nov 13 8:39 PM
Hi,
Check the below link, it has detailed steps.
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_enhanced.htm
Thanks
Ramakrishna
‎2006 Nov 13 8:39 PM
Hi. This is very simple, here is an outline of a very simple ALV grid using the funciton module, there are other ways, but this is the least complex. You simply put data into your internal table, and build the field catalog, then call the function module.
report zrich_0004
no standard page heading.
type-pools slis.
data: fieldcat type slis_t_fieldcat_alv.
data: begin of imara occurs 0,
matnr type mara-matnr,
maktx type makt-maktx,
end of imara.
* Selection Screen
selection-screen begin of block b1 with frame title text-001 .
select-options: s_matnr for imara-matnr .
selection-screen end of block b1.
start-of-selection.
perform get_data.
perform write_report.
************************************************************************
* Get_Data
************************************************************************
form get_data.
select mara~matnr makt~maktx
into corresponding fields of table imara
from mara
inner join makt
on mara~matnr = makt~matnr
where mara~matnr in s_matnr
and makt~spras = sy-langu.
endform.
************************************************************************
* WRITE_REPORT
************************************************************************
form write_report.
perform build_field_catalog.
* CALL ABAP LIST VIEWER (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = fieldcat
tables
t_outtab = imara.
endform.
************************************************************************
* BUILD_FIELD_CATALOG
************************************************************************
form build_field_catalog.
data: fc_tmp type slis_t_fieldcat_alv with header line.
clear: fieldcat. refresh: fieldcat.
clear: fc_tmp.
fc_tmp-reptext_ddic = 'Material Number'.
fc_tmp-fieldname = 'MATNR'.
fc_tmp-tabname = 'IMARA'.
fc_tmp-outputlen = '18'.
fc_tmp-col_pos = 2.
append fc_tmp to fieldcat.
clear: fc_tmp.
fc_tmp-reptext_ddic = 'Material'.
fc_tmp-fieldname = 'MAKTX'.
fc_tmp-tabname = 'IMARA'.
fc_tmp-outputlen = '40'.
fc_tmp-col_pos = 3.
append fc_tmp to fieldcat.
endform.Regards,
Rich Heilman
‎2006 Nov 13 8:55 PM
Thanks guys. I will try your tips then give points.
Hi Rich.
I thinks yours is simply enough for me.
Thanks again.