Date post: | 04-Apr-2018 |
Category: |
Documents |
Upload: | venkata-brahma-dattu |
View: | 237 times |
Download: | 0 times |
of 16
7/30/2019 Sample ALV report
1/16
ALV Grid Part 1: Detailed step by step on how to create asimple ALV Grid
Posted on January 3, 2012 by Stedie
ALV Grid Part 1 consists of a very detailed step by step on how to create a very simple
OO ALV Grid.
TL;DR: Click here to jump to thecoding.
ALV Grid Part 2: Enabling buttons
Tcode: SE80
Choose program from the first dropdown list and put in a Z program name that
makes sense at the second input box.
SE80 object navigator
Upon hitting ENTER. Pop up appears, select Yes to create the object.
Yes please, create the object
http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/author/droidster_admin/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/#codinghttp://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/#codinghttp://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/#codinghttp://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1_2.pnghttp://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1_1.pnghttp://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1_2.pnghttp://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1_1.pnghttp://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/#codinghttp://www.bluchien.com/author/droidster_admin/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/7/30/2019 Sample ALV report
2/16
We would want to keep this simple for now, uncheck the With TOP INCL.checkbox.
Uncheck the checkboxPut in a title
Put in a titleselectExecutable Program and leave everything else by default, hit SAVE.
Put in a title
Put in $TMP and click SAVE, alternately, just clickLocal Object.
http://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1_4.pnghttp://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1_31.pnghttp://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1_4.pnghttp://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1_31.png7/30/2019 Sample ALV report
3/16
Put in $TMP and click SAVE
Now..time to put in some codes!
Obviously, we would need some data to be displayed.
DATA: BEGIN OF gt_data.
INCLUDE STRUCTURE sflight.
DATA: END OF gt_data.
DATA: t_data LIKE STANDARD TABLE OF gt_data.
* Retrieve 20 rows data from table SFLIGHT
SELECT * FROM sflight INTO TABLE t_data UP TO 20 ROWS.
Next, we will need a container to hold our ALV grid to be displayed on the screen.
Back to the object navigator frame, right click on the program name -> Create ->
Screen.
http://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1_5.png7/30/2019 Sample ALV report
4/16
Creating a screen
Key in a screen number 1001 .
Key in screen number
Key in a short description of your choice and hit the Layout button where we will
create the container on the screen we just created.
http://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1_7.pnghttp://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1_6.pnghttp://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1_7.pnghttp://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1_6.png7/30/2019 Sample ALV report
5/16
Key in short description
Tada..! This is known as the screen painter.
Click the Custom Controlicon as indicate in the screenshot below, drag and draw on
the frame on the right.
Key in a name for the container, GRID_CONTAINER in this case.
Activate and go back.
http://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1_8.png7/30/2019 Sample ALV report
6/16
Create container for the newly created screen
Now we put in some coding to initialize and create the container.
DATA: g_grid_container TYPE REF TO cl_gui_custom_container.
CREATE OBJECT g_grid_container
EXPORTING
container_name = 'GRID_CONTAINER'
EXCEPTIONS
cntl_error = 1
http://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1_9.png7/30/2019 Sample ALV report
7/16
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
After which, we create the ALV Grid object and making the container we have created
to host it.
DATA: g_alv_grid TYPE REF TO cl_gui_alv_grid.
CREATE OBJECT g_alv_grid
EXPORTING
i_parent = g_grid_container.
After that, we call method set_table_for_first_display to display the ALV Grid.
CALL METHOD g_alv_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
it_outtab = t_data[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
Finally, we call the screen.
7/30/2019 Sample ALV report
8/16
CALL SELECTION-SCREEN 1001.
Coding all together:
REPORT ZTEST_STED_ALVGRID.
DATA: BEGIN OF gt_data.
INCLUDE STRUCTURE sflight.
DATA: END OF gt_data.
DATA: t_data LIKE STANDARD TABLE OF gt_data.
DATA: g_alv_grid TYPE REF TO cl_gui_alv_grid,
g_grid_container TYPE REF TO cl_gui_custom_container.
* data selection
SELECT * FROM sflight
INTO TABLE t_data UP TO 20 ROWS.
CREATE OBJECT g_grid_container
EXPORTING
container_name = 'GRID_CONTAINER'
EXCEPTIONS
cntl_error = 1
7/30/2019 Sample ALV report
9/16
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
CREATE OBJECT g_alv_grid
EXPORTING
i_parent = g_grid_container.
CALL METHOD g_alv_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
it_outtab = t_data[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
CALL SELECTION-SCREEN 1001.
7/30/2019 Sample ALV report
10/16
This entry was posted in ABAP, ALV Grid, SAP. Bookmark the permalink.
Hide Title and Notification bar
ALV Grid Part 1.5: Enabling buttons
One Response to ALV Grid Part 1: Detailed step by step on
how to create a simple ALV Grid1. Pingback:ALV Grid Part 1.5: Enabling buttons | Android / ABAP Blog
Leave a Reply
Your email address will not be published. Required fields are marked *
Name *
Email *
Website
CommentYou may use these HTML tags and attributes:
Post Comment
Search
Recent Posts Function module to retrieve Fiscal year and duration
ALV Grid Part 1.5: Enabling buttons
ALV Grid Part 1: Detailed step by step on how to create a simple ALV Grid
Hide Title and Notification bar
Debug certificate expired error
Recent Comments Alice onHide Title and Notification bar
ALV Grid Part 1: Detailed step by step on how to create a simple ALV Grid | Android / ABAP BlogonALV
Grid Part 1.5: Enabling buttons
ALV Grid Part 1.5: Enabling buttons | Android / ABAP BlogonALV Grid Part 1: Detailed step by step on how
to create a simple ALV Grid
Archives April 2012
January 2012
July 2011
Categories
ABAP Activity
http://www.bluchien.com/category/sap/abap/http://www.bluchien.com/category/sap/abap/alv-grid/http://www.bluchien.com/category/sap/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2011/07/hide-title-and-notification-bar/http://www.bluchien.com/2011/07/hide-title-and-notification-bar/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/2012/04/function-module-to-retrieve-fiscal-year-and-duration/http://www.bluchien.com/2012/04/function-module-to-retrieve-fiscal-year-and-duration/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2011/07/hide-title-and-notification-bar/http://www.bluchien.com/2011/07/hide-title-and-notification-bar/http://www.bluchien.com/2011/07/debug-certificate-expired-error/http://www.bluchien.com/2011/07/debug-certificate-expired-error/http://www.bluchien.com/2011/07/hide-title-and-notification-bar/#comment-37http://www.bluchien.com/2011/07/hide-title-and-notification-bar/#comment-37http://www.bluchien.com/2011/07/hide-title-and-notification-bar/#comment-37http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/#comment-22http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/#comment-22http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/#comment-22http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/#comment-22http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/#comment-21http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/#comment-21http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/#comment-21http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/#comment-21http://www.bluchien.com/2012/04/http://www.bluchien.com/2012/04/http://www.bluchien.com/2012/01/http://www.bluchien.com/2012/01/http://www.bluchien.com/2011/07/http://www.bluchien.com/2011/07/http://www.bluchien.com/category/sap/abap/http://www.bluchien.com/category/sap/abap/http://www.bluchien.com/category/activity/http://www.bluchien.com/category/activity/http://www.bluchien.com/category/activity/http://www.bluchien.com/category/sap/abap/http://www.bluchien.com/2011/07/http://www.bluchien.com/2012/01/http://www.bluchien.com/2012/04/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/#comment-21http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/#comment-21http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/#comment-22http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/#comment-22http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2011/07/hide-title-and-notification-bar/#comment-37http://www.bluchien.com/2011/07/debug-certificate-expired-error/http://www.bluchien.com/2011/07/hide-title-and-notification-bar/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/2012/04/function-module-to-retrieve-fiscal-year-and-duration/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/2011/07/hide-title-and-notification-bar/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/category/sap/http://www.bluchien.com/category/sap/abap/alv-grid/http://www.bluchien.com/category/sap/abap/7/30/2019 Sample ALV report
11/16
ALV Grid
Android
androidManifest.xml
debug certificate
SAP
Screen
ALV Grid Part 1: Detailed step by step on how to create a simple ALV Grid
Function module to retrieve Fiscal year and duration
ALV Grid Part 1.5: Enabling buttons
Posted on January 3, 2012 by Stedie
This post doesnt really talk about ALV Grid, but more about screen in general.
If you have followed throughALV Grid Part 1, you will notice the standard toolbar
has been disabled.
This post, we will look into how to enable the standard toolbar.
Disabled buttons
Continuing fromALV Grid Part 1, if you execute the program, theres no way to go
back or exit besides doing a /n in the Command field.
Double click on screen 1001 and click on the Flow Logic tab.
http://www.bluchien.com/category/sap/abap/alv-grid/http://www.bluchien.com/category/sap/abap/alv-grid/http://www.bluchien.com/category/android/http://www.bluchien.com/category/android/http://www.bluchien.com/category/androidmanifest-xml/http://www.bluchien.com/category/androidmanifest-xml/http://www.bluchien.com/category/debug-certificate/http://www.bluchien.com/category/debug-certificate/http://www.bluchien.com/category/sap/http://www.bluchien.com/category/sap/http://www.bluchien.com/category/sap/abap/screen/http://www.bluchien.com/category/sap/abap/screen/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/04/function-module-to-retrieve-fiscal-year-and-duration/http://www.bluchien.com/2012/04/function-module-to-retrieve-fiscal-year-and-duration/http://www.bluchien.com/2012/04/function-module-to-retrieve-fiscal-year-and-duration/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/author/droidster_admin/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1-5_1.pnghttp://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1-5_1.pnghttp://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/author/droidster_admin/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/2012/04/function-module-to-retrieve-fiscal-year-and-duration/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/category/sap/abap/screen/http://www.bluchien.com/category/sap/http://www.bluchien.com/category/debug-certificate/http://www.bluchien.com/category/androidmanifest-xml/http://www.bluchien.com/category/android/http://www.bluchien.com/category/sap/abap/alv-grid/7/30/2019 Sample ALV report
12/16
Double click on screen 1001
You will notice that 2 modules have been commented out.
PROCESS BEFORE OUTPUT
The event PROCESS BEFORE OUTPUT (PBO) is triggered by the runtime
environment before the screen of a dynpro is sent to the presentation layer.
PROCESS AFTER INPUT
The event PROCESS AFTER INPUT (PAI) is triggered by a user action on the user
interface
So the basic thing one needs to understand is the flow logic, its always called like
this.
PROCESS BEFORE OUTPUT (PBO) -> Display on screen -> PROCESS AFTER
INPUT (PAI)
Lets uncomment the 2 modules.
Double click on MODULE status_1001, you should see a pop up box saying that object
does not exist, proceed to create it.
http://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1-5_2.png7/30/2019 Sample ALV report
13/16
Uncomment the 2 modules
Lets keep things simple by creating it in the main program for now.
Create module in MAIN program
You will get something similiar as below in the main program.
*&--------------------------------------------------------------*
*& Module STATUS_1001 OUTPUT
*&--------------------------------------------------------------*
* text
*---------------------------------------------------------------*
http://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1-5_4.pnghttp://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1-5_3.pnghttp://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1-5_4.pnghttp://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1-5_3.png7/30/2019 Sample ALV report
14/16
MODULE STATUS_1001 output.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_1001 OUTPUT
Proceed to uncomment SET PF-STATUS 'xxxxxx', and replace the xxxxx with
something meaningful, e.g. STATUS_1001(needs to be all uppercase). Double click on
the STATUS_1001.
PBO Status Creation
Expand the Function keys, you will see something familiar. Lets assignBACK
, activate and go back to flow logic ofScreen 1001.
http://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1-5_5.png7/30/2019 Sample ALV report
15/16
Assign BACK button
All buttons and users interactions will be handled in the PAI (Process after Input).
Double click on the MODULE USER_COMMAND_1001 and it should prompt you to create the
missing object like you did for the PBO module.
Put in the coding to tell the program what should be done in the event of user
clicking theBACK button: Leave.
After youre done, you should have something like this in the main program.
*&--------------------------------------------------------------*
*& Module USER_COMMAND_1001 INPUT
*&--------------------------------------------------------------*
* text
*---------------------------------------------------------------*
MODULE USER_COMMAND_1001 input.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE.
ENDCASE.
ENDMODULE. " USER_COMMAND_1001 INPUT
http://www.bluchien.com/wp-content/uploads/2012/01/alvgrid-part1-5_6.png7/30/2019 Sample ALV report
16/16
Activate and execute the program. Now your Back button should be working.This entry was posted in ABAP, ALV Grid, SAP, Screen. Bookmark the permalink.
ALV Grid Part 1: Detailed step by step on how to create a simple ALV Grid
Function module to retrieve Fiscal year and duration
One Response to ALV Grid Part 1.5: Enabling buttons1. Pingback:ALV Grid Part 1: Detailed step by step on how to create a simple ALV Grid | Android /
ABAP Blog
http://www.bluchien.com/category/sap/abap/http://www.bluchien.com/category/sap/abap/alv-grid/http://www.bluchien.com/category/sap/http://www.bluchien.com/category/sap/abap/screen/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/04/function-module-to-retrieve-fiscal-year-and-duration/http://www.bluchien.com/2012/04/function-module-to-retrieve-fiscal-year-and-duration/http://www.bluchien.com/2012/04/function-module-to-retrieve-fiscal-year-and-duration/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/04/function-module-to-retrieve-fiscal-year-and-duration/http://www.bluchien.com/2012/01/alv-grid-part-1-detailed-step-by-step-on-how-to-create-a-simple-alv-grid/http://www.bluchien.com/2012/01/alv-grid-part-1-5-enabling-buttons/http://www.bluchien.com/category/sap/abap/screen/http://www.bluchien.com/category/sap/http://www.bluchien.com/category/sap/abap/alv-grid/http://www.bluchien.com/category/sap/abap/