2006 Sep 20 7:05 PM
Need an ALV in this format:
Header 1#
Name SUBJECTS TOTAL AVG
Sub Header 2#
For Subjects Column 5 sub columns(ENG TEL MAT SOC SCI)
Like in Excel we need to merge Subject column to all five columns.
Need an ALV in this format:
Header 1#
Name SUBJECTS TOTAL AVG
Sub Header 2#
For Subjects Column 5 sub columns(ENG TEL MAT SOC SCI)
Like in Excel we need to merge Subject column to all five columns.
2006 Sep 20 7:08 PM
Hi,
Go through the sample code,
&----
*& Report Z50595_EXCEL
*&
&----
*&
*&
&----
REPORT Z50595_EXCEL.
data : begin of data_tab occurs 0,
var1 type string,
end of data_tab.
DATA : ITAB TYPE MARA OCCURS 0 WITH HEADER LINE.
SELECT * INTO ITAB
FROM MARA
UP TO 10 ROWS.
APPEND ITAB.
ENDSELECT.
DATA : BEGIN OF ITAB1 OCCURS 0,
LINE(50) TYPE C,
END OF ITAB1.
data_tab-var1 = 'SUBJECTS TOTAL AVG'.
append data_tab.
ITAB1-LINE = 'field1 description'.
APPEND ITAB1.
ITAB1-LINE = 'field2 desc'.
APPEND ITAB1.
ITAB1-LINE = 'field3 desc'.
APPEND ITAB1.
*--and so on you have to add up the records in itab1.
this function adds the header
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = BIN_FILESIZE
filename = 'c:\abc.xls'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH = FILELENGTH
TABLES
data_tab = data_tab
FIELDNAMES = FIELDNAMES
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*this function adds the column fields and records
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = BIN_FILESIZE
FILENAME = 'c:\abc.xls'
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
APPEND = 'X'
HEADER = '00AAF'
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = ITAB
FIELDNAMES = ITAB1
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Azaz Ali.
2006 Sep 20 7:25 PM
Ali,
I want to have this display in ALV, example we have two columns in first header... NAME CONTACT NO
and the next sub heading would be first column nothing.. under CONTACT NO column I require two more columns like LANDLINE NO. MOBILE NO.
EG:-
-
NAME----
CONTACT_NO
-
LANDLINE NO---MOBILE NO.
ABCED----1233459837-10192828373
DEFGH----0099009900-10191818172
2006 Sep 20 7:28 PM
Hi,
I have send the code for the same logic. Go through the code and mould it according to your requirement.
Regards,
Azaz Ali.
2006 Sep 20 7:33 PM
I want to have this <b><u>display in ALV</u></b>, example we have two columns in first header... <b>NAME CONTACT NO</b>
and the next sub heading would be first column nothing.. under <b>CONTACT NO</b> column I require two more columns like <b>LANDLINE NO. MOBILE NO.</b>
EG:-
-
NAME----
CONTACT_NO
-
LANDLINE NO---MOBILE NO.
ABCED----1233459837-10192828373
DEFGH----0099009900-10191818172
2006 Sep 20 8:50 PM
Hi,
Don't forget to reward points for helpful answers.
Regards,
Azaz.
2006 Sep 20 7:17 PM
Hi,
try this Program, you will get Header1 and header2 with columns ...
data: gt_list_top_of_page type slis_t_listheader. " Top of page text.
Initialization.
perform comment_build using gt_list_top_of_page[].
form top_of_page.
* Note to self: the gif must be loaded into transaction OAOR with
* classname 'PICTURES' AND TYPE 'OT' to work with ALV GRID Functions.
* I Loaded NOVALOGO2 into system.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
* I_LOGO = 'NOVALOGO2'
* i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = gt_list_top_of_page.
endform. " TOP_OF_PAGE
form comment_build using e04_lt_top_of_page type slis_t_listheader.
data: ls_line type slis_listheader.
clear ls_line.
ls_line-typ = 'A'.
ls_line-info = 'Special'(001).
fgrant = xgrant.
concatenate ls_line-info fgrant
'Stock Option Report to the board'(002)
into ls_line-info separated by space.
condense ls_line-info.
append ls_line to e04_lt_top_of_page.
endform. " COMMENT_BUILD
How to implement a footer in alv grid programming? What is the procedure and the code regarding to create a footer?
Use following syntex for footer print in alv:
* For End of Page
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
endform.
* For End of Report
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
skip.
write:/40 'Page:', sy-pagno .
endform.
Regards
Sudheer
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |