Google Search - Blog...........

Multiple Screens In Dock Container

REPORT yztest .

TYPE-POOLS: slis.

* Tables
TABLES: mara.

TYPES: BEGIN OF ty_name,
name TYPE char10,
age TYPE i,
END OF ty_name.

TYPES: BEGIN OF ty_marks,
sub1 TYPE i,
sub2 TYPE i,
total TYPE i,
END OF ty_marks.

TYPES: BEGIN OF ty_phone,
phnum TYPE char10,
END OF ty_phone.

TYPES: BEGIN OF ty_addr,
address TYPE char20,
END OF ty_addr .

* Output internal table
DATA: itab TYPE TABLE OF ty_name,
wa TYPE ty_name,
itab1 TYPE TABLE OF ty_marks,
wa1 TYPE ty_marks,
itab2 TYPE TABLE OF ty_phone,
wa2 TYPE ty_phone,
itab3 TYPE TABLE OF ty_addr,
wa3 TYPE ty_addr.

* ALV Grid
DATA: r_grid TYPE REF TO cl_gui_alv_grid,
r_grid1 TYPE REF TO cl_gui_alv_grid,
r_grid2 TYPE REF TO cl_gui_alv_grid,
r_grid3 TYPE REF TO cl_gui_alv_grid,
g_dock TYPE REF TO cl_gui_docking_container,
g_dock1 TYPE REF TO cl_gui_docking_container,
g_dock2 TYPE REF TO cl_gui_docking_container,
g_dock3 TYPE REF TO cl_gui_docking_container,
g_dock4 TYPE REF TO cl_gui_docking_container,
it_fieldcat TYPE lvc_t_fcat,
it_fieldcat1 TYPE lvc_t_fcat,
it_fieldcat2 TYPE lvc_t_fcat,
it_fieldcat3 TYPE lvc_t_fcat,
wa_fieldcat TYPE lvc_s_fcat.

DATA picture TYPE REF TO cl_gui_picture.

DATA url(255).
CLEAR url.
DATA init.

START-OF-SELECTION.

wa-name = 'test01'.
wa-age = '1'.
APPEND wa TO itab.

wa-name = 'test02'.
wa-age = '2'.
APPEND wa TO itab.

wa-name = 'test03'.
wa-age = '3'.
APPEND wa TO itab.

wa1-sub1 = '11'.
wa1-sub2 = '22'.
wa1-total = wa1-sub1 + wa1-sub2.
APPEND wa1 TO itab1.

wa1-sub1 = '22'.
wa1-sub2 = '33'.
wa1-total = wa1-sub1 + wa1-sub2.
APPEND wa1 TO itab1.

wa2-phnum = '99999999999'.
APPEND wa2 TO itab2.

wa2-phnum = '888888888888'.
APPEND wa2 TO itab2.

wa2-phnum = '777777777777'.
APPEND wa2 TO itab2.

wa3-address = 'HItech City'.
APPEND wa3 TO itab3.

wa3-address = 'Secunderabad'.
APPEND wa3 TO itab3.

wa3-address = 'Hyderabad'.
APPEND wa3 TO itab3.

PERFORM display_image.

CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.

SET PF-STATUS 'LISTOUT1'.
SET TITLEBAR 'LIST1'.

wa_fieldcat-fieldname = 'NAME'.
wa_fieldcat-seltext = 'NAME OF THE STUDENT'.
wa_fieldcat-coltext = 'NAME OF THE STUDENT'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'AGE'.
wa_fieldcat-seltext = 'AGE OF THE STUDENT'.
wa_fieldcat-coltext = 'AGE OF THE STUDENT'.
APPEND wa_fieldcat TO it_fieldcat.

wa_fieldcat-fieldname = 'SUB1'.
wa_fieldcat-seltext = 'SUBJECT1'.
wa_fieldcat-coltext = 'SUBJECT1'.
APPEND wa_fieldcat TO it_fieldcat1.

wa_fieldcat-fieldname = 'SUB2'.
wa_fieldcat-seltext = 'SUBJECT2'.
wa_fieldcat-coltext = 'SUBJECT2'.
APPEND wa_fieldcat TO it_fieldcat1.

wa_fieldcat-fieldname = 'TOTAL'.
wa_fieldcat-seltext = 'TOTAL'.
wa_fieldcat-coltext = 'TOTAL'.
APPEND wa_fieldcat TO it_fieldcat1.

