Posted: Mon Nov 05, 2007 3:46 pm Post subject: Demo: GFW: same labels, long labels
Code:
REPORT GFW_PROG_LABELS .
* data container with special label fields
INCLUDE GFW_DC_PRES_T.
* text constants
include GFW_PROG_TEXT.
START-OF-SELECTION.
* USAGE allowed in SAP internal test reports, only
include applg_auto_test_init.
CALL SCREEN 100.
* USAGE allowed in SAP internal test reports, only
include applg_auto_test_form.
* global data (can be hidden in an application class)
DATA: OK_CODE TYPE SY-UCOMM,
F_RETURN TYPE SYMSGNO,
CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
DC TYPE REF TO IF_DC_MANAGEMENT,
DC_INSTANCE TYPE REF TO LCL_DC_PREST,
MY_ID_AT_DC TYPE I,
GP TYPE REF TO IF_GRAPHIC_PROXY,
GP_INSTANCE TYPE REF TO CL_GUI_GP_PRES.
*&---------------------------------------------------------------------*
*& Module PBO_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE PBO_0100 OUTPUT.
SET PF-STATUS '100'.
F_RETURN = CL_GFW=>OK.
IF DC IS INITIAL.
* create and fill dc
CREATE OBJECT DC_INSTANCE.
DC = DC_INSTANCE.
CALL METHOD DC->INIT IMPORTING ID = MY_ID_AT_DC
RETVAL = F_RETURN.
IF F_RETURN = CL_GFW=>OK.
* fill dc
PERFORM FILL_DC. " sets f_return
ENDIF.
IF F_RETURN <CL_GFW>OK.
CALL METHOD CL_GFW=>SHOW_MSG EXPORTING MSGNO = F_RETURN.
ENDIF.
ENDIF. "// if dc is initial: create dc
IF GP IS INITIAL AND NOT DC_INSTANCE IS INITIAL.
* create container in which to place graphic
* (place it in the custom control named CONTAINER
* defined using screen painter in dynpro 100)
CREATE OBJECT CUSTOM_CONTAINER
EXPORTING
CONTAINER_NAME = 'MY_CONTAINER'. "use uppercase letters!
" there will be a RABAX here if any error occurred while creating
" the container
* create gp
CREATE OBJECT GP_INSTANCE.
GP = GP_INSTANCE.
* create relation between dc and gp data fields
CALL METHOD GP_INSTANCE->SET_DC_NAMES
EXPORTING OBJ_ID = 'OBJID'
DIM1 = 'X_VAL'
DIM2 = 'Y_VAL'
GRP_ID = 'GRPID'
T_DIM1 = 'T_X_VAL'
T_GRP_ID = 'T_GRPID'
IMPORTING RETVAL = F_RETURN.
IF F_RETURN <CL_GFW>OK.
CALL METHOD CL_GFW=>SHOW_MSG EXPORTING MSGNO = F_RETURN.
ENDIF.
* set customizing objects
perform set_customizing.
* activate graphics proxy
CALL METHOD GP->ACTIVATE IMPORTING RETVAL = F_RETURN.
IF F_RETURN <CL_GFW>OK.
CALL METHOD CL_GFW=>SHOW_MSG EXPORTING MSGNO = F_RETURN.
ENDIF.
ENDIF. "//gp_init ok
ENDIF. "// if gp is initial: create gp
* Distribute Changes (Notify)
IF NOT DC IS INITIAL.
CALL METHOD DC->DISTRIBUTE_CHANGES IMPORTING RETVAL = F_RETURN.
IF F_RETURN <CL_GFW>OK.
CALL METHOD CL_GFW=>SHOW_MSG EXPORTING MSGNO = F_RETURN.
ENDIF.
ENDIF.
* USAGE allowed in SAP internal test reports, only
perform auto_test_pbo USING 'EXIT'.
ENDMODULE. " PBO_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module PAI_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE PAI_0100 INPUT.
OK_CODE = SY-UCOMM.
* activate event analysis of object-oriented Control Framework
CALL METHOD CL_GUI_CFW=>DISPATCH.
CASE OK_CODE.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " PAI_0100 INPUT
*&---------------------------------------------------------------------*
*& Form FILL_DC
*&---------------------------------------------------------------------*
* fill dc with data
*----------------------------------------------------------------------*
* --> p1 text
* <p2>SET_OBJ_VALUES
EXPORTING ID = MY_ID_AT_DC
OBJ = OBJ
IMPORTING RETVAL = F_RETURN.
IF F_RETURN <CL_GFW>OK. EXIT. ENDIF.
*&---------------------------------------------------------------------*
*& Form SET_CUSTOMIZING
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <p2>create_customizing
EXPORTING instance_id = 'CREATE_CUSTOMIZING_DEMO'
grpids = groups.
* set title of chart (instance of cl_cu_drawing_area is already created
* in cl_gui_gp_pres->create_customizing, see documentation)
* get drawing area
call method gp_instance->if_graphic_proxy~get_cu_bundle
exporting port = IF_GRAPHIC_PROXY=>CO_PORT_CHART
bundle_type = cl_cu=>co_clsid_drawing_area
importing bundle = bundle.
* get title context of drawing area
call method bundle->get
exporting attr_id = cl_cu_drawing_area=>co_title_context
importing value = bundle_display.
* set visibility of title
CALL METHOD BUNDLE_DISPLAY->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_DISPLAY_CONTEXT=>co_visibility
VALUE = gfw_true.
* copy display context into drawing area (title)
CALL METHOD BUNDLE->SET
EXPORTING ATTR_ID = CL_CU_drawing_area=>CO_title_CONTEXT
VALUE = BUNDLE_DISPLAY.
* set title
call method bundle->set
EXPORTING ATTR_ID = CL_CU_DRAWING_AREA=>CO_TITLE
VALUE = co_gfw_prog_title_labels.
ENDFORM. " SET_CUSTOMIZING
****************************************************************
* This file was generated by Direct Download Enterprise. *
* Please do not change it manually. *
****************************************************************
%_DYNPRO
GFW_PROG_LABELS
0100
620
40
%_HEADER
GFW_PROG_LABELS 0100 0100 20 80192 35 0 0 20 80 0G E 20001113152509
%_DESCRIPTION
%_FIELDS
MY_CONTAINER 80 00 00 00 30 00 1 2 0 0 0 20 U 1 1 101
CHAR 20 80 10 00 00 00 255 1 O 0 0 0
%_FLOWLOGIC
PROCESS BEFORE OUTPUT.
MODULE PBO_0100.
*
PROCESS AFTER INPUT.
MODULE PAI_0100.
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.