8
My Experiments with ABAP Home Index Links SAP SD SAP MM SAP Basis SAP QM Tutorial Wednesday, June 11, 2008 In this tutorial I will try to explain how to display multiple ALV Grid on a single screen. This is a very simple concept, to render or to draw a ALV grid on a screen you need a CONTAINER. Usually we create a CONTAINER with class CL_GUI_CUSTOM_CONTAINER and pass this CONTAINER object while creating ALV grid in parameter I_PARENT. Now to display multiple ALV grid you need multiple CONTAINER, here the class CL_GUI_EAST_SPLITTER_CONTAINER comes in the picture. This class divides a particular CONTAINER into two and give you two CONTAINER in return. How it divides depend on the parameter you pass while creating object. You can divide it horizontally by passing argument CL_GUI_EAST_SPLITTER_CONTAINER=>ORIENTATION_HORIZONTAL or vertically by passing argument CL_GUI_EAST_SPLITTER_CONTAINER=>orientation_VERTICAL. Since it will give you two CONTAINER you can further divide resulting CONATINER into two. So each time you create a object of CL_GUI_EAST_SPLITTER_CONTAINER you get one more CONTAINER. Finally you can use these CONATINER to create ALV Grids, or any GUI controls for example CL_GUI_ALV_TREE or CL_GUI_MOVIE (SAP Movie Control.. sounds interesting). If you are confuse with above explanation then just forgot it and see the example. I have created a SCREEN 100 with custom container name 'CONTAINER'. Below is the code for above screen shot. REPORT zreport. TABLES : scarr . DATA : it_scarr TYPE TABLE OF scarr . DATA : ob_custom TYPE REF TO cl_gui_custom_container , ob_split1 TYPE REF TO cl_gui_easy_splitter_container , ob_split2 TYPE REF TO cl_gui_easy_splitter_container , ob_grid1 TYPE REF TO cl_gui_alv_grid , ob_grid2 TYPE REF TO cl_gui_alv_grid , ob_grid3 TYPE REF TO cl_gui_alv_grid . SELECT-OPTIONS : s_carrid FOR scarr-carrid . START-OF-SELECTION . SELECT * INTO TABLE it_scarr FROM scarr WHERE carrid IN s_carrid . CALL SCREEN 100 . *&---------------------------------------------------------------------* *& Module status_0100 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* Displaying Two ALV Grid on Screen 6 Simple Code to consume Web service using SAP ABAP Displaying Two ALV Grid on Screen Processing xml with XSLT transformation in ABAP SAP ABAP Dynamic Internal table and Processing 02 Enhancement - Sales Order transactions VA01/VA02/VA03 Defining Range Type in ABAP Configure SAP Printer to send spool as PDF attachment Using field-symbol to speed up LOOP on internal table First and Last Day of the Month ALV Grid OO - Tips Popular Posts Join this site with Google Friend Connect Members (54) More » Already a member?Sign in Good one.... Thank you very much for such an good ... - 16 June 2013 - Deepak very-very good! Thanx! - 07 June 2013 - Anonymous thanks a lot for this article ! - 06 June 2013 - Yuri Kostin Really good. Crystal clear. Keep up the good work.... - 24 May 2013 - ashish kapale have you defined screen 100, titlebar and pf statu... -21May2013- Pawan Kesari Followers Recent Comments Read this on Mobile Device 1 Share More Next Blog» Create Blog Sign In Page 1 of 8 My Experiments with ABAP: Displaying Two ALV Grid on Screen 2013/06/19 http://sample-code-abap.blogspot.com/2008/06/displaying-two-alv-grid-on-screen.html

Displaying Two Alv

Embed Size (px)

DESCRIPTION

Display 2 ALVs

Citation preview

Page 1: Displaying Two Alv

My Experiments with ABAP

Home Index Links SAP SD SAP MM SAP Basis SAP QM Tutorial

Wednesday, June 11, 2008

In this tutorial I will try to explain how to display multiple ALV Grid on a single screen. This is a very simple concept, to render or to draw a ALV

grid on a screen you need a CONTAINER. Usually we create a CONTAINER with class CL_GUI_CUSTOM_CONTAINER and pass this CONTAINER

object while creating ALV grid in parameter I_PARENT. Now to display multiple ALV grid you need multiple CONTAINER, here the class

CL_GUI_EAST_SPLITTER_CONTAINER comes in the picture. This class divides a particular CONTAINER into two and give you two CONTAINER in

return. How it divides depend on the parameter you pass while creating object. You can divide it horizontally by passing argument

CL_GUI_EAST_SPLITTER_CONTAINER=>ORIENTATION_HORIZONTAL or vertically by passing argument

