Applies To: SAP 4.0-4.7 Summary Utilities Function Module to create a Logo on a Custom Control Container. By: Arpit Nigam Company and Title: Hexaware Tech. Ltd., SAP Consultant Date: 26 Sep 2005 Table of Contents Applies To:... 1 SAP 4.0-4.7... 1 Summary... 1 Table of Contents... 1 Usage... 1 Sample Code... 1 Disclaimer & Liability Notice... 6 Author Bio... 6 Usage This useful Function Module avoids unnecessary coding to implement a Logo on a Custom Control Container. Use the module to easily implement the logo. Sample Code Screen Shots. Import Parameters: NAME LIKE W3QUERY-NAME '_OBJECT_ID' Name for WWW query string name/value pair VALUE LIKE W3QUERY-VALUE Value for WWW query string name/value pair CONTAINER TYPE C 2005 SAP AG 1
2005 SAP AG 2
FUNCTION ZVAS_CUSTOM_CONTROL_CREATE. *"---------------------------------------------------------------------- *"*"Local interface: *" IMPORTING *" VALUE(NAME) LIKE W3QUERY-NAME DEFAULT '_OBJECT_ID' *" VALUE(VALUE) LIKE W3QUERY-VALUE *" VALUE(CONTAINER) TYPE C *" *" ERROR *"---------------------------------------------------------------------- *PROGRAM... ZVAS_CUSTOM_CONTROL_CREATE * *TITLE... FM to create Logo * *AUTHOR... ARPIT NIGAM * *Package... Z001 * *Request Number. * *PROGRAM TYPE...Function Module * *DESCRIPTION: This FM serves the automatic creation of Logo on * Custom Control * 2005 SAP AG 3
* MODIFICATION HISTORY * * Date Name Transport Description * * MM/DD/YY Request * *$$ GLOBAL VARIABLES DATA: QUERY_TABLE TYPE STANDARD TABLE OF W3QUERY WITH header line, HTML_TABLE type STANDARD TABLE OF W3HTML, RETURN_CODE type W3PARAM-RET_CODE, CONTENT_TYPE type W3PARAM-CONT_TYPE, CONTENT_LENGTH type W3PARAM-CONT_LEN, PIC_DATA type W3MIME OCCURS 0, PIC_SIZE type I. * DATA: CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER. DATA: PICTURE TYPE REF TO CL_GUI_PICTURE. DATA: LOGO_CONTAINER DATA: LOGO TYPE REF TO CL_GUI_CUSTOM_CONTAINER. TYPE REF TO CL_GUI_PICTURE. DATA: URL(255) TYPE C. * Appending to query table QUERY_TABLE-NAME = NAME. QUERY_TABLE-VALUE = VALUE. APPEND QUERY_TABLE. *$$ CREATE THE CUSTOM CONTAINER CREATE OBJECT LOGO_CONTAINER CONTAINER_NAME = CONTAINER OTHERS = 1. IF SY-SUBRC <> 0. RAISE ERROR. CHECK SY-SUBRC IS INITIAL. *$$ CREATE THE SAP PICTURE CONTROL CREATE OBJECT LOGO PARENT = LOGO_CONTAINER OTHERS = 1. IF SY-SUBRC <> 0. RAISE ERROR. CHECK SY-SUBRC IS INITIAL. CALL FUNCTION 'WWW_GET_MIME_OBJECT' 2005 SAP AG 4
TABLES QUERY_STRING = QUERY_TABLE HTML = HTML_TABLE MIME = PIC_DATA CHANGING RETURN_CODE = RETURN_CODE CONTENT_TYPE = CONTENT_TYPE CONTENT_LENGTH = CONTENT_LENGTH OBJECT_NOT_FOUND = 1 PARAMETER_NOT_FOUND = 2 OTHERS = 3. IF SY-SUBRC = 0. PIC_SIZE = CONTENT_LENGTH. ELSE. RAISE ERROR. *$$ GET THE ITERNAL TABLE GENERATED BY THE DATA PROVIDER CALL FUNCTION 'DP_CREATE_URL' TYPE = 'IMAGE' SUBTYPE = CNDP_SAP_TAB_UNKNOWN SIZE = PIC_SIZE LIFETIME = CNDP_LIFETIME_TRANSACTION TABLES DATA = PIC_DATA CHANGING URL = URL OTHERS = 1. *$$ SEND DATA TO FRONTEND CALL METHOD LOGO->LOAD_PICTURE_FROM_URL URL = URL OTHERS = 1. ENDFUNCTION. Usage: CALL FUNCTION 'ZVAS_CUSTOM_CONTROL_CREATE' NAME = '_OBJECT_ID' VALUE = 'ZLOGO' --------- Name of the Logo CONTAINER = 'LOGO' --------- Name of the Custom Control ERROR = 1 OTHERS = 2. IF SY-SUBRC <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. 2005 SAP AG 5
Disclaimer & Liability Notice This document may discuss sample coding, which does not include official interfaces and therefore is not supported. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing of the code and methods suggested here, and anyone using these methods, is doing it under his/her own responsibility. SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of the technical article, including any liability resulting from incompatibility between the content of the technical article and the materials and services offered by SAP. You agree that you will not hold SAP responsible or liable with respect to the content of the Technical Article or seek to do so. Author Bio Arpit is an experienced consultant in application software design, development, scope analysis and integration for business applications requirements. He has been involved in SAP R/3 - ABAP/4, to develop reports, transactions, function modules, layout sets, queries, debugging, Workflows, and batch-input programs, Exit Writing, ALE, IDOC and EDI. As a BW consultant he has been involved in BW architecture, data modeling and BEx Analyzer. His technical abilities are backed by remarkable academic background. Copyright 2005 SAP AG, Inc. All Rights Reserved. SAP, mysap, mysap.com, xapps, xapp, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product, service names, trademarks and registered trademarks mentioned are the trademarks of their respective owners. 2005 SAP AG 6