Reg. lengh of header of alv grid.....have ur points.
Hi all,
-I want to show text on the right side of the header of ALV grid.
-Secondly i have limit of around 60 characters in a line...i want to add more words in the same line.....
<b>see the code...here..</b>
wa_listheader-typ = 'S'.
wa_listheader-info = 'THE FUNCTIONAL LOCATION WISE PERCENTAGE IMPLEMENTAION'.
APPEND wa_listheader TO it_listheader.
CLEAR wa_listheader.
<b>Thanx in advance..</b>
Have ur points.
Regards,
pradeep phogat
Try this
WA_LINE-TYP = 'S'..----
><b>'H' to print in header</b>
CONCATENATE 'THE FUNCTIONAL LOCATION WISE PERCENTAGE IMPLEMENTAION'.
V_RYEAR INTO WA_LINE-INFO
SEPARATED BY SPACE.
APPEND WA_LINE TO IT_LIST_TOP_OF_PAGE.
Thanks
Similar Messages
-
Hello ,
I have a requirement to display Multiple heading in ALV Grid, I am using the Class 'cl_gui_alv_grid'. please let me know if you have Any suggestions.
Ex:
| Divison |
Sub D:1
Sub D: 2
Sub D: 3
Like wise i have few more divisions to display and Under we need to display the Sub Division also .
Thanks in Advance.. Waiting for your suggestions.
With Best Regards
NagsHi,
I had attempted to do it in the object oriented way, but found no ready solution, so I settled for the below solution.
Please use the function REUSE_ALV_COMMENTARY_WRITE.
This allows you to print multiple lines in the header.
I had a requirement of showing 5 lines in the header.
So i went on like:
DATA: it_list_commentary TYPE slis_t_listheader,
wa_list_commentary TYPE slis_listheader.
wa_list_commentary-typ = 'H'.
wa_list_commentary-info = <text>.
APPEND wa_list_commentary TO it_list_commentary.
wa_list_commentary-typ = 'S'.
wa_list_commentary-info = <text>.
APPEND wa_list_commentary TO it_list_commentary.
I fed he internal table with all 5 lines like above.
Finally I called the function.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_list_commentary.
Regards,
Prosenjit.
Edited by: prosenjit chaudhuri on Jan 28, 2009 6:14 AM -
Read the posted messages but still have some query regarding layout of Header in ALV grid. Using ALV Grid (not OO concept) in the report.
- Can texts be printed in two sections in a single row like
Name : Designation:
Age: Cost Centre:
- How to increse the row size of the header. Right now have to scroll to see the complete header.
Looking forward for replies.
Thanks
anuThe font size depends on what you have specified for the parameter SLIS_LISTHEADER ( H = Header, S = Selection, A = Action are the valid values), I don't think we have selection of the font size as such.
So, in your case you can specify Name / Designation as Header and Age / Cost Center as Selection so that they appear in different font.
I am guessing you are using the function REUSE_ALV_COMMENTARY_WRITE, for writing the header.
regards,
Ravi
Note : Please mark all the helpful answers -
How to make 1st column as header in ALV grid
Hi Experts,
How to make 1st column as header in ALV grid as attached. Please help.
Thanks in advance.Hi manoj,
Try with,
FM REUSE_ALV_HIERSEQ_LIST_DISPLAY
Regards,
Venkat. -
Hi Experts,
Can anyone help me out... in keeping the Check box at the Header Level.....
This requirement is in the copy of the standard transaction "ME2N".
1. In ME2N when you click on the Chage Layout button of ALV grid
and choose "Sorting" tabe.
2. Add any 3 fields say 1. Vendor/Supply plant 2. Purchasing group and 3. Purchasing document in the Sort criteria and choose accending order radio button and check box in the sum .
3. Now click on the Displayed Column tab and remove the above 3 fields from the Displayed colums and add it column set
4. Now report shows the heirarchial one in the sorting manner.
5. I want the Check Boxes at all levels both in the header and the item level.
When I click on the Header level check box all the item level check box should get checked. When I add the check box in the field catalog I am able to see the check box in the item level only because only item level data appears in the internal table and Header level is displayed based on the ALV grid sorting option and that row records are unknown in the internal table.
Is there some thing which I can do to get the check box at the header level retaining all the functionality of ME2N and ALV GRID.....
It would be great help if some one solves me this issue... Points will be awarded.
Br,
Laxmi.Hi Bharath,
Thanks for your response. Select ALL already existing... My requirement is not to get the whole report records selected at particular level all items and header should get selected. Say for example I have Vendor2 i.e, vendor 1 and vendor2. So in the Vendor 1 i will have Purchasing group1 , Purchasing document 1 and say 10 items under Purchasing document. say same as like in Vendor2. So if Click on the Vendor1 all the sub items of it have to selected so that I can perform further action only for these items not for the enter items of the report.
Br,
Laxmi. -
List header for alv grid using abap objects
Hai all,
I have displayed alv grid in container control using abap objects i.e. using method set_table_for_first_display.
now i need to display list header for this alv grid.
please help me how to create with a sample coding.
Thanks and regards,
Prabu S.Create a splitter using CL_GUI_EASY_SPLITTER_CONTAINER with a top and bottom half. Put the alv grid in the bottom half. Use cl_dd_document (documented in help.sap.com ) to build the header in the top half. Use events on CL_GUI_ALV_GRID to handle the top-of-list printing.
Or, if available, use CL_SALV_TABLE, and read the documentation on that. When I needed a header for my report, that's what I did. There's plenty of good documentation about if you'll search for it.
matt -
Header in alv grid using class
Hello All,
I developed alv grid using class method.
First I created CREATE OBJECT GR_CCONTAINER
then CREATE OBJECT GR_ALVGRID
then PERFORM FIELD_CATALOG TABLES GT_FIELDCAT----
for field catalog
PERFORM LAYOUT CHANGING GS_LAYOUT.----
for header
p_gs_layout-grid_title = 'class method'.
p_gs_layout-sel_mode = 'D'.
APPEND P_GS_LAYOUT TO IT_LAYOUT.
and finally CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
the report is cooming fine but in header it comes only "class method".
but i need also
1. reporting date
2. reporting time.
can any body tell me how i can i put 2 more heading line
Thanks,
RakeshHi Dude,
Please refer the below link how to handle the header in alv using abap oo
https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/abapObjects-ALVModel-UsingHeaderand+Footer
Hope it clears,..............
Thanks & Regards
Ramakrishna Pathi -
Reg. table transport.....have ur points.
Hi all,
As we know we can't directly put data in table in production server, I've a z table on development server. I used it for validation purpose. So when i'll transport it...how i will put data in production server..
Pleas assist me.
Have ur point.sPlease check the code ..
First create table maintaince.
now create program and add table name in list.
select one of the radio button ,it will take you sm30 and when you create record at Sm30 -> then it will ask request #.
so you can transport the data.
Table diclaration
tables: tvdir.
Selection screento table View
selection-screen skip 2.
parameter p_tabnm(30) as listbox visible length 30 obligatory.
selection-screen skip 1.
selection-screen begin of block s1 with frame title text-001.
parameter: p_radio1 radiobutton group g1,
p_radio radiobutton group g1.
selection-screen end of block s1.
Add values to list box
at selection-screen output.
type-pools: vrm.
data: name type vrm_id,
list type vrm_values,
value like line of list.
name = 'P_TABNM'.
refresh list.
<b>value-key = 'Table name'. " Add your table name</b>
value-text = text-002. "'Table description'.
append value to list.
call function 'VRM_SET_VALUES'
exporting
id = name
values = list.
start-of-selection.
Get flag of corresponding table view
select single tabname flag from tvdir into tvdir
where tabname = p_tabnm.
Set flag of corresponding table view
if p_radio1 eq 'X'.
if tvdir-flag ne 'X'.
update tvdir set: flag = 'X'
where tabname = p_tabnm.
endif.
endif.
if p_radio eq 'X'.
if tvdir-flag eq 'X'.
update tvdir set: flag = ''
where tabname = p_tabnm.
endif.
endif.
Execute View/Table
call function 'VIEW_MAINTENANCE_CALL'
exporting
action = 'U'
view_name = p_tabnm
exceptions
client_reference = 1
foreign_lock = 2
invalid_action = 3
no_clientindependent_auth = 4
no_database_function = 5
no_editor_function = 6
no_show_auth = 7
no_tvdir_entry = 8
no_upd_auth = 9
only_show_allowed = 10
system_failure = 11
unknown_field_in_dba_sellist = 12
view_not_found = 13
others = 14.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
Reset flag of corresponding table view
update tvdir set: flag = tvdir-flag
where tabname = p_tabnm.
Thanks
Seshu -
Reg. title bar.....have ur points.
Hi all,
I am using SET TITLEBAR 'MYTITLE' WITH 'HELLO FRIENDS' in dialog programming.
Now thing is "HELLO FRIENDS" is not displayed on the title.
Pleas assist me ....
<b>Have ur points.</b>
Regards,
pradeep phogatwhen you double click on PBO -> it creates new module,here you will have pf-status as well title bar.
just uncomment title bar -> give some name with singlle quotation -> save and activate.
now double click on name -> here -> give the text -> save -> activate it.
note : Please activate all screens in dialog programs ( Including pbo screen), if you did not activate then you will not get it
Thanks
Seshu -
ALV Grid -- Heading in each and every page while printing
Hello!!!!
How to display heading in ALV Grid in each and every page while printing?
Thanks in Advance!!!!!!Hi nitesh,
<b>data: lt_list_commentary type slis_t_listheader.
perform build_comment using
lt_list_commentary.
form build_comment using
pt_list_commentary type slis_t_listheader.
data: ls_line type slis_listheader.
clear ls_line.
ls_line-typ = 'H'.
ls_line-info = 'SREEKANTH REDDY'.
append ls_line to pt_list_commentary.
clear ls_line.
ls_line-typ = 'H'.
ls_line-info = 'HEADER1'.
append ls_line to pt_list_commentary.
clear ls_line.
ls_line-typ = 'H'.
ls_line-info = 'HEADER2TEXT'.
append ls_line to pt_list_commentary.
clear ls_line.
endform.
</b>In Function module REUSE_ALV_COMMENTARY_WRITE , give the parameter as
<b>it_list_commentary = lt_list_commentary </b>
Here ls_line-typ = 'H'. you can use options like 'H' , 'A' , 'S'. -
Exporting content of ALV grid in Web Dynpro for ABAP
Hello Experts
I have a following request which seems to be giving some headaches.
I need to export results from one of the Web Dynpro reports (ABAP) I have developed to the Excel spreadsheet. Results are stored on ALV component. Request is to add header to export file with additional information like report title, selection criteria, date when report has been executed. By default export file contains only column names and data. I have set the header for ALV grid with all extra information I need to be passed to Excel file but it does not seem to be transferred at all.
At the moment I see 2 possible solutions: 1) write my own Excel export 2) use PDF export where it is possible to set header/footer text. None of these solutions are ideal, I'd rather set header in standard Excel export. Is that even possible? Please help.
Regards
Michael
Edited by: Soltuion Manager on Apr 20, 2009 10:08 AM
Edited by: Soltuion Manager on Apr 20, 2009 10:26 AMHello Michael,
I haven't tried using the builtin functionality of ALV to achieve a similar fnctionality as yours but can suggest you a workaround for that. As how you might be already knowing you can try using the CL_WD_RUNTIME_SERVICES=>attach_file_to_response to download the contents into Excel/notepad/word. So just can modify the internal table to contain the extra information that you need. You can use the approach below for using the attach_file_to_response method:
1) First read the table's data into an internal table.
2) Convert the internal table data to STRING format.
3) Now convert it into tab separated format as how desired.
4) Convert this STRING format to XSTRING format
5) Make use of the attach_file_to_response method.
Regards,
Uday
METHOD onactionon_submit .
DATA: lv_node TYPE REF TO if_wd_context_node,
lt_mara TYPE if_main=>elements_mara,
wa_mara TYPE if_main=>element_mara,
lead_selection_index TYPE i,
mara_string TYPE string,
mara_xstring TYPE xstring.
lv_node = wd_context->get_child_node( name = 'MARA' ).
CALL METHOD lv_node->get_static_attributes_table
IMPORTING
table = lt_mara.
LOOP AT lt_mara INTO wa_mara.
CONCATENATE mara_string
wa_mara-matnr
wa_mara-ersda
wa_mara-ernam
wa_mara-matkl
wa_mara-meins
cl_abap_char_utilities=>cr_lf INTO mara_string
SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
ENDLOOP.
** Now you need to add the column headers & the desired extra information through coding to
** mara_string
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = mara_string
IMPORTING
buffer = mara_xstring.
CL_WD_RUNTIME_SERVICES=>attach_file_to_response( i_filename = 'TEMP.XLS'
i_content = mara_xstring
i_mime_type = 'EXCEL' ).
ENDMETHOD. -
Hi ALV masters,
Plz help me ..
I have an ALV grid report where i have the data in my final table t_final.
now i'm trying to populate the fieldcat using FM reuse_alv_fieldcatalog_merge but its not at all getting populated.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = l_repid
I_INTERNAL_TABNAME = 'T_Final'
I_INCLNAME = l_repid
CHANGING
CT_FIELDCAT = T_FIELDCAT[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
Please help me and if possibl try to send som sample code also.
Thanks in advance..Hi Mukesh,
this is my code.
plz tell where i'm going rong..
*& Report ZMMR_CHANGES *
Title : Material Master: Display Changes *
Description : This ABAP report will collectively list all material *
master changes to the fields specified in the selection*
criteria. *
Request No : SRDK922644 *
Author : Praveen Reddy *
Created on : 14-FEB-2007 *
REPORT ZMMR_CHANGES
NO STANDARD PAGE HEADING
message-id ZSPR.
TYPE-POOLS : SLIS.
TABLES : CDHDR , " Change document header
CDPOS , " Change document item
MARAV , " View Table for Logical DB MGM
MARC , " Plant Data for Material
MVKE . " Sales Data for Material
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN BEGIN OF BLOCK GENERAL WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS :
S_OBJCLS FOR CDHDR-OBJECTCLAS ,
S_MATNR FOR CDHDR-OBJECTID ,
S_WERKS FOR MARC-WERKS ,
S_VKORG FOR MVKE-VKORG ,
S_VTWEG FOR MVKE-VTWEG ,
S_TABNAM FOR CDPOS-TABNAME ,
S_FNAME FOR CDPOS-FNAME ,
S_CHGIND FOR CDPOS-CHNGIND ,
S_DATE FOR CDHDR-UDATE ,
S_USER FOR CDHDR-USERNAME .
SELECTION-SCREEN END OF BLOCK GENERAL.
SELECTION-SCREEN END OF BLOCK A.
*Data : G_WERKS LIKE MARC-WERKS ,
G_VKORG LIKE MVKE-VKORG ,
G_VTWEG LIKE MVKE-VTWEG ,
G_DESC LIKE MARAV-MAKTX .
TYPES : BEGIN OF TY_FOR_DISP ,
OBJCLASS LIKE CDHDR-OBJECTCLAS ,
OBJID LIKE CDHDR-OBJECTID ,
WERKS LIKE MARC-WERKS ,
VKORG LIKE MVKE-VKORG ,
VTWEG LIKE MVKE-VTWEG ,
DESC LIKE MARAV-MAKTX ,
TABNAME LIKE CDPOS-TABNAME ,
FNAME LIKE CDPOS-FNAME ,
CHNGIND LIKE CDPOS-CHNGIND ,
UDATE LIKE CDHDR-UDATE ,
USERNAME LIKE CDHDR-USERNAME ,
VALUE_OLD LIKE CDPOS-VALUE_OLD ,
VALUE_NEW LIKE CDPOS-VALUE_NEW ,
END OF TY_FOR_DISP .
TYPES : BEGIN OF TY_CDHDR,
OBJCLASS LIKE CDHDR-OBJECTCLAS ,
OBJID LIKE CDHDR-OBJECTID ,
CHNGIND LIKE CDPOS-CHNGIND ,
CHANGENR LIKE CDHDR-CHANGENR ,
UDATE LIKE CDHDR-UDATE ,
USERNAME LIKE CDHDR-USERNAME ,
VALUE_OLD LIKE CDPOS-VALUE_OLD ,
VALUE_NEW LIKE CDPOS-VALUE_NEW ,
END OF TY_CDHDR .
TYPES : BEGIN OF TY_CDPOS,
TABNAME LIKE CDPOS-TABNAME ,
FNAME LIKE CDPOS-FNAME ,
CHANGENR LIKE CDHDR-CHANGENR ,
CHNGIND LIKE CDPOS-CHNGIND ,
TABKEY LIKE CDPOS-TABKEY ,
FIELDTEXT LIKE DFIES-FIELDTEXT,
UDATE LIKE CDPOS-UDATE ,
USERNAME LIKE CDPOS-USERNAME ,
VALUE_OLD LIKE CDPOS-VALUE_OLD ,
VALUE_NEW LIKE CDPOS-VALUE_NEW ,
END OF TY_CDPOS .
DATA : T_FOR_DISP TYPE STANDARD TABLE OF TY_FOR_DISP
WITH HEADER LINE ,
T_CDHDR TYPE STANDARD TABLE OF TY_CDHDR
WITH HEADER LINE ,
T_CDPOS TYPE STANDARD TABLE OF TY_CDPOS
WITH HEADER LINE .
DATA : G_LANGU LIKE SY-LANGU,
G_TABIX LIKE SY-TABIX,
G_DATE LIKE SY-DATUM.
DATA : G_WERKS LIKE MARC-WERKS ,
G_VKORG LIKE MVKE-VKORG ,
G_VTWEG LIKE MVKE-VTWEG ,
G_DESC LIKE MARAV-MAKTX .
*------ALV Grid Field Catalog Fields
DATA: T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
T_FIELDCAT_H LIKE T_FIELDCAT WITH HEADER LINE.
*------End
CONSTANTS : C_MATERIAL(10) VALUE 'MATERIAL' ,
C_OBJCLASS(10) VALUE 'OBJCLASS' ,
C_OBJECTID(8) VALUE 'OBJID' ,
C_WERKS(5) VALUE 'WERKS' ,
C_VKORG(5) VALUE 'VKORG' ,
C_VTWEG(5) VALUE 'VTWEG' ,
C_DESC(4) VALUE 'DESC' ,
C_TABNAME(7) VALUE 'TABNAME' ,
C_FNAME(5) VALUE 'FNAME' ,
C_CHNGIND(7) VALUE 'CHNGIND' ,
C_UDATE(5) VALUE 'UDATE' ,
C_USERNAME(8) VALUE 'USERNAME' ,
C_VALUE_OLD(9) VALUE 'VALUE_OLD' ,
C_VALUE_NEW(9) VALUE 'VALUE_NEW' .
*CONSTANTS: C_TABNAM_FOR_ALV_FM TYPE SLIS_TABNAME VALUE 'T_FOR_DISP'.
INITIALIZATION *****************
INITIALIZATION.
CLEAR: T_CDHDR,
T_CDPOS,
T_FIELDCAT,
T_FIELDCAT_H,
T_FOR_DISP.
REFRESH:T_CDHDR,
T_CDPOS.
CLEAR : CDHDR, " Change document header
CDPOS. " Change document items
****START-OF-SELECTION.
START-OF-SELECTION.
*-FETCHING DETAILS of Changes done
PERFORM SUB_GET_DETAILS.
Get the field description.
PERFORM SUB_CALL_DDIF_FIELDINFO_GET.
****END-OF-SELECTION.
END-OF-SELECTION.
*--DISPLAYING DATA IN ALV
PERFORM SUB_DISPLAY_ALV.
*& Form SUB_GET_DETAILS
This subrouting is used to get Final output which will shown in
ALV Grid From Table CDPOS.
FORM SUB_GET_DETAILS.
SELECT OBJECTCLAS
OBJECTID
CHANGENR
UDATE
USERNAME
INTO TABLE T_CDHDR
FROM CDHDR
WHERE OBJECTCLAS IN S_OBJCLS
AND OBJECTID IN S_MATNR
AND TABNAME IN S_TABNAM
AND FNAME IN S_FNAME
AND CHNGIND IN S_CHGIND
AND UDATE IN S_DATE
AND UDATE IN S_DATE
AND USERNAME IN S_USER .
IF SY-SUBRC <> 0.
WRITE:/ TEXT-003.
ENDIF.
LOOP AT T_CDHDR.
CLEAR T_FOR_DISP.
IF T_CDHDR-OBJCLASS = C_MATERIAL.
SELECT SINGLE MAKTX
INTO G_DESC
FROM MARAV
WHERE MATNR = T_CDHDR-OBJID+0(18)
AND SPRAS = SY-LANGU.
ENDIF.
T_FOR_DISP-DESC = G_DESC.
CLEAR G_DESC.
CLEAR T_FOR_DISP.
T_FOR_DISP-OBJCLASS = T_CDHDR-OBJCLASS .
T_FOR_DISP-OBJID = T_CDHDR-OBJID .
T_FOR_DISP-UDATE = T_CDHDR-UDATE .
T_FOR_DISP-USERNAME = T_CDHDR-USERNAME .
*ENDIF.
APPEND T_FOR_DISP.
ENDLOOP.
*ENDIF.
SELECT
TABNAME
FNAME
CHANGENR
CHNGIND
TABKEY
UDATE
USERNAME
VALUE_OLD
VALUE_NEW
FROM CDPOS
INTO TABLE T_CDPOS
FOR ALL ENTRIES IN T_CDHDR
CDHDRCHANGENR = CDPOSCHANGENR
WHERE
CHANGENR EQ T_CDHDR-CHANGENR
AND TABNAME IN S_TABNAM
AND FNAME IN S_FNAME
AND CHNGIND IN S_CHGIND .
AND UDATE IN S_DATE.
AND OBJECTID IN S_DATE
AND USERNAME IN S_USER .
IF SY-SUBRC <> 0.
WRITE:/ TEXT-003.
ENDIF.
*CLEAR T_FOR_DISP.
READ TABLE T_CDPOS
WITH KEY CHANGENR = T_CDHDR-CHANGENR.
CLEAR : G_WERKS,
G_VKORG,
G_VTWEG.
G_DESC .
IF T_CDPOS-TABNAME = 'MARC'.
G_WERKS = T_CDPOS-TABKEY+21(4).
ENDIF.
CHECK G_WERKS IN S_WERKS.
IF SY-SUBRC = 0.
T_FOR_DISP-WERKS = G_WERKS.
ENDIF.
IF T_CDPOS-TABNAME = 'MVKE'.
G_VKORG = T_CDPOS-TABKEY+21(4).
ENDIF.
CHECK G_VKORG IN S_VKORG.
T_FOR_DISP-VKORG = G_VKORG.
G_VTWEG = T_CDPOS-TABKEY+25(2).
CHECK G_VTWEG IN S_VTWEG.
T_FOR_DISP-VTWEG = G_VTWEG.
T_FOR_DISP-TABNAME = T_CDPOS-TABNAME.
T_FOR_DISP-FNAME = T_CDPOS-FNAME.
T_FOR_DISP-CHNGIND = T_CDPOS-CHNGIND.
T_FOR_DISP-VALUE_OLD = T_CDPOS-VALUE_OLD.
T_FOR_DISP-VALUE_NEW = T_CDPOS-VALUE_NEW.
APPEND T_FOR_DISP.
ENDLOOP.
ENDLOOP.
CLEAR T_FOR_DISP.
ENDFORM. " SUB_GET_DETAILS
*& Form SUB_DISPLAY_ALV
This Subroutine is used to display data to ALV Grid from internal *
tables T_CDHDR & T_CDPOS. which is filled in subroutine *
SUB_GET_DETAILS *
FORM SUB_DISPLAY_ALV .
BREAK-POINT.
DATA: l_layout type slis_layout_alv,
l_title type lvc_title,
l_repid like sy-repid.
l_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = l_repid
I_INTERNAL_TABNAME = 'TY_FOR_DISP'
I_INCLNAME = l_repid
CHANGING
CT_FIELDCAT = T_FIELDCAT[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
WRITE:/ 'ERROR IN CALLING ALV FM'.
ENDIF.
*----Change Field Heading We move All field data from T_FIELDCAT To
*----another Internal table with header line namely T_FIELDCAT_H
*CLEAR T_FIELDCAT_H[].
REFRESH T_FIELDCAT_H[].
BREAK-POINT.
MOVE T_FIELDCAT[] TO T_FIELDCAT_H[].
CLEAR G_TABIX.
LOOP AT T_FIELDCAT_H.
G_TABIX = SY-TABIX.
CASE T_FIELDCAT_H-FIELDNAME.
WHEN C_OBJCLASS.
T_FIELDCAT_H-SELTEXT_L = TEXT-004.
T_FIELDCAT_H-SELTEXT_M = TEXT-004.
T_FIELDCAT_H-SELTEXT_S = TEXT-004.
T_FIELDCAT_H-OUTPUTLEN = 15.
WHEN C_OBJECTID.
T_FIELDCAT_H-SELTEXT_L = TEXT-005.
T_FIELDCAT_H-SELTEXT_M = TEXT-005.
T_FIELDCAT_H-SELTEXT_S = TEXT-005.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_DESC.
T_FIELDCAT_H-SELTEXT_L = TEXT-006.
T_FIELDCAT_H-SELTEXT_M = TEXT-006.
T_FIELDCAT_H-SELTEXT_S = TEXT-006.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_WERKS.
T_FIELDCAT_H-SELTEXT_L = TEXT-007.
T_FIELDCAT_H-SELTEXT_M = TEXT-007.
T_FIELDCAT_H-SELTEXT_S = TEXT-007.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_VKORG.
T_FIELDCAT_H-SELTEXT_L = TEXT-008.
T_FIELDCAT_H-SELTEXT_M = TEXT-008.
T_FIELDCAT_H-SELTEXT_S = TEXT-008.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_VTWEG.
T_FIELDCAT_H-SELTEXT_L = TEXT-009.
T_FIELDCAT_H-SELTEXT_M = TEXT-009.
T_FIELDCAT_H-SELTEXT_S = TEXT-009.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_TABNAME.
T_FIELDCAT_H-SELTEXT_L = TEXT-010.
T_FIELDCAT_H-SELTEXT_M = TEXT-010.
T_FIELDCAT_H-SELTEXT_S = TEXT-010.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_FNAME.
T_FIELDCAT_H-SELTEXT_L = TEXT-011.
T_FIELDCAT_H-SELTEXT_M = TEXT-011.
T_FIELDCAT_H-SELTEXT_S = TEXT-011.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_CHNGIND.
T_FIELDCAT_H-SELTEXT_L = TEXT-012.
T_FIELDCAT_H-SELTEXT_M = TEXT-012.
T_FIELDCAT_H-SELTEXT_S = TEXT-012.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_UDATE.
T_FIELDCAT_H-SELTEXT_L = TEXT-013.
T_FIELDCAT_H-SELTEXT_M = TEXT-013.
T_FIELDCAT_H-SELTEXT_S = TEXT-013.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_USERNAME.
T_FIELDCAT_H-SELTEXT_L = TEXT-014.
T_FIELDCAT_H-SELTEXT_M = TEXT-014.
T_FIELDCAT_H-SELTEXT_S = TEXT-014.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_VALUE_OLD.
T_FIELDCAT_H-SELTEXT_L = TEXT-015.
T_FIELDCAT_H-SELTEXT_M = TEXT-015.
T_FIELDCAT_H-SELTEXT_S = TEXT-015.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_VALUE_NEW.
T_FIELDCAT_H-SELTEXT_L = TEXT-016.
T_FIELDCAT_H-SELTEXT_M = TEXT-016.
T_FIELDCAT_H-SELTEXT_S = TEXT-016.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN OTHERS.
CONTINUE.
ENDCASE.
MODIFY T_FIELDCAT_H.
CLEAR T_FIELDCAT_H.
ENDLOOP.
*BREAK-POINT.
MOVE T_FIELDCAT_H[] TO T_FIELDCAT[].
*----End
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = l_repid
i_callback_pf_status_set = 'SET_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = 'TOP_OF_PAGE'
i_grid_title = l_title
is_layout = l_layout
it_fieldcat = t_fieldcat
i_save = 'A'
tables
t_outtab = T_FOR_DISP[]
exceptions
program_error = 1
others = 2.
IF SY-SUBRC <> 0.
WRITE:/ TEXT-017.
ENDIF.
ENDFORM. " SUB_DISPLAY_ALV
*& Form TOP_OF_PAGE
This subrouting is used to show heading to ALV Grid. This
subrouting is called from subrouting 'SUB_DISPLAY_ALV', Function
'REUSE_ALV_GRID_DISPLAY' & export param 'i_callback_top_of_page'
*Form TOP_OF_PAGE.
DATA : L_HEADER TYPE SLIS_T_LISTHEADER,
L_HEADER_H TYPE SLIS_LISTHEADER.
DATA : L_FROMDAT(10) TYPE C,
L_TODATE(10) TYPE C.
*CONSTANTS : C_DOT(1) TYPE C VALUE '.',
C_L_HEADER_H_TYP(1) VALUE 'H'. "---ALV Grid Header Type
CLEAR : L_HEADER.
**--To Manage Date Format
CONCATENATE S_DATE-LOW+6(2)
C_DOT
S_DATE-LOW+4(2)
C_DOT
S_DATE-LOW+0(4)
INTO L_FROMDAT.
CONCATENATE S_DATE-HIGH+6(2)
C_DOT
S_DATE-HIGH+4(2)
C_DOT
S_DATE-HIGH+0(4)
INTO L_TODATE.
**---End
IF L_TODATE <> '00.00.0000'.
CONCATENATE 'Purchase Org:'(014)
S_VKORG-LOW
'PO changes from'(015)
L_FROMDAT
'To'(013)
L_TODATE
INTO L_HEADER_H-INFO SEPARATED BY SPACE.
ELSE.
G_DATE = SY-DATUM.
CONCATENATE 'CHANGES: '
G_DATE
INTO L_HEADER_H-INFO SEPARATED BY SPACE.
ENDIF.
Main report header
L_HEADER_H-TYP = C_L_HEADER_H_TYP.
APPEND L_HEADER_H TO L_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = L_HEADER
I_LOGO = ''.
*ENDFORM. "TOP_OF_PAGE
Plz look into this and suggest me ..thanks a lot. -
Hi All,
I want to print a report in the following manner:
DATE:
CLASS GROUP :
MATNR CLASS ADSIZE
123 c col1
124 c col2
156 c col2
DATE:
CLASS GROUP :
MATNR CLASS ADSIZE
125 a col3
128 a col4
150 a col5
How do i do it...I am planning to do it with REUSE_ALV_LIST _DISPLAY...but i dont know how to print the header..plz help<b>Note : In the below i am passing my purchase order Ebeln with internal table to the Form header so that all purchase order are passed to Header by this way you can also pass it .</b>
<b>Add Title(heading) to ALV Grid</b>
In order to insert a report heading in to the ALV grid you need to perform the following steps:
1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include 'top-of-page' FORM
2. Create 'top-of-page' FORM
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
* Title
wa_header-typ = 'H'.
wa_header-info = EKKO-ebeln.
append wa_header to t_header.
clear wa_header.
endform.
reward points if it is usefull .....
Girish -
Hi,
I want to display header of alv grid in table format with rows and columns. Please suggest on the same. Points will be rewarded.hi,
see the below code .this may help u .
*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. -
Hi Friends
I need to add header to ALV grid, pls tell me how to do it.
Thanx in advance,
Regards,
Venu.*& Report Y_TOP_PAGE *
REPORT y_top_page .
TABLES : mara.
TYPE-POOLS: slis.
DATA : w_repid LIKE sy-repid.
w_repid = sy-repid.
DATA : BEGIN OF it_mara OCCURS 0,
matnr LIKE mara-matnr,
END OF it_mara.
*layout
DATA: wa_layout TYPE SLIS_LAYOUT_ALV.
*field catalog
DATA: it_fieldcat_wrt_off TYPE slis_t_fieldcat_alv,
wa_fieldcat_wrt_off TYPE slis_fieldcat_alv.
START-OF-SELECTION.
SELECT matnr FROM mara INTO CORRESPONDING FIELDS OF TABLE it_mara.
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = w_repid
I_INTERNAL_TABNAME = 'IT_MARA'
* i_structure_name = 'IT_MARA'
* I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = w_repid
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = it_fieldcat_wrt_off[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
is_layout = wa_layout
it_fieldcat = it_fieldcat_wrt_off
TABLES
t_outtab = it_mara
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.
* Form TOP-OF-PAGE *
* ALV Report Header *
FORM top-of-page.
*ALV Header declarations
DATA: t_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader,
t_line LIKE wa_header-info,
ld_lines TYPE i,
ld_linesc(10) TYPE c.
* Title
wa_header-typ = 'H'.
wa_header-info = 'CHANDU REPORT'.
APPEND wa_header TO t_header.
CLEAR wa_header.
* Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
APPEND wa_header TO t_header.
CLEAR: wa_header.
* Total No. of Records Selected
* describe table it_ekko lines ld_lines.
* ld_linesc = ld_lines.
* concatenate 'Total No. of Records Selected: ' ld_linesc
* into t_line separated by space.
* wa_header-typ = 'A'.
* wa_header-info = t_line.
* append wa_header to t_header.
* clear: wa_header, t_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header.
* i_logo = 'Z_LOGO'.
ENDFORM. "top-of-page
Maybe you are looking for
-
How can I register/sync my iPod Nano to two separate iTunes accounts?
I have an iTunes account and so does my husband. Being they are two separate accounts, how can I sync my device to both accounts? Also being new to Apple devices, how can I move a purchased song from an iPad Mini to my Nano?
-
How do we duplicate FM books and retain cross-references?
We are using FrameMaker 10 in a Windows 7 environment. This post is related to an earlier post of mine: http://forums.adobe.com/message/4237821#4237821 Note: To resolve this issue, we are willing to completely reorganize our folder structures or our
-
Hi all, i have done the Travel Expenses workflow, in that one step is there "Reject the Travel request" i have SOFM and compose method so approver can write the own text ...and mail will go to Workflow Initator my requirement is in "Title line of
-
Launching web page without address bar
Hi everybody! Very simple : we developped a transaction using 'CALL_BROWSER' FM to launch a web BSP. I don't want users to see the parameters we send in the URL. How should I execute 'CALL_BROWSER' in order to launch a new Internet Explorer page, wit
-
Configure listener for new database
When trying to setup my database I get a warning "Configuring the dababase with dbcontrol requires a listener to be configured in the current oracle home" I run netca and there is a LISTENER there, any ideas what is going wrong? Many thanks