Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Regarding ABAP Through OOP

Former Member
0 Likes
1,133

Hi SAP Gurus,

I have learnt how to create containers by watching different threads, But i am not getting how to display data in that containers from an internal table , any one please help !

Thanks & Regards,

Pavan.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,090

Hello Pavan,

You cannot directly put data in container. for that you need to use some custom control like avl grid, tree view etc.

After loading custom control in container you and fill data in custom control and display the data.

Just to start with the custom control, You can try loading ALV grid in container.

Follow the link [ALV Grid|http://help.sap.com/saphelp_erp2004/helpdata/EN/22/a3f5ecd2fe11d2b467006094192fe3/frameset.htm] for more details.

Also you can follow link [Custom Container|http://help.sap.com/saphelp_erp2004/helpdata/EN/d3/2955360b00a115e10000009b38f839/frameset.htm] for more detail on types and usage of containers

Hope this helps!

Thanks,

Augsutin.

Edited by: Augustarian on Aug 24, 2009 12:34 AM

10 REPLIES 10
Read only

uwe_schieferstein
Active Contributor
0 Likes
1,090

Hello Pavan

Have a look through the sample reports in package SLIS and check transaction SE83 (Reuse Library).

The reports are not well structured but quite reasonably documented (in the header section).

Regards

Uwe

Read only

Former Member
0 Likes
1,091

Hello Pavan,

You cannot directly put data in container. for that you need to use some custom control like avl grid, tree view etc.

After loading custom control in container you and fill data in custom control and display the data.

Just to start with the custom control, You can try loading ALV grid in container.

Follow the link [ALV Grid|http://help.sap.com/saphelp_erp2004/helpdata/EN/22/a3f5ecd2fe11d2b467006094192fe3/frameset.htm] for more details.

Also you can follow link [Custom Container|http://help.sap.com/saphelp_erp2004/helpdata/EN/d3/2955360b00a115e10000009b38f839/frameset.htm] for more detail on types and usage of containers

Hope this helps!

Thanks,

Augsutin.

Edited by: Augustarian on Aug 24, 2009 12:34 AM

Read only

0 Likes
1,090

Thanks,

Now i have got how to display data from in container from alv,

CREATE OBJECT GRID1

EXPORTING I_PARENT = G_CUSTOM_CONTAINER.

CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

I_STRUCTURE_NAME = 'SFLIGHT'

CHANGING

IT_OUTTAB = GT_SFLIGHT.

Here i have to use structure name ,

Can any one tell how can i use my internal table to display the fields,

Regards,

Pavan.

Read only

0 Likes
1,090

Hello Pavan,

Whatever code you have written is correct just need to change one little thing is while passing table also put [] for table body

as follow:

You need to select data into internal table before you call method SET_TABLE_FOR_FIRST_DISPLAY.

and if you change something on ALV then that part you need to handle in PAI event.

Check flow login documentation on SAP help.

CREATE OBJECT GRID1

EXPORTING I_PARENT = G_CUSTOM_CONTAINER.

CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

I_STRUCTURE_NAME = 'SFLIGHT'

CHANGING

IT_OUTTAB = GT_SFLIGHT[].

Hope this help!

Thanks,

Augustin.

Edited by: Augustarian on Aug 25, 2009 10:26 AM

Read only

0 Likes
1,090

Thanks Augustin,

But my requirement is to display from an internal table , i dont have a structure for it , how can i display.

Please Help,

Thanks & Regards,

Read only

0 Likes
1,090

Hello Pavan,

You can create structure using SFLIGHT table.

By the way I am not able to understand What you mean by you don't have strucuter?

You have structure right? SFLIGHT is the structure you are using to pass data either you can use that way or you can pass fieldcatalog table with the fields that you want to show in alv grid.

Follow the link provided in previous post and try building fieldcatalog with different methods like manually, automatic and semi-automatic fieldcatalog generation.

In your code below:


I_STRUCTURE_NAME = 'SFLIGHT'
CHANGING
IT_OUTTAB = GT_SFLIGHT[].

GT_SFLIGHT is internal table only and you must have defined that at the start of report. Right?

Normally steps in AVL report are:

1. Declare object and table variables

2. Prepare field catalog and layout tables

3. Register events

4. select data into internal table from required table

5. Create instance of alv class and call method to display data

Let me know if any issue,

Thanks,

Augustin.

Edited by: Augustarian on Aug 25, 2009 1:09 PM

Read only

0 Likes
1,090

Hi, thanks ,

one issue, can i know how to control the coloumn width in the output of alv in the container.

Thanks & Regards,

Pavan.

Read only

0 Likes
1,090

Hello,

You need to set OUTPUTLEN of fieldcatalog table for every column you are passing to fieldcatalog table

for example:



ls_fcat-fieldname = 'BNAME' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '12' .
ls_fcat-coltext = 'User Name' .
ls_fcat-seltext = 'User Name' .
APPEND lw_fcat to lt_fieldcat .

Hope this helps!

Thanks,

Augustin.

Edited by: Augustarian on Aug 25, 2009 5:25 PM

Edited by: Augustarian on Aug 25, 2009 5:25 PM

Read only

0 Likes
1,090

Hi, thanks

Can you please paste here the code for the below query(if possible),

select 2 or 3 fields from a database table (some MAKT), store them in an internal table, create a container and to display the fields of the internal table in that container using ALV

Thanks & Regards,

Pavan.

Read only

matt
Active Contributor
0 Likes
1,090

There are plenty of demo programs to help with a simple requirement like this. These are not training forums. Thread locked.

matt