ALv Header and subheading
Hi Please suggest how to give heading and subheading in ALV using Grid using Function Modules .
Three of four columns should be grouped under a heading..
and in that header the subheading for each items should come.
Refer these links
Re: ALV query
Re: Multiple lines in alv column headings
If this solves ur problem reward points and close the thread
Similar Messages
-
Blocked ALV Header and Item Displau
Hi Friends,
I`m new to ABAP and the forum.I`m in dire need of solution for a report.
Scenario
I have an internal table with fields ebeln vbeln adrnr.
For every change in ebeln i need to create a new page in ALV and display the item VBELN and some more fields.
Its like a header and item in a single page of alv report.
Is there a possibility to use ALV here or only classical report can be used in the scenario???Hi,
For Blocked alv header and item display you
declaration internal table fields ebeln vbeln adrn
TYPE-POOLS SLIS.
TYPES : BEGIN OF TY_EKKO,
EBELN TYPE EKKO-EBELN,
AEDAT TYPE EKKO-AEDAT,
vblen TYPE EKKO- vbeln,
END OF TY_EKKO.
DATA : IT_EKKO TYPE TABLE OF TY_EKKO,
WA_EKKO TYPE TY_EKKO.
DATA : WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA : WA_EVENTS TYPE SLIS_ALV_EVENT,
IT_EVENTS TYPE SLIS_T_ALV_EVENT,
IS_LAYOUT TYPE SLIS_LAYOUT_ALV.
For Build catalog
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'PO NUMBER'.
WA_FIELDCAT-COL_POS = 1.
WA_FIELDCAT-KEY = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'AEDAT'.
WA_FIELDCAT-SELTEXT_M = 'DATE OF CREATION'.
WA_FIELDCAT-COL_POS = 2.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'LIFNR'.
WA_FIELDCAT-SELTEXT_M = 'VENDOR NO'.
WA_FIELDCAT-COL_POS = 3.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
read_data :
SELECT * INTO TABLE IT_EKKO FROM EKKO UP TO 20 ROWS.
print_header :
DATA : IT_LIST TYPE SLIS_T_LISTHEADER,
WA_LIST TYPE LINE OF SLIS_T_LISTHEADER.
CLEAR WA_LIST.
WA_LIST-TYP = 'H'.
WA_LIST-INFO = 'LIST OF PURCHASE ORDERS'.
APPEND WA_LIST TO IT_LIST.
Header along with write statement at top-of-page then use these function module
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LIST -
ALV Header and details in the report
Hi Experts,
I have the following requirements for the report:
Company Code: -->Report Header
Plant:
Posting Date:
Material Jan Amount Feb Amount March Amount --> Header info
Sales order number Delivery dates Order dates Qty UOM Amount -->Details Info
1234 1,000.00 500.00 300.00 --> Header info
0001 02/02/2008 01/02/2008 10 PC 60.00 -->Details Info
0002 02/03/2008 01/02/2008 5 PC 30.00
0003 02/03/2008 01/02/2008 12 PC 70.00
0004 02/04/2008 01/02/2008 14 PC 90.00
0005 02/06/2008 01/02/2008 10 PC 60.00
5678 2,000.00 400.00 300.00 --> Header info
0001 02/02/2008 01/02/2008 10 PC 60.00 -->Details Info
0002 02/03/2008 01/02/2008 5 PC 30.00
0003 02/03/2008 01/02/2008 12 PC 70.00
0004 02/04/2008 01/02/2008 14 PC 90.00
0005 02/06/2008 01/02/2008 10 PC 60.00
the report should look like the one above. How can I develop this in ALV Grid or List? Thanks so much!
Best Regards,
KurttHi,
You can use Hierarchial ALV.
Refer:-
BCALV_TREE_01 ALV : tree control: build up the hierarchy tree
BCALV_TREE_DND ALV : tree control: Drag & Drop within a hierarchy tree
BCALV_TREE_DND_MULTIPLE ALV : tree control: Drag & Drop within a hierarchy tree
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir -
Displaying selection screen data on alv header in multiple rows and columns
Hi
Presently in my requirement , whatever the data entered in selection screen should display on alv header and item details on alv grid display.
for eg...
on alv header
customer no : 1000 to 2000 sales order no: 111
name : gff to ff sales org:
city: country:
item details below this
plz guide me how to solve this issue.
Thanks & Regards,
PradeepHi,
Check this code this may help you.
<code>
TYPE-POOLS : SLIS.
TABLES VBRK.
TYPES : BEGIN OF TY_VBRK,
VBELN TYPE VBRK-VBELN,
VKORG TYPE VBRK-VKORG,
VTWEG TYPE VBRK-VTWEG,
SPART TYPE VBRK-SPART,
FKDAT TYPE VBRK-FKDAT,
END OF TY_VBRK,
BEGIN OF TY_VBRP,
VBELN TYPE VBRP-VBELN,
POSNR TYPE VBRP-POSNR,
MATNR TYPE VBRP-MATNR,
ARKTX TYPE VBRP-ARKTX,
FKIMG TYPE VBRP-FKIMG,
NETWR TYPE VBRP-NETWR,
END OF TY_VBRP,
BEGIN OF TY_TARGET,
VBELN TYPE VBRK-VBELN,
VKORG TYPE VBRK-VKORG,
VTWEG TYPE VBRK-VTWEG,
SPART TYPE VBRK-SPART,
FKDAT TYPE VBRK-FKDAT,
POSNR TYPE VBRP-POSNR,
MATNR TYPE VBRP-MATNR,
ARKTX TYPE VBRP-ARKTX,
FKIMG TYPE VBRP-FKIMG,
NETWR TYPE VBRP-NETWR,
END OF TY_TARGET.
DATA : T_VBRK TYPE TABLE OF TY_VBRK,
W_VBRK TYPE TY_VBRK,
T_VBRP TYPE TABLE OF TY_VBRP,
W_VBRP TYPE TY_VBRP,
T_TARGET TYPE TABLE OF TY_TARGET,
W_TARGET TYPE TY_TARGET,
FIELD CATALOG ******************
T_FCAT TYPE SLIS_T_FIELDCAT_ALV,
W_FCAT TYPE SLIS_FIELDCAT_ALV,
*************************************SUB TOTALS AND SORTING***********
T_SORT TYPE SLIS_T_SORTINFO_ALV,
W_SORT TYPE SLIS_SORTINFO_ALV,
*************************************FOR LIST HEADER******************
T_LIST_HEAD TYPE SLIS_T_LISTHEADER,
W_LIST_HEAD TYPE SLIS_LISTHEADER,
T_LIST_HEAD1 TYPE SLIS_T_LISTHEADER,
W_LIST_HEAD1 TYPE SLIS_LISTHEADER,
*************************************FOR LIST HEADER******************
W_LAYOUT TYPE SLIS_LAYOUT_ALV,
************************************FOR EVENTS************************
T_EVENT TYPE SLIS_T_EVENT,
W_EVENT TYPE SLIS_ALV_EVENT.
*********************************SELECT OPTIONS***********************
SELECT-OPTIONS : S_VBELN FOR VBRK-VBELN DEFAULT 90005316 TO 90005330.
**RETRIVING DATA************************
PERFORM DATA_RETRIVE.
**BUILDING THE FIELD CATALOG************
PERFORM BUILD_FCAT.
**BUILDING THE TABLE FOR LIST HEADER****
PERFORM BUILD_LIST_HEAD.
*******************************CALLING THE FUNCTION MODULE************
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_TOP_OF_PAGE = 'LIST_TOP_OF_PAGE'
IT_FIELDCAT = T_FCAT
IT_SORT = T_SORT
TABLES
T_OUTTAB = T_TARGET.
*& Form DATA_RETRIVE
FORM DATA_RETRIVE .
SELECT VBELN VKORG VTWEG SPART FKDAT FROM VBRK INTO CORRESPONDING FIELDS
OF TABLE T_VBRK WHERE VBELN IN S_VBELN.
IF SY-SUBRC EQ 0.
SORT T_VBRK BY VBELN.
SELECT VBELN POSNR MATNR ARKTX FKIMG NETWR FROM VBRP INTO TABLE
T_VBRP FOR ALL ENTRIES IN T_VBRK WHERE VBELN = T_VBRK-VBELN.
ENDIF.
LOOP AT T_VBRP INTO W_VBRP.
LOOP AT T_VBRK INTO W_VBRK WHERE VBELN = W_VBRP-VBELN.
W_TARGET-VBELN = W_VBRK-VBELN.
W_TARGET-VKORG = W_VBRK-VKORG.
W_TARGET-VTWEG = W_VBRK-VTWEG.
W_TARGET-SPART = W_VBRK-SPART.
W_TARGET-FKDAT = W_VBRK-FKDAT.
W_TARGET-POSNR = W_VBRP-POSNR.
W_TARGET-MATNR = W_VBRP-MATNR.
W_TARGET-ARKTX = W_VBRP-ARKTX.
W_TARGET-FKIMG = W_VBRP-FKIMG.
W_TARGET-NETWR = W_VBRP-NETWR.
APPEND W_TARGET TO T_TARGET.
ENDLOOP.
ENDLOOP.
SORT T_TARGET BY VBELN.
ENDFORM. " DATA_RETRIVE
*& Form BUILD_FCAT
FORM BUILD_FCAT .
W_FCAT-COL_POS = 1.
W_FCAT-FIELDNAME = 'VBELN'.
W_FCAT-SELTEXT_M = 'BILLING NO'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 2.
W_FCAT-FIELDNAME = 'VKORG'.
W_FCAT-SELTEXT_M = 'SALES ORGANIZATION'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 3.
W_FCAT-FIELDNAME = 'VTWEG'.
W_FCAT-SELTEXT_M = 'DISTRIBUTION CHANNEL'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 4.
W_FCAT-FIELDNAME = 'SPART'.
W_FCAT-SELTEXT_M = 'DIVISION'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 5.
W_FCAT-FIELDNAME = 'FKDAT'.
W_FCAT-SELTEXT_M = 'CREATION DATE'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 6.
W_FCAT-FIELDNAME = 'POSNR'.
W_FCAT-SELTEXT_M = 'BILLING ITEM'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 7.
W_FCAT-FIELDNAME = 'MATNR'.
W_FCAT-SELTEXT_M = 'MATERIAL NUM'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 8.
W_FCAT-FIELDNAME = 'ARKTX'.
W_FCAT-SELTEXT_M = 'DESCRIPTION'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 9.
W_FCAT-FIELDNAME = 'FKIMG'.
W_FCAT-SELTEXT_M = 'QUANTITY'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 10.
W_FCAT-FIELDNAME = 'NETWR'.
W_FCAT-SELTEXT_M = 'NET VALUE'.
W_FCAT-DO_SUM = 'X'.
APPEND W_FCAT TO T_FCAT.
ENDFORM. " BUILD_FCAT
*& Form BUILD_LIST_HEAD
FORM BUILD_LIST_HEAD .
DATA : L_DATE(10),
L_TIME(8).
W_LIST_HEAD-TYP = 'S'.
W_LIST_HEAD-KEY = 'Sales org :'.
W_LIST_HEAD-INFO = S_VBELN-LOW .
APPEND W_LIST_HEAD TO T_LIST_HEAD.
CLEAR W_LIST_HEAD.
W_LIST_HEAD-TYP = 'S'.
W_LIST_HEAD-KEY = 'TO '.
W_LIST_HEAD-INFO = S_VBELN-HIGH.
APPEND W_LIST_HEAD TO T_LIST_HEAD.
CLEAR W_LIST_HEAD.
ENDFORM. " BUILD_LIST_HEAD
*& Form LIST_TOP_OF_PAGE
FORM LIST_TOP_OF_PAGE .
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_LIST_HEAD.
ENDFORM. " LIST_TOP_OF_PAGE
<code>
Regards -
Need to add Header and footer in an alv grid display output.
How can I add header and footer in an alv grid dispay output.
For the grid display, I am using the function module "REUSE_ALV_GRID_DISPLAY".HI,
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
i_callback_html_end_of_list = 'END_OF_LIST_HTML'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
FORM end_of_list_html USING end TYPE REF TO cl_dd_document.
DATA: ls_text TYPE sdydo_text_element,
l_grid TYPE REF TO cl_gui_alv_grid,
f(14) TYPE c VALUE 'SET_ROW_HEIGHT'.
ls_text = 'Footer title'.
adds and icon (red triangle)
CALL METHOD end->add_icon
EXPORTING
sap_icon = 'IL'.
adds test (via variable)
CALL METHOD end->add_text
EXPORTING
text = ls_text
sap_emphasis = 'strong'.
adds new line (start new line)
CALL METHOD end->new_line.
display text(bold)
CALL METHOD end->add_text
EXPORTING
text = 'Bold text'
sap_emphasis = 'strong'.
adds new line (start new line)
CALL METHOD end->new_line.
display text(normal)
CALL METHOD end->add_text
EXPORTING
text = 'Nor'.
adds new line (start new line)
CALL METHOD end->new_line.
display text(bold)
CALL METHOD end->add_text
EXPORTING
text = 'Yellow '
sap_emphasis = 'str'.
adds and icon (yellow triangle)
CALL METHOD end->add_icon
EXPORTING
sap_icon = 'IC''.
display text(normal)
CALL METHOD end->add_text
EXPORTING
text = 'Mor'.
*set height of this section
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = l_grid.
CALL METHOD l_grid->parent->parent->(f)
EXPORTING
id = 3
height = 14.
ENDFORM. "end_of_list_html.
This will solve it. Post if you need more help in this.
Regards,
Madhu. -
How to place header and footer in OO-ALV program using class
How to place header and footer in OO-ALV program using class tell me wat r the class we shold use and their attributes as well
Hi Venkatesh,
Take a look at this how to [ABAP Objects - ALV Model - Using Header and Footer|https://wiki.sdn.sap.com/wiki/x/xdw]
it's explaining how to define the classes and use it for display an ALV with Header and Footer.
Regards,
Marcelo Ramos -
Creating Header and Footer in ALV
hi,
can anyone please tell how will you create Header and Footer in ALv and Classical Report.Hi,
In classical report use events 'top-of-page' for header and 'end-of-page' for footer.
in ALV
follow this link
http://www.sap-img.com/abap/test-alv-display-with-header-footer.htm
http://sap.ittoolbox.com/groups/technical-functional/sap-dev/header-footer-display-in-alv-grid-for-layout-description-344391
Regards and Best wishes. -
Header and Footer in Block ALV Display
Hi All,
My requirement includes to ALV Block List Display with header and footer.
I have made two forms TOP_OF_PAGE and END_OF_PAGE . I have pass the form and name of event to an internal table it_events.
This it_events[] is then passed to FM ' REUSE_ALV_BLOCK_LIST_APPEND' . But only Top of Page is working.
Am I missing any thing in the code? or I have to use something else.
Pls Help
Regards,
NibhaHi,
For end_of_page you need to use Events as follows:
*TO CAPTURE EVENTS AND HANDLE
DATA : it_event TYPE slis_t_event,
wa_event TYPE slis_alv_event.
*& Form BUILD_EVENTCAT
FORM build_eventcat .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_event
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2.
READ TABLE it_event INTO wa_event WITH KEY name = 'END_OF_LIST'.
wa_event-form = 'END_OF_PAGE'. " Sub-routine that will be used to write
MODIFY it_event FROM wa_event INDEX sy-tabix. " Modify it_event
CLEAR wa_event.
ENDFORM. " F_BUILD_EVENTCAT
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = g_t_alv_layout2
it_fieldcat = g_t_fieldcat2[]
it_events = it_event[]
TABLES
t_outtab = <fs_final_itab>.
Regards,
Mansi. -
Header and footer in ALV using CL_SALV_TABLE
How to add header and footer for an ALV report using CL_SALV_TABLE. I know how to add header lr_table->set_top_of_list_print( lr_header )
but how do I make it aligned center.
Also how to add a footer
I want it to look like Current page of total pages
What is the system variable for total pages.Hi,
this should be the Method:
SET_END_OF_LIST_PRINT
Best Regards -
Header and Footer in ALV.. URGENT
Hi All,
I want to print Header and Footer in ALV list/grid. Like in header, i want page no.( 1 of 10), UserName, Report Name etc.. and in Footer, I need selection screen criteria. For this I am using a function module (FM_SECECTOIN_CRITERIA_PRINT).
Where exactly should i code this part in my program.
Regards,
Parvez.Check this link -
http://www.sap-img.com/abap/test-alv-display-with-header-footer.htm
http://www.sap-img.com/fu037.htm
http://www.sap-img.com/abap-function.htm
Regards,
Amit -
Header and Logo in Blocked ALV
Is It possible to put header and logo in Blocked ALV Report.
Is yes shall I go with the same way we put the Header and Logo in ALV Grid report.
Thanks in Advance.Hi,
You can put the haeder and logo same like we have used to do in classical ALV's....
sample code snippet..
REPORT ZALV_BLOCKEDALV .
*provide tables
TABLES: MARA, MAKT, MARD.
*provide type-pools
TYPE-POOLS: SLIS.
*provide select-options
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.
*provide data objects
DATA: V_REPID TYPE SY-REPID,
WA_MARA_FIELD TYPE SLIS_FIELDCAT_ALV, "it is for field catalog
WA_MAKT_FIELD TYPE SLIS_FIELDCAT_ALV,
WA_MARD_FIELD TYPE SLIS_FIELDCAT_ALV,
WA_MARA TYPE MARA,
WA_MAKT TYPE MAKT,
WA_MARD TYPE MARD, IT_MARA_FIELD TYPE SLIS_T_FIELDCAT_ALV,
IT_MAKT_FIELD TYPE SLIS_T_FIELDCAT_ALV,
IT_MARD_FIELD TYPE SLIS_T_FIELDCAT_ALV,
IT_MARA TYPE TABLE OF MARA,
IT_MAKT TYPE TABLE OF MAKT,
IT_MARD TYPE TABLE OF MARD, V_LAYOUT TYPE SLIS_LAYOUT_ALV,
IT_EVENTS TYPE SLIS_T_EVENT, "it is for events
WA_EVENTS TYPE SLIS_ALV_EVENT.V_REPID = SY-REPID.
*provide field catalog perform
PERFORM FIELD_CAT.
*call the initial function module
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* IT_EXCLUDING =
*provide perform for select the data
PERFORM SELECT_DATA.
*call mara append list
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = V_LAYOUT
IT_FIELDCAT = IT_MARA_FIELD[]
I_TABNAME = 'MARA'
IT_EVENTS = IT_EVENTS[]
* IT_SORT =
* I_TEXT = ' '
TABLES
T_OUTTAB = IT_MARA
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 2
OTHERS = 3.
*call makt append list
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = V_LAYOUT
IT_FIELDCAT = IT_MAKT_FIELD
I_TABNAME = 'MAKT'
IT_EVENTS = IT_EVENTS
* IT_SORT =
* I_TEXT = ' '
TABLES
T_OUTTAB = IT_MAKT
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 2
OTHERS = 3.
*call mard append list
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = V_LAYOUT
IT_FIELDCAT = IT_MARD_FIELD
I_TABNAME = 'MARD'
IT_EVENTS = IT_EVENTS
* IT_SORT =
* I_TEXT = ' '
TABLES
T_OUTTAB = IT_MARD
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 2
OTHERS = 3.
*display the data
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
* EXPORTING
* I_INTERFACE_CHECK = ' '
* 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 =
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2.
*& Form TOP_PAGE
* text
FORM TOP_PAGE. WRITE:/ 'THIS IS BLOCKED ALV REPORT PROGRAM BASED ON 3 BLOCKS' COLOR
5.ENDFORM. "TOP_PAGE
*& Form FIELD_CAT
* text
* --> p1 text
* <-- p2 text
FORM FIELD_CAT .WA_MARA_FIELD-COL_POS = 1.
WA_MARA_FIELD-FIELDNAME = 'MATNR'.
WA_MARA_FIELD-REF_TABNAME = 'MARA'.
APPEND WA_MARA_FIELD TO IT_MARA_FIELD.
CLEAR WA_MARA_FIELD.WA_MARA_FIELD-COL_POS = 2.
WA_MARA_FIELD-FIELDNAME = 'ERSDA'.
WA_MARA_FIELD-REF_TABNAME = 'MARA'.
APPEND WA_MARA_FIELD TO IT_MARA_FIELD.
CLEAR WA_MARA_FIELD.WA_MARA_FIELD-COL_POS = 3.
WA_MARA_FIELD-FIELDNAME = 'ERNAM'.
WA_MARA_FIELD-REF_TABNAME = 'MARA'.
APPEND WA_MARA_FIELD TO IT_MARA_FIELD.
CLEAR WA_MARA_FIELD.WA_MARA_FIELD-COL_POS = 4.
WA_MARA_FIELD-FIELDNAME = 'LAEDA'.
WA_MARA_FIELD-REF_TABNAME = 'MARA'.
APPEND WA_MARA_FIELD TO IT_MARA_FIELD.
CLEAR WA_MARA_FIELD.WA_MAKT_FIELD-COL_POS = '1'.
WA_MAKT_FIELD-FIELDNAME = 'MATNR'.
WA_MAKT_FIELD-REF_TABNAME = 'MAKT'.
APPEND WA_MAKT_FIELD TO IT_MAKT_FIELD.
CLEAR WA_MAKT_FIELD.WA_MAKT_FIELD-COL_POS = 2.
WA_MAKT_FIELD-FIELDNAME = 'MAKTX'.
WA_MAKT_FIELD-REF_TABNAME = 'MAKT'.
APPEND WA_MAKT_FIELD TO IT_MAKT_FIELD.
CLEAR WA_MAKT_FIELD.WA_MAKT_FIELD-COL_POS = 3.
WA_MAKT_FIELD-FIELDNAME = 'MAKTG'.
WA_MAKT_FIELD-REF_TABNAME = 'MAKT'.
APPEND WA_MAKT_FIELD TO IT_MAKT_FIELD.
CLEAR WA_MAKT_FIELD.WA_MARD_FIELD-COL_POS = 1.
WA_MARD_FIELD-FIELDNAME = 'MATNR'.
WA_MARD_FIELD-REF_TABNAME = 'MARD'.
APPEND WA_MARD_FIELD TO IT_MARD_FIELD.
CLEAR WA_MARD_FIELD.WA_MARD_FIELD-COL_POS = 2.
WA_MARD_FIELD-FIELDNAME = 'WERKS'.
WA_MARD_FIELD-REF_TABNAME = 'MARD'.
APPEND WA_MARD_FIELD TO IT_MARD_FIELD.
CLEAR WA_MARD_FIELD.WA_MARD_FIELD-COL_POS = 3.
WA_MARD_FIELD-FIELDNAME = 'LGORT'.
WA_MARD_FIELD-REF_TABNAME = 'MARD'.
APPEND WA_MARD_FIELD TO IT_MARD_FIELD.
CLEAR WA_MARD_FIELD.WA_EVENTS-FORM = 'TOP_PAGE'.
WA_EVENTS-NAME = 'TOP_OF_PAGE'.
APPEND WA_EVENTS TO IT_EVENTS.ENDFORM. " FIELD_CAT
*& Form SELECT_DATA
* text
* --> p1 text
* <-- p2 text
FORM SELECT_DATA .SELECT *
FROM MARA
INTO TABLE IT_MARA
WHERE MATNR IN S_MATNR.SELECT *
FROM MAKT
INTO TABLE IT_MAKT
WHERE MATNR IN S_MATNR.SELECT *
FROM MARD
INTO TABLE IT_MARD
WHERE MATNR IN S_MATNR.ENDFORM. " SELECT_DATA
hope this will help you
regards,
kiran
Edited by: kiran kumar on Aug 23, 2010 1:43 PM -
How to define header and footer in ALV
Hi All,
I have created one Report program where i have to display data in both alv grid and alv list display.
Reqt are:
1. The report output must contain standard header & footer.
2. The header must display the count of the materials displayed, the user name & system date.
3. The footer must display the name of the SAP system, Operating System of Application Server, Current GUI Status
& Release Status of SAP System.
I am using Fm REUSE_ALV_LIST_DISPLAY and REUSE_ALV_GRID_DSIPLAY.
this top of page n end of page is part of slis_t_events only.
In list display FM, i m not getting any option to define top of page form.
Any pointers on this.
Thanks,
Mamtahii Mamta..
Try this .it will solve TOP-OF-PAGE problem. Pass TOP_OF_PAGE under FM REUSE_ALV_GRID_DISPLAY
eg.CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IS_LAYOUT = ALV_LAYOUT
I_CALLBACK_PROGRAM = SY_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE' " TOP_OF_PAGE
I_GRID_TITLE = I_TITLE_ITEM
IT_FIELDCAT = I_FIELDCAT[]
I_SAVE = 'A'.
IT_EVENTS = V_EVENTS
TABLES
T_OUTTAB = IT_ITEM.
Form TOP_OF_PAGE.
* *ALV Header declarations
DATA: T_HEADER1 TYPE SLIS_T_LISTHEADER,
WA_HEADER1 TYPE SLIS_LISTHEADER,
T_LINE LIKE WA_HEADER1-INFO,
LD_LINES TYPE I,
LD_LINESC(10) TYPE C.
* Title
WA_HEADER1-TYP = 'H'.
WA_HEADER1-INFO = 'COMPLETE LC Records displayed'.
APPEND WA_HEADER1 TO T_HEADER1.
CLEAR WA_HEADER1.
* Date
WA_HEADER1-TYP = 'S'.
WA_HEADER1-KEY = 'Date: '.
CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM(4) INTO WA_HEADER1-INFO. "todays date
APPEND WA_HEADER1 TO T_HEADER1.
CLEAR: WA_HEADER1.
DESCRIBE TABLE IT1 LINES LD_LINES.
LD_LINESC = LD_LINES. " No of Records in internal Table
CONCATENATE 'Total No. of Records in Database : ' LD_LINESC
INTO T_LINE SEPARATED BY SPACE.
WA_HEADER1-TYP = 'A'.
WA_HEADER1-INFO = T_LINE.
APPEND WA_HEADER1 TO T_HEADER1.
CLEAR: WA_HEADER1, T_LINE.
WA_HEADER1-TYP = 'A'.
WA_HEADER1-INFO = sy-uname. "User Name
APPEND WA_HEADER1 TO T_HEADER1.
CLEAR: WA_HEADER1, T_LINE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_HEADER1.
endform.
Reards,
Apoorv -
Header and Footer for ALV Layout
Hi All,
I have used the following code to create the Header and Footer Areas for ALV Report.
CLEAR: FS_EVENTCAT.
FS_EVENTCAT-NAME = 'TOP_OF_PAGE'.
FS_EVENTCAT-FORM = 'build_comment'.
APPEND FS_EVENTCAT TO GT_EVENTS.
CLEAR: FS_EVENTCAT.
FS_EVENTCAT-NAME = 'END_OF_LIST'.
FS_EVENTCAT-FORM = 'F_WRITE_SUMMARY'.
APPEND FS_EVENTCAT TO GT_EVENTS.
Now the space is available for both Header and Footer...
But i would like to display the Text in Header and Footer areas...
How to insert the Texts....????
Can you help me please.....???
Regards
PavanHi,
Try with following example program:
REPORT ZRJR02 .
*Table declaration.
TABLES:ZEMP_MST,ZDEPT_MST,ZDESG_MST,ZSL_TXN.
*Varriable declaration.
TYPE-POOLS SLIS.
DATA : POS TYPE I.
DATA REPID LIKE SY-REPID.
DATA : F1 TYPE SLIS_T_FIELDCAT_ALV,
F2 TYPE SLIS_FIELDCAT_ALV,
L_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA L_POS TYPE I VALUE 1. "position of the column
DATA GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
*DATA GT_SORT TYPE SLIS_T_SORTINFO_ALV.
data: GT_EVENTS TYPE SLIS_T_EVENT,
FS_EVENTCAT LIKE LINE OF GT_EVENTs.
*Internal table declaration.
*DATA BEGIN OF IT_SORT OCCURS 5.
INCLUDE TYPE SLIS_SORTINFO_ALV.
*DATA END OF IT_SORT.
DATA:BEGIN OF ITAB OCCURS 0,
ZEMPNO LIKE ZEMP_MST-ZEMPNO,
ZEMPNAME LIKE ZEMP_MST-ZEMPNAME,
ZDEPTCD LIKE ZEMP_MST-ZDEPTCD,
ZDEPTNAME LIKE ZDEPT_MST-ZDEPTNAME,
ZDESGCD LIKE ZEMP_MST-ZDESGCD,
ZDESGNAME LIKE ZDESG_MST-ZDESGNAME,
END OF ITAB.
REFRESH ITAB.CLEAR ITAB.
START-OF-SELECTION.
SELECT AZEMPNO AZEMPNAME AZDEPTCD BZDEPTNAME AZDESGCD CZDESGNAME
FROM ZEMP_MST AS A
INNER JOIN ZDEPT_MST AS B
ON AZDEPTCD EQ BZDEPTCD
INNER JOIN ZDESG_MST AS C
ON AZDESGCD EQ CZDESGCD
INTO CORRESPONDING FIELDS OF TABLE ITAB.
IF SY-SUBRC <> 0.
MESSAGE E899(M3) WITH 'No records'.
ENDIF.
perform f_build_eventcat.
PERFORM LAYOUT.
END-OF-SELECTION.
*& Form LAYOUT
FORM LAYOUT .
PERFORM FCAT USING 'ZEMPNO' 'ITAB' '' 'Emp.No.' 'ZEMPNO' 'ZEMP_MST' ''.
PERFORM FCAT USING 'ZEMPNAME' 'ITAB' '' 'Emp. Name' 'ZEMPNAME' 'ZEMP_MST' ''.
PERFORM FCAT USING 'ZDEPTCD' 'ITAB' '' 'Dept.Code' 'ZDEPTCD' 'ZEMP_MST' ''.
PERFORM FCAT USING 'ZDEPTNAME' 'ITAB' '' 'Dept.Name' 'ZDEPTNAME' 'ZDEPT_MST' ''.
PERFORM FCAT USING 'ZDESGCD' 'ITAB' '' 'Desg.Code' 'ZDESGCD' 'ZEMP_MST' ''.
PERFORM FCAT USING 'ZDESGNAME' 'ITAB' '' 'Desg.Name' 'ZDESGNAME' 'ZDESG_MST' ''.
PERFORM LSORT USING 'ZEMPNO' 'IDATA' ''.
PERFORM LSORT USING 'ZEMPNAME' 'IDATA' ''.
MOVE IT_SORT[] TO GT_SORT[].
REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = REPID
IT_FIELDCAT = F1
IT_SORT = GT_SORT
I_SAVE = 'X'
IT_EVENTS = GT_EVENTS[]
TABLES
T_OUTTAB = ITAB.
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. " LAYOUT
*& Form FCAT
FORM FCAT USING P_FIELD P_TABLE P_SUM P_TEXT P_RFIELD P_RTABLE P_DISP.
ADD 1 TO POS.
F2-COL_POS = POS.
F2-FIELDNAME = P_FIELD.
F2-TABNAME = P_TABLE.
F2-SELTEXT_L = P_TEXT.
F2-REF_FIELDNAME = P_RFIELD.
F2-REF_TABNAME = P_RTABLE.
F2-DO_SUM = P_SUM.
F2-NO_OUT = P_DISP.
APPEND F2 TO F1.
CLEAR F2.
ENDFORM. " FCAT
*& Form LSORT
*FORM LSORT USING P_FIELD P_TABLE P_UP.
ADD 1 TO L_POS.
IT_SORT-SPOS = L_POS.
IT_SORT-FIELDNAME = P_FIELD.
IT_SORT-TABNAME = P_TABLE.
IT_SORT-UP = P_UP.
APPEND IT_SORT.
*ENDFORM. " LSORT
FORM F_BUILD_EVENTCAT .
CLEAR: GT_EVENTS. REFRESH: GT_EVENTS.
CLEAR: FS_EVENTCAT.
FS_EVENTCAT-NAME = 'TOP_OF_PAGE'.
FS_EVENTCAT-FORM = 'F_REPORT_HEADER_ALV'.
APPEND FS_EVENTCAT TO GT_EVENTS.
CLEAR: FS_EVENTCAT.
FS_EVENTCAT-NAME = 'END_OF_LIST'.
FS_EVENTCAT-FORM = 'F_WRITE_SUMMARY'.
APPEND FS_EVENTCAT TO GT_EVENTS.
ENDFORM. " F_BUILD_EVENTCAT
FORM F_REPORT_HEADER_ALV.
CALL FUNCTION 'Z_YHEAD_PRINT'
EXPORTING
TITLE1 = 'XYZ Limited'
TITLE2 = 'Employee Master'
TITLE3 = 'Created on '
COLOR = 'X'
ENDFORM.
*& Form F_WRITE_SUMMARY
Write summary before exit
FORM F_WRITE_SUMMARY .
write:/ 'Welcome to XYZ Limited'.
write:/ 'This is a test program to display Report in ALV Format'.
ENDFORM.
Regards,
Bhaskar -
Hi All,
What is the use of Header and Footer Area (Top of List & End of List ) in ALV table. Can any one explain me..
Thanks,
Susilhi ,
In the below link there is an example for creating top of list end end of list.. in this the header and footer are displayed outside the ALV table.. My question is what is the use of the header and footer even I can use UI's to display the header and footer...
http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b0ee06d0-d475-2b10-ddad-bc4bf134cfb8?overridelayout=true
Thanks,
Susil. -
Main heading and Sub Heading Requirment in ALV wih download to excel featur
Hello Everyone,
I have a very typical requirment in ALV . I want the output to be displayed as folows :
Category
Head1
Head2
Here the heading category is just a heading and no header and line item data. so hirearchal kind of ALV is of no use. and i cant write this was in TOP-OF-PAGE as i want to download this data to excel and if i write it in TOP-OF-PAGE the dwnload in excel is misaligned. I have been thorugh the various topics posted here and couldn't get a feasible solution. Please Help.Hi,
This is not possible
Refer these links
Re: ALV query
Re: Multiple lines in alv column headings
If this solves ur problem reward points and close the thread
Maybe you are looking for
-
Whenever I launch firfox through non admin login, I get an alert message.
Whenever I open firefox through non admin login, I get following alert message. "Could not initialize the application's security component. The most likely cause is problems with files in your application's profile directory. Please check that this d
-
~webgui_simple_toolbar parameter not working in ITS 7.0
Hi Experts, I want to disable the back and cancel options in my webgui HTML pages. To make this i have used the parameter called ~webgui_simple_toolbar with value 18, why 18 is, as per the note 1010519 i have taken these values. But still i am gettin
-
Query can't be executed in parallel after seting one parameter
Hi all, Got answer from metalink. best regards, Leon Edited by: user12064076 on Jan 29, 2011 7:26 PM Edited by: user12064076 on Jan 29, 2011 9:54 PM
-
I am doing some programming with CMP where i have one findBy Method , which is returning a Collection, By the way i have couple of get/set methods defined in the Bean implementation class , i need to access the get methods of which , kindly let me kn
-
Run .exe and get returned data
hello, I have a simple executable that runs from a command window in dos. You run it like this. String encryptedPW = iscrypt "scott"; and it will return a string that is encrypted. So my question is how do I do this in Java? Thanks Scott.