Issue in displaying header details in ALV report
Hi,
I have used slis_t_listheader and REUSE_ALV_COMMENTARY_WRITE to display the header details in ALV report.I want the details to be displayed as below.
Requester : ---------------------- Page: 1
Program: ----------------------- Date:---------
Title of Report
But when I use the structure slis_t_listheader to display the header details,all the fields are coming one below the other.
How can I get the fields as shown in the above format
Edited by: Abaper12345 on Jun 25, 2009 7:54 AM
Hi,
Go through following code... its showing the data exactly the way you want....
REPORT TEST3.
TYPE-POOLS:slis.
TABLES:MARA.
*Type Declaration
TYPES:BEGIN OF t_mara,
matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
ernam TYPE mara-ernam,
END OF t_mara.
*Internal Table
data:it_mara type standard table of t_mara.
*Work Area
data:wa_mara type t_mara.
DATA:i_repid TYPE sy-repid .
i_repid = sy-repid.
*Declaration for field catalog
DATA : fcat TYPE slis_t_fieldcat_alv,
wa_fcat TYPE slis_fieldcat_alv.
*Declaration for Layout
data : WA_LAYOUT type SLIS_LAYOUT_ALV.
*Initializing ColumnWidth_Optimize For Layout
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
START-OF-SELECTION
START-OF-SELECTION.
*Fetching data into internal tables
PERFORM get_data.
*Buil Fieldcatalog
PERFORM build_fcat.
*Display ALV Report
PERFORM alv_display.
*Build Fieldcat
FORM build_fcat .
wa_fcat-tabname = 'IT_MARA'.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-inttype = 'C'.
wa_fcat-seltext_m = 'Material Number'.
wa_fcat-outputlen = 25.
wa_fcat-col_pos = 1.
APPEND wa_fcat TO fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'IT_MARA'.
wa_fcat-fieldname = 'ERSDA'.
wa_fcat-inttype = 'C'.
wa_fcat-seltext_m = 'Date'.
wa_fcat-outputlen = 25.
wa_fcat-col_pos = 1.
APPEND wa_fcat TO fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'IT_MARA'.
wa_fcat-fieldname = 'ERNAM'.
wa_fcat-inttype = 'C'.
wa_fcat-seltext_m = 'User'.
wa_fcat-outputlen = 25.
wa_fcat-col_pos = 1.
APPEND wa_fcat TO fcat.
CLEAR wa_fcat.
endform.
*& Form GET_DATA
text
--> p1 text
<-- p2 text
form GET_DATA .
select matnr ersda ernam from mara into table it_mara.
endform. " GET_DATA
*& Form ALV_DISPLAY
text
--> p1 text
<-- p2 text
form ALV_DISPLAY .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = i_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = 'HTML_TOP_OF_PAGE'
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = fcat
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.
endform. " ALV_DISPLAY
*& Form html_top_of_page " I_CALLBACK_HTML_TOP_OF_PAGE "
FORM html_top_of_page USING document TYPE REF TO cl_dd_document.
CALL METHOD document->add_text
EXPORTING
text = 'Program'
sap_color = document->list_group
sap_fontstyle = document->standard
sap_emphasis = document->strong.
CALL METHOD document->new_line
EXPORTING
repeat = 1
CALL METHOD document->add_text
EXPORTING
text = 'Requester'
sap_color = document->list_group
sap_fontstyle = document->standard
sap_emphasis = document->strong.
CALL METHOD document->new_line
EXPORTING
repeat = 1
CALL METHOD document->add_gap
EXPORTING
width = 125
CALL METHOD document->add_text
EXPORTING
text = 'This Is Test Data'
sap_color = document->list_group
sap_fontsize = document->LARGE
sap_fontstyle = document->standard
sap_emphasis = document->strong.
ENDFORM. "HTML_TOP_OF_PAGE
Thanks & Regards
Ashu SIngh
Similar Messages
-
Displaying Header Text in ALV report.
HI Gurus,
I have one sales order which has header Text.
I am displaying that Header Text in my ALV report.
But while displaying in the ALV grid, the text is not coming full.
I have taken the datatype of the column of the ALV grid is string, Still the Header text is not come full.
Please help me.
Thanks in advance.Hi,
If the header text is morethan 60 characters, you can't print with REUSE_ALV_COMMENTARY_WRITE. To overcome above limit we can use dynamic document, which can be implemented through the class CL_DD_DOCUMENT. As dynamic documents use HTML viewer control so instead of triggering the TOP_OF_PAGE event we should trigger event of HTML TOP_OF_PAGE.
First create a subroutine for top of page in HTML format and send that name in I_CALLBACK_HTML_TOP_OF_PAGE parameter of ALV function module. The input parameter for this subroutine will be a variable of class CL_DD_DOCUMENT.
* FORM html_top_of_page *
FORM html_top_of_page USING top TYPE REF TO cl_dd_document.
data: l_text(255) type c.
l_text = '*******************************Hellooooooooooooooooooo************************'.
CALL METHOD top->add_text EXPORTING text = 'Hello world '
sap_style = 'heading' .
CALL METHOD top->add_gap EXPORTING width = 200.
CALL METHOD top->add_picture EXPORTING picture_id = 'ENJOYSAP_LOGO'.
CALL METHOD top->NEW_LINE( ).
CALL METHOD top->add_text EXPORTING
text = l_text.
ENDFORM.
* Display ALV grid
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE' " Use this event
i_callback_program = g_repid
i_structure_name = 'STRUCTURE'
TABLES
t_outtab = gt_outtab.
Regards
Bala Krishna -
Display header vertically in ALV report
Hello Experts,
I have a requirement in which i need to display the headers of an ALV in vertical order and items in horizantal order. It should appear as below.
Parameter | Unit | Week under consideration | % of Net Sales | This week | Next week
Week
Total Money Credited
Total Receivables
Total Sales
Overall OTIF
Total variable costs
Week,Total Money Credited, Total Receivables ,Total Sales, Overall OTIF ,Total variable costs are the Headers.
Thanx in advance.
Arya
Edited by: arya.soumya on Oct 17, 2011 12:40 PM
Moderator message: "spec dumping", please work yourself first on your requirement.
Edited by: Thomas Zloch on Oct 17, 2011 12:50 PMHello Experts,
I have a requirement in which i need to display the headers of an ALV in vertical order and items in horizantal order. It should appear as below.
Parameter | Unit | Week under consideration | % of Net Sales | This week | Next week
Week
Total Money Credited
Total Receivables
Total Sales
Overall OTIF
Total variable costs
Week,Total Money Credited, Total Receivables ,Total Sales, Overall OTIF ,Total variable costs are the Headers.
Thanx in advance.
Arya
Edited by: arya.soumya on Oct 17, 2011 12:40 PM
Moderator message: "spec dumping", please work yourself first on your requirement.
Edited by: Thomas Zloch on Oct 17, 2011 12:50 PM -
Need to display data on the right side in the header area of alv report.
hi experts,
I want to display data in the header area of alv report on the right side . I have already used function for events on the header side data is getting displayed on the left side .but i want data to be displayed on the right side.
regards,
andrews.Hi,
Hope this below code helps you.
Take care,
Çağatay.
* build header for alv
FORM top_of_page_split USING r_top TYPE REF TO cl_dd_document.
DATA: s_tab TYPE sdydo_text_table,
c_area TYPE REF TO cl_dd_area,
text TYPE sdydo_text_element.
TYPES: BEGIN OF tab_text,
text TYPE sdydo_text_element,
END OF tab_text.
DATA: i_text TYPE TABLE OF tab_text.
DATA: w_text TYPE tab_text.
CALL METHOD r_top->initialize_document.
CALL METHOD r_top->vertical_split
EXPORTING
split_area = r_top
split_width = '70%'
IMPORTING
right_area = c_area.
CONCATENATE sy-datum+4(2)
sy-datum+6(2)
sy-datum(4)
INTO date1.
CONCATENATE 'DATE' date1
INTO w_text-text
SEPARATED BY ':'.
APPEND w_text TO i_text.
CONCATENATE 'time:' sy-uzeit INTO w_text .
APPEND w_text TO i_text.
CONCATENATE 'uesr:' sy-uname INTO w_text .
APPEND w_text TO i_text.
CONCATENATE 'local date:' sy-datlo INTO w_text .
APPEND w_text TO i_text.
CONCATENATE 'time zone:' sy-zonlo INTO w_text .
APPEND w_text TO i_text.
s_tab[] = i_text[].
CALL METHOD c_area->add_text
EXPORTING
text_table = s_tab
fix_lines = 'X'
sap_fontsize = cl_dd_document=>medium
sap_emphasis = cl_dd_document=>strong.
CALL METHOD r_top->add_gap
EXPORTING
width = 60.
text = 'THIS IS REPORT HEADING'.
CALL METHOD r_top->add_text
EXPORTING
text = text
sap_emphasis = 'STRONG'.
CALL METHOD r_top->new_line.
CALL METHOD r_top->add_gap
EXPORTING
width = 70.
text = 'THIS IS REPORT HEADING1'.
CALL METHOD r_top->add_text
EXPORTING
text = text
sap_emphasis = 'STRONG'.
CALL METHOD r_top->new_line.
CALL METHOD r_top->add_gap
EXPORTING
width = 80.
text = 'THIS IS REPORT HEADING2'.
CALL METHOD r_top->add_text
EXPORTING
text = text
sap_emphasis = 'STRONG'.
CALL METHOD r_top->new_line.
text = 'Report Subheading1'.
CALL METHOD r_top->add_text
EXPORTING
text = text
sap_emphasis = 'NORMAL'.
CALL METHOD r_top->new_line.
text = 'Report Subheading2'.
CALL METHOD r_top->add_text
EXPORTING
text = text
sap_emphasis = 'NORMAL'.
CALL METHOD r_top->new_line.
text = 'Report Subheading3'.
CALL METHOD r_top->add_text
EXPORTING
text = text
sap_emphasis = 'NORMAL'.
CALL METHOD r_top->new_line.
ENDFORM. "TOP_OF_PAGE_SPLIT -
How to display two lables in alv report
Is there any chance to display two lables in alv report
for example..
AMOUNT
Rs | Ps
|
like that this for an example.
thanks,
JBHai Babu
Go through the following Code
using Classes & Methods
try with the following Code( Just copy the code & try with in SE38 Tcode & Execute it that all)
REPORT ZALV_SALES_HEADER_DETAIL MESSAGE-ID Z50650(MSG) .
TABLES
TABLES: VBAK . "SALES DOCUMENT HEADER
DATA OBJECTS DECLARATION
DATA: IT_VBAK TYPE STANDARD TABLE OF ZVBAK_STRUC,
IT_VBAP TYPE STANDARD TABLE OF ZVBAP_STRUC,
GS_LAYOUT TYPE LVC_S_LAYO,
GS1_LAYOUT TYPE LVC_S_LAYO,
GRID TYPE REF TO CL_GUI_ALV_GRID,
CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
VBAK_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
VBAP_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
WA_VBAK LIKE LINE OF IT_VBAK,
WA_VBAP LIKE LINE OF IT_VBAP,
SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
TOP_OF_PAGE_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
GRID_VBAP TYPE REF TO CL_GUI_ALV_GRID,
TOP_PAGE TYPE REF TO CL_DD_DOCUMENT,
FLAG(1).
*"EVENT RECIEVER CLASS DEFINITION
CLASS LCL_EVENT_RECIEVER DEFINITION DEFERRED.
DATA: OBJ_EVENT TYPE REF TO LCL_EVENT_RECIEVER.
SELECTION-SCREEN
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
PARAMETERS: P_VBTYP LIKE VBAK-VBTYP DEFAULT 'C'.
SELECTION-SCREEN: END OF BLOCK B1.
CLASS DEFINITION AND DECLARATIONS
CLASS LCL_EVENT_RECIEVER DEFINITION.
PUBLIC SECTION.
EVENTS:DOUBLE_CLICK,
TOP_OF_PAGE.
METHODS:HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW .
METHODS: HANDLE_TOP_OF_PAGE FOR EVENT TOP_OF_PAGE OF CL_GUI_ALV_GRID.
ENDCLASS. "LCL_EVENT_RECIEVER DEFINITION
CLASS LCL_EVENT_RECIEVER IMPLEMENTATION
CLASS LCL_EVENT_RECIEVER IMPLEMENTATION.
METHOD: HANDLE_DOUBLE_CLICK.
READ TABLE IT_VBAK INDEX E_ROW-INDEX INTO WA_VBAK.
PERFORM FETCH_ITEM_DETAILS USING WA_VBAK.
PERFORM ALV_GRID.
ENDMETHOD. "HANDLE_DOUBLE_CLICK
METHOD: HANDLE_TOP_OF_PAGE.
CALL METHOD TOP_PAGE->ADD_TEXT
EXPORTING
TEXT = 'SALES HEADER & ITEM DETAILS'.
CALL METHOD TOP_PAGE->DISPLAY_DOCUMENT
EXPORTING
PARENT = TOP_OF_PAGE_CONTAINER.
ENDMETHOD. "HANDLER_TOP_OF_PAGE
ENDCLASS. "LCL_EVENT_RECIEVER IMPLEMENTATION
AT SELECTION-SCREEN
AT SELECTION-SCREEN.
IF S_VBELN IS NOT INITIAL.
SELECT COUNT(*)
FROM VBAK
WHERE VBELN IN S_VBELN.
IF SY-DBCNT = 0.
MESSAGE E000 WITH 'NO TABLE ENTRIES FOUND FOR LOW KEY SPECIFIED'.
ENDIF.
ENDIF.
START-OF-SELECTION.
START-OF-SELECTION.
PERFORM FETCH_SALES_HEADER_RECORD.
PERFORM CREATE_CALL. "CREATION OF OBJECTS & CALLING METHODS
END-OF-SELECTION.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Form FETCH_SALES_HEADER_RECORD
text
--> p1 text
<-- p2 text
FORM FETCH_SALES_HEADER_RECORD .
SELECT
VBELN
AUDAT
VBTYP
AUART
AUGRU
NETWR
WAERK
FROM VBAK
INTO CORRESPONDING FIELDS OF TABLE IT_VBAK
WHERE VBELN IN S_VBELN
AND VBTYP = P_VBTYP.
ENDFORM. " FETCH_SALES_HEADER_RECORD
*& Form CREATE_CALL
text
--> p1 text
<-- p2 text
FORM CREATE_CALL .
IF CUSTOM_CONTAINER IS INITIAL.
CREATE OBJECT CUSTOM_CONTAINER
EXPORTING
PARENT =
CONTAINER_NAME = 'CUSTOM_CONTAINER'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT SPLITTER
EXPORTING
TOP = 5
PARENT = CUSTOM_CONTAINER
ROWS = 3
COLUMNS = 1
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_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 METHOD SPLITTER->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = TOP_OF_PAGE_CONTAINER.
CALL METHOD SPLITTER->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = VBAK_CONTAINER.
CALL METHOD SPLITTER->GET_CONTAINER
EXPORTING
ROW = 3
COLUMN = 1
RECEIVING
CONTAINER = VBAP_CONTAINER.
CREATE OBJECT GRID
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
I_PARENT = VBAK_CONTAINER
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
GS_LAYOUT-GRID_TITLE = 'SALES HEADER DETAILS.'(100).
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'ZVBAK_STRUC'
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT = GS_LAYOUT
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
IT_OUTTAB = IT_VBAK
IT_FIELDCATALOG =
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
CREATE OBJECT OBJ_EVENT .
SET HANDLER OBJ_EVENT->HANDLE_DOUBLE_CLICK FOR GRID.
SET HANDLER OBJ_EVENT->HANDLE_TOP_OF_PAGE FOR GRID.
CREATE OBJECT TOP_PAGE
EXPORTING
STYLE = 'ALV_GRID'
CALL METHOD TOP_PAGE->INITIALIZE_DOCUMENT.
CALL METHOD GRID->LIST_PROCESSING_EVENTS
EXPORTING
I_EVENT_NAME = 'TOP_OF_PAGE'
I_DYNDOC_ID = TOP_PAGE.
CALL SCREEN 100.
ENDFORM. " CREATE_CALL
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form FETCH_ITEM_DETAILS
text
--> p1 text
<-- p2 text
FORM FETCH_ITEM_DETAILS USING WA_VBAK TYPE ZVBAK_STRUC .
SELECT
VBELN
POSNR
MATNR
MATWA
PMATN
CHARG
FROM VBAP
INTO TABLE IT_VBAP
WHERE VBELN = WA_VBAK-VBELN.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'NO RECORDS FOUND FOR SPECIFIED KEY'.
ENDIF.
ENDFORM. " FETCH_ITEM_DETAILS
*& Module STATUS_0200 OUTPUT
text
MODULE STATUS_0200 OUTPUT.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module USER_COMMAND_0200 INPUT
text
MODULE USER_COMMAND_0200 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Form alv_grid
text
--> p1 text
<-- p2 text
FORM ALV_GRID .
IF FLAG = ''.
FLAG = 'X'.
CREATE OBJECT GRID_VBAP
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
I_PARENT = VBAP_CONTAINER
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
GS1_LAYOUT-GRID_TITLE = 'SALES ITEM DETAILS.'(100).
CALL METHOD GRID_VBAP->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'ZVBAP_STRUC'
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT = GS1_LAYOUT
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
IT_OUTTAB = IT_VBAP
IT_FIELDCATALOG =
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4
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. " alv_grid
Thansk & regards
Sreenivasulu P -
How to get header in the ALV report
Hi
I want to print header in the ALV report.But i am not getting that.Plz see my program it is getting error and also not printing header.If there is any error means plz give me the solution.In this program there is an error.
REPORT ZREPORT_ALV .
TYPE-POOLS : slis.
tables:vbak,vbap.
DATA: report_id LIKE sy-repid.
DATA: I_LAYOUT TYPE SLIS_LAYOUT_ALV.
data: heading TYPE slis_t_listheader,
wa_header TYPE slis_listheader,
events TYPE slis_t_event.
data: l_string type c.
data: ivariant(1) type c,
itvariant like disvariant,
w_variant like disvariant.
initialization.
REPORT_ID = SY-REPID.
PERFORM pgm. "F1000_LAYOUT_INIT. "using I_LAYOUT.
ivariant = 'A'.
*PERFORM init.
itvariant = w_variant.
select-options:so_vbeln for vbap-vbeln.
data:itab like vbak occurs 0 with header line.
data:itab1 like vbap occurs 0 with header line.
start-of-selection.
select * from vbak into table itab where vbeln in so_vbeln.
if not itab[] is initial.
select * from vbap into table itab1
for all entries in itab
where vbeln = itab-vbeln.
endif.
data:ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat1 TYPE slis_t_fieldcat_alv.
****For alv display
IF NOT itab1[] IS INITIAL.
DEFINE ls_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-outputlen = &2.
ls_fieldcat-seltext_l = &3.
ls_fieldcat-emphasize = &4.
append ls_fieldcat to lt_fieldcat1.
clear ls_fieldcat.
END-OF-DEFINITION.
ls_fieldcat 'VBELN' '10' 'Sales Order Number'.
ls_fieldcat 'POSNR' '6' 'SO Item'.
ls_fieldcat 'MATNR' '13' 'Material No'.
m_fieldcat1 'NETWR' '13' 'Amount'.
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 = ' '
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 =
I_GRID_SETTINGS =
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = lt_fieldcat1
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT = ITVARIANT
IT_EVENTS =
IT_EVENT_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
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
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.
endif.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
I_SAVE = ivariant
CHANGING
CS_VARIANT = itvariant
EXCEPTIONS
WRONG_INPUT = 1
NOT_FOUND = 2
PROGRAM_ERROR = 3
OTHERS = 4
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 pgm. "F1000_LAYOUT_INIT. "USING I_LAYOUT TYPE SLIS_LAYOUT_ALV.
CLEAR I_LAYOUT.
i_layout-colwidth_optimize = 'X'.
I_LAYOUT-key_hotspot = u2018Xu2019.
I_LAYOUT-hotspot_fieldname = MATNR.
ENDFORM.
*regarding logo and header,,,,
*first store the logo in T-code OAOR, then call that in your report.....
*data: heading TYPE slis_t_listheader,
wa_header TYPE slis_listheader,
events TYPE slis_t_event.
To display TOP_OF_PAGE.
FORM top_of_page.
DATA : text(40),txtdt(40).
CLEAR l_string.
l_string = 'JCB India Limited'(hd2).
wa_header-typ = 'H'.
wa_header-info = l_string.
APPEND wa_header TO heading. " index 1.
CLEAR l_string.
WRITE :'Number of records:' TO text,'dbcnt' TO text+20 LEFT-JUSTIFIED.
wa_header-typ = 'S'.
wa_header-info = text.
APPEND wa_header TO heading.
CLEAR l_string.
wa_header-typ = 'S'.
WRITE : 'Report Run Date :' TO txtdt,sy-datum TO txtdt+20 DD/MM/YY.
WRITE sy-datum TO dat DD/MM/YY.
wa_header-info = txtdt.
APPEND wa_header TO heading.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = heading.
CLEAR heading.
ENDFORM. "top_of_page
*to execute top-of-page you have to create events.
*for ex......
FORM create_event USING p_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = p_events.
READ TABLE p_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE formname_top_of_page TO ls_event-form.
APPEND ls_event TO p_events.
ENDIF.
ENDFORM. " create_eventHi,
Find below code for your question, you may get some idea,,
*& Report ZACTIONGRIDPRACTICE
REPORT ZACTIONGRIDPRACTICE.
*data declarations.....
TYPE-POOLS SLIS.
TABLES : T529T ,PA0000.
data : gd_repid type sy-repid.
DATA : LD_COLOR(10) TYPE N.
DATA : GD_TAB_GROUP TYPE SLIS_T_SP_GROUP_ALV.
Data: is_fieldcat TYPE slis_fieldcat_alv.
DATA : GD_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA : GD_DATUM TYPE DATUM.
DATA : BEGIN OF WA_TABLE,
MASSN TYPE T529T-MASSN,
MNTXT TYPE T529T-MNTXT,
userg type userg,
TOTAL TYPE I ,
begda type begda,
endda type endda,
april type i,
SLNO TYPE I,
LINE_COLOR(4) TYPE C,
END OF WA_TABLE,
IT_TABLE LIKE TABLE OF WA_TABLE.
data : april type i.
DATA : TEMP TYPE C.
data : LT_PA0000 TYPE TABLE OF PA0000,
LT_PA0000_T typE TABLE OF PA0000 with header line.
DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FCAT LIKE LINE OF IT_FCAT.
DATA : IT_EVENTS TYPE SLIS_T_EVENT,
WA_EVENTS LIKE LINE OF IT_EVENTS.
wa_events-form = 'HEADER'.
WA_EVENTS-NAME = 'TOP_OF_PAGE'.
APPEND WA_EVENTS TO IT_EVENTS.
PERFORM HEADER.
DATA : SLNO TYPE I.
DATA : lv_output TYPE dats.
CALL FUNCTION 'ZHR_RE_BE_CALC_START_DATE'
EXPORTING
id_daberi = sy-datum
IMPORTING
ed_date_cor = lv_output.
select-options...
selection-screen BEGIN OF BLOCK B WITH FRAME TITLE TEXT-003.
select-options : s_date for sy-datum OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B.
lv_output = sy-datum - 27.
INITIALIZATION.
S_DATE-LOW = lv_output.
S_DATE-HIGH = SY-DATUM.
S_DATE-SIGN = 'I'.
S_DATE-OPTION = 'BT'.
APPEND s_date.
*AT SELECTION-SCREEN ON S_DATE.
*SELECT MASSN INTO TABLE IT_TABLE FROM PA0000 WHERE BEGDA IN S_DATE.
*SELECT STATEMENTS....
start-of-selection.
SELECT t529t~MASSN t529t~MNTXT INTO TABLE IT_table FROM T529T where SPRSL EQ 'E' and t529t~massn in ('10','13','16','20','28','30','45','01','03') .
DATUM IN S_DATE.
PERFORM LAYOUT.
loop at it_table into wa_table.
LD_COLOR = 2.
LD_COLOR = LD_COLOR + 1.
if LD_COLOR = 8.
LD_COLOR = 1.
endif.
concatenate 'C' '1' '11' into wa_table-LINE_COLOR . "='C410'.
modify it_table from wa_table.
endloop.
LOOP AT IT_TABLE INTO WA_TABLE." = 'C410'.
select massn from pa0000 into table lt_pa0000 where begda in s_date and massn = wa_table-massn.
*write : / sy-dbcnt. gt s_date-low and endda lt s_date-high
*DESCRIBE TABLE LT_PA0000_t LINES LV_LINES.
move sy-dbcnt to wa_table-total.
READ TABLE lt_pa0000 INTO LT_PA0000_T WITH KEY MASSN = wa_TABLE-MASSN BINARY SEARCH.
DESCRIBE TABLE LT_PA0000_t LINES LV_LINES.
MOVE LV_LINES to wa_TABLE-TOTAL.
MODIFY IT_TABLE FROM WA_TABLE.
MOVE SY-TABIX TO WA_TABLE-SLNO.
MODIFY IT_TABLE FROM WA_TABLE.
REFRESH : LT_PA0000_t.
CLEAR : LV_LINES.
ENDLOOP.
loop at it_table into wa_table.
SELECT MASSN FROM PA0000 INTO TABLE lt_pa0000 where begda between '01.02.2008' and '20.02.2008'.
MOVE SY-DBCNT TO WA_TABLE-APRIL.
MODIFY IT_TABLE FROM WA_TABLE.
*endloop.
*PERFORM STATEMENTS...
PERFORM FCAT USING '1' 'MASSN' 'ACTIONCODE'.
PERFORM FCAT USING '2' 'MNTXT' 'ACTION TYPE'.
PERFORM fcat USING '3' 'TOTAL' 'TOTAL'.
DEFINE m_fieldcat.
is_fieldcat-fieldname = &1.
is_fieldcat-hotspot = &2.
is_fieldcat-seltext_m = &3.
is_fieldcat-col_pos = &4.
is_fieldcat-outputlen = &5.
is_fieldcat-hotspot = &6.
append is_fieldcat to it_fcat.
clear is_fieldcat.
END-OF-DEFINITION.
m_fieldcat 'SLNO' '' Text-012 '1' '17' ''.
m_fieldcat 'MASSN' '' Text-010 '2' '40' ''.
m_fieldcat 'MNTXT' '' Text-009 '3' '50' '' .
m_fieldcat 'TOTAL' '' Text-011 '4' '10' 'X'.
m_fieldcat 'april' '' Text-013 '5' '10' 'X'.
*FOR DISPLAYING THE RECORDS...
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = gd_repid
IS_LAYOUT = GD_LAYOUT
I_CALLBACK_USER_COMMAND = ' '
I_GRID_TITLE = 'REPORT'
IS_LAYOUT = gd_LAYOUT
IT_FIELDCAT = IT_FCAT
I_SAVE = 'X'
IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = IT_TABLE.
**& Form FCAT
*FORM FCAT USING FP_COL_POS
FP_FIELDNAME
FP_SELTEXT_M.
WA_FCAT-COL_POS = FP_COL_POS.
WA_FCAT-FIELDNAME = FP_FIELDNAME.
wa_fcat-seltext_m = fp_seltext_m.
APPEND WA_FCAT TO IT_FCAT.
ENDFORM.
*& Form HEADER
text
--> p1 text
<-- p2 text
form header .
DATA : IT_HEADER TYPE SLIS_T_LISTHEADER,
WA_HEADER LIKE LINE OF it_header.
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = 'ACTION TYPE REPORT'.
APPEND WA_HEADER TO IT_HEADER.
wa_header-typ = 'S'.
wa_header-key = Text-022.
CONCATENATE s_date-low+6(2) '.'
s_date-low+4(2) '.'
s_date-low(4)
temp
'. TO .'
s_date-high+6(2) '.'
s_date-high+4(2) '.'
s_date-high(4)
INTO wa_header-info SEPARATED BY space.
APPEND wa_header TO it_header.
CLEAR wa_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_HEADER
I_LOGO = 'HRRU_51050061'.
*select single bstkd into CORRESPONDING FIELDS OF gt_vbkd
*from vbkd where vbeln = rt_outtab-vgbel
*and posnr = '000000'.
*rt_outtab-bstkd = gt_vbkd-bstkd.
ENDFORM. " HEADER
*& Form LAYOUT
text
--> p1 text
<-- p2 text
FORM LAYOUT .
GD_LAYOUT-NO_INPUT = ''.
gd_layout-colwidth_optimize = ''.
gd_layout-totals_text = 'TOTALS'(201).
gd_layout-info_fieldname = 'LINE_COLOR'.
ENDFORM. " LAYOUT -
Problem in display of text in ALV report
Dear experts,
I am working on a MM Report in which I need to display Material Basic data text maintained in MM01,02 Tcodes through ALV report.
I have declared a string type variable for the Basic data text in the Final Internal Table.
For reading the Standard text I am using Read_Text FM, from which I am looping the Text internal table and concatenating it into
String variable.
What I notice is all the content beyond 255 chars is not getting displayed, Even when the ALV report is downloaded to Excel file.
Can you suggest some approach to over come this issue.
Regards,
MurthyHi,
Use the below code
Data : lt_content TYPE TABLE OF tline,
lw_content TYPE tline.
Data : lt_text Type Table of solisti1,
lw_text TYPE solisti1.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = lv_id
language = tdspras
name = lv_name
object = lv_object
archive_handle = 0
local_cat = ' '
TABLES
lines = lt_content
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
loop at lt_content into lw_content.
lw_text-line = lw_content-tdline.
APPEND lw_text TO lt_text.
CLEAR: lw_content, lw_text.
endloop.
Now your whole text is in "lt_text".
Regards,
Avish Mittal -
Displaying data on an ALV report
Hi Abaper's
I have data that is stored in an internal table and I want to display it in an ALV report, How can I achieve this?
Thanx in advance
ThandieHi,
Try to run the following code you will find the Ans.
TABLES : ekpo.
TYPE-POOLS : slis.
TYPES : BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
matnr TYPE ekpo-matnr,
werks TYPE ekpo-werks,
menge TYPE ekpo-menge,
END OF t_ekpo.
*VARIABLES
DATA : check(1),
rep_id TYPE sy-repid.
*INTERNAL TABLE TYPE OF ZEKPO
DATA : it_ekpo TYPE STANDARD TABLE OF t_ekpo WITH HEADER LINE.
*FIELD CATALOG
DATA : it_field TYPE slis_t_fieldcat_alv,
wa_field TYPE slis_fieldcat_alv.
*SORTING
DATA : it_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv.
INITIALIZATION.
check = 'X'.
rep_id = sy-repid.
START-OF-SELECTION.
SELECT ebeln
ebelp
matnr
werks
menge
FROM ekpo
INTO CORRESPONDING FIELDS OF TABLE it_ekpo.
* FIELD CATALOG
wa_field-fieldname = 'EBELN'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 10.
wa_field-seltext_l = 'PO #'.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'EBELP'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 10.
wa_field-seltext_l = 'Line Item'.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'MATNR'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 15.
wa_field-seltext_l = 'Material'.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'WERKS'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 6.
wa_field-seltext_l = 'Plant'.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'MENGE'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 10.
wa_field-seltext_l = 'Qty.'.
* wa_field-outputlen = 17.
* wa_field-edit = 'X'.
wa_field-do_sum = check.
APPEND wa_field TO it_field.
CLEAR wa_field.
* SORT W.R.T. PURCHASE ORDER NUMBER
wa_sort-spos = 1.
wa_sort-fieldname = 'EBELN'.
wa_sort-tabname = 'IT_EKPO'.
wa_sort-up = check.
wa_sort-subtot = check.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
* DISPLAY RECORDS IN ALV GRID
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = rep_id
it_fieldcat = it_field
it_sort = it_sort
TABLES
t_outtab = it_ekpo
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc = 0.
ENDIF.
Kind Regards,
Faisal -
Displaying special characters in ALV report.
Hi Experts,
Can we display special characters in ALV reports? Special characters such as tick mark.(Like in character map(Font Bookshelf Symbol 7) of windows ).
I tried with icons in ALV report, I was able to display tick icon in the ALV report, but when we export the report in to a excel, the icons comes in as Hexadecimal code.
Can any we display special characters like tick in ALV report or display the icons in excel aswell?
I will be gratefull for the <urgency reduced by moderator> response.
Regards,
Sharath.
Edited by: Thomas Zloch on May 10, 2011 10:26 AMSharath,
I think it is possible to do so.
Please check this link.
http://www.sapfans.com/forums/viewtopic.php?f=13&t=322569
Thanks,
Guru. -
I want to display invoice details(MIRO) in REPORT
Hi,
i am new for abap can any one please send code for to display miro details in a report based on below logic.
Pass the RSEG-BELNR & RSEG-GJAHR joined together into BKPF-AWKEY to get the MIRO Doc date BKPF-BUDAT, vendor invoice number BKPF-XBLNR& Vendor invoice date BKPF-BLDAT.
Pass the RSEG-BELNR & RSEG-GJAHR joined together into BKPF-AWKEY to get the BKPF-BELNR & BKPF-GJAHR to pass this into BSEG-BELNR BSEG-GJAHR to get the BSEG-LIFNR, BSEG-DMBTR, BSEG-ZTERM corresponding to the vendor code.Set the option PRINT OBJECT ON to First Page, I think this might resolve your problem.
-
Performance Issue With Displaying Candidate Details for iRecruitment
We are in EBS R12.1.3 when we trying to display the Candidate Details page in iRecruitment iRecruitment >vacancies>applicants> click on applicant> the page spins for a quite whille to show the results and some times we see the 500 errors..
We are in R12.1.3 and also applied the Patch.10427777:R12.IRC.B patch.. is there any tunnign steps for the iRecruitment page=/oracle/apps/irc/candidateSearch/webui/CmAplSrchPGYou have already applied the patch mention in note: Performance Issue With Displaying Candidate Details Page in 12.1.3 (Doc ID 1293164.1)
check this note also Performance Issue when Clicking on Candidate Name (Doc ID 1575164.1)
thanks -
Displaying selection screen details in Alv Report output display as Header
Hi all,
May be somebody knows how I can show selected values with select-options in top_of_page using REUSE_ALV_GRID_DISPLAY.
This shoud work for all the reports and diff selection screens .
I need one dynamic process which will for display any report selection screen selected details.(Basically varient information of report).
Small example if possible, please.
Thanks in advance,
RimasHi Thiru,
Thanks for the input.
This is my exact requirement.
Hi Experts,
I would like to Display / Print Select-options selected details in ALV Header.
Ex: Say suppose here i enter kunnr as 1000
lifnr as 2000 to 4000
p_langu as 'EN'.
p_dir as 'C:\TEMP,
p_upda as 'X'
for selection screen below.
SELECTION-SCREEN :BEGIN OF BLOCK blk1 WITH FRAME TITLE text-000.
SELECT-OPTIONS : s_kunnr FOR kna1-kunnr.
SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr.
PARAMETER : p_lanuge LIKE t002-spras DEFAULT sy-langu.
PARAMETER: p_dir LIKE rlgrap-filename
DEFAULT text-003 LOWER CASE.
PARAMETERS: p_upd AS CHECKBOX DEFAULT 'X'.
I dont want to Hard code selection screen values like
DATA: header TYPE slis_t_listheader,
wa TYPE slis_listheader,
wa-typ = 'S'(093).
wa-key = s_lifnr .
wa-info = 'Vendor no".
APPEND wa TO header.
I want dynamic process for all of my selection screen values selected
hard code may be it will be fine small selection screen it will work.
Fur that i got one process to get dynamically through fm
Ex: DATA: irsparams TYPE rsparams OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = program
TABLES
selection_table = irsparams
EXCEPTIONS
not_found = 1
no_report = 2
OTHERS = 3.
loop at irsparams.
write : / irsparams-SELNAME.
write : / irsparams-SIGN.
write : / irsparams-OPTION.
write : / irsparams-LOW.
write : / irsparams-HIGH.
endloop.
I have done my requirement partially but i am failed to achive my full requirement.
Because
rsparams strcture is diff from slis_t_listheader.
Can any one help me for further assistence to display irsparams strcture data in alv header.
Thanks
Nag -
Hi,
i need to display a report using ALV in the following manner. im using reuse_alv_listdisplay and the display is fine . however, i need to add a header to the list and i need to display total for the currency fields. how can i do that. your help would be appreciated.
Thanks,
kranthi.
________some company header----
alv report----
display total for currency fields------
i appreciate all of you for your quick response.
i need to call a function module which uses couple of 'write' statements to create the header. is it possible to use that in this context.
Thanks,
Kranthi.
Message was edited by: kranthi kumar*& Report ZVENU_ALV *
Program: ZZ_ALV_REPORT_STUB
Author :
Date :
Purpose: Report using ALV function
Notes:
1) Logos & wallpapers can be found in table BDS_CONN05
with class = PICTURES
2) Transaction OAER can be used to create PICTURES.
Run transaction OAER with class name = PICTURES, Class type = OT,
and Object key with whatever name you want to create. In the
next screen, right clicking on screen and import
Revisions
Name :
Date :
Comments:
report zz_alv_report_stub
no standard page heading
line-size 200
line-count 65
message-id zz.
Tables
tables:
ekpo,
trdir.
Global Types
type-pools: slis.
Global Internal Tables
data:
i_fieldcat_alv type slis_t_fieldcat_alv,
i_events type slis_t_event,
i_event_exit type slis_t_event_exit,
i_list_comments type slis_t_listheader,
i_excluding type slis_t_extab.
Display data
data: begin of i_data occurs 0,
name like trdir-name,
clas like trdir-clas,
subc like trdir-subc,
cnam like trdir-cnam,
cdat like trdir-cdat,
myfield(1) type c,
end of i_data.
Global Variables
data:
w_variant like disvariant,
wx_variant like disvariant,
w_variant_save(1) type c,
w_exit(1) type c,
w_repid like sy-repid,
w_user_specific(1) type c,
w_callback_ucomm type slis_formname,
w_print type slis_print_alv,
w_layout type slis_layout_alv,
w_html_top_of_page type slis_formname,
w_fieldcat_alv like line of i_fieldcat_alv,
w_excluding like line of i_excluding,
w_events like line of i_events,
w_event_exit like line of i_event_exit,
w_list_comments like line of i_list_comments.
Global Constants
*constants:
Selection Screen
selection-screen begin of block blk_criteria with frame title text-f01.
select-options:
s_name for trdir-name.
selection-screen end of block blk_criteria.
selection-screen begin of block blk_params with frame title text-f02.
parameters:
p_vari like disvariant-variant.
selection-screen skip 1.
parameters:
p_grid radiobutton group rb01 default 'X',
p_html as checkbox.
selection-screen skip 1.
parameters:
p_list radiobutton group rb01.
selection-screen end of block blk_params.
Initialization
initialization.
perform init_variant.
perform variant_default using p_vari.
clear: s_name[].
s_name-sign = 'I'.
s_name-option = 'CP'.
s_name-low = 'Z*'.
append s_name.
At Selection Screen PBO
at selection-screen output.
At Selection Screen Value Request
at selection-screen on value-request for p_vari.
perform variant_f4 using p_vari.
At Selection Screen
at selection-screen.
perform variant_fill.
Start of Selection
start-of-selection.
perform get_data.
end-of-selection.
perform fieldcat_build.
perform event_build.
perform event_exit_build.
perform exclude_build.
perform print_build.
perform layout_build.
perform display_data.
Top of Page
top-of-page.
Top of Page During Line Sel
top-of-page during line-selection.
At User Command
at user-command.
At Line Selection
at line-selection.
Macros
define skip_1.
write: /001 sy-vline,
at sy-linsz sy-vline.
end-of-definition.
Forms
*& Form variant_f4
form variant_f4 using p_variant.
call function 'LVC_VARIANT_F4'
exporting
is_variant = w_variant
i_save = w_variant_save
importing
e_exit = w_exit
es_variant = wx_variant
exceptions
not_found = 1
program_error = 2
others = 3.
if sy-subrc <> 0.
message i000(zz) with text-g01.
endif.
if w_exit is initial.
w_variant-variant = wx_variant-variant.
p_variant = wx_variant-variant.
endif.
endform.
*& Form init_variant
form init_variant.
clear: w_variant.
w_repid = sy-repid.
w_variant-report = w_repid.
w_variant-username = sy-uname.
w_variant_save = 'A'. "All types
endform.
*& Form variant_default
form variant_default using p_variant.
wx_variant = w_variant.
if not p_variant is initial.
wx_variant-variant = p_variant.
endif.
call function 'LVC_VARIANT_DEFAULT_GET'
exporting
i_save = w_variant_save
changing
cs_variant = wx_variant
exceptions
wrong_input = 1
not_found = 2
program_error = 3
others = 4.
case sy-subrc.
when 0.
p_variant = wx_variant-variant.
when 2.
clear: p_variant.
endcase.
endform.
*& Form variant_fill
form variant_fill.
clear: w_variant.
if p_vari is initial.
w_variant-variant = 'STANDARD'.
w_variant-report = w_repid.
else.
w_variant-variant = p_vari.
w_variant-report = w_repid.
call function 'LVC_VARIANT_EXISTENCE_CHECK'
exporting
i_save = w_variant_save
changing
cs_variant = w_variant
exceptions
others = 01.
if sy-subrc ne 0.
message i000(zz) with text-g02.
endif.
endif.
endform.
*& Form fieldcat_build
form fieldcat_build.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = w_repid
i_structure_name = 'TRDIR'
i_internal_tabname = 'I_DATA'
i_inclname = w_repid
changing
ct_fieldcat = i_fieldcat_alv.
Modify displayed fields
loop at i_fieldcat_alv into w_fieldcat_alv.
case w_fieldcat_alv-fieldname.
when 'NAME'.
w_fieldcat_alv-hotspot = 'X'.
when 'MYFIELD'.
w_fieldcat_alv-checkbox = 'X'.
w_fieldcat_alv-seltext_s = 'MyChkBox'.
when others.
endcase.
modify i_fieldcat_alv from w_fieldcat_alv.
endloop.
endform.
*& Form display_data
form display_data.
w_callback_ucomm = 'CALLBACK_UCOMM'.
case 'X'.
when p_grid.
if p_html = 'X'.
w_html_top_of_page = 'HTML_TOP_OF_PAGE'.
endif.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_background_id = 'SIWB_WALLPAPER'
i_background_id = 'SIWB_WALLPAPER'
i_callback_program = w_repid
i_callback_html_top_of_page = w_html_top_of_page
i_structure_name = 'TRDIR'
i_default = 'X'
i_save = 'A'
is_variant = w_variant
is_layout = w_layout
i_callback_user_command = w_callback_ucomm
it_fieldcat = i_fieldcat_alv
it_events = i_events
it_event_exit = i_event_exit
it_excluding = i_excluding
is_print = w_print
i_screen_start_column = 1
i_screen_start_line = 1
i_screen_end_column = 70
i_screen_end_line = 30
tables
t_outtab = i_data.
when p_list.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_background_id = 'ALV_BACKGROUND'
i_callback_program = w_repid
i_default = 'X'
i_save = 'A'
is_variant = w_variant
is_layout = w_layout
i_callback_user_command = w_callback_ucomm
it_fieldcat = i_fieldcat_alv
it_events = i_events
it_event_exit = i_event_exit
is_print = w_print
tables
t_outtab = i_data.
endcase.
endform.
FORM user_command *
form callback_ucomm using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
message i000(zz) with r_ucomm.
case r_ucomm.
when '&IC1'.
set parameter id 'RID' field rs_selfield-value.
call transaction 'SE38'.
when others.
endcase.
endform.
*& Form get_data
form get_data.
select * up to 15 rows from trdir
into corresponding fields of table i_data
where name in s_name.
endform.
FORM ALV_TOP_OF_PAGE *
form alv_top_of_page.
clear: i_list_comments[].
w_list_comments-typ = 'H'. "H=Header, S=Selection, A=Action
w_list_comments-key = ''.
w_list_comments-info = 'Info 1'.
append w_list_comments to i_list_comments.
w_list_comments-typ = 'A'. " H = Header, S = Selection, A = Action
w_list_comments-key = ''.
w_list_comments-info = 'Begin of list'.
append w_list_comments to i_list_comments.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = i_list_comments.
endform.
*& Form event_build
form event_build.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = i_events.
read table i_events
with key name = slis_ev_top_of_page
into w_events.
if sy-subrc = 0.
move 'ALV_TOP_OF_PAGE' to w_events-form.
modify i_events from w_events index sy-tabix.
endif.
read table i_events
with key name = slis_ev_end_of_list
into w_events.
if sy-subrc = 0.
move 'ALV_END_OF_LIST' to w_events-form.
modify i_events from w_events index sy-tabix.
endif.
read table i_events
with key name = slis_ev_end_of_page
into w_events.
if sy-subrc = 0.
move 'ALV_END_OF_PAGE' to w_events-form.
modify i_events from w_events index sy-tabix.
endif.
endform.
FORM alv_end_of_list *
form alv_end_of_list.
clear: i_list_comments[].
w_list_comments-typ = 'A'. "H = Header, S = Selection, A = Action
w_list_comments-key = ''.
w_list_comments-info = 'End of list'.
append w_list_comments to i_list_comments.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = i_list_comments
i_logo = 'ZMYOBJECTKEY'
i_end_of_list_grid = 'X'.
endform.
FORM alv_end_of_page *
form alv_end_of_page.
endform.
*& Form print_build
form print_build.
w_print-no_print_listinfos = 'X'.
endform.
*& Form layout_build
form layout_build.
w_layout-zebra = 'X'.
w_layout-no_vline = 'X'.
w_layout-colwidth_optimize = 'X'.
w_layout-detail_popup = 'X'.
w_layout-detail_initial_lines = 'X'.
w_layout-detail_titlebar = 'Detail Title Bar'.
endform.
*& Form event_exit_build
form event_exit_build.
clear: i_event_exit[].
Pick
w_event_exit-ucomm = '&ETA'.
w_event_exit-before = ' '.
w_event_exit-after = 'X'.
append w_event_exit to i_event_exit.
endform.
FORM HTML_TOP_OF_PAGE *
form html_top_of_page using r_top type ref to cl_dd_document.
data:
text type sdydo_text_element,
s_table type ref to cl_dd_table_element,
col_key type ref to cl_dd_area,
col_info type ref to cl_dd_area,
a_logo type ref to cl_dd_area.
Split TOP-Document
call method r_top->vertical_split
exporting split_area = r_top
split_width = '30%'
importing right_area = a_logo.
Fill TOP-Document
call method r_top->add_text
exporting text = 'Example of a Heading'
sap_style = 'HEADING'.
call method r_top->new_line.
call method r_top->new_line.
call method r_top->add_table
exporting no_of_columns = 2
with_heading = ' '
border = '1'
importing table = s_table.
call method s_table->add_column importing column = col_key.
call method s_table->add_column importing column = col_info.
text = 'A key value marked'.
call method col_key->add_text
exporting text = text
sap_emphasis = 'Strong'.
call method col_info->add_gap exporting width = 6.
text = '600' .
call method col_info->add_text
exporting text = text
sap_style = 'Key'.
call method col_info->add_gap exporting width = 3.
text = 'Block brick units'.
call method col_info->add_text exporting text = text.
call method s_table->new_row.
text = 'Storage Bin'.
call method col_key->add_text
exporting text = text
sap_emphasis = 'Strong'.
call method col_info->add_gap exporting width = 7.
text = 'C-A-004'.
call method col_info->add_text exporting text = text.
call method s_table->new_row.
text = 'Warehouse number' .
call method col_key->add_text
exporting text = text
sap_emphasis = 'Strong'.
call method col_info->add_gap exporting width = 6.
text = '200' .
call method col_info->add_text
exporting text = text
sap_style = 'Success'.
call method col_info->add_gap exporting width = 3.
text = 'marked success'.
call method col_info->add_text exporting text = text.
call method s_table->new_row.
call method r_top->new_line.
text = 'This last line is a comment in italics.'.
call method r_top->add_text
exporting text = text
sap_emphasis = 'EMPHASIS'.
call method r_top->new_line.
call method a_logo->add_picture
exporting picture_id = 'ZZTESTBMP'.
exporting picture_id = 'ENJOYSAP_LOGO'.
endform.
*& Form exclude_build
form exclude_build.
w_excluding = '&GRAPH'. "Graphic
append w_excluding to i_excluding.
endform. " exclude_build -
Header prob. in ALV report
Hi All,
Hope you all are doing fine!!!
In the below program am trying to print the top-of-page/header in alv report,,but am unable to do it..
Am working on 4.6c version,,,,,its working fine in ECC 6.0 but i really dont understand why its not working in 4.6c...AM JUST PASTING THE ALV PART...!!!
Pls. do the needful
REPORT yjack LINE-SIZE 132
LINE-COUNT 65
NO STANDARD PAGE HEADING.
DATA: /sie/swe_ag0_rdo TYPE /sie/swe_ag0_rdo,
wa_tvko TYPE tvko,
/sie/swe_ag0_raa TYPE /sie/swe_ag0_raa,
wa_kna1 TYPE kna1,
wa_t001 TYPE t001,
wa_tvkot TYPE tvkot,
/sie/swe_ag0_con TYPE /sie/swe_ag0_con,
/sie/swe_ag0_r02 TYPE /sie/swe_ag0_r02.
TYPES: BEGIN OF ty_itab,
bukrs TYPE /sie/swe_ag0_rdo-bukrs,
vkorg TYPE /sie/swe_ag0_rdo-vkorg,
zclpr TYPE /sie/swe_ag0_rdo-zclpr,
zcdaz TYPE /sie/swe_ag0_rdo-zcdaz,
vbeln TYPE /sie/swe_ag0_rdo-vbeln,
posnr TYPE /sie/swe_ag0_rdo-posnr,
vbtyp TYPE /sie/swe_ag0_rdo-vbtyp,
zidag TYPE /sie/swe_ag0_rdo-zidag,
zimpp TYPE /sie/swe_ag0_rdo-zimpp,
zimco TYPE /sie/swe_ag0_rdo-zimco,
zimmg TYPE /sie/swe_ag0_rdo-zimmg,
fkdat TYPE /sie/swe_ag0_rdo-fkdat,
zstre TYPE /sie/swe_ag0_rdo-zstre,
vtweg TYPE /sie/swe_ag0_rdo-vtweg,
kunrg TYPE /sie/swe_ag0_rdo-kunrg,
END OF ty_itab.
TYPES: BEGIN OF ty_itab2,
bukrs TYPE /sie/swe_ag0_rdo-bukrs,
vkorg TYPE /sie/swe_ag0_rdo-vkorg,
zcdaz TYPE /sie/swe_ag0_rdo-zcdaz,
fkdat TYPE /sie/swe_ag0_rdo-fkdat,
vbeln TYPE /sie/swe_ag0_rdo-vbeln,
zimpp TYPE /sie/swe_ag0_rdo-zimpp,
zimco(5) TYPE p DECIMALS 2,
zimmg(5) TYPE p DECIMALS 2,
resid(6) TYPE p DECIMALS 2,
kunrg TYPE /sie/swe_ag0_rdo-kunrg,
name1 TYPE kna1-name1,
END OF ty_itab2.
type-pools: slis.
types: begin of ty_final,
bukrs type char29,
vkorg type char24,
mese type char17,
gjahr type gjahr,
agent type char45,
vbeln type vbeln,
fkdat type fkdat,
zimpp type /SIE/SWE_AG0_ZIMPP,
zimco type /SIE/SWE_AG0_ZIMCO,
zimmg type /SIE/SWE_AG0_ZIMMG,
resid(5) TYPE p DECIMALS 2,
kunrg type kunrg,
name1 type NAME1_GP,
end of ty_final.
data: it_final type table of ty_final,
wa_final type ty_final,
g_bukrs(29) type c,
g_vkorg(24) type c.
data: it_fieldcat type slis_t_fieldcat_alv,
it_layout type slis_layout_alv,
it_list_top_of_page type slis_t_listheader,
it_events type slis_t_event,
wa_events type slis_alv_event,
it_headings type slis_t_listheader,
wa_headings type slis_listheader.
constants: c_h type c value 'H',
c_s type c value 'S'.
field-symbols: <fs_final> type ty_final.
DATA: it_itab TYPE TABLE OF ty_itab,
it_itab2 TYPE TABLE OF ty_itab2,
wa_itab TYPE ty_itab,
wa_itab2 TYPE ty_itab2.
DATA: wa_app TYPE ty_itab.
DATA: w_var TYPE c VALUE '1',
w_com_mese(9) TYPE c,
w_flag_st TYPE c.
$$ Selection-screen
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK parametri WITH FRAME TITLE text-001.
BEG MOD ESX00596 IMS:100276414 TR:SWIK9A04W7 11.04.2007
*PARAMETERS: p_bukrs LIKE /sie/swe_ag0_rdo-bukrs OBLIGATORY.
*PARAMETERS: p_vkorg LIKE /sie/swe_ag0_rdo-vkorg OBLIGATORY.
PARAMETERS: p_bukrs TYPE /sie/swe_ag0_rdo-bukrs OBLIGATORY.
PARAMETERS: p_vkorg TYPE /sie/swe_ag0_rdo-vkorg OBLIGATORY.
SELECT-OPTIONS: s_zcdaz FOR /sie/swe_ag0_rdo-zcdaz OBLIGATORY
MATCHCODE OBJECT /sie/swe_ag0_zaa.
PARAMETERS: mese(2) TYPE n OBLIGATORY,
anno TYPE /sie/swe_ag0_rdo-gjahr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK parametri.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: c1 AS CHECKBOX.
SELECTION-SCREEN COMMENT 8(31) text-006 FOR FIELD c1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN: END OF BLOCK b1.
DATA: w_cd_a TYPE /sie/swe_ag0_rdo-vtweg,
w_cd_gen TYPE /sie/swe_ag0_rdo-vtweg,
w_cd_di TYPE /sie/swe_ag0_rdo-vtweg,
w_cd_re TYPE /sie/swe_ag0_rdo-vtweg,
w_cd_te TYPE /sie/swe_ag0_rdo-vtweg,
w_cd_ca TYPE /sie/swe_ag0_rdo-vtweg.
INITIALIZATION.
PERFORM selezione_hard_coding.
$$ At selection-screen
AT SELECTION-SCREEN.
PERFORM controlli.
$$ Top-of-page
TOP-OF-PAGE.
PERFORM top_of_page.
$$ Start-of-selection
START-OF-SELECTION.
perform build_events.
PERFORM carica_itab.
PERFORM carica_itab2.
PERFORM stampa.
END-OF-SELECTION.
IF C1 EQ 'X'.
perform fill-fieldcatalog.
perform display_alv.
ENDIF.
*& Form fill-fieldcatalog
text
--> p1 text
<-- p2 text
form fill-fieldcatalog.
data: l_fieldcat TYPE slis_fieldcat_alv.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'BUKRS'.
l_fieldcat-col_pos = 1.
l_fieldcat-seltext_l = 'Company'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'VKORG'.
l_fieldcat-col_pos = 2.
l_fieldcat-seltext_l = 'Comm. Organization'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'MESE'.
l_fieldcat-col_pos = 3.
l_fieldcat-seltext_l = 'Month'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'GJAHR'.
l_fieldcat-col_pos = 4.
l_fieldcat-seltext_l = 'Year'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'AGENT'.
l_fieldcat-col_pos = 5.
l_fieldcat-seltext_l = 'AGENT'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'VBELN'.
l_fieldcat-col_pos = 6.
l_fieldcat-seltext_l = 'Invoice'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'FKDAT'.
l_fieldcat-col_pos = 7.
l_fieldcat-seltext_l = 'Date'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'ZIMPP'.
l_fieldcat-col_pos = 8.
l_fieldcat-seltext_l = 'Taxable'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'ZIMCO'.
l_fieldcat-col_pos = 9.
l_fieldcat-seltext_l = 'Tot.Comm.'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'ZIMMG'.
l_fieldcat-col_pos = 10.
l_fieldcat-seltext_l = 'Settle'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'RESID'.
l_fieldcat-col_pos = 11.
l_fieldcat-seltext_l = 'Accruing'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'KUNRG'.
l_fieldcat-col_pos = 12.
l_fieldcat-seltext_l = 'Cust.Code'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
l_fieldcat-tabname = 'IT_FINAL'.
l_fieldcat-fieldname = 'NAME1'.
l_fieldcat-col_pos = 13.
l_fieldcat-seltext_l = 'Company Name'.
APPEND l_fieldcat TO it_fieldcat.
clear l_fieldcat.
endform. " fill-fieldcatalog
*& Form display_alv
text
--> p1 text
<-- p2 text
form display_alv.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_TOP_OF_PAGE = 'PRINT_HEADING'
IS_LAYOUT = it_layout
IT_FIELDCAT = it_fieldcat
IT_EVENTS = it_events
TABLES
t_outtab = it_final
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
*& Form build_events
text
-->P_IT_EVENTS[] text
form build_events.
clear wa_events.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = it_events.
read table it_events into wa_events with key name = 'TOP_OF_PAGE'.
if sy-subrc eq 0.
wa_events-form = 'PRINT_HEADING'.
modify it_events from wa_events transporting form
where name = 'TOP_OF_PAGE'.
endif.
endform. " build_events
form PRINT_HEADING.
clear wa_headings.
wa_headings-typ = 'H'.
wa_headings-info = 'DEMO FOR ALV!!!'.
append wa_headings to it_headings.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_headings.
endform.
Thanks n Regards
JackHi friend,
I think u have to remove below lines in your program because FM 'REUSE_ALV_GRID_DISPLAY' will call directly Form 'PRINT_HEADING' for TOP-OF-PAGE event through table 'it_events' :
Remove lines:
TOP-OF-PAGE.
PERFORM top_of_page.
Also remove the parameter
I_CALLBACK_TOP_OF_PAGE = 'PRINT_HEADING' in FM 'REUSE_ALV_GRID_DISPLAY'
Also put a breakpoint in your program in the line,
START-OF-SELECTION.
perform build_events.
See whether 'form' 'name' gets populated in table 'it_events' or not.
See sample report and compare.
REPORT zawi_assign3 NO STANDARD PAGE HEADING.
TYPE-POOLS: slis.
DATA: BEGIN OF gt_outtab OCCURS 0.
INCLUDE STRUCTURE ekpo.
DATA: END OF gt_outtab,
gs_layout TYPE slis_layout_alv,
g_exit_caused_by_caller,
gs_exit_caused_by_user TYPE slis_exit_by_user,
g_repid LIKE sy-repid.
DATA:
gt_events TYPE slis_t_event,
gt_list_top_of_page TYPE slis_t_listheader,
g_status_set TYPE slis_formname VALUE 'PF_STATUS_SET',
g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
g_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
g_top_of_list TYPE slis_formname VALUE 'TOP_OF_LIST',
g_end_of_list TYPE slis_formname VALUE 'END_OF_LIST'.
DATA: gs_variant LIKE disvariant,
g_save.
INITIALIZATION.
g_repid = sy-repid.
PERFORM layout_init USING gs_layout.
PERFORM eventtab_build USING gt_events[].
gs_variant-report = g_repid.
g_save = 'X'.
START-OF-SELECTION.
PERFORM select_data TABLES gt_outtab.
END-OF-SELECTION.
PERFORM comment_build USING gt_list_top_of_page[].
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_background_id = 'ALV_BACKGROUND'
i_buffer_active = 'X'
i_callback_program = g_repid
i_structure_name = 'ekpo'
is_layout = gs_layout
i_save = g_save
is_variant = gs_variant
it_events = gt_events[]
IMPORTING
e_exit_caused_by_caller = g_exit_caused_by_caller
es_exit_caused_by_user = gs_exit_caused_by_user
TABLES
t_outtab = gt_outtab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc = 0.
IF g_exit_caused_by_caller = 'X'.
ELSE.
IF gs_exit_caused_by_user-back = 'X'.
ELSE.
IF gs_exit_caused_by_user-exit = 'X'.
ELSE.
IF gs_exit_caused_by_user-cancel = 'X'.
ELSE.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
ENDIF.
FORM select_data TABLES rt_outtab LIKE gt_outtab[].
SELECT * FROM ekpo INTO CORRESPONDING FIELDS
OF TABLE rt_outtab
UP TO 00030 ROWS.
ENDFORM. "SELECT_DATA
FORM layout_init USING rs_layout TYPE slis_layout_alv.
rs_layout-detail_popup = 'X'.
rs_layout-edit = 'X'.
ENDFORM. "LAYOUT_INIT
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.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = rt_events.
READ TABLE rt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE g_top_of_page TO ls_event-form.
APPEND ls_event TO rt_events.
ENDIF.
ENDFORM. "EVENTTAB_BUILD
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = gt_list_top_of_page.
ENDFORM. "TOP_OF_PAGE
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'.
ls_line-info = text-100.
APPEND ls_line TO lt_top_of_page.
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-key = 'Program'.
ls_line-info = sy-repid.
APPEND ls_line TO lt_top_of_page.
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-key = 'User'.
ls_line-info = sy-uname.
APPEND ls_line TO lt_top_of_page.
ENDFORM. "COMMENT_BUILD
Might solve your problem.
Thanks.
Edited by: Sap Fan on Feb 20, 2009 9:50 AM
Edited by: Sap Fan on Feb 20, 2009 9:52 AM
Edited by: Sap Fan on Feb 20, 2009 9:54 AM -
To display the date in ALV report
Hi All,
In the header part of the ALV report, how to write a particular date by the day,month & year and simultaneously how to get the orders due for the week with displaying the weekend date..by the day, month & year.
example :
monday, december 16 2007
orders for the weekend : sunday, december 22 2007.
**and the orders will be displayed here..**
How to get it? is there any function module to display as such, <REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 21, 2008 10:42 AMHi,
Please refer to the below code:
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.
*Use FM DATE_TO_DAY to get the day, month and year by specifying the date.
*Date
wa_header-typ = 'H'.
wa_header-info = <variable>.
append wa_header to t_header.
clear wa_header.
* Time
wa_header-typ = 'H'.
wa_header-info = <variable>.
append wa_header to t_header.
clear wa_header.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
* i_logo = 'Z_LOGO'.
endform.
Thanks,
Sriram Ponna.
Maybe you are looking for
-
My Google Calendar will not show up on iPhone 4S with iOS 7.1.1. What do?
I just got an iPhone 4S (bougtt used through a third party, in case it may make a difference) and I'm having issues connecting Google's calendar. I've followed instructions here: http://michaelhyatt.com/how-to-setup-google-calendar-on-your-iphone-4.h
-
Cubase (both SE and LE) hangs _every_time_ I try to do this!
I just bought Audigy 4 today, and it seems to me that it has a bug that renders it completely useless to me... I hope that someone will help me, otherwise I will be really dissapointed. Here's the problem: 1. I set Cubase to use ASIO drivers (does no
-
[Scopes] Execute command in specific scope
Hello fellow Powershell users, I am currently looking for a way to execute a command in a specific scope of my choice. While some commands offer a choice in how they do that, many do not. Any ideas on how to do this? Background: I occasionally find i
-
Why i get low quality videos on my iphone but it looks fine on the phone it was recorded
low quality videos
-
I have an epson cx2400 which doesnt come with icc profiles (Just a generic profile) so I struggled to get decent prints until discovered that letting the printer manage the process in lightroom gives good results. But, I would like to use Aperture 2