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: GFW: same labels, long labels



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



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Mon Nov 05, 2007 3:46 pm    Post subject: Demo: GFW: same labels, long labels Reply with quote

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.

    CALL METHOD GP->INIT
                       EXPORTING DC    = DC_INSTANCE
                             PROD_ID   = CL_GUI_GP_PRES=>CO_PROD_CHART
                             parent    = custom_container
                       IMPORTING RETVAL   = F_RETURN.
    IF F_RETURN <CL_GFW>OK.
      CALL METHOD CL_GFW=>SHOW_MSG EXPORTING MSGNO = F_RETURN.
    ELSE.

*     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.

  OBJ-OBJID = co_gfw_prog_objid_2.
  OBJ-GRPID = co_gfw_prog_series1.
  OBJ-X_VAL = co_gfw_prog_category2.
  OBJ-Y_VAL = '50'. "#EC NOTEXT
  OBJ-T_X_VAL = co_gfw_long_cat2.
  OBJ-T_GRPID = co_gfw_long_grpid1.
  CALL METHOD DC_INSTANCE->SET_OBJ_VALUES
         EXPORTING ID        = MY_ID_AT_DC
                   OBJ       = OBJ
         IMPORTING RETVAL = F_RETURN.
  IF F_RETURN <CL_GFW>OK. EXIT. ENDIF.

  OBJ-OBJID = co_gfw_prog_objid_3.
  OBJ-GRPID = co_gfw_prog_series1.
  OBJ-X_VAL = co_gfw_prog_category3.
  OBJ-Y_VAL = '18'. "#EC NOTEXT
  OBJ-T_X_VAL = co_gfw_long_cat3.
  OBJ-T_GRPID = co_gfw_long_grpid1.
  CALL METHOD DC_INSTANCE->SET_OBJ_VALUES
         EXPORTING ID        = MY_ID_AT_DC
                   OBJ       = OBJ
         IMPORTING RETVAL = F_RETURN.
  IF F_RETURN <CL_GFW>OK. EXIT. ENDIF.

  OBJ-OBJID = co_gfw_prog_objid_4.
  OBJ-GRPID = co_gfw_prog_series1.
  OBJ-X_VAL = co_gfw_prog_category4.
  OBJ-Y_VAL = '45'. "#EC NOTEXT
  OBJ-T_X_VAL = co_gfw_long_cat2.
  OBJ-T_GRPID = co_gfw_long_grpid1.
  CALL METHOD DC_INSTANCE->SET_OBJ_VALUES
         EXPORTING ID        = MY_ID_AT_DC
                   OBJ       = OBJ
         IMPORTING RETVAL = F_RETURN.
  IF F_RETURN <CL_GFW>OK. EXIT. ENDIF.

* insert data for second group/curve
  OBJ-OBJID = co_gfw_prog_objid_5.
  OBJ-GRPID = co_gfw_prog_series2.
  OBJ-X_VAL = co_gfw_prog_category1.
  OBJ-Y_VAL = '7'. "#EC NOTEXT
  OBJ-T_X_VAL = co_gfw_long_cat1.
  OBJ-T_GRPID = co_gfw_long_grpid2.
  CALL METHOD DC_INSTANCE->SET_OBJ_VALUES
         EXPORTING ID        = MY_ID_AT_DC
                   OBJ       = OBJ
         IMPORTING RETVAL = F_RETURN.
  IF F_RETURN <CL_GFW>OK. EXIT. ENDIF.

  OBJ-OBJID = co_gfw_prog_objid_6.
  OBJ-GRPID = co_gfw_prog_series2.
  OBJ-X_VAL = co_gfw_prog_category2.
  OBJ-Y_VAL = '20'. "#EC NOTEXT
  OBJ-T_X_VAL = co_gfw_long_cat2.
  OBJ-T_GRPID = co_gfw_long_grpid2.
  CALL METHOD DC_INSTANCE->SET_OBJ_VALUES
         EXPORTING ID        = MY_ID_AT_DC
                   OBJ       = OBJ
         IMPORTING RETVAL = F_RETURN.
  IF F_RETURN <CL_GFW>OK. EXIT. ENDIF.

  OBJ-OBJID = co_gfw_prog_objid_7.
  OBJ-GRPID = co_gfw_prog_series2.
  OBJ-X_VAL = co_gfw_prog_category3.
  OBJ-Y_VAL = '2'. "#EC NOTEXT
  OBJ-T_X_VAL = co_gfw_long_cat3.
  OBJ-T_GRPID = co_gfw_long_grpid2.
  CALL METHOD DC_INSTANCE->SET_OBJ_VALUES
         EXPORTING ID        = MY_ID_AT_DC
                   OBJ       = OBJ
         IMPORTING RETVAL = F_RETURN.
  IF F_RETURN <CL_GFW>OK. EXIT. ENDIF.

  OBJ-OBJID = co_gfw_prog_objid_8.
  OBJ-GRPID = co_gfw_prog_series2.
  OBJ-X_VAL = co_gfw_prog_category4.
  OBJ-Y_VAL = '25'. "#EC NOTEXT
  OBJ-T_X_VAL = co_gfw_long_cat2.
  OBJ-T_GRPID = co_gfw_long_grpid2.
  CALL METHOD DC_INSTANCE->SET_OBJ_VALUES
         EXPORTING ID        = MY_ID_AT_DC
                   OBJ       = OBJ
         IMPORTING RETVAL = F_RETURN.
  IF F_RETURN <CL_GFW>OK. EXIT. ENDIF.

ENDFORM.                    " FILL_DC

*&---------------------------------------------------------------------*
*&      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.
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 -> Graphics 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.