CL_GUI_EAST_SPLITTER_CONTAINER=>orientation_VERTICAL. Since it will give you two CONTAINER you can further divide resulting CONATINER

into two. So each time you create a object of CL_GUI_EAST_SPLITTER_CONTAINER you get one more CONTAINER. Finally you can use these

CONATINER to create ALV Grids, or any GUI controls for example CL_GUI_ALV_TREE or CL_GUI_MOVIE (SAP Movie Control.. sounds interesting).

If you are confuse with above explanation then just forgot it and see the example. I have created a SCREEN 100 with custom container

name 'CONTAINER'.

Below is the code for above screen shot.

REPORT zreport.

TABLES : scarr .

DATA : it_scarr TYPE TABLE OF scarr .

DATA : ob_custom TYPE REF TO cl_gui_custom_container ,

ob_split1 TYPE REF TO cl_gui_easy_splitter_container ,

ob_split2 TYPE REF TO cl_gui_easy_splitter_container ,

ob_grid1 TYPE REF TO cl_gui_alv_grid ,

ob_grid2 TYPE REF TO cl_gui_alv_grid ,

ob_grid3 TYPE REF TO cl_gui_alv_grid .

SELECT-OPTIONS : s_carrid FOR scarr-carrid .

START-OF-SELECTION .

SELECT *

INTO TABLE it_scarr

FROM scarr

WHERE carrid IN s_carrid .

CALL SCREEN 100 .

*&---------------------------------------------------------------------*

*& Module status_0100 OUTPUT

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

Displaying Two ALV Grid on Screen

6

Simple Code to consume Web service using SAP ABAP

Displaying Two ALV Grid on Screen

Processing xml with XSLT transformation in ABAP

SAP ABAP Dynamic Internal table and Processing 02

Enhancement - Sales Order transactions VA01/VA02/VA03

Defining Range Type in ABAP

Configure SAP Printer to send spool as PDF attachment

Using field-symbol to speed up LOOP on internal table

First and Last Day of the Month

ALV Grid OO - Tips

Popular Posts

Join this site

with Google Friend Connect

Members (54) More »

Already a member?Sign in

Good one.... Thank you very much for such an good ... - 16 June 2013 - Deepak

very-very good! Thanx! - 07 June 2013 - Anonymous

thanks a lot for this article ! - 06 June 2013 - Yuri Kostin

Really good. Crystal clear. Keep up the good work.... - 24 May 2013 - ashish kapale

have you defined screen 100, titlebar and pfstatu... - 21 May 2013 - Pawan Kesari

Followers

Recent Comments

Read this on Mobile Device

1Share More Next Blog» Create Blog Sign In

Page 1 of 8My Experiments with ABAP: Displaying Two ALV Grid on Screen

2013/06/19http://sample-code-abap.blogspot.com/2008/06/displaying-two-alv-grid-on-screen.html

Page 2: Displaying Two Alv

Posted by Pawan Kesari

Labels: ALV List, SAP ABAP, Tutorial

Recommended blogs

Display ALV Grid (OOP) Fullscreen

Use of Application Log FMs to display Message List/Log

Creating custom page format for sapscript/smartform

Reset ALV Export Option for User

MODULE status_0100 OUTPUT.

SET TITLEBAR 'ZTITLE01' .

SET PF-STATUS 'ZPF01' .

* This will create a container

CREATE OBJECT ob_custom

EXPORTING

container_name = 'CONTAINER' .

* This spit the container OB_CUSTOM into two

CREATE OBJECT ob_split1

EXPORTING

parent = ob_custom

orientation = cl_gui_easy_splitter_container=>orientation_vertical .

* Now we have two container

* OB_SPLIT1->TOP_LEFT_CONTAINER

* OB_SPLIT1->BOTTOM_RIGHT_CONTAINER

* Since these two are itself a container we can further devide them into two.

* Let try to divide OB_SPLIT1->BOTTOM_RIGHT_CONTAINER into two

CREATE OBJECT ob_split2

EXPORTING

parent = ob_split1->bottom_right_container

orientation = cl_gui_easy_splitter_container=>orientation_horizontal .

* Now we have total 3 container available with us

* OB_SPLIT1->TOP_LEFT_CONTAINER

* OB_SPLIT2->TOP_LEFT_CONTAINER

* OB_SPLIT2->BOTTOM_RIGHT_CONTAINER

* Note that OB_SPLIT1->BOTTOM_RIGHT_CONTAINER is not available because we divided

* that into two.

* Now Put a grid in each container

CREATE OBJECT ob_grid1

EXPORTING

i_parent = ob_split1->top_left_container .

CREATE OBJECT ob_grid2

EXPORTING

i_parent = ob_split2->top_left_container .

CREATE OBJECT ob_grid3

EXPORTING

i_parent = ob_split2->bottom_right_container .

