首页 > 代码库 > ALV SPLITTER 分割器 需要在屏幕上画个控件

ALV SPLITTER 分割器 需要在屏幕上画个控件

  1 *&---------------------------------------------------------------------*  2 *& Report  ZTEST4  3 *&  4 *&---------------------------------------------------------------------*  5 *&  6 *&  7 *&---------------------------------------------------------------------*  8 REPORT ZTEST4.  9  10  11 DATA : 12   OK_CODE LIKE SY-UCOMM, 13   SAVE_OK LIKE SY-UCOMM. 14  15 DATA : 16   URL(256) TYPE C, 17   INIT(1)  TYPE C. 18  19 " cl_gui_custom_container container for hosting splitter 20 DATA CL_GUI_CUSTOM_CONTAINER_OBJ TYPE REF TO CL_GUI_CUSTOM_CONTAINER. 21 " cl_gui_splitter_container splitter container 22 DATA CL_GUI_SPLITTER_CONTAINER_OBJ TYPE REF TO CL_GUI_SPLITTER_CONTAINER. 23 " cl_gui_container objects for splitter 24 DATA CL_GUI_CONTAINER_1 TYPE REF TO CL_GUI_CONTAINER. 25 DATA CL_GUI_CONTAINER_2 TYPE REF TO CL_GUI_CONTAINER. 26 DATA CL_GUI_CONTAINER_3 TYPE REF TO CL_GUI_CONTAINER. 27 " cl_gui_picture objects 28 DATA CL_GUI_PICTURE_1 TYPE REF TO CL_GUI_PICTURE. 29 DATA CL_GUI_PICTURE_2 TYPE REF TO CL_GUI_PICTURE. 30 DATA CL_GUI_PICTURE_3 TYPE REF TO CL_GUI_PICTURE. 31  32 START-OF-SELECTION. 33   CALL SCREEN 100. 34  35 END-OF-SELECTION. 36  37  38 MODULE STATUS_0100 OUTPUT. 39  40   SET TITLEBAR TITLE. 41   SET PF-STATUS STATUS. 42  43   IF INIT IS INITIAL. 44  45     CREATE OBJECT CL_GUI_CUSTOM_CONTAINER_OBJ EXPORTING CONTAINER_NAME = CUSTOM. 46  47     " Create SPLITTER and SPLITTER panes 48     CREATE OBJECT CL_GUI_SPLITTER_CONTAINER_OBJ 49       EXPORTING 50         PARENT  = CL_GUI_CUSTOM_CONTAINER_OBJ 51         ROWS    = 1 52         COLUMNS = 3. 53  54     CALL METHOD CL_GUI_SPLITTER_CONTAINER_OBJ->GET_CONTAINER 55       EXPORTING 56         ROW       = 1 57         COLUMN    = 1 58       RECEIVING 59         CONTAINER = CL_GUI_CONTAINER_1. 60  61     CALL METHOD CL_GUI_SPLITTER_CONTAINER_OBJ->GET_CONTAINER 62       EXPORTING 63         ROW       = 1 64         COLUMN    = 2 65       RECEIVING 66         CONTAINER = CL_GUI_CONTAINER_2. 67  68     CALL METHOD CL_GUI_SPLITTER_CONTAINER_OBJ->GET_CONTAINER 69       EXPORTING 70         ROW       = 1 71         COLUMN    = 3 72       RECEIVING 73         CONTAINER = CL_GUI_CONTAINER_3. 74  75     DATA REPID TYPE SY-REPID. 76     DATA DYNNR TYPE SY-DYNNR. 77     REPID = SY-REPID. 78     DYNNR = SY-DYNNR. 79  80     CREATE OBJECT CL_GUI_PICTURE_1 EXPORTING PARENT = CL_GUI_CONTAINER_1. 81     CREATE OBJECT CL_GUI_PICTURE_2 EXPORTING PARENT = CL_GUI_CONTAINER_2. 82     CREATE OBJECT CL_GUI_PICTURE_3 EXPORTING PARENT = CL_GUI_CONTAINER_3. 83  84     " Request an URL from the data provider by exporting the pic_data. 85     CLEAR URL. 86     PERFORM LOAD_PIC_FROM_DB CHANGING URL. 87  88     " load picture 89     CALL METHOD CL_GUI_PICTURE_1->LOAD_PICTURE_FROM_URL 90       EXPORTING 91         URL = URL. 92  93     CLEAR URL. 94     URL = file://C:\sap-logo.gif. 95     CALL METHOD CL_GUI_PICTURE_2->LOAD_PICTURE_FROM_URL 96       EXPORTING 97         URL = URL. 98  99     CLEAR URL.100     URL = C:\TEST\T1\1.JPG.101     CALL METHOD CL_GUI_PICTURE_3->LOAD_PICTURE_FROM_URL102       EXPORTING103         URL = URL.104 105     INIT = X.106 107     CALL METHOD CL_GUI_CFW=>FLUSH108       EXCEPTIONS109         CNTL_SYSTEM_ERROR = 1110         CNTL_ERROR        = 2.111 112   ENDIF.113 114 ENDMODULE. " STATUS_0100 OUTPUT115 FORM LOAD_PIC_FROM_DB CHANGING URL.116 117   DATA QUERY_TABLE LIKE W3QUERY OCCURS 1 WITH HEADER LINE.118   DATA HTML_TABLE LIKE W3HTML OCCURS 1.119   DATA RETURN_CODE LIKE W3PARAM-RET_CODE.120   DATA CONTENT_TYPE LIKE W3PARAM-CONT_TYPE.121   DATA CONTENT_LENGTH LIKE W3PARAM-CONT_LEN.122   DATA PIC_DATA LIKE W3MIME OCCURS 0.123   DATA PIC_SIZE TYPE I.124 125   REFRESH QUERY_TABLE.126   QUERY_TABLE-NAME = _OBJECT_ID.127   QUERY_TABLE-VALUE = http://www.mamicode.com/ENJOYSAP_LOGO.128   APPEND QUERY_TABLE.129 130   CALL FUNCTION WWW_GET_MIME_OBJECT131     TABLES132       QUERY_STRING        = QUERY_TABLE133       HTML                = HTML_TABLE134       MIME                = PIC_DATA135     CHANGING136       RETURN_CODE         = RETURN_CODE137       CONTENT_TYPE        = CONTENT_TYPE138       CONTENT_LENGTH      = CONTENT_LENGTH139     EXCEPTIONS140       OBJECT_NOT_FOUND    = 1141       PARAMETER_NOT_FOUND = 2142       OTHERS              = 3.143   IF SY-SUBRC = 0.144     PIC_SIZE = CONTENT_LENGTH.145   ENDIF.146 147   CALL FUNCTION DP_CREATE_URL148     EXPORTING149       TYPE     = image150       SUBTYPE  = CNDP_SAP_TAB_UNKNOWN151       SIZE     = PIC_SIZE152       LIFETIME = CNDP_LIFETIME_TRANSACTION153     TABLES154       DATA     =http://www.mamicode.com/ PIC_DATA155     CHANGING156       URL      = URL157     EXCEPTIONS158       OTHERS   = 1.159 160 ENDFORM. " load_pic_from_db161 MODULE USER_COMMAND_0100 INPUT.162 163   SAVE_OK = OK_CODE.164   CLEAR OK_CODE.165 166   CASE SAVE_OK.167     WHEN EXIT OR CNCL OR BACK.168       LEAVE PROGRAM.169     WHEN OTHERS.170   ENDCASE.171 172 ENDMODULE. " USER_COMMAND_0100 INPUT

 

ALV SPLITTER 分割器 需要在屏幕上画个控件