Regarding alv heading
hi,
i had made a report which is showing correct data but now i want to display the heading and other fields which are used to be dere:-
<b>PHYSICAL INVENTORY REPORT</b>
PERIOD:- ___ TO ___ PLANT:-_________
CONTROL NO. :- ______
CONTROL DATE :- _____
I am not able to display dis format in my alv report, so plzzz help me out as it is most urgent to me and u will definately get rewards for it....
Regards,
ric.s
refer this code....
use events top of page or top of list whatever u want.....n put required fields....
REPORT ZALV1.
******************TABLE DECLARATION***********************************
TABLES : VBAP. " tables declaration
*****************TYPE POOLS*******************************************
TYPE-POOLS : SLIS. " slis type pool
*****************INTERNAL TABLE DECLARATION***************************
DATA : BEGIN OF IT_VBAP OCCURS 0,
" internal table for sales document item
VBELN LIKE VBAP-VBELN, " sales document
POSNR LIKE VBAP-POSNR, " document item
ERNAM LIKE VBAP-ERNAM,
" name of the person who created the object
ERDAT LIKE VBAP-ERDAT, " date on which the record was created
MATNR LIKE VBAP-MATNR. " material number
DATA : END OF IT_VBAP.
DATA : BEGIN OF IT_MARA OCCURS 0, " general material data
MATNR LIKE MARA-MATNR, " material number
ERNAM LIKE MARA-ERNAM,
" name of the person who created the object
MATKL LIKE MARA-MATKL, " material group
MEINS LIKE MARA-MEINS, " base unit of measure
PSTAT LIKE MARA-PSTAT. " maintainence status
DATA : END OF IT_MARA.
******************VARIABLE
DECLARATION**********************************
DATA : REPID LIKE SY-REPID. " program name
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
" field catalog table for vbap
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA : IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
" field catalog table for mara
WA_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.
DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA: GT_XEVENTS TYPE SLIS_T_EVENT.
DATA: GT_YEVENTS TYPE SLIS_T_EVENT. " events table
DATA : XS_EVENT TYPE SLIS_ALV_EVENT. " events type
DATA : GT_PRINT TYPE SLIS_PRINT_ALV. " print table
*******************MULTIPLE SELECT INPUT
PARAMETERS**********************
SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.
" multiple selection for sales document
******************INITIALIZATION**************************************
INITIALIZATION.
REPID = SY-REPID.
*******************START OF
SELECTION************************************
START-OF-SELECTION.
PERFORM POP_VBAP.
" populating the table with document item data
PERFORM POP_MARA.
" populating the table with general material data
PERFORM FIELD_CAT.
" mapping the fields for the field catalog
PERFORM EVENTS. " using the events
PERFORM BLOCK_LIST.
" displaying the data in blocked list
*& Form field_cat
text
--> p1 text
<-- p2 text
FORM FIELD_CAT .
WA_FIELDCAT-FIELDNAME = 'VBELN'.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.
WA_FIELDCAT-COL_POS = 1.
WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'POSNR'.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-SELTEXT_L = 'DOC ITEM'.
WA_FIELDCAT-COL_POS = 2.
WA_FIELDCAT-OUTPUTLEN = 6.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ERNAM'.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-SELTEXT_L = 'NAME'.
WA_FIELDCAT-COL_POS = 3.
WA_FIELDCAT-OUTPUTLEN = 12.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ERDAT'.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-SELTEXT_L = 'DATE'.
WA_FIELDCAT-COL_POS = 4.
WA_FIELDCAT-OUTPUTLEN = 8.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-SELTEXT_L = 'MAT NO'.
WA_FIELDCAT-COL_POS = 5.
WA_FIELDCAT-OUTPUTLEN = 18.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT1-FIELDNAME = 'MATNR'.
WA_FIELDCAT1-TABNAME = 'IT_MARA'.
WA_FIELDCAT1-SELTEXT_L = 'MAT NO'.
WA_FIELDCAT1-COL_POS = 1.
WA_FIELDCAT1-OUTPUTLEN = 18.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-FIELDNAME = 'ERNAM'.
WA_FIELDCAT1-TABNAME = 'IT_MARA'.
WA_FIELDCAT1-SELTEXT_L = 'NAME'.
WA_FIELDCAT1-COL_POS = 2.
WA_FIELDCAT1-OUTPUTLEN = 12.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-FIELDNAME = 'MATKL'.
WA_FIELDCAT1-TABNAME = 'IT_MARA'.
WA_FIELDCAT1-SELTEXT_L = 'MAT DESC'.
WA_FIELDCAT1-COL_POS = 3.
WA_FIELDCAT1-OUTPUTLEN = 9.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-FIELDNAME = 'MEINS'.
WA_FIELDCAT1-TABNAME = 'IT_MARA'.
WA_FIELDCAT1-SELTEXT_L = 'UNITS'.
WA_FIELDCAT1-COL_POS = 4.
WA_FIELDCAT1-OUTPUTLEN = 3.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-FIELDNAME = 'PSTAT'.
WA_FIELDCAT1-TABNAME = 'IT_MARA'.
WA_FIELDCAT1-SELTEXT_L = 'STATUS'.
WA_FIELDCAT1-COL_POS = 5.
WA_FIELDCAT1-OUTPUTLEN = 15.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
ENDFORM. " field_cat
*& Form events
text
--> p1 text
<-- p2 text
FORM EVENTS .
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_END_OF_PAGE.
XS_EVENT-FORM = 'XEND_OF_PAGE'.
APPEND XS_EVENT TO GT_XEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
XS_EVENT-FORM = 'XTOP_OF_PAGE'.
APPEND XS_EVENT TO GT_XEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_TOP_OF_LIST.
XS_EVENT-FORM = 'XTOP_OF_LIST'.
APPEND XS_EVENT TO GT_XEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_END_OF_LIST.
XS_EVENT-FORM = 'XEND_OF_LIST'.
APPEND XS_EVENT TO GT_XEVENTS.
CLEAR XS_EVENT.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_END_OF_PAGE.
XS_EVENT-FORM = 'YEND_OF_PAGE'.
APPEND XS_EVENT TO GT_YEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
XS_EVENT-FORM = 'YTOP_OF_PAGE'.
APPEND XS_EVENT TO GT_YEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_TOP_OF_LIST.
XS_EVENT-FORM = 'YTOP_OF_LIST'.
APPEND XS_EVENT TO GT_YEVENTS.
CLEAR XS_EVENT.
XS_EVENT-NAME = SLIS_EV_END_OF_LIST.
XS_EVENT-FORM = 'YEND_OF_LIST'.
APPEND XS_EVENT TO GT_YEVENTS.
ENDFORM. " events
*& Form XTOP_OF_PAGE
text
FORM XTOP_OF_PAGE.
BREAK-POINT.
WRITE: / 'X_TOP_OF_PAGE'.
ENDFORM. "XTOP_OF_PAGE
FORM XTOP_OF_LIST *
FORM XTOP_OF_LIST.
BREAK-POINT.
WRITE: / 'X_TOP_OF_LIST'.
ENDFORM. "XTOP_OF_LIST
FORM XEND_OF_PAGE *
FORM XEND_OF_PAGE.
BREAK-POINT.
WRITE: / 'X_END_OF_PAGE'.
ENDFORM. "XEND_OF_PAGE
FORM XEND_OF_LIST *
FORM XEND_OF_LIST.
BREAK-POINT.
WRITE: / 'X_END_OF_LIST'.
ENDFORM. "XEND_OF_LIST
FORM YTOP_OF_PAGE.
BREAK-POINT.
WRITE: / 'Y_TOP_OF_PAGE'.
ENDFORM. "YTOP_OF_PAGE
FORM YTOP_OF_LIST *
FORM YTOP_OF_LIST.
BREAK-POINT.
WRITE: / 'Y_TOP_OF_LIST'.
ENDFORM. "YTOP_OF_LIST
FORM YEND_OF_PAGE *
FORM YEND_OF_PAGE.
BREAK-POINT.
WRITE: / 'Y_END_OF_PAGE'.
ENDFORM. "YEND_OF_PAGE
FORM YEND_OF_LIST *
FORM YEND_OF_LIST.
BREAK-POINT.
WRITE: / 'Y_END_OF_LIST'.
ENDFORM. "YEND_OF_LIST
*& Form POP_VBAP
text
--> p1 text
<-- p2 text
FORM POP_VBAP .
SELECT VBELN
POSNR
ERNAM
ERDAT
MATNR
FROM VBAP
INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
WHERE VBELN IN S_VBELN.
ENDFORM. " POP_VBAP
*& Form POP_MARA
text
--> p1 text
<-- p2 text
FORM POP_MARA .
LOOP AT IT_VBAP.
SELECT SINGLE MATNR
ERNAM
MATKL
MEINS
PSTAT
FROM MARA
INTO CORRESPONDING FIELDS OF IT_MARA
WHERE MATNR = IT_VBAP-MATNR.
APPEND IT_MARA.
ENDLOOP.
ENDFORM. " POP_MARA
*& Form BLOCK_LIST
text
--> p1 text
<-- p2 text
FORM BLOCK_LIST .
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
I_CALLBACK_PROGRAM = REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'user_command'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
I_TABNAME = 'IT_VBAP'
IT_EVENTS = GT_XEVENTS
IT_SORT =
I_TEXT = ' '
TABLES
T_OUTTAB = IT_VBAP
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 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_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT1
I_TABNAME = 'IT_MARA'
IT_EVENTS = GT_YEVENTS
IT_SORT =
I_TEXT = ' '
TABLES
T_OUTTAB = IT_MARA
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 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_BLOCK_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
IS_PRINT = GT_PRINT
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 =
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. " BLOCK_LIST
Similar Messages
-
Hi Abapers,
I am having one Problem regarding ALV Header on the report. Requirement is to get the data it into this order on ALV Header using Simple ABAP.
Summary
"Building No Room No Comments
111 AA Over Allocated.
545 XX Space Free
787 YY No Space
I have Tried to enter it into the header table but the data is not coming correctly.
Problem is It is coming in this way which is wrong..
Summary
"Building No Room No Comments
111 AA Over Allocated.
545 XX Space Free
787 YY No Space
Can Any body solve my Problem to get the header information it into the below .
Summary
"Building No Room No Comments
111 AA Over Allocated.
545 XX Space Free
787 YY No SpaceHi ,
I have tried but couldn't succeded. Can you Please provide me the solution. -
Regarding ALV Header to display at Right side of Header
Hi dudes..
How to handle ALV header to print content at right side of the report out-put.
If we use ALV_list dispaly line size ends to 80 and Other than
using OOP's is there any way to do this..
Could You please let me know.How to handle this issue??
Regards,
SgHi,
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZALV_PRDS'
i_callback_user_command = 'USER_COMMAND'
i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE' "for header alignment
it_fieldcat = t_fcat
i_save = 'A'
it_events = t_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 html_top_of_page USING document TYPE REF TO cl_dd_document.
DATA: text TYPE sdydo_text_element.
CALL METHOD document->add_gap
EXPORTING
width = 200.
text = 'Material Information'.
CALL METHOD document->add_text
EXPORTING
text = text
sap_style = 'HEADING'.
CALL METHOD document->new_line.
CALL METHOD document->new_line.
CALL METHOD document->new_line.
ENDFORM. "HTML_TOP_OF_PAGE
For more details, refer to the methods of the class cl_dd_document
Also check the below link.
https://www.sdn.sap.com/irj/sdn/wiki?path=/pages/viewpage.action&pageid=37566
Also this link
Report header using ALV Grid(oops)
Please reward points if it helps
Thanks
Vikranth -
Regarding CehckBox at ALV header
Hi,
know that we can have checkbox in column in ALV by using class CL_SALV_WD_UIE_CHECKBOX.
But want to have CheckBox at ALV header like we can have button by using class CL_SALV_WD_FE_BUTTON.
Is it possible to have CheckBox at ALV header.
If yes than how?
Thanks & Regards,
ArvindUnfortunately, I don't see any class for Checkbox
CL_SALV_WD_FE_A_BUTTON
CL_SALV_WD_FE_A_BUTTON_CHOICE
CL_SALV_WD_FE_A_CAPTION
CL_SALV_WD_FE_A_DRDN_BY_INDEX
CL_SALV_WD_FE_A_DRDN_BY_KEY
CL_SALV_WD_FE_A_DROPDOWN
CL_SALV_WD_FE_A_INPUT
CL_SALV_WD_FE_A_LINK
CL_SALV_WD_FE_A_TOGGLE
CL_SALV_WD_FE_A_TOGGLE_BUTTON
CL_SALV_WD_FE_BUTTON
CL_SALV_WD_FE_BUTTON_CHOICE
CL_SALV_WD_FE_DROPDOWN_BY_IDX
CL_SALV_WD_FE_DROPDOWN_BY_KEY
CL_SALV_WD_FE_INPUT_FIELD
CL_SALV_WD_FE_INTERACTIVE
CL_SALV_WD_FE_LINK_TO_ACTION
CL_SALV_WD_FE_LINK_TO_URL
CL_SALV_WD_FE_SEPARATOR
CL_SALV_WD_FE_TOGGLE_BUTTON -
Space in Top of page on alv header
Hi Experts,
I do have a query on ALV , Can you please help me in solving my problem.
Here goes my query...
I have to develop a ALV where on the top of page i have to display two fields as shown in below which was highlighted in the screen
http://img410.imageshack.us/my.php?image=op2sn9.jpg
But i'm getting output as shown below screen
http://img410.imageshack.us/my.php?image=op1ut4.jpg
I have tried with space and all other alternatives but i'm unable to get the desired output.
Can i have any sample code for the same
Regards
NandaHi,
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 No'.
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-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.
Try with this sample
Regards
Krishna -
Regarding ALV ( To be displayed in Tree Format)
Hi all,
I am working on a ALV report which is to be displayed in Tree Structure . I found some demo programs within SAP .. but do we have an Alternative .. all those Demos use OOPS concept .. Can this Report be done without using OOPS in ALV.
Please Suggest.
Thanks & Regards
SrinivasHi,
This is a ALV Report with tree structure.
report zwmr_pick_status_report no standard page heading
message-id zw.
Type Pools *
type-pools: icon, slis.
Tables *
tables: tvst,
likp,
t30b,
vekp,
zpallettr,
zvantr.
Types *
types:
begin of ty_data,
lgtor like likp-lgtor, " door
vbeln like likp-vbeln, " delivery
wbstk like vbuk-wbstk, " Goods movement status
kostk like vbuk-kostk, " Picking status
posnr like lips-posnr, " item
route like likp-route, " route
wadat like likp-wadat, " goods issue date
lvsta like vbup-lvsta, " warehouse status
packvorschr like vekp-packvorschr, " pack mnemonic
exidv like vekp-exidv, " handling unit
zpallet_no(10), "like zpallettr-zpallet_no, " pallet no
zcount_check like zpallettr-zcount_check," count check flag
zvan_no(10), "like zvantr-zvan_no, " van no
zvan_print like zvantr-zvan_print, " van manifest print
zeod_print like zvantr-zeod_print, " eod manifest print
zzpackclass like vekp-zzpackclass, " package class
zzti like vekp-zzti, " T.I. value
end of ty_data.
Data *
ranges: r_del for likp-vbeln,
r_lgtor for likp-lgtor.
ranges: r_vanno for zvantr-zvan_no,
r_palno for zpallettr-zpallet_no.
data: begin of number_range occurs 0,
mark(1),
id(3),
num(10) type n,
desc like zpalletmd-zdesc,
end of number_range.
data: t_disp_tab type standard table of zpickdisp,
t_data_tab type ty_data occurs 0 with header line,
t_disp_head type standard table of zpickhead.
data: w_numrnge like number_range,
w_number(10) type n.
data: t_likp like likp occurs 0 with header line,
t_lips like lips occurs 0 with header line,
t_vbuk like vbuk occurs 0 with header line,
t_vbup like vbup occurs 0 with header line,
t_vepo like vepo occurs 0 with header line,
t_vekp like vekp occurs 0 with header line,
t_vantr like zvantr occurs 0 with header line,
t_pallettr like zpallettr occurs 0 with header line,
w_likp like likp,
w_lips like lips,
w_vbuk like vbuk,
w_vbup like vbup,
w_vepo like vepo,
w_vekp like vekp.
ALV DATA *****
data:
g_grid type ref to cl_gui_alv_grid,
g_sort type slis_t_sortinfo_alv,
g_custom_container type ref to cl_gui_custom_container,
g_layout type slis_layout_alv,
gt_fieldcat type slis_t_fieldcat_alv,
t_fldcat like line of gt_fieldcat,
g_keyinfo type slis_keyinfo_alv,
gt_events type slis_t_event,
gs_event type slis_alv_event,
w_sy_repid like sy-repid.
data: begin of seltab occurs 0.
include structure rsparams.
data: end of seltab.
SYSTEM GENERATED TABLE CONTROL DATA ********
DECLARATION OF TABLECONTROL 'TC_TABCON' ITSELF
controls: tc_tabcon type tableview using screen 0100.
LINES OF TABLECONTROL 'TC_TABCON'
data: g_tc_tabcon_lines like sy-loopc.
data: ok_code like sy-ucomm.
Constants *
constants: c_data_class like klah-class value 'DG_DATA',
c_mat_class like rmclf-klart value '001',
c_pack like lips-mtart value 'VERP',
c_a(1) value 'A',
c_b(1) value 'B',
c_c(1) value 'C',
c_yes(1) value 'X',
c_no(1) value ' '.
Selection screen *
standard report select options block
selection-screen begin of block a with frame title text-002.
select-options:
s_wadat for likp-wadat no-extension obligatory. " Goods Issue Date
*parameters: "TR01-
p_vstel like tvst-vstel obligatory. " Shipping Point "TR01-
select-options: "TR01+
p_vstel for tvst-vstel. " Shipping Point "TR01+
select-options:
s_lfart for likp-lfart, " Delivery type
s_lgtor for t30b-lgtor, " Door selection
s_exidv for vekp-exidv, " Handling Unit
s_vbeln for likp-vbeln. " Delivery
parameters:
p_exdata as checkbox. " Show extra columns flag
selection-screen end of block a.
van/pallet specific select options block
selection-screen begin of block b with frame title text-001.
select-options:
s_palno for zpallettr-zpallet_no, " no-extension,
s_vanno for zvantr-zvan_no. " no-extension.
selection-screen end of block b.
Value Request Events *
at selection-screen on value-request for s_palno-low.
clear: number_range, w_number .
refresh number_range.
select numbers and display pop up screen for selection
perform select_pal_nos.
s_palno-low = w_number.
at selection-screen on value-request for s_palno-high.
clear: number_range, w_number .
refresh number_range.
select numbers and display pop up screen for selection
perform select_pal_nos.
s_palno-high = w_number.
at selection-screen on value-request for s_vanno-low.
clear: number_range, w_number .
refresh number_range.
select numbers and display pop up screen for selection
perform select_van_nos.
s_vanno-low = w_number.
at selection-screen on value-request for s_vanno-high.
clear: number_range, w_number .
refresh number_range.
select numbers and display pop up screen for selection
perform select_van_nos.
s_vanno-high = w_number.
At Selection Screen *
at selection-screen.
perform validate_selections.
Initialization *
initialization.
Start of selection *
start-of-selection.
clear all data tables
clear: t_likp,
t_lips,
t_vbuk,
t_vbup,
t_vepo,
t_vantr,
t_pallettr,
w_likp,
w_lips,
w_vbuk,
w_vbup,
w_vepo,
w_vekp.
refresh: t_likp,
t_lips,
t_vbuk,
t_vbup,
t_vepo,
t_vantr,
t_pallettr.
select data for ALV
due to different input parameters being used, to streamline the data
selection process, different selection methods are required
if not s_vanno is initial
or not s_palno is initial.
if selecting by van/pallet number, need to select the data from the
handling unit upwards to delivery
perform select_data_up.
else.
otherwise the data can be selected from the delivery downwards
perform select_data_down.
endif.
End of selection *
end-of-selection.
call hierarchical ALV display function module
call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
exporting
i_callback_program = 'ZWMR_PICK_STATUS_REPORT'
i_callback_pf_status_set = 'SET_STATUS'
i_callback_user_command =
'USER_COMMAND' "custom gui status form
is_layout = g_layout "user command form
it_fieldcat = gt_fieldcat
it_sort = g_sort
it_events = gt_events
i_tabname_header = 't_disp_head'
i_tabname_item = 't_disp_tab'
i_structure_name_header = 'ZPICKHEAD'
i_structure_name_item = 'ZPICKDISP'
is_keyinfo = g_keyinfo
tables
t_outtab_header = t_disp_head
t_outtab_item = t_disp_tab.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
FORMS *
Includes inserted by Screen Painter Wizard. DO NOT CHANGE THIS LINE!
include zwmr_pick_status_reporto01 .
include zwmr_pick_status_reporti01 .
include zwmr_pick_status_reportf01 .
*& Form select_pal_nos
select pallet numbers for search help
form select_pal_nos.
data: begin of t_palno occurs 0,
zpallet_no like zpallettr-zpallet_no,
end of t_palno.
select all available pallet numbers
select distinct zpallet_no from zpallettr
into corresponding fields of table t_palno.
loop at t_palno.
get pallet id
select single zpallet_id from zpallettr
into number_range-id
where zpallet_no = t_palno-zpallet_no.
get pallet description
select single zdesc from zpalletmd
into number_range-desc
where zpallet_id = number_range-id.
number_range-num = t_palno-zpallet_no.
append to search help table
append number_range.
endloop.
call pop up dialog box
call screen 0100 starting at 5 5.
endform. " select_pal_nos
*& Form select_van_nos
select van numbers for search help
form select_van_nos.
data: begin of t_vanno occurs 0,
zvan_no like zvantr-zvan_no,
end of t_vanno.
select available van numbers
select distinct zvan_no from zvantr
into corresponding fields of table t_vanno.
loop at t_vanno.
select van id
select single zvan_id from zvantr
into number_range-id
where zvan_no = t_vanno-zvan_no.
select van description (maintained in pallet tables)
select single zdesc from zpalletmd
into number_range-desc
where zpallet_id = number_range-id.
number_range-num = t_vanno-zvan_no.
append to search help table
append number_range.
endloop.
call pop up dialog box
call screen 0100 starting at 5 5.
endform. " select_van_nos
*& Form select_data_down
select data if selecting from delivery down
form select_data_down.
select all deliveries from LIKP that fulfill selection criteria
select * from likp into table t_likp
where vbeln in s_vbeln
and vstel eq p_vstel "TR01-
and vstel in p_vstel
and lgtor in s_lgtor
and wadat in s_wadat
and lfart in s_lfart.
if sy-subrc ne 0.
no data found
message i007.
exit.
endif.
if not t_likp[] is initial.
select sales document headers from VBUK
select * from vbuk into table t_vbuk
for all entries in t_likp
where vbeln eq t_likp-vbeln.
select all relevant delivery items from LIPS
select * from lips into table t_lips
for all entries in t_likp
where vbeln eq t_likp-vbeln
and pstyv ne 'ZPAC'
and pstyv ne 'ZGDP' "TR02+
and lfimg gt 0. "TR01+
endif.
if not t_lips[] is initial.
select all sales document line items from VBUP
select * from vbup into table t_vbup
for all entries in t_lips
where vbeln eq t_lips-vbeln
and posnr = t_lips-posnr.
select corresponding handling unit ID's (venum)
TR03 Replace start
select * from vepo appending corresponding fields of table t_vepo
for all entries in t_lips
where vbeln = t_lips-vbeln
and posnr = t_lips-posnr
and matnr = t_lips-matnr
and charg = t_lips-charg.
select * from vepo
inner join vekp on vepovenum = vekpvenum
appending corresponding fields of table t_vepo
for all entries in t_lips
where vepo~vbeln = t_lips-vbeln
and vepo~posnr = t_lips-posnr
and vepo~matnr = t_lips-matnr
and vepo~charg = t_lips-charg
and vekp~exidv in s_exidv.
TR03 Replace end
endif.
build process table
perform move_to_table.
endform. "select_data_down
*& Form select_data_up
select data if selecting from van/pallet up
form select_data_up.
if not s_vanno is initial.
if van then select van numbers and hence pallet numbers
select * from zvantr into table t_vantr
where zvan_no in s_vanno.
and vstel eq p_vstel."TR01-
if not t_vantr[] is initial.
select * from zpallettr into table t_pallettr
for all entries in t_vantr
where zpallet_no eq t_vantr-zpallet_no.
and vstel eq p_vstel."TR01-
endif.
else.
otherwise can get pallet numbers directly
select * from zpallettr into table t_pallettr
where zpallet_no in s_palno.
and vstel eq p_vstel."TR01-
endif.
if not t_pallettr[] is initial.
from the pallet nos. we can select the handling units
select * from vekp into table t_vekp
for all entries in t_pallettr
where exidv eq t_pallettr-exidv
and exidv ne space
and exidv in s_exidv "TR03+
and ( exida = 'E' "TR01+
or exida = 'F' ). "TR01+
endif.
if not t_vekp[] is initial.
build vbeln range from t_vekp.
loop at t_vekp.
r_del-sign = 'I'.
r_del-option = 'EQ'.
r_del-low = t_vekp-vpobjkey.
append r_del.
endloop.
select all deliveries from LIKP that correspond to HU's
select * from likp into table t_likp
where vbeln in r_del
and wadat in s_wadat
and lfart in s_lfart.
endif.
if not t_likp[] is initial.
select sales document headers from VBUK
select * from vbuk into table t_vbuk
for all entries in t_likp
where vbeln eq t_likp-vbeln.
select all relevant delivery items from LIPS
select * from lips into table t_lips
for all entries in t_likp
where vbeln eq t_likp-vbeln
and pstyv ne 'ZPAC'
and pstyv ne 'ZGDP' "TR02+
and lfimg gt 0. "TR01+
endif.
if not t_lips[] is initial.
select all sales document line items from VBUP
select * from vbup into table t_vbup
for all entries in t_lips
where vbeln eq t_lips-vbeln
and posnr = t_lips-posnr.
select corresponding handling unit ID's (venum)
select * from vepo appending corresponding fields of table t_vepo
for all entries in t_lips
where vbeln = t_lips-vbeln
and posnr = t_lips-posnr
and matnr = t_lips-matnr
and charg = t_lips-charg.
endif.
build process table
perform move_to_table.
endform. "select_data_up
*& Form move_to_table
move data to processing table
form move_to_table.
loop at t_vepo.
clear t_data_tab.
delivery lines.
clear w_lips.
read table t_lips with key vbeln = t_vepo-vbeln
posnr = t_vepo-posnr
into w_lips.
move-corresponding w_lips to t_data_tab.
sales document line items
clear w_vbup.
read table t_vbup with key vbeln = t_vepo-vbeln
posnr = t_vepo-posnr
into w_vbup.
if w_vbup-kosta = space. "TR01-
not relevant for picking
delete t_vepo. "TR01-
continue. "TR01-
else. "TR01-
move-corresponding w_vbup to t_data_tab.
endif. "TR01-
sales doc header
clear w_vbuk.
read table t_vbuk with key vbeln = t_vepo-vbeln
into w_vbuk.
move-corresponding w_vbuk to t_data_tab.
delivery header
clear w_likp.
read table t_likp with key vbeln = t_vepo-vbeln
into w_likp.
move-corresponding w_likp to t_data_tab.
select handling unit info using vepo entry
clear w_vekp.
if t_vekp[] is initial.
select single * from vekp into w_vekp
where venum = t_vepo-venum.
else.
read table t_vekp with key venum = t_vepo-venum
into w_vekp.
if sy-subrc ne 0.
select single * from vekp into w_vekp
where venum = t_vepo-venum.
endif.
endif.
move-corresponding w_vekp to t_data_tab.
select pallet / van load information
select single zpallet_no zcount_check from zpallettr
into (t_data_tab-zpallet_no,
t_data_tab-zcount_check)
where exidv eq w_vekp-exidv.
if not t_data_tab-zpallet_no in s_palno. "TR01+
continue. "TR01+
endif. "TR01+
if sy-subrc = 0.
select single zvan_no zvan_print zeod_print from zvantr
into (t_data_tab-zvan_no,
t_data_tab-zvan_print,
t_data_tab-zeod_print)
where zpallet_no eq t_data_tab-zpallet_no.
if not t_data_tab-zvan_no in s_vanno. "TR01+
continue. "TR01+
endif. "TR01+
endif.
append t_data_tab.
endloop.
*-----> TR01+ start
If the delivery has yet to be packed, then need to include in report
Thus delete t_lips here and if any entries left after looping through
t_vepo, these will also need to be added to t_data_tab
if the selection is by handling unit though we do not want these"TR03+
if s_exidv is initial. "TR03+
loop at t_vepo.
read table t_lips with key vbeln = t_vepo-vbeln
posnr = t_vepo-posnr.
if sy-subrc = 0.
delete t_lips index sy-tabix.
endif.
endloop.
if not t_lips[] is initial.
move any unpacked items to the data table
perform move_lips_to_table.
endif.
endif. "TR03+
*<---- TR01+ End
get relevant status icons
perform select_icons.
prepare ALV data
perform prepare_alv.
endform. " select_data
*& Form select_icons
select icons for display and move data to display table
form select_icons.
data: w_disp_tab like zpickdisp,
w_disp_head like zpickhead,
w_color like zpickdisp-color,
ov_icon like zpickdisp-ov_icon,
gi_icon like zpickdisp-gi_icon,
to_icon like zpickdisp-to_icon,
lp_icon like zpickdisp-lp_icon,
pc_icon like zpickdisp-pc_icon,
lv_icon like zpickdisp-lv_icon,
vm_icon like zpickdisp-vm_icon,
em_icon like zpickdisp-em_icon,
t_ovst_tab like t_disp_tab with header line.
constants: c_col1(3) value 'C10',
c_col2(3) value 'C20'.
sort t_data_tab by lgtor vbeln.
w_color = c_col2.
loop at t_data_tab.
at new lgtor.
fill ALV header table
clear w_disp_head.
w_disp_head-lgtor = t_data_tab-lgtor.
append w_disp_head to t_disp_head.
endat.
goods issue status & overall amber/green only
case t_data_tab-wbstk.
when c_c.
move icon_green_light to gi_icon.
move icon_green_light to ov_icon.
when others.
move icon_red_light to gi_icon.
move icon_yellow_light to ov_icon.
endcase.
transfer order status
case t_data_tab-lvsta.
when c_a.
move icon_red_light to to_icon.
when c_b.
move icon_yellow_light to to_icon.
when c_c.
move icon_green_light to to_icon.
when space.
write N/A
to_icon = 'N/A'.
endcase.
loaded to pallet status
if not t_data_tab-zpallet_no is initial.
move icon_green_light to lp_icon.
else.
move icon_red_light to lp_icon.
endif.
pallet count status
if not t_data_tab-zcount_check is initial.
move icon_green_light to pc_icon.
else.
move icon_red_light to pc_icon.
endif.
loaded to van status
if not t_data_tab-zvan_no is initial.
move icon_green_light to lv_icon.
else.
move icon_red_light to lv_icon.
endif.
van manifest status
if not t_data_tab-zvan_print is initial.
move icon_green_light to vm_icon.
else.
move icon_red_light to vm_icon.
endif.
end of day manifest status
if not t_data_tab-zeod_print is initial.
move icon_green_light to em_icon.
else.
move icon_red_light to em_icon.
endif.
move working data table to display table
move-corresponding t_data_tab to w_disp_tab.
w_disp_tab-ov_icon = ov_icon.
w_disp_tab-gi_icon = gi_icon.
w_disp_tab-to_icon = to_icon.
w_disp_tab-lp_icon = lp_icon.
w_disp_tab-pc_icon = pc_icon.
w_disp_tab-lv_icon = lv_icon.
w_disp_tab-vm_icon = vm_icon.
w_disp_tab-em_icon = em_icon.
w_disp_tab-color = w_color.
fill N/A values for initial fields for display
if w_disp_tab-packvorschr is initial.
w_disp_tab-packvorschr = 'N/A'.
endif.
if w_disp_tab-exidv is initial.
w_disp_tab-exidv = 'N/A'.
endif.
if w_disp_tab-zpallet_no is initial.
write 'N/A' to w_disp_tab-zpallet_no.
endif.
if w_disp_tab-zvan_no is initial.
write 'N/A' to w_disp_tab-zvan_no.
endif.
display different color for new doc number
at end of vbeln.
if w_color = c_col1.
w_color = c_col2.
elseif w_color = c_col2.
w_color = c_col1.
endif.
endat.
append w_disp_tab to t_disp_tab.
clear w_disp_tab.
endloop.
we have all the icons in display but need to check the overall status
as this refers to the line items
green and amber statuses already set and use the same criteria as the
goods issue status unless detected as red here
data: ov_stat_red(1).
clear w_disp_tab.
sort t_disp_tab by vbeln.
loop at t_disp_tab into w_disp_tab.
at new vbeln.
check all line items for delivery
loop at t_data_tab where vbeln = w_disp_tab-vbeln.
if t_data_tab-lvsta = c_a.
set overall status to red
ov_stat_red = c_yes.
exit.
else.
leave green/amber status icon as previosly determined
endif.
endloop.
if ov_stat_red = c_yes.
set overall status to red for all items in that delivery
clear ov_stat_red.
move icon_red_light to w_disp_tab-ov_icon.
modify t_disp_tab from w_disp_tab transporting ov_icon
where vbeln = w_disp_tab-vbeln.
endif.
endat.
endloop.
endform. " select_icons
*& Form fill_layout
fill ALV layout parameters
form fill_layout.
clear g_layout.
g_layout-colwidth_optimize = c_yes. " column width optimisation
g_layout-zebra = space. " alternate line colors
g_layout-box_fieldname = 'MARK'. " checkbox fieldname
g_layout-info_fieldname = 'COLOR'. " highlight row indicator
g_layout-no_vline = space. " vertical line
g_layout-key_hotspot = space. " hotspot field
g_layout-f2code = 'PICK'. " F2 ok_code
g_layout-numc_sum = c_yes. " sum numc fields
g_layout-box_tabname = 't_disp_head'. " checkbox table name
g_layout-expand_fieldname = 'EXPAND'. " expand field name
endform. " fill_layout
*& Form fill_sort
fill ALV sort table
form fill_sort.
data: w_g_sort type slis_sortinfo_alv.
w_g_sort-spos = 1.
w_g_sort-fieldname = 'LGTOR'.
w_g_sort-tabname = 't_disp_tab'.
w_g_sort-up = c_yes.
append w_g_sort to g_sort.
w_g_sort-spos = 2.
w_g_sort-fieldname = 'VBELN'.
w_g_sort-tabname = 't_disp_tab'.
w_g_sort-up = c_yes.
append w_g_sort to g_sort.
w_g_sort-spos = 3.
w_g_sort-fieldname = 'POSNR'.
w_g_sort-tabname = 't_disp_tab'.
w_g_sort-up = c_yes.
append w_g_sort to g_sort.
w_g_sort-spos = 4.
w_g_sort-fieldname = 'WADAT'.
w_g_sort-tabname = 't_disp_tab'.
w_g_sort-up = c_yes.
append w_g_sort to g_sort.
endform. " fill_sort
*& Form fill_fieldcat
Fill field category structure for ALV
form fill_fieldcat.
clear t_fldcat.
create field catalogue for header table
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = 'ZWMR_PICK_STATUS_REPORT'
i_internal_tabname = 't_disp_head'
i_structure_name = 'ZPICKHEAD'
i_client_never_display = c_yes
changing
ct_fieldcat = gt_fieldcat[].
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
ceate field catalogue for items table
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = 'ZWMR_PICK_STATUS_REPORT'
i_internal_tabname = 't_disp_tab'
i_structure_name = 'ZPICKDISP'
i_client_never_display = c_yes
changing
ct_fieldcat = gt_fieldcat[].
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
modify field catalogue for this report
set no display flag if not requested on selection screen
if p_exdata ne c_yes.
t_fldcat-no_out = c_yes.
modify gt_fieldcat from t_fldcat transporting no_out
where fieldname eq 'PACKVORSCHR'
or fieldname eq 'EXIDV'
or fieldname eq 'ZPALLET_NO'
or fieldname eq 'ZVAN_NO'
or fieldname eq 'ZZPACKCLASS'
or fieldname eq 'ZZTI'.
endif.
set no display flag for item level LGTOR field
t_fldcat-no_out = c_yes.
modify gt_fieldcat from t_fldcat transporting no_out
where fieldname eq 'LGTOR'
and tabname eq 't_disp_tab'.
prevent display of technical fields
t_fldcat-tech = c_yes.
modify gt_fieldcat from t_fldcat transporting tech
where fieldname eq 'EXPAND'
or fieldname eq 'SELKZ'.
set vbeln as key
t_fldcat-key = c_yes.
modify gt_fieldcat from t_fldcat transporting key
where fieldname eq 'VBELN'.
prevent scrolling for info fields
t_fldcat-fix_column = c_yes.
modify gt_fieldcat from t_fldcat transporting fix_column
where fieldname eq 'VBELN'.
endform. " fill_fieldcat
*& Form prepare_ALV
Fill ALV parameters
form prepare_alv.
fill ALV key info
g_keyinfo-header01 = 'LGTOR'.
g_keyinfo-item01 = 'LGTOR'.
fill ALV events
gs_event-name = 'TOP_OF_PAGE'.
gs_event-form = 'TOP_OF_PAGE'.
append gs_event to gt_events.
fill ALV sort table
perform fill_sort.
fill ALV layout structure
perform fill_layout.
fill ALV field category
perform fill_fieldcat.
endform. " prepare_ALV
*& Form user_command
form called on user command from ALV list
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
data: index type i,
w_disp_head like line of t_disp_head,
w_door like likp-lgtor.
clear r_lgtor. refresh r_lgtor.
case r_ucomm.
when 'PICK'. " Double click line
when 'VANM'. " Van Manifest button
read the header table where has been selected
loop at t_disp_head into w_disp_head where mark = c_yes.
r_lgtor-sign = 'I'.
r_lgtor-option = 'EQ'.
r_lgtor-low = w_disp_head-lgtor.
append r_lgtor.
endloop.
print the van manifest
perform print_van_manifest tables r_lgtor.
when 'EODM'. " EOD Manifest button
read the header table where has been selected
loop at t_disp_head into w_disp_head where mark = c_yes.
r_lgtor-sign = 'I'.
r_lgtor-option = 'EQ'.
r_lgtor-low = w_disp_head-lgtor.
append r_lgtor.
endloop.
print the end of day manifest
perform print_eod_manifest tables r_lgtor.
when 'REFR'. "Refresh
refresh display
w_sy_repid = sy-repid.
call function 'RS_REFRESH_FROM_SELECTOPTIONS'
exporting
curr_report = w_sy_repid
tables
selection_table = seltab.
exceptions
not_found = 1
no_report = 2
others = 3.
if sy- -
How to Display Logo in ALV Header?
Hi
I want to display/ print my company logo image in ALV Header. Please help me how can I do this?
Thanks
Iftikhar Ali
Islamabad.Hi,
If you are already having a logo say ZLOGO .
You can use it this way .
Give TOP-OF-PAGE
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.
And in top of page do this .
FORM top-of-page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRIT
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHE
i_logo = 'ZLOGO'
I_END_OF_LIST_GRID =
endform.
Hope this will work .
Reward if found useful.
Regards
SureshP. -
Displaying blank line in ALV header
How do I display a blank line in ALV header
For eg i want if i want the ALV header to display as follows
Document Datewise Report as of 31/10/2009
<-- BLANK LINE
Run On : 01/12/2009Hi,
Are you using 'REUSE_ALV_COMMENTARY_WRITE' for displaying the header?
If yes, then I think it is not possible. Instead, use the events table to achieve it.
Use the 'REUSE_ALV_EVENTS_GET' FM to get all possible events and then modify
the events internal table to specify the form name to handle top-of-page event.
eg.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS
* EXCEPTIONS
* LIST_TYPE_WRONG = 1
* OTHERS = 2
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
ENDIF.
FORM TOP_OF_PAGE.
* Use write statements to display the header data.
ENDFORM.
In write statement use '/' to go to new line. So to insert an empty line you can use something like
write : 'some text' / / 'some text' .
Hope this helps.
Regards,
Bhavesh. -
Hi Friends,
In ALV GRID i need to display the output header like below.
SHIP
SOLD
|----
NUM
NAME
NUM
NAME
It's not dots and pipes. But like the box with above design.
Can any one please give me your valuable inputs regarding this.
I want to use it in ALV GRID . i.e: By using ALV FM or OOPS also.
Thanks
Srinivas.Hi
REPORT znnr_nnr LINE-SIZE 125.
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-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.
endform. -
Hi friends,
I want the heading of an ALV report in the format given as below ..... Is that possible ???
In the 1st line :-
123 ( Left corner ) ..... ABC (Center).... date (right corner)
In the second line also :- something like the first line .....
Is that possible ???
If yes ... How can i do this ???
Expecting your answers
thanks in advance
Cheers
R.Kriparefer the links:
http://www.sap-img.com/abap/test-alv-display-with-header-footer.htm
or
http://www.sap-img.com/abap/sample-alv-heading-in-alv.htm
or
ALV LIST Header
how to display header in alv list
The last two would address your question more precisely.
Regards,
Ravi -
Hi,
How to dispaly ALV Heading in each and every page while printing or in download file in (EXCEL).
Thanks & Regards
hruHi Manish,
Thank you for your reply
Iam using the ALV GRID using FM REUSE_ALV_GRID_DISPLAY
The event ( FROM = 'TOP_OF_PAGE') (NAME = 'SLIS_EV_TOP_OF_PAGE') and add this event to the function module REUSE_ALV_EVENTS_GET.
create a Form with the name 'TOP_OF_PAGE',in this form use the function module REUSE_ALV_LIST_COMMENTARY' to display heaer text.
Build the code like this and then i did download all the records to excel file, But in that i found Header information display only once.
But i want display heading each and every page.
Thanks & Regards
hru -
Displaying selection screen data on alv header in multiple rows and columns
Hi
Presently in my requirement , whatever the data entered in selection screen should display on alv header and item details on alv grid display.
for eg...
on alv header
customer no : 1000 to 2000 sales order no: 111
name : gff to ff sales org:
city: country:
item details below this
plz guide me how to solve this issue.
Thanks & Regards,
PradeepHi,
Check this code this may help you.
<code>
TYPE-POOLS : SLIS.
TABLES VBRK.
TYPES : BEGIN OF TY_VBRK,
VBELN TYPE VBRK-VBELN,
VKORG TYPE VBRK-VKORG,
VTWEG TYPE VBRK-VTWEG,
SPART TYPE VBRK-SPART,
FKDAT TYPE VBRK-FKDAT,
END OF TY_VBRK,
BEGIN OF TY_VBRP,
VBELN TYPE VBRP-VBELN,
POSNR TYPE VBRP-POSNR,
MATNR TYPE VBRP-MATNR,
ARKTX TYPE VBRP-ARKTX,
FKIMG TYPE VBRP-FKIMG,
NETWR TYPE VBRP-NETWR,
END OF TY_VBRP,
BEGIN OF TY_TARGET,
VBELN TYPE VBRK-VBELN,
VKORG TYPE VBRK-VKORG,
VTWEG TYPE VBRK-VTWEG,
SPART TYPE VBRK-SPART,
FKDAT TYPE VBRK-FKDAT,
POSNR TYPE VBRP-POSNR,
MATNR TYPE VBRP-MATNR,
ARKTX TYPE VBRP-ARKTX,
FKIMG TYPE VBRP-FKIMG,
NETWR TYPE VBRP-NETWR,
END OF TY_TARGET.
DATA : T_VBRK TYPE TABLE OF TY_VBRK,
W_VBRK TYPE TY_VBRK,
T_VBRP TYPE TABLE OF TY_VBRP,
W_VBRP TYPE TY_VBRP,
T_TARGET TYPE TABLE OF TY_TARGET,
W_TARGET TYPE TY_TARGET,
FIELD CATALOG ******************
T_FCAT TYPE SLIS_T_FIELDCAT_ALV,
W_FCAT TYPE SLIS_FIELDCAT_ALV,
*************************************SUB TOTALS AND SORTING***********
T_SORT TYPE SLIS_T_SORTINFO_ALV,
W_SORT TYPE SLIS_SORTINFO_ALV,
*************************************FOR LIST HEADER******************
T_LIST_HEAD TYPE SLIS_T_LISTHEADER,
W_LIST_HEAD TYPE SLIS_LISTHEADER,
T_LIST_HEAD1 TYPE SLIS_T_LISTHEADER,
W_LIST_HEAD1 TYPE SLIS_LISTHEADER,
*************************************FOR LIST HEADER******************
W_LAYOUT TYPE SLIS_LAYOUT_ALV,
************************************FOR EVENTS************************
T_EVENT TYPE SLIS_T_EVENT,
W_EVENT TYPE SLIS_ALV_EVENT.
*********************************SELECT OPTIONS***********************
SELECT-OPTIONS : S_VBELN FOR VBRK-VBELN DEFAULT 90005316 TO 90005330.
**RETRIVING DATA************************
PERFORM DATA_RETRIVE.
**BUILDING THE FIELD CATALOG************
PERFORM BUILD_FCAT.
**BUILDING THE TABLE FOR LIST HEADER****
PERFORM BUILD_LIST_HEAD.
*******************************CALLING THE FUNCTION MODULE************
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_TOP_OF_PAGE = 'LIST_TOP_OF_PAGE'
IT_FIELDCAT = T_FCAT
IT_SORT = T_SORT
TABLES
T_OUTTAB = T_TARGET.
*& Form DATA_RETRIVE
FORM DATA_RETRIVE .
SELECT VBELN VKORG VTWEG SPART FKDAT FROM VBRK INTO CORRESPONDING FIELDS
OF TABLE T_VBRK WHERE VBELN IN S_VBELN.
IF SY-SUBRC EQ 0.
SORT T_VBRK BY VBELN.
SELECT VBELN POSNR MATNR ARKTX FKIMG NETWR FROM VBRP INTO TABLE
T_VBRP FOR ALL ENTRIES IN T_VBRK WHERE VBELN = T_VBRK-VBELN.
ENDIF.
LOOP AT T_VBRP INTO W_VBRP.
LOOP AT T_VBRK INTO W_VBRK WHERE VBELN = W_VBRP-VBELN.
W_TARGET-VBELN = W_VBRK-VBELN.
W_TARGET-VKORG = W_VBRK-VKORG.
W_TARGET-VTWEG = W_VBRK-VTWEG.
W_TARGET-SPART = W_VBRK-SPART.
W_TARGET-FKDAT = W_VBRK-FKDAT.
W_TARGET-POSNR = W_VBRP-POSNR.
W_TARGET-MATNR = W_VBRP-MATNR.
W_TARGET-ARKTX = W_VBRP-ARKTX.
W_TARGET-FKIMG = W_VBRP-FKIMG.
W_TARGET-NETWR = W_VBRP-NETWR.
APPEND W_TARGET TO T_TARGET.
ENDLOOP.
ENDLOOP.
SORT T_TARGET BY VBELN.
ENDFORM. " DATA_RETRIVE
*& Form BUILD_FCAT
FORM BUILD_FCAT .
W_FCAT-COL_POS = 1.
W_FCAT-FIELDNAME = 'VBELN'.
W_FCAT-SELTEXT_M = 'BILLING NO'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 2.
W_FCAT-FIELDNAME = 'VKORG'.
W_FCAT-SELTEXT_M = 'SALES ORGANIZATION'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 3.
W_FCAT-FIELDNAME = 'VTWEG'.
W_FCAT-SELTEXT_M = 'DISTRIBUTION CHANNEL'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 4.
W_FCAT-FIELDNAME = 'SPART'.
W_FCAT-SELTEXT_M = 'DIVISION'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 5.
W_FCAT-FIELDNAME = 'FKDAT'.
W_FCAT-SELTEXT_M = 'CREATION DATE'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 6.
W_FCAT-FIELDNAME = 'POSNR'.
W_FCAT-SELTEXT_M = 'BILLING ITEM'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 7.
W_FCAT-FIELDNAME = 'MATNR'.
W_FCAT-SELTEXT_M = 'MATERIAL NUM'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 8.
W_FCAT-FIELDNAME = 'ARKTX'.
W_FCAT-SELTEXT_M = 'DESCRIPTION'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 9.
W_FCAT-FIELDNAME = 'FKIMG'.
W_FCAT-SELTEXT_M = 'QUANTITY'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 10.
W_FCAT-FIELDNAME = 'NETWR'.
W_FCAT-SELTEXT_M = 'NET VALUE'.
W_FCAT-DO_SUM = 'X'.
APPEND W_FCAT TO T_FCAT.
ENDFORM. " BUILD_FCAT
*& Form BUILD_LIST_HEAD
FORM BUILD_LIST_HEAD .
DATA : L_DATE(10),
L_TIME(8).
W_LIST_HEAD-TYP = 'S'.
W_LIST_HEAD-KEY = 'Sales org :'.
W_LIST_HEAD-INFO = S_VBELN-LOW .
APPEND W_LIST_HEAD TO T_LIST_HEAD.
CLEAR W_LIST_HEAD.
W_LIST_HEAD-TYP = 'S'.
W_LIST_HEAD-KEY = 'TO '.
W_LIST_HEAD-INFO = S_VBELN-HIGH.
APPEND W_LIST_HEAD TO T_LIST_HEAD.
CLEAR W_LIST_HEAD.
ENDFORM. " BUILD_LIST_HEAD
*& Form LIST_TOP_OF_PAGE
FORM LIST_TOP_OF_PAGE .
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_LIST_HEAD.
ENDFORM. " LIST_TOP_OF_PAGE
<code>
Regards -
Hi
I am using ALV to print my report.
I want to write some data above or below
the ALV output. How to do it?
Regards,
Abhimanyu.LHi abhimanyu,
check this code:
report zus_alv_demo_grid .
tables: ekko.
type-pools: slis.
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,
line_color(4) type c, "Used to store row color
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.
Data declaration for EVENT and PRINT PARAMETER.
data: gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
data declaration for sorting.
data : it_sortcat type slis_sortinfo_alv occurs 1,
wa_sort like line of it_sortcat.
data : i_list_comments type slis_t_listheader.
start-of-selection.
perform data_retrieval.
perform user_command.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
perform build_sortcat.
perform display_alv_report.
end-of-selection.
*TOP-OF-PAGE.
PERFORM top-of-page.
end-of-page.
*& Form build_fieldcatalog
text
--> p1 text
<-- p2 text
form build_fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = '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.
fieldcatalog-do_sum = 'X'.
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-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
text
--> p1 text
<-- p2 text
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
Set layout field for row attributes(i.e. color)
gd_layout-info_fieldname = 'LINE_COLOR'.
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for
*when double
"click(press f2)*
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
endform. " build_layout
*& Form data_retrieval
text
--> p1 text
<-- p2 text
form data_retrieval.
data: ld_color(1) type c.
select ebeln ebelp statu aedat matnr menge meins netpr
peinh from ekpo into table it_ekko.
*Populate field with color attributes
loop at it_ekko into wa_ekko.
Populate color variable with colour properties
Char 1 = C (This is a color property)
Char 2 = 3 (Color codes: 1 - 7)
Char 3 = Intensified on/off ( 1 or 0 )
Char 4 = Inverse display on/off ( 1 or 0 )
i.e. wa_ekko-line_color = 'C410'
ld_color = ld_color + 1.
Only 7 colours so need to reset color value
if ld_color = 8.
ld_color = 1.
endif.
concatenate 'C' ld_color '10' into wa_ekko-line_color.
wa_ekko-line_color = 'C410'.
modify it_ekko from wa_ekko.
endloop.
endform. " data_retrieval
*& Form display_alv_report
text
--> p1 text
<-- p2 text
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
is_layout = gd_layout
i_callback_top_of_page = 'TOP-OF-PAGE'
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
it_event = gt_events
is_print = gd_prntparams
it_fieldcat = fieldcatalog[]
it_sort = it_sortcat
i_save = 'X'
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 user_command
text
--> p1 text
<-- p2 text
*& Form top-of-page
text
--> p1 text
<-- p2 text
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 = 'GANESH_LOGO'.
endform. " top-of-page
FORM user_command *
--> R_UCOMM *
--> RS_SELFIELD *
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when '&IC1'.
if rs_selfield-fieldname = 'EBELN'.
read table it_ekko into wa_ekko index rs_selfield-tabindex.
set parameter id 'BES' field wa_ekko-ebeln.
call transaction 'ME23N' and skip first screen.
endif.
when 'ULHAS'.
if rs_selfield-fieldname = 'EBELN'.
read table it_ekko into wa_ekko index rs_selfield-tabindex.
set parameter id 'BES' field wa_ekko-ebeln.
call transaction 'ME23N' and skip first screen.
endif.
endcase.
endform.
FORM set_pf_status *
--> RT_EXTAB *
form set_pf_status using rt_extab type slis_t_extab.
set pf-status 'ZNEWSTATUS'.
endform.
*& Form build_events
text
--> p1 text
<-- p2 text
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[]
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 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
text
--> p1 text
<-- p2 text
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.
*& Form build_sortcat
text
--> p1 text
<-- p2 text
form build_sortcat.
wa_sort-spos = 1.
wa_sort-fieldname = 'EBELN'.
append wa_sort to it_sortcat.
wa_sort-spos = 2.
wa_sort-fieldname = 'EBELP'.
append wa_sort to it_sortcat.
endform. " build_sortcat
regards,
keerthi. -
How to delelete alv header part.
Dear frnds,
I want to delete ALV header data, In alv output above the alv table sum setting are there (view filter) i dont want that settings i want to delete that header part and i want to delete columns headings also i need data part only.
Give the code to delete that headers and column headings..
thanks & regards,
rajeshHi ,
I added below code in on_select method.
data: node_customer type ref to if_wd_context_node,
l_salv_wd_table1 TYPE REF TO iwci_salv_wd_table,
l_table1 TYPE REF TO cl_salv_wd_config_table.
DATA : lr_salv_wd_table_usage1 TYPE REF TO if_wd_component_usage.
refresh: i_custmast.
node_customer = wd_context->get_child_node( name = `CUST_STATUS` ).
node_customer->bind_table( new_items = i_custmast ).
select NAME1 STATUS from zbas_custmast into TABLE
i_custmast where kunnr eq <lt_kunnr>.
if i_custmast is not INITIAL.
node_customer = wd_context->get_child_node( name = `CUST_STATUS` ).
node_customer->bind_table( new_items = i_custmast ).
ELSE.
wd_this->report_message( EXPORTING message = 'No data available for customer details' ).
endif.
lr_salv_wd_table_usage1 = wd_this->wd_cpuse_alv( ).
IF lr_salv_wd_table_usage1->has_active_component( ) IS INITIAL.
lr_salv_wd_table_usage1->create_component( ).
ENDIF.
l_salv_wd_table1 = wd_this->wd_cpifc_alv( ).
l_table1 = l_salv_wd_table1->get_model( ).
l_table1->if_salv_wd_column_settings~delete_column( 'STAT_COL' ). -
How to keep fields enable for Inout on ALV Header
Hi,
I have a requirement where I have Material and plant Number of selection screen.
I have to display the ALV GRID report keeping Material and Plant in its header details.
I need to put a "CHG MAT/PLNT" button on the report output screen. When user presses this button Material and Plant fields on ALV header should become enable to Change. User given new selection criteria there itself and presses ENTER, the report output should be refreshed on the basis of given new selection criteria.
Can anyone please suggest me how to put a BUTTON in ALV display and make these two fields open for INPUT once this button is pressed.
Please write back to me if you feel any doubt in the requirement.
Thanks,
Ashish AgrawalHi Ashish Agrawal ,
in Form built layout
check LAYOUT-GROUP_CHANGE_EDIT = 'X'.
Hope this sole u r problem.
<REMOVED BY MODERATOR>
Thanks and regards ,
rajeshwar .
Edited by: Alvaro Tejada Galindo on Apr 23, 2008 5:13 PM
Maybe you are looking for
-
제품 : FIN_AP 작성날짜 : 2004-05-19 WITHHOLDING TAX TYPE의 INVOICE ============================= PURPOSE Invoice Distribution Level에 있는 Type중에는 Withholding Tax가 있고, 해당 Type은 자동으로 생성되도록 설정하여 사용해야 합니다. Explanation Withholding Tax type의 invoice에 대해 말씀드리겠습니다. 해
-
to send email on my iphone 4s, it goes to outbox. I have to use another email adress. How can I use my default address?
-
Unresponsive MacBook in clamshell mode
My morning routine no longer works. Every day I wake up and turn on my MacBook that is connected to a monitor, firewire external hdd, usb printer, and speaker. After it has booted, I open Mail. Once that is loaded and my Bluetooth keyboard and trackp
-
IPhone 5c not recognizing charger/charging?
I've had my 5c for about 3 weeks, and its seems like its not charging properly, at least when connected to an outlet. It runs out of battery (frequently I might add), and shows the "charge me" icon of empty battery and charger plug. When I plug it in
-
Outlook contacts & Comcast problems
I'm a total Newbie!! I have 2 problems.Until I purchased my 8130, my email & cell contacts were completely seperate.I synced on Outlook and it worked perfectly. 1. My first problem is that I can not "import" my address book from Comcast.All my old em