wa_fieldcat-fieldname = 'PHNUM'.
wa_fieldcat-seltext = 'PHONE NO'.
wa_fieldcat-coltext = 'PHONE NO'.
APPEND wa_fieldcat TO it_fieldcat2.

wa_fieldcat-fieldname = 'ADDRESS'.
wa_fieldcat-seltext = 'ADDRESS'.
wa_fieldcat-coltext = 'ADDRESS'.
APPEND wa_fieldcat TO it_fieldcat3.


IF g_dock IS INITIAL.
CREATE OBJECT g_dock
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock->dock_at_left
extension = 300.

CREATE OBJECT r_grid
EXPORTING
i_parent = g_dock.

ENDIF.

IF g_dock1 IS INITIAL.
CREATE OBJECT g_dock1
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock1->dock_at_right
extension = 300.

CREATE OBJECT r_grid1
EXPORTING
i_parent = g_dock1.

ENDIF.

IF g_dock2 IS INITIAL.
CREATE OBJECT g_dock2
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock2->dock_at_top
extension = 100.

CREATE OBJECT r_grid2
EXPORTING
i_parent = g_dock2.

IF g_dock3 IS INITIAL.
CREATE OBJECT g_dock3
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock3->dock_at_top
extension = 100.

CREATE OBJECT r_grid3
EXPORTING
i_parent = g_dock3.

ENDIF.

IF NOT itab[] IS INITIAL.
CALL METHOD r_grid->set_table_for_first_display
CHANGING
it_outtab = itab
it_fieldcatalog = it_fieldcat.
ENDIF.

IF NOT itab1[] IS INITIAL.
CALL METHOD r_grid1->set_table_for_first_display
CHANGING
it_outtab = itab1
it_fieldcatalog = it_fieldcat1.
ENDIF.

IF NOT itab2[] IS INITIAL.
CALL METHOD r_grid2->set_table_for_first_display
CHANGING
it_outtab = itab2
it_fieldcatalog = it_fieldcat2.
ENDIF.

IF NOT itab3[] IS INITIAL.
CALL METHOD r_grid3->set_table_for_first_display
CHANGING
it_outtab = itab3
it_fieldcatalog = it_fieldcat3.
ENDIF.

if g_dock4 is initial.
CREATE OBJECT g_dock4
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock4->dock_at_bottom
extension = 100.

CREATE OBJECT picture
EXPORTING parent = g_dock4.

CALL METHOD picture->load_picture_from_url
EXPORTING
url = url.
init = 'X'.
endif.

ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Form display_image
*----------------------------------------------------------------------*
FORM display_image .

DATA query_table LIKE w3query OCCURS 1 WITH HEADER LINE.
DATA html_table LIKE w3html OCCURS 1.
DATA return_code LIKE w3param-ret_code.
DATA content_type LIKE w3param-cont_type.
DATA content_length LIKE w3param-cont_len.
DATA pic_data LIKE w3mime OCCURS 0.
DATA pic_size TYPE i.

REFRESH query_table.
query_table-name = '_OBJECT_ID'.
query_table-value = 'ENJOYSAP_LOGO'.
APPEND query_table.

CALL FUNCTION 'WWW_GET_MIME_OBJECT'
TABLES
query_string = query_table
html = html_table
mime = pic_data
CHANGING
return_code = return_code
content_type = content_type
content_length = content_length
EXCEPTIONS
object_not_found = 1
parameter_not_found = 2
OTHERS = 3.
IF sy-subrc = 0.
pic_size = content_length.
ENDIF.

CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'image'
subtype = cndp_sap_tab_unknown
size = pic_size
lifetime = cndp_lifetime_transaction
TABLES
data = pic_data
CHANGING
url = url
EXCEPTIONS
OTHERS = 1.



ENDFORM. " display_image
*&---------------------------------------------------------------------*
*& Module EXIT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE exit INPUT.

CALL METHOD g_dock->free.
CALL METHOD g_dock1->free.
CALL METHOD g_dock2->free.
CALL METHOD g_dock3->free.

ENDMODULE. " EXIT INPUT

the output is like this :

2 comments:

  1. Thanx a lot Mr Venkateswararao.
    Its really a very gud sample for the beginners...

    ReplyDelete
  2. It would be better (and more flexible) to use multiple splitters then al those docking containers

    ReplyDelete