SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Demo: Custom Container



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dialog Programming
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sun Nov 04, 2007 8:13 pm    Post subject: Demo: Custom Container Reply with quote

Code:
*&---------------------------------------------------------------------*
*& Report  RSDEMO_CUSTOM_CONTROL                                       *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  rsdemo_custom_control         .
DATA  url(132).

TYPE-POOLS cndp.
* custom container
DATA container TYPE REF TO cl_gui_custom_container.
* picture Control.
DATA picture TYPE REF TO cl_gui_picture.
* Definition of Control Framework
CLASS cl_gui_cfw DEFINITION LOAD.

DATA  init.
DATA ok_code TYPE sy-ucomm.

CALL SCREEN 100.

*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'STATUS'.
*  SET TITLEBAR 'xxx'.
  IF init is initial.
* create the custom container
    CREATE OBJECT container
                  EXPORTING container_name = 'CUSTOM'.
* create the picture control
    CREATE OBJECT picture
                  EXPORTING parent = container.

* Request an URL from the data provider by exporting the pic_data.

    CLEAR URL.
    PERFORM LOAD_PIC_FROM_DB CHANGING URL.

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

    CALL METHOD cl_gui_cfw=>flush
         EXCEPTIONS cntl_system_error = 1
                    cntl_error = 2.
    IF sy-subrc <> 0.
* error handling
    ENDIF.
  ENDIF.
ENDMODULE.                             " STATUS_0100  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  EXIT  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE exit INPUT.
  CALL METHOD picture->free.
  CALL METHOD container->free.
  FREE picture.
  FREE container.
  LEAVE PROGRAM.
ENDMODULE.                             " EXIT  INPUT
*&---------------------------------------------------------------------*
*&      Form  LOAD_PIC_FROM_DB
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
FORM LOAD_PIC_FROM_DB CHANGING URL.
  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.                    " LOAD_PIC_FROM_DB


****************************************************************
* This file was generated by Direct Download Enterprise. *
* Please do not change it manually. *
****************************************************************
%_DYNPRO
RSDEMO_CUSTOM_CONTROL
0100
620
40
%_HEADER
RSDEMO_CUSTOM_CONTROL 0100 0100 21 81192 35 0 0 21 83 0G D 19990224041651
%_DESCRIPTION
Screen 100
%_FIELDS
CUSTOM 81 00 00 00 00 00 1 2 0 0 0 21 U 1 1 101
OK_CODE CHAR 20 80 10 00 00 00 255 1 O 0 0 0 0 0 0 ____________________
%_FLOWLOGIC
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
module exit.
* MODULE USER_COMMAND_0100.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dialog Programming All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.