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

custom controll in module pool .

Former Member
0 Likes
3,167

Hello gurus ,

I have an object in module pool that one is client defiant object , in that client want some logo in left side of screen , I have created custom control , but I am not getting through which class I have to call that picture and how to upload that picture in database ,

if some one have code for that sample program , plz guide me , how to create .

regards ,

Joy Chakravorty .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,932

You can display logo(s) on your screen using the custom control function. A custom control is an area on the screen, created using the screen painter. Custom controls are used to embed controls. Container controls are instances of special global classes from the SAP Control Framework. The global class for custom controls is called CL_GUI_CUSTOM_CONTAINER. To link a custom control to a container control, pass the custom control name to the CONTAINER_NAME parameter of the container control constructor when you instantiate it. The following is a sample program to demonstrate the logo display using the custom control. This program was written in SAP4.6C. Design a screen with the custom control, by name PICTURE_CONTAINER. It has the following flow logic:

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

*

PROCESS AFTER INPUT.

MODULE CANCEL AT EXIT-COMMAND.

The GUI status SCREEN100 has the functions BACK, EXIT, and CANCEL (all with type E).

Code

REPORT ZSURESH_TEST .

  • Type declarations.....................

TYPES pict_line(256) TYPE c.

  • data declarations......................

DATA :init,

container TYPE REF TO cl_gui_custom_container,

editor TYPE REF TO cl_gui_textedit,

picture TYPE REF TO cl_gui_picture,

pict_tab TYPE TABLE OF pict_line,

url(255) TYPE c.

CALL SCREEN 100.

  • Dialog modules......................................

MODULE status_0100 OUTPUT.

SET PF-STATUS 'SCREEN100'.

IF init is initial.

init = 'X'.

CREATE OBJECT:

container EXPORTING container_name = 'PICTURE_CONTAINER',

picture EXPORTING parent = container.

ENDIF.

IMPORT pict_tab = pict_tab FROM DATABASE abtree(pi) ID 'ENJOY'.

CALL FUNCTION 'DP_CREATE_URL'

EXPORTING

type = 'IMAGE'

subtype = 'GIF'

TABLES

data = pict_tab

CHANGING

url = url.

CALL METHOD picture->load_picture_from_url EXPORTING url = url.

CALL METHOD picture->set_display_mode

EXPORTING display_mode = picture->display_mode_fit_center.

ENDMODULE.

MODULE cancel INPUT.

LEAVE TO SCREEN 0.

ENDMODULE.

/ABAP/DisplayLogoOnScreen/DisplayLogo.htm

7 REPLIES 7
Read only

Former Member
0 Likes
1,933

You can display logo(s) on your screen using the custom control function. A custom control is an area on the screen, created using the screen painter. Custom controls are used to embed controls. Container controls are instances of special global classes from the SAP Control Framework. The global class for custom controls is called CL_GUI_CUSTOM_CONTAINER. To link a custom control to a container control, pass the custom control name to the CONTAINER_NAME parameter of the container control constructor when you instantiate it. The following is a sample program to demonstrate the logo display using the custom control. This program was written in SAP4.6C. Design a screen with the custom control, by name PICTURE_CONTAINER. It has the following flow logic:

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

*

PROCESS AFTER INPUT.

MODULE CANCEL AT EXIT-COMMAND.

The GUI status SCREEN100 has the functions BACK, EXIT, and CANCEL (all with type E).

Code

REPORT ZSURESH_TEST .

  • Type declarations.....................

TYPES pict_line(256) TYPE c.

  • data declarations......................

DATA :init,

container TYPE REF TO cl_gui_custom_container,

editor TYPE REF TO cl_gui_textedit,

picture TYPE REF TO cl_gui_picture,

pict_tab TYPE TABLE OF pict_line,

url(255) TYPE c.

CALL SCREEN 100.

  • Dialog modules......................................

MODULE status_0100 OUTPUT.

SET PF-STATUS 'SCREEN100'.

IF init is initial.

init = 'X'.

CREATE OBJECT:

container EXPORTING container_name = 'PICTURE_CONTAINER',

picture EXPORTING parent = container.

ENDIF.

IMPORT pict_tab = pict_tab FROM DATABASE abtree(pi) ID 'ENJOY'.

CALL FUNCTION 'DP_CREATE_URL'

EXPORTING

type = 'IMAGE'

subtype = 'GIF'

TABLES

data = pict_tab

CHANGING

url = url.

CALL METHOD picture->load_picture_from_url EXPORTING url = url.

CALL METHOD picture->set_display_mode

EXPORTING display_mode = picture->display_mode_fit_center.

ENDMODULE.

MODULE cancel INPUT.

