10-02-2008 7:44 PM
Hi,
here I am calling a Z T.code which internally calling the standard program CL_GUI_DIALOGBOX_CONTAINER====CM001
and giving dump in the method constructor as below
please provide me the reason
METHOD CONSTRUCTOR .
IF STYLE IS INITIAL.
STYLE = cl_gui_control=>ws_THICKFRAME +
cl_gui_control=>ws_MINIMIZEBOX +
cl_gui_control=>WS_MAXIMIZEBOX +
cl_gui_control=>WS_SYSMENU.
ENDIF.
DATA MY_PARENT TYPE REF TO CL_GUI_CONTAINER.
DATA CHILD_MASK(4) type X.
Data style_mask(4) type X.
data DoAutoAlign type c.
CHILD_MASK = cl_gui_control=>WS_CHILD.
style_mask = style.
" Abfrage etwas schmutzig (da nur auf erste Byte geprueft wird,
" aber fuer WS_CHILD ist es richtig
" Abap kann nur ein Byte bitweise vergleichen
if style_mask(1) O CHILD_MASK(1). " Eingebettet ins Dynpro
MY_PARENT = GET_DYNPRO_CONTAINER( CONTAINER = PARENT
CONTAINER_MUST_BE_TOPLEVEL = 1 ).
" Autoalign to Parent
DoAutoAlign = 'x'.
else. " Popup Fall
MY_PARENT = GET_FRAME_CONTAINER( CONTAINER = PARENT
CONTAINER_MUST_BE_TOPLEVEL = 1 ).
endif.
" Call constructor of CL_GUI_CONTAINER
CALL METHOD SUPER->CONSTRUCTOR
EXPORTING
CLSID = 'SAPGUI.DIALOGCTRL.1'
STYLE = STYLE
REPID = REPID
DYNNR = DYNNR
PARENT = MY_PARENT
LIFETIME = LIFETIME
NO_AUTODEF_PROGID_DYNNR = NO_AUTODEF_PROGID_DYNNR
name = name
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6.
CASE SY-SUBRC.
WHEN 0.
WHEN 1.
RAISE CNTL_SYSTEM_ERROR.
WHEN 2.
RAISE CNTL_ERROR.
WHEN 3.
class cl_gui_cfw definition load.
message id 'DC' type 'W' number cl_gui_cfw=>reason_no_init
raising create_error.
WHEN 4.
RAISE LIFETIME_ERROR.
WHEN 5.
RAISE LIFETIME_DYNPRO_DYNPRO_LINK.
WHEN OTHERS.
RAISE CNTL_ERROR.
ENDCASE.
CALL METHOD SET_VISIBLE
EXPORTING
VISIBLE = '1'
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2.
CASE SY-SUBRC.
WHEN 0.
WHEN 1.
RAISE CNTL_SYSTEM_ERROR.
WHEN 2.
--
--> RAISE CNTL_ERROR
WHEN OTHERS.
RAISE CNTL_ERROR.
ENDCASE.
call method SET_WINDOW_PROPERTY
exporting
property_id = property_metric
value = metric.
CALL METHOD SET_POSITION
EXPORTING
TOP = TOP
LEFT = LEFT
WIDTH = WIDTH
HEIGHT = HEIGHT
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2.
if not doAutoAlign is initial.
call method set_alignment( 15 ).
endif.
call method set_caption( caption ).
Subscribe nicht mehr notwendig
*
data: se type cntl_simple_event.
data: tse type cntl_simple_events.
" Close Event registrieren
se-eventid = event_close.
se-appl_event = ' '.
append se to tse.
call method set_registered_events
exporting
events = tse.
register for close event click
CALL METHOD REG_EVENT_CLOSE
EXPORTING
REGISTER = CTRUE
EXCEPTIONS
EVENT_ALREADY_REGISTERED = 1
ERROR_REGIST_EVENT = 2.
IF SY-SUBRC NE 0.
if sy-subrc = 1.
RAISE EVENT_ALREADY_REGISTERED.
else.
RAISE ERROR_REGIST_EVENT.
endif.
ENDIF.
ENDMETHOD.
10-03-2008 4:50 AM
Hello Ram
Missing all essential information for addressing this problem (namely: How did you call the CONSTRUCTOR method? Is the report run in dialog or in batch? At which screen level (main, popup) is the dialog box called?) it is only possible to do some speculations:
Calling the dialog box at the wrong screen level
Calling a dialog box in background
You may have a look at sample report SBAL_DEMO_04_CONTROL which demonstrates the use of the dialog box container.
Regards
Uwe