ALV programming
Content:
Ø Introduction
Ø ALV List Display
Ø ALV Grid Display
Ø ALV Hierarchical Display
Ø ALV using OOPs
Ø Editing and coloring
Ø Code snippets
Introduction:
Common Steps:
- Data declarations
- Fetch the required data form the tables
- Prepare field catalog
- Build up the event table if required
- Display ALV output by Calling FM
All the definitions TYPES and STRUCTURES and CONSTANTS are defined in the TYPE-POOL ‘SLIS’, so it should be declared first.
ALV List Display:
- Field catalog can be prepared manually (should contain at least TABNAME, FIELDNAME, REF_TABNAME, SELTECT_M) or by using REUSE_ALV_FIELDCATALOG_MERGE.
- To get all possible events REUSE_ALV_EVENTS_GET can be used.
- To write proper comments use REUSE_ALV_COMMENTARY_WRITE.
- To print the data REUSE_ALV_LIST_DISPLAY can be used.
- Build up the event table if required
- Display ALV output by Calling FM
All the definitions TYPES and STRUCTURES and CONSTANTS are defined in the TYPE-POOL ‘SLIS’, so it should be declared first.
ALV List Display:
- Field catalog can be prepared manually (should contain at least TABNAME, FIELDNAME, REF_TABNAME, SELTECT_M) or by using REUSE_ALV_FIELDCATALOG_MERGE.
- To get all possible events REUSE_ALV_EVENTS_GET can be used.
- To write proper comments use REUSE_ALV_COMMENTARY_WRITE.
- To print the data REUSE_ALV_LIST_DISPLAY can be used.
ALV Grid Display:
- The first 3 function modules mentioned above can be used and to print the data REUSE_ALV_GRID_DISPLAY is used.
- The first 3 function modules mentioned above can be used and to print the data REUSE_ALV_GRID_DISPLAY is used.
Hierarchical ALV:
- Hierarchical display is used for displaying data that are related. Like sales order and item details.
- REUSE_ALV_HIERSEQ_LIST_DISPLAY is used to print the data.
- Hierarchical display is used for displaying data that are related. Like sales order and item details.
- REUSE_ALV_HIERSEQ_LIST_DISPLAY is used to print the data.
ALV Using OOPs:
- Create Docking/custom container.
- Create a grid inside container.
- Call function LVC_FIELDCATALOG_MERGE to get the field catalog.
- Call method SET_TABLE_FOR_FIRST_DISPLAY for o/p.
Editing and Coloring:
- Coloring an entire column
- Create Docking/custom container.
- Create a grid inside container.
- Call function LVC_FIELDCATALOG_MERGE to get the field catalog.
- Call method SET_TABLE_FOR_FIRST_DISPLAY for o/p.
Editing and Coloring:
- Coloring an entire column
To make an entire column be painted with the color you want, you can use the "emphasize" option of the field catalog. Simply assign a color code to this field of the row added for your column. Color codes are constructed as follows:
Cxyz: - x: 1-7 (1 for example is gray-blue, 6 is red), y: intensified on/off, z: inverse on/off.
- Coloring an entire row
Cxyz: - x: 1-7 (1 for example is gray-blue, 6 is red), y: intensified on/off, z: inverse on/off.
- Coloring an entire row
Coloring a row is a bit more complicated. To enable row coloring, you should add an additional field to your list data table. It should be of character type and at least 4 bit long. This field will contain the color code for the row. So for example:
DATA: BEGIN OF gt_list occurs 0.
INCLUDE STRUCTURE .
DATA rowcolor(4) TYPE c.
DATA: END OF gt_list.
As you guess, you should fill the color code to this field. Its format is as explained before. For second you must pass the name of the field to the layout structure:E.g. ps_layout-info_fname = 'ROWCOLOR'.
- Coloring an individual cell:
Likely coloring rows, you must append an internal table to each line of gt_list containing the color information:
DATA: BEGIN OF gt_list occurs 0.
INCLUDE STRUCTURE .
DATA cellcolors TYPE lvc_t_scol.
DATA: END OF gt_list.
If you want to modify the cell in the 5 row and the 2 column, you have to set:
DATA: cellcolor type line of lvc_t_scol.
READ TABLE gt_list INDEX 2.
cellcolor-fname = '.cellcolor-color-col = '6'.
cellcolor-color-int = '0'.
APPEND cellcolor TO gt_list-cellcolors.
Modify GT_LIST INDEX 5.
As like coloring rows, you have to pass the info for coloring cell to the layout-structure:
ps_layout-info_ctab_fname = 'CELLCOLOR'.
- Editing an entire column:
When you want to do edit only for particular column and not for the entire grid then you need to perform fieldcat in that particular column only. Loop the field catalog and for that column make the EDIT field of catalog as ‘X’ and then modify catalog.
- Editing a single cell:Add a table to your list data table.
Data begin of gt_grid occurs 0.
data cellstyles type lvc_t_styl.
Data end of gt_grid.Form make_field_edit using pt_grid like gt_grid[].
data: ls_grid like line of pt_grid,
ls_style type lvc_s_styl,
lt_style type lvc_t_styl.Loop at pt_grid into ls_grid.
If ls_grid-curr = xyz. 'your condition for the row
ls_style-fieldname = 'CURR'.
ls_style-style = cl_gui_alv_grid=>mc_style_enabled.
append ls_style to lt_style.
endif.
Insert lines of lt_style into ls_grid-celltyles.modify pt_grid from ls_grid.
Endloop.
Endform.
When you want to do edit only for particular column and not for the entire grid then you need to perform fieldcat in that particular column only. Loop the field catalog and for that column make the EDIT field of catalog as ‘X’ and then modify catalog.
- Editing a single cell:Add a table to your list data table.
Data begin of gt_grid occurs 0.
data cellstyles type lvc_t_styl.
Data end of gt_grid.Form make_field_edit using pt_grid like gt_grid[].
data: ls_grid like line of pt_grid,
ls_style type lvc_s_styl,
lt_style type lvc_t_styl.Loop at pt_grid into ls_grid.
If ls_grid-curr = xyz. 'your condition for the row
ls_style-fieldname = 'CURR'.
ls_style-style = cl_gui_alv_grid=>mc_style_enabled.
append ls_style to lt_style.
endif.
Insert lines of lt_style into ls_grid-celltyles.modify pt_grid from ls_grid.
Endloop.
Endform.
Code Snippet for ALV List Display, Grid Display and Using OOP.
Link : http://www.scribd.com/doc/139934961/ABAP-ALV-Programming
ABAP ALV Programming by Debesh Swain
This comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteGreat post and informative blog.it was awesome to read, thanks for sharing this great content to my vision.
ReplyDeleteInformatica Training In Chennai
Hadoop Training In Chennai
Oracle Training In Chennai
SAS Training In Chennai
Thank you for taking the time and sharing this information with us. It was indeed very helpful and insightful while being straight forward and to the point.
ReplyDeleteangularjs interview questions and answers
angularjs Training in bangalore
angularjs Training in bangalore
angularjs Training in chennai
automation anywhere online Training
I found this informative and interesting blog so i think so its very useful and knowledge able.I would like to thank you for the efforts you have made in writing this article.
ReplyDeleteJava training in Bangalore | Java training in Electronic city
Java training in Chennai | Java training institute in Chennai | Java course in Chennai
Java training in USA
Java training in Bangalore | Java training in Indira nagar
Well researched article and I appreciate this. The blog is subscribed and will see new topics soon.
ReplyDeleteonline Python training
python training in chennai
Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information.
ReplyDeleterpa training in chennai
rpa training in bangalore
rpa course in bangalore
best rpa training in bangalore
rpa online training
wonderful opportunity is created by you
ReplyDeleteBEST ANGULAR JS TRAINING IN CHENNAI WITH PLACEMENT
https://www.acte.in/angular-js-training-in-chennai
https://www.acte.in/angular-js-training-in-annanagar
https://www.acte.in/angular-js-training-in-omr
https://www.acte.in/angular-js-training-in-porur
https://www.acte.in/angular-js-training-in-tambaram
https://www.acte.in/angular-js-training-in-velachery
I inspired a lot by seeing your site.
ReplyDeleteAngularJS training in chennai | AngularJS training in anna nagar | AngularJS training in omr | AngularJS training in porur | AngularJS training in tambaram | AngularJS training in velachery
Nice information on the ethical hacking. I read the complete blog and all topics. Great one...thanks lot!!
ReplyDeleteAndroid Training in Chennai
Android Online Training in Chennai
Android Training in Bangalore
Android Training in Hyderabad
Android Training in Coimbatore
Android Training
Android Online Training
Thanks for the great post on your blog, it really gives me an insight on this topic.I must thank you for this informative ideas. I hope you will post again soon.
ReplyDeleteAngular js Training in Chennai
Angular js Training in Velachery
Angular js Training in Tambaram
Angular js Training in Porur
Angular js Training in Omr
Angular js Training in Annanagar
Thanks for the great post on your blog, it really gives me an insight on this topic.I must thank you for this informative ideas. I hope you will post again soon.
ReplyDeleteIELTS Coaching in chennai
German Classes in Chennai
GRE Coaching Classes in Chennai
TOEFL Coaching in Chennai
Spoken english classes in chennai | Communication training
I loved your post.Much thanks again. Fantastic.
ReplyDeleteselenium online trainings
selenium trainings
Cool and I have a nifty provide: Whole House Renovation affordable home renovations
ReplyDelete