LEAVE TO SCREEN 0.

ENDMODULE.

/ABAP/DisplayLogoOnScreen/DisplayLogo.htm

Read only

0 Likes
1,932

hello guru , thanks for this code , but its not working ,

IMPORT pict_tab = pict_tab FROM DATABASE abtree(pi) ID 'ENJOY'.

CALL FUNCTION 'DP_CREATE_URL'

here no pic file is comming (pict_tab) , after debugging I come into know .

Plz healp is there any othere way .

Read only

0 Likes
1,932

hi,

try this code and see that the container name is the same as given in the screen

DATA: L_GRAPHIC_XSTR TYPE XSTRING,

L_GRAPHIC_CONV TYPE I,

L_GRAPHIC_OFFS TYPE I.

CALL METHOD CL_SSF_XSF_UTILITIES=>GET_BDS_GRAPHIC_AS_BMP

EXPORTING

P_OBJECT = 'GRAPHICS'

P_NAME = 'UFPL' "IMAGE NAME - IMAGE NAME FROM SE78

P_ID = 'BMAP'

P_BTYPE = 'BCOL' "(BMON = BLACK&WHITE, BCOL = COLOUR)

RECEIVING

P_BMP = L_GRAPHIC_XSTR

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2.

  • IF SY-SUBRC = 1.

  • MESSAGE E287 WITH G_STXBITMAPS-TDNAME.

  • ELSEIF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • EXIT.

  • ENDIF.

*

GRAPHIC_SIZE = XSTRLEN( L_GRAPHIC_XSTR ).

CHECK GRAPHIC_SIZE > 0.

L_GRAPHIC_CONV = GRAPHIC_SIZE.

L_GRAPHIC_OFFS = 0.

WHILE L_GRAPHIC_CONV > 255.

GRAPHIC_TABLE-LINE = L_GRAPHIC_XSTR+L_GRAPHIC_OFFS(255).

APPEND GRAPHIC_TABLE.

L_GRAPHIC_OFFS = L_GRAPHIC_OFFS + 255.

L_GRAPHIC_CONV = L_GRAPHIC_CONV - 255.

ENDWHILE.

GRAPHIC_TABLE-LINE = L_GRAPHIC_XSTR+L_GRAPHIC_OFFS(L_GRAPHIC_CONV).

APPEND GRAPHIC_TABLE.

CALL FUNCTION 'DP_CREATE_URL'

EXPORTING

TYPE = 'IMAGE' "#EC NOTEXT

SUBTYPE = CNDP_SAP_TAB_UNKNOWN " 'X-UNKNOWN'

SIZE = GRAPHIC_SIZE

LIFETIME = CNDP_LIFETIME_TRANSACTION "'T'

TABLES

DATA = GRAPHIC_TABLE

CHANGING

URL = GRAPHIC_URL

EXCEPTIONS

  • DP_INVALID_PARAMETER = 1

  • DP_ERROR_PUT_TABLE = 2

  • DP_ERROR_GENERAL = 3

OTHERS = 4 .

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

EXIT.

ENDIF.

CREATE OBJECT H_PIC_CONTAINER

EXPORTING CONTAINER_NAME = 'CUST_CONTAINER'.

CREATE OBJECT H_PICTURE EXPORTING PARENT = H_PIC_CONTAINER.

CALL METHOD H_PICTURE->LOAD_PICTURE_FROM_URL

EXPORTING

URL = GRAPHIC_URL

IMPORTING

RESULT = G_RESULT.

<removed_by_moderator>

siri

Edited by: Julius Bussche on Aug 13, 2008 9:51 PM

Read only

0 Likes
1,932

Hello Dear ,

GRAPHIC_SIZE code is not accepting , plz check and let me know , I am in ECC6.0 .

Joy .

Read only

0 Likes
1,932

Hi Joy,

I'm curious to know what is a control and whats the diff with custom control.

What do u think i need to get started in this??

Regards

Varun

Read only

0 Likes
1,932

Hi,

I'm new to module pool programming. Can any one please provide me where to create selections screens to display existing purchase orders using the below selection criteria in thr module pool program.,

SELECT-OPTIONS : S_LIFNR FOR EKKO-LIFNR,

S_BSART FOR EKKO-BSART,

S_BUKRS FOR EKKO-BUKRS,

S_WERKS FOR EKPO-WERKS OBLIGATORY,

S_BEDAT FOR SY-DATUM,

S_EINDT FOR EKET-EINDT,

S_EBELN FOR EKKO-EBELN,

S_MATNR FOR EKPO-MATNR.

provide me step by step to do this.

Read only

0 Likes
1,932

I don't think u can put select options in module pool.

correct me if i'm wrong.

varun