Two line column heading in ALV Report
Hi Experts,
My requirement is that I have to create an ALV report with columns having two lines of headings. Like a main heading called Consultants under which 5 to 10 columns of departments(Dept Num, Num of Ppl , Manager etc. ) and then Contractors(Name, Address Etc ) underwhich there would be 5 to 10 departments. Right now my report has the depts of...
How can i do that . If u would suggest by CL_SALV_TABLE then it would be great.
Thanks a lot !
Sau
i don't think you can do it using cl_gui_alv_grid or cl_salv_table.
Similar Messages
-
Two column header in ALV Report
Hi Experts,
Can I have 2 headers in ALV report kind of one header and one sub header below that.
like i have to display a report having the same information for 3 systems so in header I can have the system name and below that
usual headers.
Thanks
Yogesh Guptait is is not possible using the ALV GRID function, ALV OO.
it is possible with ALV List function. you might loose some functionalities layout etc.
check this sample..
cehck this image..
http://img100.imageshack.us/img100/3846/output6ef.th.gif
REPORT ZTEST_ALV message-id zz .
TYPE-POOLS: SLIS.
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
L_LAYOUT type slis_layout_alv,
x_events type slis_alv_event,
it_events type SLIS_T_EVENT.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
MALE type i,
female type i,
END OF ITAB.
SELECT VBELN
POSNR
FROM VBAP
UP TO 20 ROWS
INTO TABLE ITAB.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-SELTEXT_L = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 1.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-SELTEXT_L = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 2.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'MALE'.
X_FIELDCAT-SELTEXT_L = 'MALE'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 3.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'FEMALE'.
X_FIELDCAT-SELTEXT_L = 'FEMALE'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 3.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
x_events-NAME = SLIS_EV_TOP_OF_PAGE.
x_events-FORM = 'TOP_OF_PAGE'.
APPEND x_events TO iT_EVENTS.
CLEAR x_events .
L_LAYOUT-NO_COLHEAD = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
it_events = it_events
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC ne 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.
*-To display the headers for main list
FORMAT COLOR COL_HEADING.
WRITE: / SY-ULINE(103).
WRITE: / SY-VLINE,
(8) ' ' ,
SY-VLINE,
(8) ' ' ,
SY-VLINE,
(19) '***'(015) centered,
sy-vline.
WRITE: / SY-VLINE,
(8) 'VBELN'(013) ,
SY-VLINE,
(8) 'POSNR'(014) ,
SY-VLINE,
(8) 'MALE'(016) ,
sy-vline,
(8) 'FMALE'(017) ,
sy-vline.
FORMAT COLOR OFF.
ENDFORM. -
Change Column Heading in ALV Report
Hi,
I have developed a ALV Report, showing correct output.
Problem is that Column Heading is not showing correct...means it is showing as per field name. But We want to change as per our understand. i.e. One column heading is like Unrestricted Stock but we want Unrestricted Stock...(BILF is an indicator)..
We have write in the code..
FORM build_fieldcat10.
CLEAR fieldcat_ln.
ADD 1 TO col_pos.
fieldcat_ln-ref_tabname = 'MARD'.
fieldcat_ln-fieldname = 'LABST'.
fieldcat_ln-seltext_m = 'BILF Unrest.Stock'.
fieldcat_ln-key = space.
fieldcat_ln-do_sum = space.
fieldcat_ln-col_pos = col_pos.
fieldcat_ln-no_out = space.
fieldcat_ln-qfieldname = space.
fieldcat_ln-hotspot = space.
APPEND fieldcat_ln TO fieldcat.
ENDFORM. " BUILD_FIELDCAT1
But after change the selection text...not showing correct text..How can i change Column heading???
Please help me..Thanks a lot dear..
My problem resolved by using SCRTEXT_L. -
How to display multi line headings in procedural alv report
Hi experts,
How to display multi line heading in alv( procedural alv report) report.
some columns single line and some columns multi line in the same report.
ex:
solvent consumed solvent recovered
fresh | recovery recovery | spent batch no storage
I am using procedural alv .pls give me idea.Hi Ram,
Check the sample report [how to display multi line headings in procedural alv report|http://sample-code-abap.blogspot.com/2008/01/printing-multiple-line-header-and.html]
Thanks,
Duy -
Only one column header in delimited report ?
Hi!
Is there a way to put only one line of column header on delimited report?
(By default the Report builder puts the header in every record line...
as well the delimited_hdr = no command prompt property is not good, because puts out no header)
Thanks!
(I use RB 6i)Hello,
http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/cmdline/common/bld_delim_hdr.htm
DELIMITED_HDR command line keyword
DELIMITED_HDR is used to remove boilerplate text (such as the report header) when running a report with DESFORMAT=DELIMITED or DESFORMAT=DELIMITEDDATA.
This parameter exists in Reports 6i too .
Regards -
How to give no of lines per page in alv report
hi
could anybody tell me
how to give no of lines per page in alv report
i need bottom of page too
if possible plz send the code too
it ll be very helpful to me
thanx
kals.Hi,
This is possible, using some of the events in the ALV.
You could use AFTER_LINE_OUTPUT event and call you form after say, a certain line count is reached on the list output.
MOVE 'AFTER_LINE_OUTPUT' TO gw_event-name.
MOVE 'AFTER_LINE_OUTPUT' TO gw_event-form.
APPEND gw_event TO gt_events.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_events = gt_events[]
and define the form for each event as follows - this would be a dynamic call by the ALV.
*& Form after_line_output
* Form for the After Line Output Event in the internal table
* --> rs_lineinfo
FORM after_line_output USING rs_lineinfo TYPE slis_lineinfo.
IF sy-linno eq v_linno. "Defaulted value for line count
perform write_footer.
NEW-PAGE.
ENDIF.
ENDFORM. " after_line_output
For lines per page:
rs_lineinfo-tabindex would give you the index of the current line in the list, which you could use to read the t_outtab table, and reduce the line count of items displayed on the earlier page.
There are a few other events too, like BEFORE_LINE_OUTPUT and END_OF_LIST which you can use as required and print the data.
Regards,
Anil. -
Hi Experts,
I want to dispaly a P/L acount in ALV report format as given below , the items will diplay should be in Excel format as:
1.Current Month and YTD should be under in current Year Column it and again in next column Current
month and YTD should be under Last Year Column.
Current Year Last Year
ITEM No Current Month YTD Current Month YTD
Please reply me ASAP.
Thanksexample:
REPORT ZHIERSEQ_ALV.
TYPE-POOLS: slis. " ALV Global types
CONSTANTS :
c_x VALUE 'X',
c_gt_vbap TYPE slis_tabname VALUE 'GT_VBAP',
c_gt_vbak TYPE slis_tabname VALUE 'GT_VBAK'.
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(02) TYPE n DEFAULT '10' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_2 FOR FIELD p_expand. "#EC NEEDED
PARAMETERS p_expand AS CHECKBOX DEFAULT c_x.
SELECTION-SCREEN END OF LINE.
TYPES :
1st Table
BEGIN OF ty_vbak,
vbeln TYPE vbak-vbeln, " Sales document
kunnr TYPE vbak-kunnr, " Sold-to party
netwr TYPE vbak-netwr, " Net Value of the Sales Order
erdat TYPE vbak-erdat, " Creation date
waerk TYPE vbak-waerk, " SD document currency
expand TYPE xfeld,
END OF ty_vbak,
2nd Table
BEGIN OF ty_vbap,
vbeln TYPE vbap-vbeln, " Sales document
posnr TYPE vbap-posnr, " Sales document
matnr TYPE vbap-matnr, " Material number
arktx TYPE vbap-arktx, " Material description
netwr TYPE vbap-netwr, " Net Value of the Sales Order
waerk TYPE vbap-waerk, " SD document currency
END OF ty_vbap.
DATA :
1st Table
gt_vbak TYPE TABLE OF ty_vbak,
2nd Table
gt_vbap TYPE TABLE OF ty_vbap.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
v_2 = 'With ''EXPAND'' field'.
START-OF-SELECTION.
Read Sales Document: Header Data
SELECT vbeln kunnr netwr waerk erdat
FROM vbak
UP TO p_max ROWS
INTO CORRESPONDING FIELDS OF TABLE gt_vbak.
IF gt_vbak[] IS NOT INITIAL.
Read Sales Document: Item Data
SELECT vbeln posnr matnr arktx netwr waerk
FROM vbap
INTO CORRESPONDING FIELDS OF TABLE gt_vbap
FOR ALL ENTRIES IN gt_vbak
WHERE vbeln = gt_vbak-vbeln.
ENDIF.
END-OF-SELECTION.
PERFORM f_display.
Form F_DISPLAY
FORM f_display.
Macro definition
DEFINE m_fieldcat.
ls_fieldcat-tabname = &1.
ls_fieldcat-fieldname = &2.
ls_fieldcat-ref_tabname = &3.
ls_fieldcat-cfieldname = &4. " Field with currency unit
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
ls_sort-tabname = &1.
ls_sort-fieldname = &2.
ls_sort-up = c_x.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_layout TYPE slis_layout_alv,
ls_keyinfo TYPE slis_keyinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
lt_sort TYPE slis_t_sortinfo_alv," Sort table
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv." Field catalog
ls_layout-group_change_edit = c_x.
ls_layout-colwidth_optimize = c_x.
ls_layout-zebra = c_x.
ls_layout-detail_popup = c_x.
ls_layout-get_selinfos = c_x.
IF p_expand = c_x.
ls_layout-expand_fieldname = 'EXPAND'.
ENDIF.
Build field catalog and sort table
m_fieldcat c_gt_vbak 'VBELN' 'VBAK' ''.
m_fieldcat c_gt_vbak 'KUNNR' 'VBAK' ''.
m_fieldcat c_gt_vbak 'NETWR' 'VBAK' 'WAERK'.
m_fieldcat c_gt_vbak 'WAERK' 'VBAK' ''.
m_fieldcat c_gt_vbak 'ERDAT' 'VBAK' ''.
m_fieldcat c_gt_vbap 'POSNR' 'VBAP' ''.
m_fieldcat c_gt_vbap 'MATNR' 'VBAP' ''.
m_fieldcat c_gt_vbap 'ARKTX' 'VBAP' ''.
m_fieldcat c_gt_vbap 'NETWR' 'VBAP' 'WAERK'.
m_fieldcat c_gt_vbap 'WAERK' 'VBAP' ''.
m_sort c_gt_vbak 'KUNNR'.
m_sort c_gt_vbap 'NETWR'.
ls_keyinfo-header01 = 'VBELN'.
ls_keyinfo-item01 = 'VBELN'.
ls_keyinfo-item02 = 'POSNR'.
Dipslay Hierarchical list
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
i_tabname_header = c_gt_vbak
i_tabname_item = c_gt_vbap
is_keyinfo = ls_keyinfo
i_save = 'A'
TABLES
t_outtab_header = gt_vbak
t_outtab_item = gt_vbap
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.
ENDFORM. " F_LIST_DISPLAY
Form USER_COMMAND *
FORM user_command USING i_ucomm TYPE sy-ucomm
is_selfield TYPE slis_selfield. "#EC CALLED
DATA ls_vbak TYPE ty_vbak.
CASE i_ucomm.
WHEN '&IC1'. " Pick
CASE is_selfield-tabname.
WHEN c_gt_vbap.
WHEN c_gt_vbak.
READ TABLE gt_vbak INDEX is_selfield-tabindex INTO ls_vbak.
IF sy-subrc EQ 0.
Sales order number
SET PARAMETER ID 'AUN' FIELD ls_vbak-vbeln.
Display Sales Order
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDCASE.
ENDFORM. " USER_COMMAND -
Heading in ALV report is showing up blank
Hello Friends
First of all thanks to you all for giving so much of help. I appreciate it.
I would appreciate if some could please let me know, why my code is not printing the header in my ALV report. It shows up as blank. I have written the Form 'TOP-OF-PAGE'.
Thanks a lot in advance
RamThis coding will give u the solution ....
this is an interactive ALV ...
*& Report ZMR001_MATERIAL_STOCK_VALUE
REPORT zmr001_material_stock_value.
MODULE MMxxxxxxxx. *
Objective :.......................................... *
Program : Updates Tables ( ) Downloads data ( ) *
Outputs List ( ) *
Technical Spec No ............... *
Date Created 07/12/2006 *
Author Jayakumar.T.... *
Location April Business / Banglore *
LDB ..... *
External Dependencies *
Amendment History *
Who Change ID Reason *
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ *
XXXXXXXXX AADDMMYYYY Where XXXX = Developers Name................. *
AA- Developers Initial ................................ *
Includes *
*INCLUDE : *
Tables *
*TABLES : *
TABLES : mchb , mara , mbew , tvkos , t001w.
Types Begin with TY_ *
*TYPES : *
TYPES : BEGIN OF ty_mchb,
matnr LIKE mchb-matnr,
charg LIKE mchb-charg,
clabs LIKE mchb-clabs,
werks LIKE mchb-werks,
spart LIKE mara-spart,
maktx LIKE makt-maktx,
value LIKE mchb-clabs,
total LIKE mchb-clabs,
END OF ty_mchb.
TYPE-POOLS: slis.
CONSTANTS:
c_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
DATA gt_list_top_of_page TYPE slis_t_listheader.
Constants Begin with C_ *
*CONSTANTS: *
Data Begin with W_ *
*DATA : *
Infotypes ( HR Module Specific) *
*INFOTYPES : *
Internal tables Begin with IT_ *
*DATA : *
DATA : it_mchb TYPE TABLE OF ty_mchb,
wa_mchb TYPE ty_mchb ,
it_final TYPE TABLE OF ty_mchb,
wa_final TYPE ty_mchb,
it_temp TYPE TABLE OF ty_mchb,
wa_temp TYPE ty_mchb,
it_temp1 TYPE TABLE OF ty_mchb,
wa_temp1 TYPE ty_mchb
DATA: it_listheader TYPE slis_t_listheader.
Field Symbols Begin with FS_ *
*FIELD-SYMBOLS: *
Insert *
*INSERT : *
Select Options Begin with SO_ *
*SELECT-OPTIONS : *
Parameters Begin with PR_ *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001 .
PARAMETERS : pr_vkorg LIKE tvko-vkorg OBLIGATORY .
SELECT-OPTIONS : so_werks FOR mchb-werks.
SELECT-OPTIONS : so_spart FOR mara-spart.
SELECTION-SCREEN END OF BLOCK b1.
Initialisation *
*INITIALISATION :
DATA: wa_variant LIKE disvariant , "Variant
wa_fieldcat TYPE slis_fieldcat_alv ,
it_fieldcat TYPE slis_t_fieldcat_alv ,
it_fieldcat1 TYPE slis_t_fieldcat_alv ,
wa_layout TYPE slis_layout_alv ,
wa_print TYPE slis_print_alv ,
it_sort TYPE slis_t_sortinfo_alv ,
it_sp_group TYPE slis_t_sp_group_alv ,
it_events TYPE slis_t_event ,
it_list_top_of_page TYPE slis_t_listheader,
w_title1 TYPE lvc_title,
w_datum LIKE sy-datum.
DATA slis_ev_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
DATA w_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'. " for top of page
DATA it_event TYPE slis_t_event.
INITIALIZATION.
PERFORM eventtab_build USING it_event[].
*set pf-status '002'.
At selection-screen *
AT SELECTION-SCREEN.
SELECT SINGLE * FROM tvkos WHERE vkorg = pr_vkorg AND spart IN so_spart.
IF sy-subrc NE 0 .
MESSAGE text-008 TYPE 'E'.
ENDIF.
SELECT SINGLE * FROM t001w WHERE vkorg = pr_vkorg AND werks IN so_werks.
IF sy-subrc NE 0 .
MESSAGE text-009 TYPE 'E'.
ENDIF.
S T A R T O F S E L E C T I O N *
START-OF-SELECTION.
SELECT mc~matnr charg clabs werks spart maktx
INTO CORRESPONDING
FIELDS OF TABLE it_mchb FROM mchb AS mc
INNER JOIN mara AS ma
ON mamatnr = mcmatnr
INNER JOIN makt AS mt
ON mamatnr = mtmatnr
WHERE werks IN so_werks AND
spart IN so_spart
AND spras = 'EN'
it_temp[] = it_mchb[].
SORT it_temp BY matnr.
DELETE ADJACENT DUPLICATES FROM it_temp COMPARING matnr.
LOOP AT it_temp INTO wa_temp.
it_temp1[] = it_mchb[].
DELETE it_temp1 WHERE matnr NE wa_temp-matnr.
LOOP AT it_temp1 INTO wa_temp1.
SUM.
EXIT.
ENDLOOP.
wa_final-matnr = wa_temp1-matnr.
wa_final-charg = wa_temp1-charg.
wa_final-maktx = wa_temp1-maktx.
wa_final-clabs = wa_temp1-clabs.
wa_final-werks = wa_temp1-werks.
wa_final-spart = wa_temp1-spart.
APPEND wa_final TO it_final.
ENDLOOP.
SORT it_mchb BY matnr.
LOOP AT it_mchb INTO wa_mchb.
ON CHANGE OF wa_mchb-matnr.
IF wa_final-matnr IS NOT INITIAL.
SELECT SINGLE * FROM mbew WHERE matnr = wa_final-matnr
AND bwkey = wa_final-werks.
IF mbew-vprsv = 'V'.
wa_final-value = mbew-verpr.
ELSEIF mbew-vprsv = 'S'.
wa_final-value = mbew-stprs.
ENDIF.
wa_final-total = wa_final-value * wa_final-clabs.
APPEND wa_final TO it_final.
CLEAR wa_final.
ENDIF.
ENDON.
wa_final-clabs = wa_mchb-clabs + wa_final-clabs .
wa_final-matnr = wa_mchb-matnr.
wa_final-werks = wa_mchb-werks.
wa_final-charg = wa_mchb-charg.
wa_final-maktx = wa_mchb-maktx.
ENDLOOP.
IF it_final IS INITIAL.
MESSAGE text-010 TYPE 'I'.
ELSE.
PERFORM fieldcat.
PERFORM display_data.
ENDIF.
LOOP AT it_mchb INTO wa_mchb.
WRITE : / , wa_mchb-matnr , wa_mchb-charg , wa_mchb-maktx , wa_mchb-clabs , wa_mchb-werks , wa_mchb-spart .
ENDLOOP.
WRITE : / , 'Jaya'.
LOOP AT it_final INTO wa_final.
WRITE : / , wa_final-matnr , wa_final-charg , wa_final-maktx , wa_final-clabs , wa_final-werks , wa_final-spart .
ENDLOOP.
*GET XX.
*END-OF-SELECTION.
E N D O F S E L E C T I O N *
At line selection *
*AT LINE-SELECTION.
User Command Processing *
*AT USER-COMMAND.
Top Of Page *
*TOP-OF-PAGE.
End Of Page *
*END-OF-PAGE.
FORM eventtab_build USING rt_events TYPE slis_t_event.
*"Registration of events to happen during list display
DATA: ls_event TYPE slis_alv_event.
to get the events
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = rt_events.
READ TABLE rt_events INTO ls_event WITH KEY name = slis_ev_top_of_page
IF sy-subrc = 0.
ls_event-form = slis_ev_top_of_page.
MODIFY rt_events FROM ls_event TRANSPORTING form WHERE
name = ls_event-form.
ENDIF.
READ TABLE rt_events INTO ls_event WITH KEY name = 'USER_COMMAND'.
IF sy-subrc EQ 0.
ls_event-form = 'USER_COMMAND'.
MODIFY rt_events FROM ls_event TRANSPORTING form WHERE name = ls_event-name.
ENDIF.
ENDFORM. "eventtab_build
*& Form fieldcat
FORM fieldcat .
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-seltext_m = text-002 .
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MAKTX'.
wa_fieldcat-seltext_m = text-003 .
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'CLABS'.
wa_fieldcat-seltext_m = text-004 .
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'VALUE'.
wa_fieldcat-seltext_m = text-006 .
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'TOTAL'.
wa_fieldcat-seltext_m = text-007 .
APPEND wa_fieldcat TO it_fieldcat.
ENDFORM. "fieldcat
*& Form display_data
FORM display_data .
PERFORM comment_build USING gt_list_top_of_page[].
wa_layout-info_fieldname = 'LINE_COLOR'. " Line Color
wa_print-no_coverpage = 'X'.
wa_print-no_print_listinfos = 'X'. " Remove the default first page.
to get thr grid display
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_background_id = 'ALV_BACKGROUND'
i_callback_top_of_page = 'TOP_OF_PAGE'
i_callback_user_command = 'USER_COMMAND'
is_layout = wa_layout
it_fieldcat = it_fieldcat
i_default = 'X'
i_save = 'A'
it_events = it_event[]
is_print = wa_print
TABLES
t_outtab = it_final
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.
ENDFORM. " eventtab_build
*& Form comment_build
FORM comment_build USING lt_top_of_page TYPE slis_t_listheader.
DATA: ls_line TYPE slis_listheader.
CLEAR ls_line.
ls_line-typ = 'H'.
to get the company text
DATA w_name(50) TYPE c.
ls_line-info = text-005 .
APPEND ls_line TO lt_top_of_page.
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-info = ''.
APPEND ls_line TO lt_top_of_page.
ENDFORM. "comment_build
*& Form top_of_page
to print at top of page
FORM top_of_page.
to pass the comment bulid for the top of page into the alv
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_list_top_of_page.
ENDFORM. "top_of_page
*& Form USER_COMMAND
text
-->R_UCOMM text
-->RS_SELFIELDtext
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
MESSAGE 'jj' TYPE 'I'.
READ TABLE it_final INTO wa_final INDEX rs_selfield-tabindex.
PERFORM build_fieldcatlog.
PERFORM event_call USING it_event[].
PERFORM POPULATE_EVENT_EKPO.
PERFORM data_retrieval.
PERFORM build_listheader USING it_listheader.
PERFORM DISPLAY_ALV.
ENDCASE.
ENDFORM. "user_command
*& Form BUILD_FIELDCATLOG
text
FORM build_fieldcatlog.
clear it_fieldcat1[].
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-seltext_m = text-002 .
APPEND wa_fieldcat TO it_fieldcat1.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MAKTX'.
wa_fieldcat-seltext_m = text-003 .
APPEND wa_fieldcat TO it_fieldcat1.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'CHARG'.
wa_fieldcat-seltext_m = text-003 .
APPEND wa_fieldcat TO it_fieldcat1.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'CLABS'.
wa_fieldcat-seltext_m = text-004 .
APPEND wa_fieldcat TO it_fieldcat1.
ENDFORM. "BUILD_FIELDCATLOG
*& Form EVENT_CALL
text
-->RT_EVENTS text
FORM event_call USING rt_events TYPE slis_t_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = rt_events
EXCEPTIONS
LIST_TYPE_WRONG = 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.
ENDFORM. "event_call
*& Form DATA_RETRIEVAL
text
FORM data_retrieval.
it_temp[] = it_mchb[].
DELETE it_temp WHERE matnr NE wa_final-matnr.
ENDFORM. "DATA_RETRIEVAL
*& Form BUILD_LISTHEADER
text
-->I_LISTHEADEtext
FORM build_listheader USING i_listheader TYPE slis_t_listheader.
DATA: hline1 TYPE slis_listheader.
hline1-typ = 'H'.
hline1-info = 'CHECKING PGM'.
ENDFORM. "BUILD_LISTHEADER
FORM DISPLAY_ALV.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = TITLE_EKPO
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = It_FIELDCAT1[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT =
I_SAVE = 'A'
IS_VARIANT =
IT_EVENTS = it_EVENTS[]
TABLES
T_OUTTAB = IT_temp[]
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.
ENDFORM. -
How to Change Column header in ALV List
hello,
is there a way to change the column header/label of an ALV list other than inheriting it from the source table it is bound to?
thanks,
sidYes, you can. If you are using a field catalog, you can change the field labels in your program.
For example.
data: fc_tmp type slis_fieldcat_alv .
clear: fieldcat. refresh: fieldcat.
clear: fc_tmp.
<b> fc_tmp-reptext_ddic = 'Material Number'.</b>
fc_tmp-fieldname = 'MATNR'.
fc_tmp-tabname = 'IMARA'.
fc_tmp-outputlen = '18'.
fc_tmp-col_pos = 2.
append fc_tmp to fieldcat.
If you are using the MERGE funciton module to get your field catalog, then you just need to loop thru it and change the field which is holding the description, then modify the line of the field catalog.
REgards,
Rich Heilman -
Hi ,
I have report and i want to display the column heading for both the key and text column in the report.At present i could see column Heading only for the key column.Kindly advice
thanx
SriramHI Sriram
Why you want to display the heading? Do You mean, two different headings? -
Change Column Headings in ALV Report Using OO
Hi Friends,
I am using OO to display a report with ALV Grid
I tried to change the column names but it still takes the column names from the DDIC.
My declaration is as follows
Data: num type dmbtr.
TRY.
lr_column ?= lr_columns->get_column( columnname = 'NUM' ).
lr_column->set_output_length('7').
lr_column->set_long_text( ' Value' ).
lr_column->set_short_text( ''() ).
lr_column->set_medium_text( 'Value' ).
CATCH cx_salv_not_found INTO gr_error.
gr_msg = gr_error->get_text( ).
MESSAGE gr_msg TYPE 'I'.
ENDTRY.
*--- display report
gr_table->display( ).
CATCH cx_salv_msg.
WRITE: 'Error displaying grid! - cx_salv_msg'(044).
CATCH cx_salv_not_found.
WRITE: 'Error displaying grid! - cx_salv_not_found'(004).
CATCH cx_salv_data_error.
WRITE: 'Error displaying grid! - cx_salv_data_error'(005).
CATCH cx_salv_existing.
WRITE: 'Error displaying grid! - cx_salv_existing'(006).
I need the column name as VALUE but it displays as Amount LC in the alv report.
Thanks
chaithanyaHey hello,
you have to change short medium and log text
look at this:
gr_columns = (Table got from factory)->get_columns( ).
gr_column = gr_columns->get_column('NAme').
gr_column->set_long_text('new name long').
gr_column->set_medium_text('new name medium').
gr_column->set_short_text('new name short ).
it will help
thanks
Edited by: Alfito on Nov 28, 2011 9:31 AM -
Change column headers in ALV report
Hi experts,
I have created a new simple ALV report (it uses only internal tables, no structures). I would like to change the names of column headers in the ALV report. Is this possible? How can I do it?
Thanks in advanced.Thanks for your reply,
I am trying to use the code mentioned in the link but I think that something
is missing, probably a CASE statement before WHEN in the LOOP.
Can you help me? What do I have to put before WHEN statement?
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = <program name>
i_structure_name = <DDIC structure>
i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = gi_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3. "#EC *
LOOP AT gi_fieldcat INTO wa_fieldcat.
WHEN 'XXXX'.
wa_fieldcat-seltext_s = 'Fac'.
wa_fieldcat-seltext_m = 'Factory'.
wa_fieldcat-seltext_l = 'Factory'.
wa_fieldcat-reptext_ddic = 'Factory'.
MODIFY gi_fieldcat FROM wa_fieldcat.
ENDLOOP. -
How to extract the column width in ALv report if its executed in background
I am executing an ALV report in background , in front end i am getting data properly, in back end for some columns some of the digits are missing.For example if PO no is of 10 digits it will display only 8 becos column size is like that , how to extract coulmns in back ground.
I have executed in background and checked the spool and for some of the columns width is not sufficient to display comeplete data so please suggest how to extract the columns sizes if executed inj background for an ALVHi Deepthi,
you can try with the above mentioned suggestions ,if its worked its fine ,
If not use Docking container instead of custom container, For ALV in back ground jobs, its suggest to use docking container instead of custom container , below you can find the declaration for docking container and code to use docking and custom container in your program for fore and back ground.
or you can use docking container alone for both operations.
Data : G_DOCK1 TYPE REF TO CL_GUI_DOCKING_CONTAINER,
IF CCON IS INITIAL. (ccon is container name )
*Check whether the program is run in batch or foreground
IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL.
*Run in foreground
CREATE OBJECT CCON
EXPORTING
CONTAINER_NAME = 'CON1'.
CREATE OBJECT GRID1
EXPORTING
I_PARENT = parent_1.
ELSE.
*Run in background
CREATE OBJECT GRID1
EXPORTING
I_PARENT = G_DOCK1.
ENDIF.
ENDIF.
B&R,
Saravana.S -
Multiple level headers in column of an ALV report
Hi All,
I have a requirement . I need to display a two level coloumn in alv grid display .
Example :
| Cust no | Address |
| |------------------|
| | city | code |
Kindly please help how can i achieve this in alv report .
Regards.
Moderator message: not available, flat structures only, see online documentation of class or function module.
Edited by: Thomas Zloch on May 24, 2011 4:47 PMHi Ricky,
Kindly go through the link below:
http://help.sap.com/saphelp_erp2004/helpdata/EN/85/ce25c2d7ae11d3b56d006094192fe3/content.htm
Hope it helps you
Regrds
Mansi -
Hyperlink Field in column of 2D ALV Report
Hi,
I have to display a ALV Report in which one of column reprsent a field which have hyperlink.
How to acheive this?Can anybody tell me approach?
-RickHi Ricky,
Kindly go through the link below:
http://help.sap.com/saphelp_erp2004/helpdata/EN/85/ce25c2d7ae11d3b56d006094192fe3/content.htm
Hope it helps you
Regrds
Mansi
Maybe you are looking for
-
Backing up and Restoring a large Aperture library
One of our departments is looking to backup their Aperture library (170 Gb and growing). They would like to do an initial backup of everything, and then incrementally from that point. We tried using Retrospect it backed up fine although it took about
-
Same issues posted here: http://answers.microsoft.com/en-us/windows/forum/windows8_1-windows_install/bsod-with-irqlnotlessorequal-when-fresh-install-of/790c6c20-40b3-483a-9cea-25916cbd9c13 http://answers.microsoft.com/en-us/windows/forum/windows8_1-h
-
Background Images Do Not Display
Hi -- On this page: http://www.thelegatogroup.com/test/ I have the DIVs #left and #right and each has a background image. My problem is that neither display either in preview or when live. I can, however, see the images in DW's design view. The DIV #
-
Charged for canceling service in first 30 days
Hi, all. In short: I cancelled my Comcast service within the first thirty days of a new plan. I was told that I wouldn't owe anything if I cancelled within that time, not even termination fees. However, Comcast is charging me over $40 for that mont
-
Error in TS01 - Country for issuer (12539) of securities cannot be determ
Hi expert, I m creating a deal trnsaction using t.code- TS01, here i m gettting an error "Country for issuer (12539) of securities 3000037 cannot be determined". Diagnosis The issuer#s registered office is required in order to determine the t