REPORT ZROWCOLOR.
TABLES: vbak.
TYPE-pools: slis. "ALV Declarations
TYPES: BEGIN OF t_vbak,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
netwr TYPE vbak-netwr,
CELLCOLOR TYPE LVC_T_SCOL,
END OF t_vbak.
DATA: it_vbak TYPE STANDARD TABLE OF t_vbak INITIAL SIZE 0,
wa_vbak TYPE t_vbak.
*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.
PERFORM fill_data.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM set_cell_colours.
PERFORM display_alv_report.
*&---------------------------------------------------------------------*
*& Form BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
* Build Fieldcatalog for ALV Report
*----------------------------------------------------------------------*
FORM build_fieldcatalog.
fieldcatalog-fieldname = 'VBELN'.
fieldcatalog-seltext_m = 'Sales Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-KEY = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ERDAT'.
fieldcatalog-seltext_m = 'Created Date '.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NETWR'.
fieldcatalog-seltext_m = 'Document Value'.
fieldcatalog-col_pos = 2.
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-coltab_fieldname = 'CELLCOLOR'. "CTAB_FNAME
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
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
TABLES
t_outtab = it_vbak
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " DISPLAY_ALV_REPORT
*&---------------------------------------------------------------------*
*& Form DATA_RETRIEVAL
*&---------------------------------------------------------------------*
* Retrieve data form vbak table and populate itab it_vbak
*----------------------------------------------------------------------*
FORM fill_data.
SELECT vbeln erdat netwr
UP TO 10 ROWS
FROM vbak
INTO CORRESPONDING FIELDS OF TABLE it_vbak.
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 = 'Sales Order 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_vbak 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.
ENDFORM. "top-of-page
*&---------------------------------------------------------------------*
*& Form SET_CELL_COLOURS
*&---------------------------------------------------------------------*
* Set colour of individual ALV cell, field
*----------------------------------------------------------------------*
FORM SET_CELL_COLOURS .
DATA: WA_CELLCOLOR TYPE LVC_S_SCOL.
DATA: ld_index TYPE SY-TABIX.
LOOP AT IT_VBAK INTO wa_vbak.
LD_INDEX = SY-TABIX.
WA_CELLCOLOR-FNAME = 'VBELN'.
WA_CELLCOLOR-COLOR-COL = sy-tabix.
WA_CELLCOLOR-COLOR-INT = '1'. "1 = Intensified on, 0 = Intensified off
WA_CELLCOLOR-COLOR-INV = '0'. "1 = text colour, 0 = background colour
APPEND WA_CELLCOLOR TO wa_vbak-CELLCOLOR.
MODIFY it_vbak FROM wa_vbak INDEX ld_index TRANSPORTING CELLCOLOR.
IF wa_vbak-netwr GT 0.
WA_CELLCOLOR-FNAME = 'NETWR'.
WA_CELLCOLOR-COLOR-COL = 4.
WA_CELLCOLOR-COLOR-INT = '0'.
WA_CELLCOLOR-COLOR-INV = '0'.
APPEND WA_CELLCOLOR TO wa_vbak-CELLCOLOR.
MODIFY it_vbak FROM wa_vbak INDEX ld_index TRANSPORTING CELLCOLOR.
ENDIF.
WA_CELLCOLOR-FNAME = 'ERDAT'.
WA_CELLCOLOR-COLOR-COL = 6.
WA_CELLCOLOR-COLOR-INT = '0'.
WA_CELLCOLOR-COLOR-INV = '1'.
APPEND WA_CELLCOLOR TO wa_vbak-CELLCOLOR.
MODIFY it_vbak FROM wa_vbak INDEX ld_index TRANSPORTING CELLCOLOR.
ENDLOOP.
ENDFORM.
outputs:
You made some decent factors there. I looked on the internet for the difficulty and found most individuals will associate with along with your website.Keep update more excellent posts.
ReplyDeleteSap Training in Chennai | Sap Abap Training in Chennai | Sap SD Training in Chennai
Thanks for your comments..
Deletethank you for sharing such a unique content.please provide latest updates .one of the recommanded blog
http://www.suntrainings.com/sapabap.html
Thanks for your comments..
ReplyDeleteThanks for your comments..
ReplyDeleteThanks for your comments.. And will try to keep uploading new contents.
ReplyDeleteI am planning to join sap abap with them after reading your blog.
ReplyDeleteHope the best will turn out.
Call them at 8122241286 in chennai.
www.thecreatingexperts.com
We provide sap abap technical course, call us to know more about us and join with us.
ReplyDeleteCall them at 8122241286 in chennai.
www.thecreatingexperts.com
Thank you for your post on sap video tutorials.
ReplyDeleteThanks for the great information in your blog on It was so nice article sap video tutorials
ReplyDeleteThank you for your post on sap video tutorials.
ReplyDelete
ReplyDeleteWell it Was Very Good Information. Thanks for sharing this Information. sap video tutorials
ReplyDeleteThank you for giving this best information. It’s a very nice topic sap video tutorials
Thank you sir.I get a lot of great information from this blog on sap video
ReplyDelete
ReplyDeleteThanks for the great information in your blog on It was so nice article Thank you for valuable informationsap video tutorials
Thank you sir.It was so nice article Thank you for valuable information sap video
ReplyDeleteThank you for giving this best information. It’s a very nice topic.sap video
ReplyDeleteI am very greatful to you that you share very informative post with us sap video tutorials
ReplyDeleteThank you sir.I am very greatful to you that you share very informative post with us sap video tutorials
ReplyDeleteThank you for giving this best information. It’s a very nice topic. sap video tutorials
ReplyDeleteThank you sir.Thanks for Nice and Informative Post on sap video
ReplyDeleteIt was so nice article Thank you for valuable information sap video
ReplyDelete
ReplyDeleteThank you for giving this best information. It’s a very nice topic sap video tutorials
Thank you. It is such a wonderful post. it has great information it is very useful for sap video tutorial.
ReplyDeleteThis article is really contains lot more information about This Topic on. sap video tutorials
ReplyDeleteGood post! Thanks for sharing this Information.The information you Provided is much useful on sap video
ReplyDelete
ReplyDeleteWell, I found this information really useful. Thanks a ton for this.
sap video tutorials
ReplyDeleteWell, I found this information really useful. Thanks a ton for this. sap video tutorials
Thanks for providing this information. sap video tutorials
ReplyDeleteThanks for the interesting information. sap video tutorials
ReplyDelete
ReplyDeleteI am very greatful to you that you share very informative post with us. sap video tutorials
ReplyDeleteThanks for the detailed info about SAP. sap video tutorials
ReplyDeleteThanks for the interesting information sap video tutorials
SAP ABAP training is provided in CHENNAI.
ReplyDeleteTHE CREATING EXPERTS is one of the leading trainer in SAP who provides real time training
http://thecreatingexperts.com/sap-abap-training-in-chennai/
contact 8122241286
Thank you. sir, Really I like your post on. sap video
ReplyDeleteThank you for Wonderful information.
ReplyDeleteSAP ABAP training in CHENNAI BY THE CREATING EXPERTS
http://thecreatingexperts.com/sap-abap-training-in-chennai/
CONTACT 8122241286
Thank you for Wonderful information.
ReplyDeleteSAP ABAP training in CHENNAI BY THE CREATING EXPERTS
http://thecreatingexperts.com/sap-abap-training-in-chennai/
CONTACT 8122241286
Fabulous..!!! The information you Provided is much useful. sapvideos
ReplyDeleteI get a lot of great information from this blog on. sap video tutorials
ReplyDelete
ReplyDeleteThank you for Sharing Great Information. sap video tutorials
ReplyDeleteit has great information it is very useful Post. sap video
ReplyDeleteThank you for giving this best information. It’s a very nice topic. sap tutorial videos
ReplyDeleteI get a lot of great information from this blog on. sap video
it has great information it is very useful Post. sap video
ReplyDeleteI get a lot of great information from this blog. sap videos tutorials
ReplyDeleteThank you. sir, Really I like your post on. sap video
ReplyDeleteFabulous..!!! The information you Provided is much useful. sap videos tutorials
ReplyDeleteThanks for sharing this Information,
ReplyDeleteGot to learn new things from your Blog on Sap fiori.
SAP ABAP Consultant India
ReplyDeleteWell, I found this information really useful. Thanks a ton for this. sap tutorial videos
ReplyDeleteThank you. sir, Really I like your post on sap video tutorials
Thankyou for Sharing Great Information. It is Very Helpful Information on sap training videos.
ReplyDeletethanks for sharing this posting
ReplyDeleteSap Training in Gurgaon
It was so nice article.I was really satisified by seeing this article sapvideos.
ReplyDelete
ReplyDeleteSap Online Access
Thanks for sharing the informative content in sap training.
ReplyDeleteSAP ABAP Training institute in Noida