2008 Jun 18 12:28 PM
Hi I dont know how to display header details in Object oriented programming.
Can any one help me how to achieve it as I want to display the following details in header
Material 25612-F040
Material Description 243L PVC 3T W=1.37
Plant 1000
Total stock (MBEW-LBKUM) 500
Unit of Meausrement (MBEW-MEINS) EA
Itemdetails separate in ALV Grid display.
2008 Jun 18 12:30 PM
HI,
Check these links below:
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
Hope this helps.
Regards,
Sharath
2008 Jun 18 12:34 PM
I want in Object oriented programming and can u send me the code
2008 Jun 18 12:31 PM
Hello,
Please see this at the events section.
[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907]
Regards.
2008 Jun 18 12:34 PM
data: wa_layout TYPE lvc_s_layo.
wa_layout-zebra = 'X'.
wa_layout-GRID_TITLE = 'your title'
*fill your internal table
* fill field catalogue
CALL METHOD g_alvgrid->set_table_for_first_display
EXPORTING
is_layout = wa_layout
CHANGING
it_outtab = it_out
it_fieldcatalog = it_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
.
IF sy-subrc <> 0.
ENDIF.
Reward points
2008 Jun 18 12:36 PM
Hi,
chk this lilnk.
You wil find ALV program....using OOP concepts.
/people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid
Regards
Sandeep Reddy
2008 Jun 18 12:41 PM
Hi,
have look at this Trial code...
&----
*& Report ZTRIAL *
*& *
&----
*& *
*& *
&----
REPORT ZTRIAL .
*report sy-repid.
type-pools : slis.
*ALV Formatting tables /structures
data: gt_fieldcat type slis_t_fieldcat_alv.
data: gt_events type slis_t_event.
data: gs_layout type slis_layout_alv.
data: gt_page type slis_t_listheader.
data: gs_page type slis_listheader.
data: v_repid like sy-repid.
*ALV Formatting work area
data: w_fieldcat type slis_fieldcat_alv.
data: w_events type slis_alv_event.
data: gt_bsid type table of bsid with header line.
initialization.
PERFORM BUILD_EVENTS CHANGING GT_EVENTS.
perform build_page_header.
start-of-selection.
*perform build_comment. "top_of_page - in initialization at present
select * from bsid into table gt_bsid up to 10 rows.
*perform populate_for_fm using '1' '3' 'BUKRS' '8' 'GT_BSID' 'Whee'.
*USING = Row, Column, Field name, display length, table name, heading
*OR
perform build_fieldcat.
gs_layout-zebra = 'X'.
*top of page event does not work without I_callback_program
v_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = v_repid
i_structure_name = 'BSID'
i_background_id = 'ALV_BACKGROUND'
i_grid_title = 'This is the grid title'
I_GRID_SETTINGS =
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
it_events = gt_events[]
tables
t_outtab = gt_bsid.
************************************************************************
Form..............: populate_for_fm
Description.......: Populates fields for function module used in ALV
************************************************************************
form populate_for_fm using p_row
p_col
p_fieldname
p_len
p_table
p_desc.
w_fieldcat-row_pos = p_row. "Row Position
w_fieldcat-col_pos = p_col. "Column Position
w_fieldcat-fieldname = p_fieldname. "Field name
w_fieldcat-outputlen = p_len. "Column Lenth
w_fieldcat-tabname = p_table. "Table name
w_fieldcat-reptext_ddic = p_desc. "Field Description
w_fieldcat-input = '1'.
append w_fieldcat to gt_fieldcat.
clear w_fieldcat.
endform. " populate_for_fm
&----
*& Form build_events
&----
FORM BUILD_EVENTS CHANGING GT_EVENTS TYPE SLIS_T_EVENT.
DATA: LINE_EVENT TYPE SLIS_ALV_EVENT.
CLEAR LINE_EVENT.
LINE_EVENT-NAME = 'TOP_OF_PAGE'.
LINE_EVENT-FORM = 'TOP_OF_PAGE'.
APPEND LINE_EVENT TO GT_EVENTS.
ENDFORM. "build_events
&----
*& Form USER_COMMAND
&----
When user command is called it uses 2 parameters. The itab
passed to the ALV is in whatever order it currently is on screen.
Therefore, you can read table itab index rs_selfield-tabindex to get
all data from the table. You can also check r_ucomm and code
accordingly.
&----
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
read table gt_bsid index rs_selfield-tabindex.
error checking etc.
set parameter id 'KUN' field gt_bsid-kunnr.
call transaction 'XD03' and skip first screen.
endform.
&----
*& Form top_of_page
&----
Your own company logo can go here if it has been saved (OAOR)
If the logo is larger than the size of the headings in gt_page,
the window will not show full logo and will have a scroll bar. Thus,
it is a good idea to have a standard ALV header if you are going to
use logos in your top of page.
&----
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = gt_page
i_logo = 'ENJOYSAP_LOGO'.
endform.
&----
*& Form build_fieldcat
&----
*Many and varied fields are available here. Have a look at documentation
*for FM REUSE_ALV_LIST_DISPLAY and REUSE_ALV_FIELDCATALOG_MERGE
----
form build_fieldcat.
w_fieldcat-fieldname = 'BUDAT'.
w_fieldcat-seltext_m = 'Dte pst'.
w_fieldcat-ddictxt(1) = 'M'.
Can change the position of fields if you do not want them in order
of the DDIC or itab
w_fieldcat-row_pos = '1'.
w_fieldcat-col_pos = '10'.
append w_fieldcat to gt_fieldcat.
clear w_fieldcat.
endform. " build_fieldcat
&----
*& Form build_page_header
&----
gt_page is used in top of page (ALV subroutine - NOT event)
*H = Header, S = Selection, A = Action
----
form build_page_header.
For Headers, Key is not printed and is irrelevant. Will not cause
a syntax error, but is not used.
gs_page-typ = 'H'.
gs_page-info = 'Header 1'.
append gs_page to gt_page.
gs_page-typ = 'H'.
gs_page-info = 'Header 2'.
append gs_page to gt_page.
For Selections, the Key is printed (bold). It can be anything up to 20
bytes. It gets printed in order of code here, not by key value.
gs_page-typ = 'S'.
gs_page-key = 'And the winner is:'.
gs_page-info = 'Selection 1'.
append gs_page to gt_page.
gs_page-typ = 'S'.
gs_page-key = 'Runner up:'.
gs_page-info = 'Selection 2'.
append gs_page to gt_page.
For Action, Key is also irrelevant.
gs_page-typ = 'A'.
gs_page-info = 'Action goes here'.
append gs_page to gt_page.
endform. " build_page_header
Reward pts if helpfull.
Regards,
Dhan
.
2008 Jun 18 1:12 PM