How to display values in top of page in ALV report
Hai,
This is my billing report program, i developed that object by using ALV but i could not able to use Top-of-page. please any one correct my code,
*& Report ZE0232_ALV_BILLING *
report ze0232_alv_billing.
type-pools: slis.
data: repid like sy-repid.
data: fieldcatalog type slis_t_fieldcat_alv,
wa_fieldcatalog type slis_fieldcat_alv.
data : ievent type slis_t_event,
wevent type slis_alv_event.
data: sal_text like tvkot-vtext,
DIS_TEXT LIKE TVTWT-VTEXT,
DIV_TEXT LIKE TSPAT-VTEXT.
tables: vbrk.
data: begin of i_vbrk occurs 0,
vbeln like vbrk-vbeln,
fkdat like vbrk-fkdat,
erdat like vbrk-erdat,
kunrg like vbrk-kunrg,
name1 like kna1-name1,
netwr like vbrk-netwr,
stext like tvkot-vtext,
dtext like tvtwt-vtext,
divtext like tspat-vtext,
end of i_vbrk.
selection-screen begin of block billing with frame.
parameters: salesorg like vbrk-vkorg.
select-options: dischanl for vbrk-vtweg,
division for vbrk-spart,
bildat for vbrk-fkdat.
selection-screen end of block billing.
select vbeln fkdat erdat kunrg netwr from vbrk into corresponding fields of table i_vbrk where vkorg = salesorg
and vtweg in dischanl
and spart in division
and fkdat in bildat.
select vtext from tvkot into sal_text where vkorg = salesorg and spras = 'EN'.
endselect.
select vtext from TVTWT into DIS_text where VTWEG IN dischanl and spras = 'EN'.
endselect.
select vtext from TSPAT into DIV_text where SPART IN DIVISION and spras = 'EN'.
endselect.
loop at i_vbrk.
move: sal_text to i_vbrk-stext,
DIS_TEXT TO I_VBRK-DTEXT,
DIV_TEXT TO I_VBRK-DIVTEXT.
modify i_vbrk.
endloop.
perform get_fieldcatalog.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = repid
I_GRID_TITLE =
i_callback_top_of_page = 'TOPS'
it_fieldcat = fieldcatalog
tables
t_outtab = i_vbrk
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 GET_FIELDCATALOG
text
<b>form tops.
write :/ 'Hai Welcome'.
endform. "tops</b>&----
*& Form get_fieldcatalog
text
form get_fieldcatalog.
wa_fieldcatalog-col_pos = '1'.
wa_fieldcatalog-fieldname = 'VBELN'.
wa_fieldcatalog-tabname = 'I_VBAK'.
wa_fieldcatalog-seltext_m = 'SALES DOCUMENT'.
WA_fieldcatalog-rollname = 'VBELN'.
wa_fieldcatalog-hotspot = 'X'.
append wa_fieldcatalog to fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-col_pos = '2'.
wa_fieldcatalog-fieldname = 'FKDAT'.
wa_fieldcatalog-tabname = 'I_VBAK'.
wa_fieldcatalog-seltext_m = 'BILL DATE'.
WA_fieldcatalog-rollname = 'VBELN'.
WA_fieldcatalog-hotspot = 'X'.
append wa_fieldcatalog to fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-col_pos = '3'.
wa_fieldcatalog-fieldname = 'ERDAT'.
wa_fieldcatalog-tabname = 'I_VBAK'.
wa_fieldcatalog-seltext_m = 'CREATED DATE'.
append wa_fieldcatalog to fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-col_pos = '4'.
wa_fieldcatalog-fieldname = 'KUNRG'.
wa_fieldcatalog-tabname = 'I_VBAK'.
wa_fieldcatalog-seltext_m = 'CUSTOMER NO'.
append wa_fieldcatalog to fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-col_pos = '5'.
wa_fieldcatalog-fieldname = 'NAME1'.
wa_fieldcatalog-tabname = 'I_VBAK'.
wa_fieldcatalog-seltext_m = 'CUSTOMER NAME'.
append wa_fieldcatalog to fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-col_pos = '6'.
wa_fieldcatalog-fieldname = 'NETWR'.
wa_fieldcatalog-tabname = 'I_VBAK'.
wa_fieldcatalog-seltext_m = 'NET VALUE'.
append wa_fieldcatalog to fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-col_pos = '7'.
wa_fieldcatalog-fieldname = 'STEXT'.
wa_fieldcatalog-tabname = 'I_VBAK'.
wa_fieldcatalog-seltext_m = 'SALES ORG'.
append wa_fieldcatalog to fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-col_pos = '8'.
wa_fieldcatalog-fieldname = 'DTEXT'.
wa_fieldcatalog-tabname = 'I_VBAK'.
wa_fieldcatalog-seltext_m = 'DIS.CHANNEL'.
append wa_fieldcatalog to fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-col_pos = '9'.
wa_fieldcatalog-fieldname = 'DIVTEXT'.
wa_fieldcatalog-tabname = 'I_VBAK'.
wa_fieldcatalog-seltext_m = 'DIVISION'.
append wa_fieldcatalog to fieldcatalog.
clear wa_fieldcatalog.
endform. "GET_FIELDCATALOG
HI see this report
you can know how to write TOP-OF_PAGE code
and insert LOGO also
*& Report ZTEST_ALV_LOGO
REPORT ztest_alv_logo.
TYPE-POOLS : slis.
*ALV Formatting tables /structures
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: gt_events TYPE slis_t_event.
DATA: gs_layout TYPE slis_layout_alv.
DATA: gt_page TYPE slis_t_listheader.
DATA: gs_page TYPE slis_listheader.
DATA: v_repid LIKE sy-repid.
*ALV Formatting work area
DATA: w_fieldcat TYPE slis_fieldcat_alv.
DATA: w_events TYPE slis_alv_event.
DATA: gt_bsid TYPE TABLE OF bsid WITH HEADER LINE.
INITIALIZATION.
PERFORM build_events.
PERFORM build_page_header.
START-OF-SELECTION.
*perform build_comment. "top_of_page - in initialization at present
SELECT * FROM bsid INTO TABLE gt_bsid UP TO 10 ROWS.
*perform populate_for_fm using '1' '3' 'BUKRS' '8' 'GT_BSID' 'Whee'.
*USING = Row, Column, Field name, display length, table name, heading
*OR
PERFORM build_fieldcat.
gs_layout-zebra = 'X'.
*top of page event does not work without I_callback_program
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_structure_name = 'BSID'
i_background_id = 'ALV_BACKGROUND'
i_grid_title = 'This is the grid title'
I_GRID_SETTINGS =
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
it_events = gt_events[]
TABLES
t_outtab = gt_bsid.
Form..............: populate_for_fm
Description.......: Populates fields for function module used in ALV
FORM populate_for_fm USING p_row
p_col
p_fieldname
p_len
p_table
p_desc.
w_fieldcat-row_pos = p_row. "Row Position
w_fieldcat-col_pos = p_col. "Column Position
w_fieldcat-fieldname = p_fieldname. "Field name
w_fieldcat-outputlen = p_len. "Column Lenth
w_fieldcat-tabname = p_table. "Table name
w_fieldcat-reptext_ddic = p_desc. "Field Description
w_fieldcat-input = '1'.
APPEND w_fieldcat TO gt_fieldcat.
CLEAR w_fieldcat.
ENDFORM. " populate_for_fm
*& Form build_events
FORM build_events.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = gt_events.
READ TABLE gt_events
WITH KEY name = slis_ev_user_command
INTO ls_event.
IF sy-subrc = 0.
MOVE slis_ev_user_command TO ls_event-form.
APPEND ls_event TO gt_events.
ENDIF.
READ TABLE gt_events
WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE slis_ev_top_of_page TO ls_event-form.
APPEND ls_event TO gt_events.
ENDIF.
ENDFORM. " build_events
*& Form USER_COMMAND
When user command is called it uses 2 parameters. The itab
passed to the ALV is in whatever order it currently is on screen.
Therefore, you can read table itab index rs_selfield-tabindex to get
all data from the table. You can also check r_ucomm and code
accordingly.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
READ TABLE gt_bsid INDEX rs_selfield-tabindex.
error checking etc.
SET PARAMETER ID 'KUN' FIELD gt_bsid-kunnr.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
ENDFORM. "user_command
*& Form top_of_page
Your own company logo can go here if it has been saved (OAOR)
If the logo is larger than the size of the headings in gt_page,
the window will not show full logo and will have a scroll bar. Thus,
it is a good idea to have a standard ALV header if you are going to
use logos in your top of page.
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_page
i_logo = 'ENJOYSAP_LOGO'.
ENDFORM. "top_of_page
*& Form build_fieldcat
*Many and varied fields are available here. Have a look at documentation
*for FM REUSE_ALV_LIST_DISPLAY and REUSE_ALV_FIELDCATALOG_MERGE
FORM build_fieldcat.
w_fieldcat-fieldname = 'BUDAT'.
w_fieldcat-seltext_m = 'Dte pst'.
w_fieldcat-ddictxt(1) = 'M'.
w_fieldcat-edit = 'x'.
Can change the position of fields if you do not want them in order
of the DDIC or itab
w_fieldcat-row_pos = '1'.
w_fieldcat-col_pos = '10'.
APPEND w_fieldcat TO gt_fieldcat.
CLEAR w_fieldcat.
ENDFORM. " build_fieldcat
*& Form build_page_header
gt_page is used in top of page (ALV subroutine - NOT event)
*H = Header, S = Selection, A = Action
FORM build_page_header.
For Headers, Key is not printed and is irrelevant. Will not cause
a syntax error, but is not used.
gs_page-typ = 'H'.
gs_page-info = 'Header 1'.
APPEND gs_page TO gt_page.
gs_page-typ = 'H'.
gs_page-info = 'Header 2'.
APPEND gs_page TO gt_page.
For Selections, the Key is printed (bold). It can be anything up to 20
bytes. It gets printed in order of code here, not by key value.
gs_page-typ = 'S'.
gs_page-key = 'And the winner is:'.
gs_page-info = 'Selection 1'.
APPEND gs_page TO gt_page.
gs_page-typ = 'S'.
gs_page-key = 'Runner up:'.
gs_page-info = 'Selection 2'.
APPEND gs_page TO gt_page.
For Action, Key is also irrelevant.
gs_page-typ = 'A'.
gs_page-info = 'Action goes here'.
APPEND gs_page TO gt_page.
ENDFORM. " build_page_header
<b>Reward if useful</b>
Similar Messages
-
How to declare top of page in alv report
hi guru
how to declare top of page in alv report
thanks
subhasisHi,
check this simple program.
REPORT ZBHALV_LIST.
TABLES:MARA.
SELECT-OPTIONS: MATNR FOR MARA-MATNR.
DATA:BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
ERSDA LIKE MARA-ERSDA,
MTART LIKE MARA-MTART,
MBRSH LIKE MARA-MBRSH,
END OF ITAB.
SELECT * FROM MARA INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE MATNR
IN MATNR.
TYPE-POOLS SLIS.
DATA:FCAT TYPE slis_t_fieldcat_alv.
DATA:LAYOUT TYPE slis_layout_alv.
DATA:EVE TYPE slis_t_event WITH HEADER LINE.
DATA:HEAD TYPE slis_t_listheader WITH HEADER LINE.
DATA:SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE.
SORT-UP = 'X'.
SORT-SPOS = 1.
SORT-FIELDNAME = 'ERSDA'.
SORT-tabname = 'MARA'.
APPEND SORT.
SORT-SPOS = 2.
SORT-FIELDNAME = 'MTART'.
SORT-tabname = 'MARA'.
APPEND SORT.
EVE-NAME = 'TOP_OF_PAGE'.
EVE-FORM = 'TOPOFPAGE'.
APPEND EVE.
EVE-NAME = 'TOP_OF_LIST'.
EVE-FORM = 'TOPOFLIST'.
APPEND EVE.
EVE-NAME = 'END_OF_LIST'.
EVE-FORM = 'ENDOFLIST'.
APPEND EVE.
LAYOUT-ZEBRA = 'X'.
LAYOUT-no_hline = 'X'.
LAYOUT-NO_VLINE = 'X'.
LAYOUT-window_titlebar = 'MATERIAL DETAILS'.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'ITAB'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = SY-REPID
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = FCAT
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_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FCAT
IT_SORT = SORT[]
IT_EVENTS = EVE[]
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.
FORM TOPOFPAGE.
REFRESH HEAD.
HEAD-TYP = 'H'.
HEAD-INFO = 'MATERIALS'.
APPEND HEAD.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = HEAD[]
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM.
FORM TOPOFLIST.
REFRESH HEAD.
HEAD-TYP = 'H'.
HEAD-INFO = 'MATERIALS-LISTTOP'.
APPEND HEAD.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = HEAD[]
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM.
FORM ENDOFLIST.
REFRESH HEAD.
HEAD-TYP = 'H'.
HEAD-INFO = 'MATERIALS-LISTEND'.
APPEND HEAD.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = HEAD[]
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM.
Regards,
Priyanka. -
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. -
How to provide top of page in ALV reports
Hi....
here is requirement.
i entered some 1000 to 2000 in the selection screen.
now i want to display the same in output list.
that is the <b></b>output from 1000 to 2000 are displayed with 1000 records<b></b>
like this i want to display in top of list in alv report.
how to do this requirement.
thanks and regards,
k.swaminath reddy.hi,
check this one
*& Report ZALV_FIELD_GRID1
REPORT ZALV_FIELD_GRID1
NO STANDARD PAGE HEADING.
TABLES MARA.
type-pools :slis.
TYPES : BEGIN OF TMARA ,
MATNR LIKE MARA-MATNR,
MEINS LIKE MARA-MEINS,
ERSDA LIKE MARA-ERSDA,
color(4) type c,
SEL type c,
LIGHT TYPE C,
END OF TMARA.
TYPES: BEGIN OF TMAKT,
MATNR LIKE MAKT-MATNR,
MAKTX LIKE MAKT-MAKTX,
MAKTG LIKE MAKT-MAKTG,
SEL TYPE C,
COLOR(4),
END OF TMAKT.
DATA: ITAB TYPE TMARA OCCURS 0 WITH HEADER LINE,
ITAB1 TYPE TMAKT OCCURS 0 WITH HEADER LINE,
wa_fieldcat type slis_fieldcat_alv,
fieldcat type slis_fieldcat_alv occurs 0,
i_layout type slis_layout_alv,
WA_LISTHEADER TYPE SLIS_LISTHEADER ,
i_LISTHEADER TYPE SLIS_LISTHEADER OCCURS 0,
V_EVENTS TYPE SLIS_T_EVENT ,
WA_EVENT TYPE SLIS_ALV_EVENT,
I_TITLE_MARA TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED',
I_TITLE_MAKT TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED',
SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE,
PRINT_CONT type slis_print_alv.
SELECTION SCREE
selection-screen begin of block screen1 with frame title TEXT-001.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT /32(35) COMM1.
SELECTION-SCREEN ULINE /27(35).
SELECTION-SCREEN SKIP.
SELECT-OPTIONS MATNR FOR MARA-MATNR.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN ULINE.
SELECTION-SCREEN COMMENT /30(50) COMM2.
SELECTION-SCREEN ULINE /27(40).
SELECTION-SCREEN SKIP.
SELECT-OPTIONS ERSDA FOR MARA-ERSDA.
SELECTION-SCREEN SKIP.
selection-screen end of block screen1.
INITIALIZATION
INITIALIZATION.
MATNR-low = '23'.
MATNR-high = '1000'.
MATNR-option = 'BT'.
MATNR-sign = 'I'.
APPEND MATNR.
ERSDA-low = '20030124'.
ERSDA-high = '20050302' .
APPEND ERSDA.
PERFORM FILLFIELD.
PERFORM FILLLAYOUT.
PERFORM build_print_params.
PERFORM FILL_SORT.
PERFORM EVENT_CALL.
PERFORM POPULATE_EVENT.
SELECTION-SCREEN OUTPUT
AT SELECTION-SCREEN OUTPUT.
comm1 ='SELECT MATERIAL NUMBER RANGE'.
comm2 ='SELECT MATERIAL CREATION DATE'.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM READDATA.
PERFORM POPDATA.
*& Form READDATA
text
FORM READDATA .
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = MATNR-LOW
IMPORTING
OUTPUT = MATNR-LOW.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = MATNR-HIGH
IMPORTING
OUTPUT = MATNR-HIGH.
SELECT MATNR
ERSDA
MEINS
FROM MARA
INTO CORRESPONDING FIELDS OF
TABLE ITAB
WHERE MATNR IN MATNR AND ERSDA IN ERSDA.
LOOP AT ITAB.
data id_color type i VALUE 1.
data id_colors(2) type c.
IF ITAB-MATNR < '000000000000000100'.
ITAB-LIGHT = '1'.
ELSEIF ITAB-MATNR < '000000000000000150' AND ITAB-MATNR >
'000000000000000100' .
ITAB-LIGHT = '2'.
ELSE.
ITAB-LIGHT = '3'.
ENDIF.
id_color = id_color + 1.
if id_color > 7.
id_color = 1.
endif.
id_colors = id_color.
concatenate 'C' id_colors '10' into itab-color.
modify itab.
CLEAR ITAB.
endloop.
ENDFORM. " READDATA
Form FILLFIELD
FORM FILLFIELD .
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-KEY = 'X'.
WA_FIELDCAT-COL_POS = '1'.
WA_FIELDCAT-outputlen = 20.
WA_FIELDCAT-HOTSPOT = 'X'.
wa_fieldcat-seltext_m = 'MATERIAL NUMBER'.
*WA_FIELDCAT-EMPHASIZE = 'C210'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
WA_FIELDCAT-FIELDNAME = 'MEINS'.
WA_FIELDCAT-COL_POS = '2'.
*WA_FIELDCAT-EMPHASIZE = 'C510'.
WA_FIELDCAT-outputlen = 10.
wa_fieldcat-seltext_m = 'UNIT'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
WA_FIELDCAT-FIELDNAME = 'ERSDA'.
WA_FIELDCAT-COL_POS = '3'.
WA_FIELDCAT-outputlen = 15.
*WA_FIELDCAT-EDIT_MASK = 'DD.MM.YYYY'.
*WA_FIELDCAT-EMPHASIZE = 'C710'.
wa_fieldcat-seltext_m = 'CREAT DATE'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
ENDFORM. "FILLFIELD
Setup print parameters
form build_print_params.
PRINT_CONT-reserve_lines = '3'. "Lines reserved for footer
PRINT_CONT-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
Form POPDATA
FORM POPDATA .
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 = 'USER-COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOPPAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = I_TITLE_MARA
I_GRID_SETTINGS =
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = V_EVENTS
IT_EVENT_EXIT =
IS_PRINT = PRINT_CONT
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
ENDFORM. " POPDATA
Form TOPPAGE
FORM TOPPAGE.
REFRESH I_LISTHEADER.
DATA: ld_lines type i,
ld_linesc(10) type c,
I_DATE(10) TYPE C,
I_INFO LIKE WA_LISTHEADER-INFO.
WA_LISTHEADER-TYP = 'H'.
WA_LISTHEADER-INFO = 'MATERIAL DETAIL'.
APPEND WA_LISTHEADER TO I_LISTHEADER.
CLEAR WA_LISTHEADER.
WA_LISTHEADER-TYP = 'S'.
WA_LISTHEADER-KEY = 'DATE :'.
CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM(4) INTO I_DATE.
WA_LISTHEADER-INFO = I_datE.
APPEND WA_LISTHEADER TO I_LISTHEADER.
CLEAR WA_LISTHEADER.
describe table ITAB lines ld_lines.
ld_linesc = ld_lines.
concatenate 'TOTAL NUMBER OF RECORD SELECTED: ' ld_linesc
into I_INFO separated by space.
WA_LISTHEADER-TYP = 'A'.
WA_LISTHEADER-INFO = I_INFO.
append WA_LISTHEADER to I_LISTHEADER.
clear: WA_LISTHEADER , I_INFO.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_LISTHEADER
I_LOGO = 'ENJOYSAP_LOGO'.
ENDFORM. "TOPPAGE
Form FILLLAYOUT
FORM FILLLAYOUT .
i_layout-zebra = 'X'.
i_layout-info_fieldname = 'COLOR'.
i_layout-box_fieldname = 'SEL'.
I_LAYOUT-lights_fieldname = 'LIGHT'.
I_LAYOUT-EDIT ='X'.
I_LAYOUT-colwidth_optimize = 'X'.
I_LAYOUT-window_titlebar = 'EXAMPLE FOR ALV GRID'.
I_LAYOUT-no_totalline = 'X'.
ENDFORM. "FILLLAYOUT
Form FILL_SORT
FORM FILL_SORT .
SORT-DOWN = 'X'.
SORT-SPOS = 1.
SORT-FIELDNAME = 'MATNR'.
SORT-tabname = 'MARA'.
APPEND SORT.
ENDFORM. " FILL_SORT
Form EVENT_CALL
FORM EVENT_CALL .
DATA: I_EVENT LIKE V_EVENTS.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS.
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 POPULATE_EVENT
FORM POPULATE_EVENT .
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'USER_COMMAND'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
READ TABLE V_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
INTO WA_EVENT.
IF SY-SUBRC = 0.
move 'END_OF_PAGE' to WA_EVENT-FORM.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
endif.
ENDIF.
ENDFORM. "POPULATE_EVENT
FORM END_OF_PAGE.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
ENDFORM.
*& Form USER_COMMAND
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
CASE RS_SELFIELD-FIELDNAME.
when 'MATNR'.
read table itab with key matnr = RS_SELFIELD-VALUE.
if sy-subrc = 0.
PERFORM DATA_RETRIEVAL_MAKT USING RS_SELFIELD-VALUE.
PERFORM BUILD_FIELDCATLOG_MAKT.
PERFORM FILLLAYOUT_MAKT.
PERFORM DISPLAY_ALV_MAKT.
CLEAR RS_SELFIELD.
ENDIF.
ENDCASE.
ENDCASE.
ENDFORM. "user_command
Form DATA_RETRIEVAL_MAKT
FORM DATA_RETRIEVAL_MAKT USING TMATNR .
SELECT MATNR
MAKTX
MAKTG
UP TO 100 ROWS
FROM MAKT
INTO TABLE ITAB1
WHERE SPRAS = 'EN' AND MATNR = TMATNR.
LOOP AT ITAB1.
data id_color type i VALUE 1.
data id_colors(2) type c.
id_color = id_color + 1.
if id_color > 7.
id_color = 1.
endif.
id_colors = id_color.
concatenate 'C' id_colors '10' into itab1-color.
modify itab1.
CLEAR ITAB1.
ENDLOOP.
ENDFORM. "DATA_RETRIEVAL_MAKT
Form FILLLAYOUT_MAKT
FORM FILLLAYOUT_MAKT .
CLEAR I_LAYOUT.
i_layout-zebra = 'X'.
i_layout-info_fieldname = 'COLOR'.
i_layout-box_fieldname = 'SEL'.
I_LAYOUT-EDIT ='X'.
I_LAYOUT-colwidth_optimize = 'X'.
I_LAYOUT-window_titlebar = 'EXAMPLE FOR ALV GRID'.
ENDFORM. " LAYOUT_MAKT
Form BUILD_FIELDCATLOG_MAKT
FORM BUILD_FIELDCATLOG_MAKT .
REFRESH FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-KEY = 'X'.
WA_FIELDCAT-COL_POS = '1'.
*WA_FIELDCAT-EDIT_MASK = 'DD.MM.YYYY'.
WA_FIELDCAT-EMPHASIZE = 'C510'.
wa_fieldcat-seltext_m = 'MATERIAL NUMBER'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
WA_FIELDCAT-FIELDNAME = 'MAKTX'.
WA_FIELDCAT-COL_POS = '2'.
WA_FIELDCAT-EMPHASIZE = 'C710'.
wa_fieldcat-seltext_m = 'MATERIAL DESCRIPTION'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
WA_FIELDCAT-FIELDNAME = 'MAKTG'.
WA_FIELDCAT-COL_POS = '3'.
WA_FIELDCAT-EMPHASIZE = 'C210'.
wa_fieldcat-seltext_m = 'MATERIAL DESCRIPTION'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
ENDFORM. " BUILD_FIELDCATLOG_MAKT
Form DISPLAY_ALV_MAKT
FORM TOP-OF-PAGE.
REFRESH I_LISTHEADER.
DATA: ld_lines type i,
ld_linesc(10) type c,
I_DATE(10) TYPE C,
I_INFO LIKE WA_LISTHEADER-INFO.
WA_LISTHEADER-TYP = 'H'.
WA_LISTHEADER-INFO = 'MATERIAL DESCRIPTION FOR SELECTED NUMBER'.
APPEND WA_LISTHEADER TO I_LISTHEADER.
CLEAR WA_LISTHEADER.
WA_LISTHEADER-TYP = 'S'.
WA_LISTHEADER-KEY = 'DATE :'.
CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM(4) INTO I_DATE.
WA_LISTHEADER-INFO = I_datE.
APPEND WA_LISTHEADER TO I_LISTHEADER.
CLEAR WA_LISTHEADER.
describe table ITAB1 lines ld_lines.
ld_linesc = ld_lines.
concatenate 'TOTAL NUMBER OF RECORD SELECTED: ' ld_linesc
into I_INFO separated by space.
WA_LISTHEADER-TYP = 'A'.
WA_LISTHEADER-INFO = I_INFO.
append WA_LISTHEADER to I_LISTHEADER.
clear: WA_LISTHEADER , I_INFO.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_LISTHEADER
I_LOGO = 'ENJOYSAP_LOGO'.
I_END_OF_LIST_GRID =
I_ALV_FORM =
ENDFORM. "TOP-OF-PAGE
*& Form DISPLAY_ALV_MAKT
text
FORM DISPLAY_ALV_MAKT .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
I_GRID_TITLE = I_TITLE_MAKT
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = fieldcat
TABLES
T_OUTTAB = ITAB1
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. " DISPLAY_ALV_MAKT
<b>rewards point</b>
regards
Ashok kumar -
hi all ,
please let me know that ,can we use write statement to display top of page in ALV.if not suggest alternative.
thanks in advance.
janardhan.Hi Janajana,
Here is the code. Reward points if it helps you.
REPORT ZALV_SAMPLE.
* NO STANDARD PAGE HEADING
* LINE-COUNT 58
* LINE-SIZE 220.
TYPE-POOLS: SLIS. "for 'REUSE_ALV...list&grids'
* TABLES *
TABLES: KNA1. "General Data in Customer Master
* Internal data *
DATA: BEGIN OF LT_ALVTABLE OCCURS 0,
KUNNR LIKE KNA1-KUNNR,
NAME1 LIKE KNA1-NAME1,
NAME2 LIKE KNA1-NAME2,
STRAS LIKE KNA1-STRAS,
PSTLZ LIKE KNA1-PSTLZ,
ORT01 LIKE KNA1-ORT01,
UMSA1 LIKE KNA1-UMSA1,
KTOKD LIKE KNA1-KTOKD,
END OF LT_ALVTABLE.
* data-statements that are necessary for the use of the ALV-grid
DATA: GT_XEVENTS TYPE SLIS_T_EVENT.
DATA: XS_EVENT TYPE SLIS_ALV_EVENT.
DATA: REPID TYPE SY-REPID.
DATA: ZTA_PRINT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
DATA: LO_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA: LO_ITABNAME TYPE SLIS_TABNAME.
DATA: LS_VARIANT TYPE DISVARIANT.
* Initialization *
INITIALIZATION.
* Parameters and select-options *
SELECT-OPTIONS SO_KUNNR FOR KNA1-KUNNR DEFAULT '2000' TO '2300'.
SELECT-OPTIONS SO_NAME FOR KNA1-NAME1.
PARAMETERS: PA_PSTCD AS CHECKBOX DEFAULT 'X'.
PARAMETERS: PA_VAR AS CHECKBOX DEFAULT 'X'.
* Start of main program *
START-OF-SELECTION.
PERFORM SELECT_RECORDS.
PERFORM PRINT_ALVLIST.
END-OF-SELECTION.
*& Form select_records
FORM SELECT_RECORDS.
SELECT * FROM KNA1 INTO CORRESPONDING FIELDS OF LT_ALVTABLE
WHERE KUNNR IN SO_KUNNR
AND NAME1 IN SO_NAME.
APPEND LT_ALVTABLE.
ENDSELECT.
ENDFORM. " select_records
*& Form print_alvlist
FORM PRINT_ALVLIST.
REPID = SY-REPID.
LO_ITABNAME = 'LT_ALVTABLE'. "NB: ONLY USE CAPITALS HERE!
* Fill the variables of the ALV-grid.
PERFORM SET_LAYOUT USING LO_LAYOUT. "Change layout-settings
PERFORM SET_EVENTS USING GT_XEVENTS."Set the events (top-page etc)
PERFORM FILL_STRUCTURE. "Read the structure of the itab
PERFORM MODIFY_STRUCTURE. "Modify itab's field-properties
* Sort the table
SORT LT_ALVTABLE BY KUNNR.
* Present the table using the ALV-grid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = REPID
IT_FIELDCAT = ZTA_PRINT[]
IS_LAYOUT = LO_LAYOUT
IT_EVENTS = GT_XEVENTS
I_SAVE = 'A'
IS_VARIANT = LS_VARIANT
TABLES
T_OUTTAB = LT_ALVTABLE.
ENDFORM. " print_alvlist
*& Form SET_LAYOUT
FORM SET_LAYOUT USING PA_LAYOUT TYPE SLIS_LAYOUT_ALV.
* Minimize the columnwidth
PA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
* Give the table a striped pattern
PA_LAYOUT-ZEBRA = 'X'.
* Set the text of the line with totals
PA_LAYOUT-TOTALS_TEXT = 'Total:'.
* Set the text of the line with subtotals
PA_LAYOUT-SUBTOTALS_TEXT = 'Subtotal:'.
* Set the variant, as requested via the checkbox
IF PA_VAR = 'X'.
LS_VARIANT-VARIANT = '/ZLAYOUT'.
ELSE.
CLEAR LS_VARIANT-VARIANT.
ENDIF.
ENDFORM. " SET_LAYOUT
*& Form Set_events
* Appends the values of the events to the events-variable that is
* used by REUSE_ALV_LIST_DISPLAY
FORM SET_EVENTS USING PA_EVENTS TYPE SLIS_T_EVENT.
XS_EVENT-NAME = SLIS_EV_TOP_OF_LIST.
XS_EVENT-FORM = 'XTOP_OF_LIST'.
APPEND XS_EVENT TO PA_EVENTS.
XS_EVENT-NAME = SLIS_EV_END_OF_LIST.
XS_EVENT-FORM = 'XEND_OF_LIST'.
APPEND XS_EVENT TO PA_EVENTS.
XS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
XS_EVENT-FORM = 'XTOP_OF_PAGE'.
APPEND XS_EVENT TO PA_EVENTS.
XS_EVENT-NAME = SLIS_EV_END_OF_PAGE.
XS_EVENT-FORM = 'XEND_OF_PAGE'.
APPEND XS_EVENT TO PA_EVENTS.
ENDFORM.
*& Form XTOP_OF_LIST
FORM XTOP_OF_LIST.
DATA LO_DATE(8).
CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM+2(2)
INTO LO_DATE.
WRITE: AT 1 'Report:'(T01), 20 'Reportname'(T02).
WRITE: AT 50 'Date:'(T03), LO_DATE.
NEW-LINE.
WRITE: AT 1 'Abap-name report: '(T04), SY-REPID.
WRITE: AT 50 'Page:'(T05), SY-CPAGE.
ENDFORM. "xtop_of_list
*& Form XEND_OF_LIST
FORM XEND_OF_LIST.
WRITE: 'Footer of the list'(002).
ENDFORM. "xend_of_list
*& Form XTOP_OF_PAGE
FORM XTOP_OF_PAGE.
WRITE:/ 'Top of the page.'(003).
*()*Here your selection-criteria can be printed
ENDFORM. "xtop-of-page
*& Form XEND_OF_PAGE
FORM XEND_OF_PAGE.
WRITE:/ 'End of the page.'(004).
ENDFORM. "xtop-of-page
*& Form FILL_STRUCTURE
FORM FILL_STRUCTURE.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = REPID
I_INTERNAL_TABNAME = LO_ITABNAME
I_INCLNAME = 'ZALV_SAMPLE'
CHANGING
CT_FIELDCAT = ZTA_PRINT[].
ENDFORM. " FILL_STRUCTURE
*& Form MODIFY_STRUCTURE
* Set the fieldproperties to your wishes
FORM MODIFY_STRUCTURE.
LOOP AT ZTA_PRINT.
CLEAR ZTA_PRINT-KEY.
CASE ZTA_PRINT-FIELDNAME.
WHEN 'KUNNR'. "Klantnummer
ZTA_PRINT-COL_POS = 0.
ZTA_PRINT-SELTEXT_S = 'Cstm'(H01).
ZTA_PRINT-SELTEXT_M = 'Customer'(H01).
ZTA_PRINT-SELTEXT_L = 'Customer is king'(H01).
WHEN 'NAME1'. "Name1
ZTA_PRINT-COL_POS = 1.
WHEN 'NAME2'. "Name 2 (now set to invisible)
ZTA_PRINT-COL_POS = 2.
ZTA_PRINT-NO_OUT = 'X'.
WHEN 'STRAS'. "Month
ZTA_PRINT-COL_POS = 3.
WHEN 'PSTLZ'. "Postcode
ZTA_PRINT-COL_POS = 4.
IF PA_PSTCD = ''.
ZTA_PRINT-NO_OUT = 'X'.
ELSE.
CLEAR ZTA_PRINT-NO_OUT.
ENDIF.
WHEN 'ORT01'. "Stad
ZTA_PRINT-COL_POS = 5.
WHEN 'UMSA1'. "Annual sales
ZTA_PRINT-COL_POS = 6.
WHEN 'KTOKD'. "
ZTA_PRINT-COL_POS = 7.
* when others. "set all other fields to invisible
* zta_print-no_out = 'X'.
ENDCASE.
MODIFY ZTA_PRINT.
ENDLOOP.
ENDFORM. " modify_structure
Regards,
Amit Mishra -
How to display values on top of each bar in graph???
Hi Everyone,
My Jdev version is 11.1.2.3.0.
I have developed one ADF BAr Graph </dvt:barGraph>. Everything is working fine.
How can i show the values on top of each bar in my graph???
And how can we show arrows left arrow right arrow top arrow bottom arrow like arrows in keyboard in ADF??? Example: Text1 right arrow Text2 right arrow Text3
Any suggestions will be really helpful.
Thanks.I'm not sure if that's what you're looking for, but you can display values by using markerText tag:
<dvt:barGraph...>
<dvt:markerText rendered="true">
<dvt:y1Format>
<af:convertNumber type="number"/>
</dvt:y1Format>
<dvt:graphFont id="graphFont4" size="20"/>
</dvt:markerText>
</dvt:barGraph>
About the other question, have you tried to use unicode characters? Right arrow, for example is "⇨" -
How to display values of DFF on page.
I have created an item on the page of the type flex.But it does not displays the DFF values on page.
I have checked that the values are properly inserted into the VO instance used by flex item.
What else i need to do to display the DFF segments on page? Am I missing something here?
I have set the flex properties as follow :
View Instance - <View Object name> (I checked that the values are being set correctly in this VO)
Rendered - True
application short name - <application short name>
name - <name of the DFF >
type - descriptive
Read only - false
Display context field - true
Thanks in Advance,
TanveerHi all , I found this posting by Jon
---Jon text bellow
I had the same problem a couple of weeks back in that we couldn't get context sensitive flex fields (Req Line) from displaying on the non-cat request page. The standard FlexField item does not render anything but Global segments. After raising a TAR the response was to disable the standard DFF page item and create a new FlexField item as follows.
1) Login into iProcurement ( enable the profiles related to do Personalization )
Goto the Page where you would like to display this DFF . You need to make sure that this region is based on
View Object : PoRequisitionLinesVO .
Click on the Personalization link and create a item with below values :
Item Style = Flex
ID = Procurement_Card
Appl Short Name = PO
Display Context Field = True
name = PO_REQUISITION_LINES
Prompt = Procurement Card --- you need to make sure that this matches to your Prompt in
Context Field above .
Read Only = False
Rendered = True
Type = Descriptive
View Instance = PoRequisitionLinesVO
This worked however we soon found that there was a major flaw in that the DFF's were only rendered when there were items in the shopping cart. That is that the VO was instantiated.
After much reluctance Oracle raised a bug for this: 5169570 which we have been told to monitor.
Very frustrating that this has not been implemented correctly!!!
Jon.
it was really helpfull but my DFF still dont dispalyed on non-catalog request form . how I can verify what view instance Region is using
View Instance = PoRequisitionLinesVO
sorry question might seems stupit but I am very new to OAF and iProcurement
Thanks Artur
Message was edited by:
user555312 -
Regarding Header(top-of-page) in ALV Report
Dear All,
I am displaying name and address of company on the top of alv report and after that alv grid is displaying.
e.g.
'XYZ' LTD.
ADDRESS1,PINCODE1.
ACCOUNTING DOC.NO. DOC TYPE G/L ACCT. AMOUNT
123456 DD 6353 444400
123457 DD 6334 455500
Issue : Header is coming on all the pages I want it to come only on first page.
I am using REUSE_ALV_COMMENTARY_WRITE function for top of page.
Pls , suggest any suitable suggestion.
Thanks & regards,
Sandip SonarHi,
check the below code
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = i_repid
it_fieldcat = header
is_layout = gt_layout
i_callback_top_of_page = 'TOP-OF-PAGE1'
i_grid_title = xyz
it_sort = gt_sort[]
i_default = 'X'
i_save = 'U'
is_variant = gt_variant
it_events = gt_events
tables
t_outtab = t_output.
form top-of-page1.
data: header type slis_t_listheader,
wa type slis_listheader,
flag(1).
if flag is initial.
TITLE AREA
wa-typ = 'S'.
wa-info = text-h04.
append wa to header.
wa-typ = 'S'.
write sy-datum to wa-info mm/dd/yyyy.
concatenate text-h03 wa-info into wa-info separated by space.
append wa to header.
wa-typ = 'S'.
concatenate text-h02 sy-uname into wa-info separated by space.
append wa to header.
wa-typ = 'S'.
concatenate text-h01 sy-repid into wa-info separated by space.
append wa to header.
********" LOGO
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = header
i_logo = 'ENJOYSAP_LOGO'.
*********" LOGO
flag = 'x'.
endif.
endform.
Edited by: sateesh kumar on Nov 30, 2009 10:47 AM -
Hi all,
i have an alv report, in which i have form top_of_page form , but i don't see perform top_of_page in the entire program
its not been passed to fm also.
where this form comes from
my other question is, i have some text in this form, i want to make it bold can anyone tell me how to do this.
Thanks
preetihi in your program the TOP OF PAGE must have been declared like this FORM TOP
WA_EVENTS-NAME = 'TOP_OF_PAGE'.
<b> WA_EVENTS-FORM = 'TOP'. </b>
APPEND WA_EVENTS TO IT_EVENTS.
CLEAR WA_EVENTS.
WA_EVENTS-NAME = 'END_OF_LIST'.
WA_EVENTS-FORM = 'END_LIST'.
APPEND WA_EVENTS TO IT_EVENTS.
CLEAR WA_EVENTS.
dont forget to award points if found helpful -
How to display the fields using field catelog in ALV Report
Hi,
I have rquiremrnt in ALV report.I would need to add the new fileld in the ALV output screen.I have added the field but its appearing in the layout set but not directly displaying in the output screen.
I have written the below logic for field catelog.
CLEAR wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'LOGGR'.
wa_fieldcatalog-ref_tabname = 'MARC'.
wa_fieldcatalog-col_pos = l_pos.
wa_fieldcatalog-outputlen = 13.
wa_fieldcatalog-seltext_s = 'Log. group'.
wa_fieldcatalog-seltext_m = 'Logistics group'.
wa_fieldcatalog-seltext_l = 'Log. handling group'.
wa_fieldcatalog-reptext_ddic = 'Log. handling group'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
l_pos = l_pos + 1.
Please let me know why the added field was not displaying automaticaly in the output screen.
Regards,
Reddyhi,
try this
clear wa_fieldcatalog.
wa_fieldcat-tabname = 'ITAB' ( give the internal table which has the field LOGGR)
wa_fieldcatalog-fieldname = 'LOGGR'.
wa_fieldcatalog-ref_tabname = 'MARC'.
wa_fieldcatalog-col_pos = l_pos.
wa_fieldcatalog-outputlen = 13.
wa_fieldcatalog-seltext_s = 'Log. group'.
wa_fieldcatalog-seltext_m = 'Logistics group'.
wa_fieldcatalog-seltext_l = 'Log. handling group'.
wa_fieldcatalog-reptext_ddic = 'Log. handling group'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
l_pos = l_pos + 1. -
How to display values and new char line (blank line)
Hi,
In database, one field contains values followed by new character lines (blank lines) after blank lines there is no values. Finally, I would say the field contains values and blank lines. Every thing is fine in database.
In Crystal Reports the field is displaying only values. Need to display values and blank line.
User is asking after values new character lines (blank line) to be shown. They enter like that in an application. The user doubt is why report is not showing what they enter in the application.
In detail explanation, front end tool is ASP.NET and backend is SQL Server.
User enter some values in note field, after that they hit enter button in the same field, cursor will go next line...user may hit u2018enter buttonu2019 more than 5 times. So note field contain values and some blank lines which are created by after hitting enter button.
If user opens the application, they could see values plus blank lines in the note field.
They are fine with the application.
In Crystal Reports, the note field shows only values.
User is questioning that why we could not see in report we enter.
I checked in .Net application and SQL server database it is fine. It is displaying values and blank line.
Please help me out how to display values followed by blank lines in Crystal Reports - the way they enter in the application.
Thanks and Regards,
Manjunath N. JoginHi,
Sharonmat,
I tried as you suggested. It is still displaying only values.
I would like to explain again.
it is not exactly null values.
In .Net application it is called 'new char line'.
it shows those many lines look like null.
it is working fine in database.
Why it is not working in Crystal Reports? I am wondering...
Thanks for your suggestion.
Debi,
User may enter any number of blank lines or they may not enter blank lines.
That is the reason I can not always give more height or blank text object.
Thanks for your suggestion.
Please suggest me some more suggestions,
Thanks and Regards,
Manjunath N. Jogin -
How To Print Field Value in TOP-OF-PAGE During Line Selection.
How To Print Field Value in TOP-OF-PAGE During Line Selection when double click on field.
(If my memory serves me well (not used for long time ago)
Assign values to system fields sy-tvar0 - sy-tvar9, they will replace the placeholders "&0" through "&9" in the list headers and column headers.
TOP-OF-PAGE DURING LINE-SELECTION.
WRITE: / 'Interactive Report &3'.
WRITE record-vbeln TO sy-tvar3.
Regards,
Raymond -
How to devide the top of page in alv grid display
hi all
in the alv grid display am getting the page number and total number of pages in the left hand side
but what i need is i need in the right hand side
how to get thatHi,
PLease refer to the code below:
*& Report ZDEMO_ALVGRID *
*& Example of a simple ALV Grid Report *
*& The basic requirement for this demo is to display a number of *
*& fields from the EKKO table. *
REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid,
gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
* Build Fieldcatalog for ALV Report
form build_fieldcatalog.
* There are a number of ways to create a fieldcat.
* For the purpose of this example i will build the fieldcatalog manualy
* by populating the internal table fields individually and then
* appending the rows. This method can be the most time consuming but can
* also allow you more control of the final product.
* Beware though, you need to ensure that all fields required are
* populated. When using some of functionality available via ALV, such as
* total. You may need to provide more information than if you were
* simply displaying the result
* I.e. Field type may be required in-order for
* the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'.
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
* Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
* gd_layout-totals_only = 'X'.
* gd_layout-f2code = 'DISP'. "Sets fcode for when double
* "click(press f2)
* gd_layout-zebra = 'X'.
* gd_layout-group_change_edit = 'X'.
* gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
* Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
* i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
* it_special_groups = gd_tabgroup
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
* is_variant = z_template
tables
t_outtab = it_ekko
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. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
* Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
endform. " DATA_RETRIEVAL
* 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 = 'EKKO Table 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.
* FORM USER_COMMAND *
* --> R_UCOMM *
* --> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* Check function code
CASE r_ucomm.
WHEN '&IC1'.
* Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'EBELN'.
* Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
* Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
* Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
*& Form BUILD_EVENTS
* Build events table
form build_events.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gt_events[].
read table gt_events with key name = slis_ev_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform. " BUILD_EVENTS
*& Form BUILD_PRINT_PARAMS
* Setup print parameters
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
*& Form 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.
*& Form END_OF_LIST
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.
Thanks,
Sriram Ponna. -
How to give colors to the top-of-page in ALV List Display
how to give colors to the top-of-page in ALV List Display....
Check this blog.........
It provides your required output...........
/people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid
See the point 7 for complete code...
Regards,
Pavan -
Top of page in ALV GRID display
Hi All,
Is it possible to have a top of page in ALV grid display?
If yes, then how?
Thanks and Regards,
Sirishahi
check out the following code:
report z_alv2 line-count 20.
type-pools : slis.
type-pools : icon.
tables:
lfa1, lfb1, lfm1.
selection-screen begin of block b1 with frame title text-001.
select-options:
s_lifnr for lfa1-lifnr, "VENDOR
s_bukrs for lfb1-bukrs, "COMPANY CODE
s_ekorg for lfm1-ekorg, "PURCHASING ORGANIZATION
s_ktokk for lfa1-ktokk. "ACCOUNT GROUP
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-002.
parameters: r1 radiobutton group g1,
r2 radiobutton group g1.
selection-screen end of block b2.
data:
v_repid like sy-repid,
begin of itab occurs 0,
lifnr like lfa1-lifnr,
bukrs like lfb1-bukrs,
ekorg like lfm1-ekorg,
ktokk like lfa1-ktokk,
name1 like lfa1-name1,
stras like lfa1-stras,
ort01 like lfa1-ort01,
regio like lfa1-regio,
pfort like lfa1-pfort,
pstlz like lfa1-pstlz,
pstl2 like lfa1-pstl2,
telf1 like lfa1-telf1,
end of itab.
data : itab_event type slis_t_event,
wa_event type slis_alv_event.
data : itab_fld_cat type slis_t_fieldcat_alv,
wa_fldcat type slis_fieldcat_alv.
data : wa_layout type slis_layout_alv.
start-of-selection.
*PERFORM GET_VARIANT.
PERFORM data_validation.
perform select_data.
perform get_events using itab_event .
perform fieldcatmerge.
if r1 = 'X'.
perform alvlistdisplay.
elseif r2 = 'X' .
perform alvgriddisplay.
endif.
*& Form DATA_VALIDATION
text
--> p1 text
<-- p2 text
form data_validation .
data: v_count type i.
if s_lifnr is initial and
s_bukrs is initial and
s_ekorg is initial and
s_ktokk is initial.
message e000(z13325).
Enter any value in the Selection Screen
endif.
select count(*) from lfa1 where lifnr in s_lifnr.
if sy-subrc <> 0.
message e000(z13325).
Enter any value in the Selection Screen
endif.
select count(*) from lfb1 where lifnr in s_bukrs.
if sy-subrc <> 0.
message e000(z13325).
Enter any value in the Selection Screen
endif.
select count(*) from lfm1 where lifnr in s_ekorg.
if sy-subrc <> 0.
message e000(z13325).
Enter any value in the Selection Screen
endif.
select count(*) from lfa1 where lifnr in s_ktokk.
if sy-subrc <> 0.
message e000(z13325).
Enter any value in the Selection Screen
endif.
endform. " DATA_VALIDATION
*& Form SELECT_DATA
text
--> p1 text
<-- p2 text
form select_data .
select a~lifnr
b~bukrs
c~ekorg
a~ktokk
a~name1
a~stras
a~ort01
a~regio
a~pfort
a~pstlz
a~pstl2
a~telf1
into corresponding fields of table itab
from lfa1 as a inner join lfb1 as b
on alifnr = blifnr
inner join lfm1 as c
on alifnr = clifnr
where a~lifnr in s_lifnr
and b~bukrs in s_bukrs
and c~ekorg in s_ekorg
and a~ktokk in s_ktokk.
sort itab by lifnr bukrs ekorg.
endform. " SELECT_DATA
*& Form FIELDCATMERGE
text
--> p1 text
<-- p2 text
form fieldcatmerge .
v_repid = sy-repid.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = v_repid
i_internal_tabname = 'ITAB'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = v_repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
changing
ct_fieldcat = itab_fld_cat
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.
endform. " FIELDCATMERGE
*& Form ALVLISTDISPLAY
text
--> p1 text
<-- p2 text
form alvlistdisplay .
v_repid = sy-repid.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = v_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
is_layout = wa_layout
it_fieldcat = itab_fld_cat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
i_default = 'X'
I_SAVE = 'A'
IS_VARIANT =
it_events = itab_event
IT_EVENT_EXIT = itab_exit
IS_PRINT =
IS_REPREP_ID =
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 =
tables
t_outtab = itab
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. " ALVLISTDISPLAY
*& Form ALVGRIDDISPLAY
text
--> p1 text
<-- p2 text
form alvgriddisplay .
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = v_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = 'GRID DISPLAY'
I_GRID_SETTINGS =
IS_LAYOUT = WS_LAYOUT1
it_fieldcat = itab_fld_cat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = itab_event
IT_EVENT_EXIT = itab_exit
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = itab
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. " ALVGRIDDISPLAY
*& Form GET_EVENTS
text
--> p1 text
<-- p2 text
form get_events using itab_event type slis_t_event.
call function 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
importing
et_events = itab_event
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.
read table itab_event with key name = slis_ev_top_of_page into wa_event
if sy-subrc = 0.
wa_event-form = 'FRM_TOP_OF_PAGE'.
modify itab_event from wa_event index sy-tabix.
endif.
endform. " GET_EVENTS
*& Form FRM_TOP_OF_PAGE
text
form frm_top_of_page.
write : 130 'Time:' ,sy-uzeit .
write :/2 'User: ', sy-uname.
write: 59 sy-title, 130 'Page:' , sy-pagno.
write:/ 'this is swathi and this is top of page '.
endform. "FRM_TOP_OF_PAGE
Reward points if helpful.
Regards
Swathi
Maybe you are looking for
-
I called apple and did what they asked but it didn't work.
-
I have imported text into a dynamic text field with a scroll bar. How would I go about starting the imported text at the bottom rather than having to scroll to the bottom? Normal: ----------------- window top text 1 text 2 text 3 ----------------- wi
-
Apple restore mail is not arriving to hotmail
I Can t remenber my password and the email that apple sends to restore my ID never arrives and it is not in the junk, I have tried more than 100 times and many times in many days, i also dont remember the security question the only way to recover my
-
Ok, I have been trying for quite a while now to figure out a way to export my library on iTunes. The actual exporting part is easy, I know, my issue with it is that when you export your iTunes library to either a txt file or a xml file it exports all
-
How do I find a printer driver for a Dell 1320c Color Laser Printer for use on a MacBook Pro running Mavericks OSX 10.9.2?