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

create an object

Former Member
0 Likes
611

HI ALL

CAN ANYBODY EXPLAIN ME WHAT IS THIS 'BCALV_GRID_DEMO_0100_CONT1'

AND WHAT IS AN INSTANCE EXACTLY?(WHILE CREATING AN OBJECT ON FILLER)

REGARDS

KANNY

3 REPLIES 3
Read only

uwe_schieferstein
Active Contributor
0 Likes
545

Hello Kanny

'BCALV_GRID_DEMO_0100_CONT1' is a custom control on dynpro 100 of the report.

The coding of the PBO module is shown below:

MODULE PBO OUTPUT.
  SET PF-STATUS 'MAIN100'.
  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 = 'SFLIGHT'
         CHANGING  IT_OUTTAB        = GT_SFLIGHT.
  ENDIF.
ENDMODULE.

What does it mean? You cannot directly place a control (like ALV grid control, tree control) onto a dynpro but you need a container. This container instance is created using command:

    CREATE OBJECT G_CUSTOM_CONTAINER
           EXPORTING CONTAINER_NAME = G_CONTAINER.

The container instance is directly linked to the custom control element on the dynpro, meaning it will be displayed there.

What is an instance? Well, a class is just a description of a possible object with attributes and methods. To work with a class you need a concrete object which is an instance of this class. This instance has attributes with concrete values and it can execute the methods.

Regards

Uwe

Read only

Former Member
0 Likes
545

hi,

In the program BCALV_GRID_DEMO, BCALV_GRID_DEMO_0100_CONT1 is the container that hold the alv grid control. Basically, a custom container is needed to hold controls like alv grid control, tree control, picture control, HTML Control etc. You can find useful example that are simle and easy to understand in se38->Environment->Examples->Control Examples.

We have classes(which is abstract) and instance(or objects which has real existance). So first the object/instance of this container is created so that it can hold a control.

CREATE OBJECT G_CUSTOM_CONTAINER
           EXPORTING CONTAINER_NAME = G_CONTAINER.

Then an instance of grid is created and while creating this instance we need to give the controller name which will hold this control(grid control).

CREATE OBJECT GRID1
           EXPORTING I_PARENT = G_CUSTOM_CONTAINER.

Hope this will provide some understanding about instance and how BCALV_GRID_DEMO works.

Regards,

Richa

Read only

Former Member
0 Likes
545

hi

good

go through this example

report BCALV_TABLE_CREATE.

data: ok_code like sy-ucomm,

g_container type scrfname value 'BCALV_GRID_DEMO_0100_CONT1',

grid1 type ref to cl_gui_alv_grid,

g_custom_container type ref to cl_gui_custom_container.

*

data: gt_fieldcat type lvc_t_fcat.

data: gp_table type ref to data.

field-symbols: <gt_table> type table.

parameters: n type i.

if n > 100.

message a000(0k) with 'N <= 100'.

endif.

perform fieldcat_build.

call method cl_alv_table_create=>create_dynamic_table

exporting it_fieldcatalog = gt_fieldcat

importing ep_table = gp_table.

assign gp_table->* to <gt_table>.

perform fill_table.

call screen 100.

thanks

mrutyun