CALL METHOD ob_grid1->set_table_for_first_display

EXPORTING

i_structure_name = 'SCARR'

CHANGING

it_outtab = it_scarr.

CALL METHOD ob_grid2->set_table_for_first_display

EXPORTING

i_structure_name = 'SCARR'

CHANGING

it_outtab = it_scarr.

CALL METHOD ob_grid3->set_table_for_first_display

EXPORTING

i_structure_name = 'SCARR'

CHANGING

it_outtab = it_scarr.

ENDMODULE. " status_0100 OUTPUT

*&---------------------------------------------------------------------*

*& Module user_command_0100 INPUT

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

MODULE user_command_0100 INPUT.

IF sy-ucomm = 'BACK' OR sy-ucomm = 'EXIT' .

FREE : ob_grid1 ,

ob_grid2 ,

ob_grid3 ,

ob_split1 ,

ob_split2 ,

ob_custom .

LEAVE TO SCREEN 0 .

ENDIF.

ENDMODULE. " user_command_0100 INPUT

+1 Recommend this on Google

24 comments:

Sanjay July 4, 2008 at 1:55 PM

nice explanation

Reply

Anonymous September 25, 2008 at 4:08 AM

Page 2 of 8My Experiments with ABAP: Displaying Two ALV Grid on Screen

2013/06/19http://sample-code-abap.blogspot.com/2008/06/displaying-two-alv-grid-on-screen.html

Page 3: Displaying Two Alv

Reply

Replies

Great explanation! I was curious whether you could essentially split a screen into thirds (top/middle/bottom) by splitting vertically

twice. Can you do this, or does a secondary split have to be opposite of the first?

Thanks!!!

Reply

Pawan Kesari September 26, 2008 at 12:40 AM

I think in above code if you replace the second split by

CREATE OBJECT ob_split2 EXPORTING parent = ob_split1->bottom_right_container orientation =

cl_gui_easy_splitter_container=>orientation_vertical .

then you will get the desire result.

Reply

Luis December 10, 2009 at 6:56 AM

Hi, I'm getting an error: ASSERTION_FAILED scrolling down in the first ALV Grid. Have you ever got it????

Reply

Pawan Kesari December 10, 2009 at 6:11 PM

Try sap note 1053399

Reply

Anonymous April 4, 2010 at 4:23 AM

when i run the code am getting error

Dynpro does not exist.

Reply

Pawan Kesari April 6, 2010 at 4:46 PM

Have you defined screen 100 with custom container in it?

Reply

Hitesh May 7, 2010 at 4:30 PM

what is procedure to define ?

pls..

Reply

orgy May 11, 2010 at 4:37 PM

how to identify in wich ALV we triggered event?

(in my case double click)

Reply

Pawan Kesari May 11, 2010 at 5:46 PM

Usually we write a local class with method and assiciate that method double click of ALV grid. Write a local class for each ALV grid

and register their method with double click.

Reply

Anonymous November 26, 2012 at 1:35 PM

Could you explain this in detail.

I need to create different action buttons for different ALVs.

Thanks & Regards

Amit Pal

Mob:+91-9999026862

Anonymous May 25, 2010 at 4:22 PM

clearly explained, but i need to know abt the screen 100 used here, do we need to draw the windows on the screen or is it a

empty screen.

Reply

Pawan Kesari May 25, 2010 at 4:59 PM

You need to create screen 100. Put a custom container with name 'CONTAINER'

Reply

Lokesh Reddy Avuthu July 7, 2010 at 3:16 PM

Page 3 of 8My Experiments with ABAP: Displaying Two ALV Grid on Screen

2013/06/19http://sample-code-abap.blogspot.com/2008/06/displaying-two-alv-grid-on-screen.html

Page 4: Displaying Two Alv

Reply

Replies

i tried with this example.It is working fine.Here when i divide the Container (using split container using TOP_LEFT and

BOTTOM_RIGHT) it is dividing the screen into two equal portions. How can i control this. I want the top Container to be minimal

and below as bigger one. Can i control this. I tried with SET_HEIGHT method.But did't work. Can you look into this if get time.

Thanks in Advance.

Reply

Pawan Kesari July 7, 2010 at 3:44 PM

If you are using class CL_GUI_EASY_SPLITTER_CONTAINER as shown in above example, just pass SASH_POSITION parameter in

constructor to control the position.

Its position in percentage

Reply

Jason September 22, 2010 at 3:16 PM

Is there a way to make it dynamic?

As in a scenario where there are multiple company code records and each company code is a separate ALV grid

Reply

SakDaMan September 22, 2010 at 11:30 PM

is there a way to make it dynamic...so we could control the no. of ALV grids based on the data in the internal table?

Reply

