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 problem

Former Member
0 Likes
857

Hallow I have a little problem and I don’t see it I have alv and I wont to display on screen 2 tables on the same time . in screen 100 layout I copy the container and I call it con1 and con 2 the problem is when I run the program I see just con1 and In the screen i have con2 but a empty blue square what I doing wrong thankes

I do this declaration

MODULE pbo OUTPUT.

SET PF-STATUS 'MAIN100'.

IF g_custom_container IS INITIAL.

CREATE OBJECT g_custom_container

EXPORTING container_name = 'CON1'.

CREATE OBJECT grid1

EXPORTING i_parent = g_custom_container.

gs_layout-grid_title = text-001.

CALL METHOD grid1->set_table_for_first_display

EXPORTING

i_structure_name = 'YHR_GET_EMP_COURSE_STR'

is_layout = gs_layout

is_variant = variant

i_save = 'A'

CHANGING

it_outtab = itab_final.

ENDIF.

IF g_custom_container1 IS INITIAL.

CREATE OBJECT g_custom_container1

<b>EXPORTING container_name = 'CON2'.</b> CREATE OBJECT grid2

EXPORTING i_parent = g_custom_container1.

gs_layout-grid_title = text-002.

CALL METHOD grid1->set_table_for_first_display

EXPORTING

i_structure_name = 'YHR_GET_EMP_DONT_COURSE'

is_layout = gs_layout1

is_variant = variant1

i_save = 'A'

CHANGING

it_outtab = it_final.

ENDIF.

DATA: ok_code LIKE sy-ucomm,

con1 TYPE REF TO cl_gui_custom_container,

  • g_container scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',

con2 TYPE REF TO cl_gui_custom_container,

  • g_container1 scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT2',

grid1 TYPE REF TO cl_gui_alv_grid,

grid2 TYPE REF TO cl_gui_alv_grid,

g_custom_container TYPE REF TO cl_gui_custom_container,

g_custom_container1 TYPE REF TO cl_gui_custom_container,

gs_layout TYPE lvc_s_layo,

gs_layout1 TYPE lvc_s_layo .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
823

Hi Antanio ,

Was just looking through your code and saw a flaw , in both the cases you are displying the ALV using the grid grid1 , which is created with ref to the container g_custom_container.

Create a new object for grid , say grid2 with the parent as g_custom_container1.

This would solve your problem , if you do not want to use splitters.

Regadrs

Arun

7 REPLIES 7
Read only

Former Member
0 Likes
823

Hi Antonio ,

Insted of using two custom containers , use only one and then use splitters .

What splitter does is it splits your container into the number of parts you want and each one acts as a saperate container and the rest process is the same.

Regards

Arun

Read only

0 Likes
823

hi arun how i do that mybe u can give me example regards

Read only

0 Likes
823

Hi Antonio ,

Here is a sample code

the splitter is of type CL_GUI_SPLITTER_CONTAINER


*" Map the container on the screen
IF G_C_CONTAINER IS INITIAL.
* Create the container
  CREATE OBJECT G_C_CONTAINER
    EXPORTING
*      PARENT                      =
      CONTAINER_NAME              = 'C_CONTAINER'
*      STYLE                       =
*      LIFETIME                    = lifetime_default
*      REPID                       =
*      DYNNR                       =
*      NO_AUTODEF_PROGID_DYNNR     =
*    EXCEPTIONS
*      CNTL_ERROR                  = 1
*      CNTL_SYSTEM_ERROR           = 2
*      CREATE_ERROR                = 3
*      LIFETIME_ERROR              = 4
*      LIFETIME_DYNPRO_DYNPRO_LINK = 5
*      others                      = 6
      .
  IF SY-SUBRC <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


*" Split the container into 2 parts , look at the value for parameters row and column
CREATE OBJECT G_C_SPLITTER
  EXPORTING
*    LINK_DYNNR        =
*    LINK_REPID        =
*    SHELLSTYLE        =
*    LEFT              =
*    TOP               =
*    WIDTH             =
*    HEIGHT            =
*    METRIC            = cntl_metric_dynpro
*    ALIGN             = 15
    PARENT            = G_C_CONTAINER
    ROWS              = 2
    COLUMNS           = 1
*    NO_AUTODEF_PROGID_DYNNR =
*    NAME              =
*  EXCEPTIONS
*    CNTL_ERROR        = 1
*    CNTL_SYSTEM_ERROR = 2
*    others            = 3
    .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*" Get the reference to the first container 
CALL METHOD G_C_SPLITTER->GET_CONTAINER
  EXPORTING
    ROW       = 1
    COLUMN    = 1
  RECEIVING
    CONTAINER = G_C_CONTAINER1  " This is of type CL_GUI_CONTAINER
    .


* " Rest of coding is the same.
CREATE OBJECT G_C_GRID
  EXPORTING
*    I_SHELLSTYLE      = 0
*    I_LIFETIME        =
    I_PARENT          =  G_C_CONTAINER1
*    I_APPL_EVENTS     = space
*    I_PARENTDBG       =
*    I_APPLOGPARENT    =
*    I_GRAPHICSPARENT  =
*    I_USE_VARIANT_CLASS = SPACE
*    I_NAME            =
*  EXCEPTIONS
*    ERROR_CNTL_CREATE = 1
*    ERROR_CNTL_INIT   = 2
*    ERROR_CNTL_LINK   = 3
*    ERROR_DP_CREATE   = 4
*    others            = 5
    .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

-


For the other part of the container use the command

*" Get the reference to the first container

CALL METHOD G_C_SPLITTER->GET_CONTAINER

EXPORTING

ROW = 2

COLUMN = 1

RECEIVING

CONTAINER = G_C_CONTAINER2 " This is of type CL_GUI_CONTAINER

and then use G_C_CONTAINER2 to display the second alv.

Do revert back if you have any further questions

Regards

Arun

Read only

Former Member
0 Likes
823

Hi antonio,

IF g_custom_container1 IS INITIAL.

CREATE OBJECT g_custom_container1

EXPORTING container_name = 'CON2'.

<b>CREATE OBJECT grid2</b>

EXPORTING i_parent = g_custom_container1.

gs_layout-grid_title = text-002.

<b>CALL METHOD grid1->set_table_for_first_display

EXPORTING

i_structure_name = 'YHR_GET_EMP_DONT_COURSE'

is_layout = gs_layout1

is_variant = variant1

i_save = 'A'

CHANGING

it_outtab = it_final.

ENDIF.</b>

<b>change it to,</b>

CALL METHOD grid2->set_table_for_first_display

EXPORTING

i_structure_name = 'YHR_GET_EMP_DONT_COURSE'

is_layout = gs_layout1

is_variant = variant1

i_save = 'A'

CHANGING

it_outtab = it_final.

or u can use splitter container , that would be better

Read only

Former Member
0 Likes
824

Hi Antanio ,

Was just looking through your code and saw a flaw , in both the cases you are displying the ALV using the grid grid1 , which is created with ref to the container g_custom_container.

Create a new object for grid , say grid2 with the parent as g_custom_container1.

This would solve your problem , if you do not want to use splitters.

Regadrs

Arun

Read only

Former Member
0 Likes
823

hi,

create a new container in your screen layout.

arrange the two containers side by side .

transfer first table contents to first container

using set_table_for_first_display.

assign a grid object to the second container .

for this grid object call 'set_table_for_first_display'

with data from second table.

hope this helps.

Read only

0 Likes
823

hi kasi u can give an example for that regards