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

alv grid internal settings

Former Member
0 Likes
1,254

Hi experts,

I want a display one internal table by alv grid oops.

There is no need of making it interactive or layout designing just to display.

I have the following code.

data: ok_code like sy-ucomm,

gt_sflight type table of sflight,

g_container type scrfname value 'cc_alv',

grid1 type ref to cl_gui_alv_grid,

g_custom_container type ref to cl_gui_custom_container.

data : begin of it_ekko1 occurs 0,

ekgrp type ekko-ekgrp,

lifnr type ekko-lifnr,

bukrs type ekko-bukrs,

ebeln type ekko-ebeln,

end of it_ekko1.

          • let this table be populated by some queries.****

call screen 100.

if g_custom_container is initial.

create object g_custom_container

exporting container_name = g_container.

create object grid1

exporting i_parent = g_custom_container.

call method grid1->set_table_for_first_display

exporting i_structure_name = 'it_ekko1'

changing it_outtab = it_ekko1.

endif.

can u please suggest wat r the settings i need to make for the execution of the code.

for example going to scrren painter and setting scrren 100.

any settings like strucure defining ,

is fieldcatalod a mandatory one.

it is giving error of it_outtab type non-compatible.

thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,227
changing it_outtab = it_ekko1[]. 
 "  it_ekko1 is considered as an work area(it_ekko1[] is internal table with header line)

Cheers,

Hi experts,

I want a display one internal table by alv grid oops.

There is no need of making it interactive or layout designing just to display.

I have the following code.

data: ok_code like sy-ucomm,

gt_sflight type table of sflight,

g_container type scrfname value 'cc_alv',

grid1 type ref to cl_gui_alv_grid,

g_custom_container type ref to cl_gui_custom_container.

data : begin of it_ekko1 occurs 0,

ekgrp type ekko-ekgrp,

lifnr type ekko-lifnr,

bukrs type ekko-bukrs,

ebeln type ekko-ebeln,

end of it_ekko1.

          • let this table be populated by some queries.****

call screen 100.

if g_custom_container is initial.

create object g_custom_container

exporting container_name = g_container.

create object grid1

exporting i_parent = g_custom_container.

call method grid1->set_table_for_first_display

exporting i_structure_name = 'it_ekko1'

changing it_outtab = it_ekko1.

endif.

can u please suggest wat r the settings i need to make for the execution of the code.

for example going to scrren painter and setting scrren 100.

any settings like strucure defining ,

is fieldcatalod a mandatory one.

it is giving error of it_outtab type non-compatible.

thanks in advance.

8 REPLIES 8
Read only

Former Member
0 Likes
1,227

Hi,

there are a lot examples in this forum and in R/3.

Search in R/3 for BCALV* etc. or try tcode dwdm.

Regards, Dieter

Read only

Former Member
0 Likes
1,228
changing it_outtab = it_ekko1[]. 
 "  it_ekko1 is considered as an work area(it_ekko1[] is internal table with header line)

Cheers,

Read only

0 Likes
1,227

Hi mukundan,

ur correct but the output screen is not coming.

do i need to write PBO,PAO modules or any slight change in the code required.

The screen is complete blank.

Thanks.

Read only

0 Likes
1,227

Pass field catalog

changing it_outtab = it_ekko1[]
            it_fieldcatalog = it_fcat.

Cheers

Read only

0 Likes
1,227

Hi,

Double click on Screen 100.

There give short description and click on layout.

Then click on button on left side with C on it.

Drag it and create a container and give this name in create object r_container exporting parameter.

Give it a name and save,activate.

Then goto flowlogic ---> uncomment modules and double click them ,

these will come into your program .

Create a module in PBO and double cllick.

In the program ,create instances in this module.

Field catalog is needed when u are using extra fields or some fields of standard tables.

Read only

0 Likes
1,227

Hi,

refer the below code.

DATA :

R_CONTAINER1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,

R_GRID1 TYPE REF TO CL_GUI_ALV_GRID.

DATA :

FS_SFLIGHT TYPE SFLIGHT,

FS_SBOOK TYPE SBOOK.

START-OF-SELECTION.

SELECT * FROM SFLIGHT

INTO TABLE T_SFLIGHT.

CALL SCREEN 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'YH1312_SF'.

SET TITLEBAR 'Flight details'.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module SFLIGHT OUTPUT

&----


  • text

----


MODULE SFLIGHT OUTPUT.

CREATE OBJECT R_CONTAINER1

EXPORTING

CONTAINER_NAME = 'CONTAINER'.

CREATE OBJECT R_GRID1

EXPORTING

I_PARENT = R_CONTAINER1.

CALL METHOD R_GRID1->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

I_STRUCTURE_NAME = 'SFLIGHT'

  • is_variant =

  • i_save =

  • i_default = 'X'

  • is_layout =

CHANGING

IT_OUTTAB = T_SFLIGHT

  • it_fieldcatalog =

  • it_sort =

  • it_filter =

.

SET HANDLER DCLICK=>ON_DOUBLE FOR R_GRID1.

ENDMODULE. " SFLIGHT OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

CASE SY-UCOMM.

WHEN 'BACK' OR 'EXIT' OR 'RETURN'.

SET SCREEN 0.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

This works fine.

Read only

0 Likes
1,227

thanks Sreesudha,

this code is looking good and wil work.

I wil give reply after implementing as of now server is down .

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,227

Hi,

Use this wiki for Learn to display data in ALV Grid using Object Oriented Programming, for a basic example for OOPs ALV Display:-

https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/learn%252bto%252bdisplay%252bdata%252bin...

Hope this helps you.

Thanks & Regards,

Tarun