firdaush February 7, 2011 at 12:25 PM

hi, nice code. i'have tried and it works!. But i'm searching the abap code to display this such result using OOP ALV without using

Screen/Container

Reply

Anonymous March 29, 2011 at 1:23 AM

Is it necessary to use CL_GUI_EASY_SPLITTER_CONTAINER? Can't we use CL_GUI_SPLITTER_CONTAINER? What is the

difference between the two?

Reply

Anonymous July 22, 2011 at 4:22 AM

Is it possible to i_structure_name = 'st', where 'st' is define in the abap code and not in the dictionary?

Reply

Pawan Kesari July 22, 2011 at 7:40 PM

Is it possible to i_structure_name = 'st', where 'st' is define in the abap code and not in the dictionary?

i_structure_name = 'ST' , ST should be defined in dictionary.

Reply

Baju Muslimah August 28, 2012 at 4:41 AM

oh, ok thanks bro

Reply

kiruphagar heartbeats May 21, 2013 at 11:02 AM

Its not working , so kindly explain me to do..........

Reply

Pawan Kesari May 21, 2013 at 5:13 PM

have you defined screen 100, titlebar and pf status ZPF01?

Page 4 of 8My Experiments with ABAP: Displaying Two ALV Grid on Screen

2013/06/19http://sample-code-abap.blogspot.com/2008/06/displaying-two-alv-grid-on-screen.html

Page 5: Displaying Two Alv

Subscribe to: Post Comments (Atom)

HomeNewer Post Older Post

Create a Link

Comment as: Select profile...

Publish Preview

Links to this post

► 2013 (10)

► 2012 (6)

► 2011 (16)

► 2010 (11)

► 2009 (23)

▼ 2008 (39)

► December (1)

► November (1)

► October (1)

► September (5)

► July (9)

▼ June (12)

Transporting Table Entry

Sample/Demo code availble in SAP

SELECT-OPTION in Module Pool Screen

Add your own pattern in SE38

Call Transaction in New Window

Minimum Code Required to Send SAP Mail

Calculate Tax of Purchase order Line Item

Send report as attachment in background

Button on Selection-Screen

Displaying Two ALV Grid on Screen

Function Module for getting information of Diction...

HR ABAP 02 - Getting Started - LDB PNP

► May (3)

► February (4)

► January (3)

Blog Archive

Search

Search This Blog

Abap Objects (5) ALV List (10) Config (10) Customer-exit (1)Date (3) Dynamic (4) EDI (6) Enhacement (2) Excel (2)

Formatting (2) HR ABAP (2) MD04 (1) Module Pool (6) OLE

Automation (1) Open Dialog Box (1) Performance (2) QuickReference (46) Report (12) Rounding Issue (1)

Sample Code (53) SAP ABAP (71) SAP

Basis (4) SAP FI (3) SAP Mail (2) SAP MM (13) SAP Notes (3)SAP QM (2) SAP SD (11) Sapscript (9) Screen-exit (1)

Selection-Screen (6) Smartforms (7) Standard Text (2)

Translation (1) Tutorial (10) Upload Download (2) Utility (5) VAT(1) Web service (2) xml to ABAP (1) XSLT (1)

Labels

You are most welcome to use any information available in this blog. Any usage of the information or sample code is at your own risk. I do take care of accuracy and relevance of blog before

publishing. However, I do not guarantee that information and code are accurate and bug free, their can be alternate and better way of doing same thing so please use information as

reference only. Relevance of code and instructions can possibly change with time, check the blog post date before using this information. This is my personal blog, recommendation and

opinions expressed in this blog are mine and not of any company of any of my employer. I do moderate comments and publish as soon as I check them. You can post questions as well, which

I will try best to solve. I will anyway publish your questions in case others readers might have answer. Thanks for coming here and reading the blogs :)

Page 5 of 8My Experiments with ABAP: Displaying Two ALV Grid on Screen

2013/06/19http://sample-code-abap.blogspot.com/2008/06/displaying-two-alv-grid-on-screen.html

Page 6: Displaying Two Alv

Page 6 of 8My Experiments with ABAP: Displaying Two ALV Grid on Screen

2013/06/19http://sample-code-abap.blogspot.com/2008/06/displaying-two-alv-grid-on-screen.html

Page 7: Displaying Two Alv

Page 7 of 8My Experiments with ABAP: Displaying Two ALV Grid on Screen

2013/06/19http://sample-code-abap.blogspot.com/2008/06/displaying-two-alv-grid-on-screen.html

Page 8: Displaying Two Alv

Page 8 of 8My Experiments with ABAP: Displaying Two ALV Grid on Screen

2013/06/19http://sample-code-abap.blogspot.com/2008/06/displaying-two-alv-grid-on-screen.html