Accessing Sender parameter attribute in event hander method implementation
Hello knowledgeable friends.
I would like a single event handler to manage two alv grid objects. There is a parameter SENDER that is available in the method implementations to say which object triggered the event. I would like to get at the attribute MT_OUTTAB but this syntax does not work:
local_variable = sender->mt_outtab
Any help would be greatly appreciated
Ok, MT_OUTTAB is a protected Attribute. I would settle for just the name of the Sender. This code checks:
call method sender->get_name RECEIVING name = l_name.
but l_name is empty. I was hoping for 'GRID1'; when I created the object I used:
CREATE OBJECT alvgrid
EXPORTING
i_parent = container_top
i_name = 'GRID1'.
Similar Messages
-
Is there any way to send value to my attribute through event handler method
While I give value to the img array it does not print while I call object for this class. Is there any way that I could give value for img attribute
// Attribute
public var img:Array;
// Constructor
public function ReadXML(myfile:String) {
img=new Array();
xmlFile=myfile;
var loader:URLLoader=new URLLoader;
var url:URLRequest=new URLRequest(xmlFile);
loader.addEventListener(Event.COMPLETE,onXMLLoad);
loader.load(url);
// Event handling Method
function onXMLLoad(event:Event):Array {
var xml:XML=new XML(event.target.data);
//trace(xml);
//trace("Number of Contacts : " + xml..person.length());
//trace("First contact’s favorite food : " + xml.contacts.person[0].@favoriteFood);
img["height"]=100;
img["width"]=200;
return img;what are you trying to do?
if img has anything to do with an image, explain.
if img is supposed to be an associate array, use:
var img:Object;
img=new Object();
etc -
Accessing exception information in an event handler method
Hi,
I am trying to handle an event thrown by a fatal exception. I am able to capture the event in this event handler method. However, I need to access the PREVIOUS of the exception in this event handler method and am not sure how to do it.
Can some one please help with this?
Thanks
Saravanan.Hi,
Look at this code end check if your program works in the similar way.
Here, i'm changing an atribute from one class from other class.
If it doesn't works and you can't change an atribute directelly, i really don't know other way to do this.
CLASS main DEFINITION
CLASS main DEFINITION.
PUBLIC SECTION.
EVENTS evt EXPORTING value(e_data) TYPE char01.
METHODS event_trigger.
METHODS set_data IMPORTING i_data TYPE char01.
PRIVATE SECTION.
DATA v_data TYPE char01 VALUE 'X'.
ENDCLASS.
CLASS main IMPLEMENTATION
CLASS main IMPLEMENTATION.
METHOD event_trigger.
RAISE EVENT evt EXPORTING e_data = v_data.
ENDMETHOD.
METHOD set_data.
MOVE i_data TO v_data.
WRITE: / 'New v_data value ->', v_data.
ENDMETHOD.
ENDCLASS.
CLASS second DEFINITION
CLASS second DEFINITION.
PUBLIC SECTION.
METHODS event_handler FOR EVENT evt OF main IMPORTING e_data sender.
ENDCLASS.
CLASS second IMPLEMENTATION
CLASS second IMPLEMENTATION.
METHOD event_handler.
WRITE: 'v_data value ->', e_data.
CALL METHOD sender->set_data( i_data = 'Y' ).
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA: obj_main TYPE REF TO main.
DATA: obj_second TYPE REF TO second.
CREATE OBJECT: obj_main, obj_second.
SET HANDLER obj_second->event_handler FOR obj_main.
call method obj_main->event_trigger( ).
Regards.
Marcelo Ramos -
Using page attribute in event handler method of controller
Hi all,
I have created a page attribute GT_TABLE. I need to use this table in one of the event handler methods of the controller of the same page. I tried to use the GET_ATTRIBUTE method but it always returns an empty table.
Can someone please guide me in this respect.
Thanking you in advance,
Regards,
Sumit.Hi Sumit,
The page attribute you mention (GT_TABLE) it's an internal table, isn't it? So far I know, the value of internal table will gone when BSP finish to load in server. If you want to keep the data in internal table, you need to load the internal table into Session (in one of page event in BSP).
Regards
David -
Need to access a parameter in a super class method
Hi,
I have the following setup:
class A{
exceptionHandler(Throwable ex, int iNeedThis);
class B extends A{
execute();
func1{};
}When execute() fails, the ecexptionHandler method is automatically called. In func1() of class B I need to access the iNeedThis variable once excute() fails. Is it possible to do this?
Thanks.wow, thats about impossible to follow.
Let me take a stab.
If you want to save a value for later use when an exception is thrown, throw your own exception type that stores this info in the exception.
Or perhaps you are asking something completely different. -
Type for SENDER parameter in Class Method
Hi all,
I have an import parameter declared in a Class method .
in SE38 program i want to retrieve through export parameter .
But i am not able to figure how to defind the type of SENDER parameter . Please suggest if my perception is wrong or the point that i am missing here .
Regards,
Ry.Hi Vijay,
Thank you for your reply . the problem i am having is the functionlaity of this report is it displays three grids and when ever i double click on a grid it should identify the particluar grid . i have highlighted in bold where i am encountering the problem. i am enclosing the class details and the report source code. Please suggest after going through it . thanks in advance.
Class details that i have created :
the class has a method handle_double_event with event handler double_click of CL_GUI_ALV_GRID . i have defined this in the method section.
in public section section :
public section.
types GO_GRID1 type ref to CL_GUI_ALV_GRID .
class-methods HANDLE_DOUBLE_CLICK
for event DOUBLE_CLICK of CL_GUI_ALV_GRID
importing
ES_ROW_NO
E_COLUMN
E_ROW
SENDER .
in handle_double_event code :
DATA:
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid,
go_grid3 TYPE REF TO cl_gui_alv_grid.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1,
gt_vbak TYPE STANDARD TABLE OF vbak,
gt_vbap TYPE STANDARD TABLE OF vbap.
define local data
DATA:
ls_knb1 TYPE knb1,
ls_vbak TYPE vbak,
ls_vbap TYPE vbap.
DATA: es_row_no type lvc_s_roid,
e_column type lvc_s_col,
e_row type lvc_s_row.
*CASE sender. - here when i double click on the first grid go_grid1 it should go inside the go_grid1 . but it is not entering .*
WHEN go_grid1.
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
IS_ROW_ID =
IS_COLUMN_ID =
is_row_no = es_row_no.
Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDERS' ).
WHEN go_grid2.
READ TABLE gt_vbak INTO ls_vbak INDEX e_row-index.
CHECK ( ls_vbak-vbeln IS NOT INITIAL ).
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
IS_ROW_ID =
IS_COLUMN_ID =
is_row_no = es_row_no.
Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDER_DET' ).
WHEN go_grid3.
READ TABLE gt_vbap INTO ls_vbap INDEX e_row-index.
CHECK ( ls_vbap-matnr IS NOT INITIAL ).
SET PARAMETER ID 'MAT' FIELD ls_vbap-matnr.
CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
WHEN OTHERS.
RETURN.
ENDCASE.
endmethod.
Code for the Report that is accessing the class.
DATA:
gd_okcode TYPE ui_func,
go_docking TYPE REF TO cl_gui_docking_container,
go_splitter TYPE REF TO cl_gui_splitter_container,
go_splitter_2 TYPE REF TO cl_gui_splitter_container,
go_cell_top TYPE REF TO cl_gui_container,
go_cell_bottom TYPE REF TO cl_gui_container,
go_cell_left TYPE REF TO cl_gui_container,
go_cell_right TYPE REF TO cl_gui_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid,
go_grid3 TYPE REF TO cl_gui_alv_grid,
list type ref to zcl_eventhandler,
es_row_no type lvc_s_roid,
e_column type lvc_s_col,
e_row type lvc_s_row,
sender(8) type c.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1,
gt_vbak TYPE STANDARD TABLE OF vbak,
gt_vbap TYPE STANDARD TABLE OF vbap.
PARAMETERS : p_bukrs TYPE ekko-bukrs default '1000'.
START-OF-SELECTION.
create object list.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = p_bukrs.
Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 50
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Create splitter container
CREATE OBJECT go_splitter
EXPORTING
parent = go_docking
rows = 1
columns = 1
NO_AUTODEF_PROGID_DYNNR =
NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Get cell container
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_left.
container = go_cell_top.
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = go_cell_right.
Create 2nd splitter container
CREATE OBJECT go_splitter_2
EXPORTING
parent = go_cell_left
parent = go_cell_top
rows = 2
columns = 1
NO_AUTODEF_PROGID_DYNNR =
NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Get cell container
CALL METHOD go_splitter_2->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_top.
CALL METHOD go_splitter_2->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = go_cell_bottom.
Create ALV grids
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_cell_top
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_cell_bottom
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid3
EXPORTING
i_parent = go_cell_right
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD ZCL_EVENTHANDLER=>HANDLE_DOUBLE_CLICK
EXPORTING
ES_ROW_NO = ES_ROW_NO
E_COLUMN = E_COLUMN
E_ROW = E_ROW
SENDER.
Set event handler
SET HANDLER: list->handle_double_click FOR go_grid1.
SET HANDLER: list->handle_double_click FOR go_grid2.
SET HANDLER: list->handle_double_click FOR go_grid3.
Display data
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'KNB1'
CHANGING
it_outtab = gt_knb1
EXCEPTIONS
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.
ENDIF.
REFRESH: gt_vbak.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'VBAK'
CHANGING
it_outtab = gt_vbak
EXCEPTIONS
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.
ENDIF.
REFRESH: gt_vbap.
CALL METHOD go_grid3->set_table_for_first_display
EXPORTING
i_structure_name = 'VBAP'
CHANGING
it_outtab = gt_vbap
EXCEPTIONS
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.
ENDIF.
Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
CONTAINER =
EXCEPTIONS
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.
ENDIF.
NOTE: dynpro does not contain any elements
CALL SCREEN '0100'.
Flow logic of dynpro:
*PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
*PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Form CUSTOMER_SHOW_ORDERS
text
--> p1 text
<-- p2 text
FORM customer_show_orders .
define local data
DATA:
ld_row TYPE i,
ls_knb1 TYPE knb1.
CALL METHOD go_grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT * FROM vbak INTO TABLE gt_vbak
WHERE kunnr = ls_knb1-kunnr.
REFRESH: gt_vbap.
ENDFORM. " CUSTOMER_SHOW_ORDERS
*& Form ORDER_SHOW_DETAILS
text
--> p1 text
<-- p2 text
FORM order_show_details .
define local data
DATA:
ld_row TYPE i,
ls_vbak TYPE vbak.
CALL METHOD go_grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_vbak INTO ls_vbak INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT * FROM vbap INTO TABLE gt_vbap
WHERE vbeln = ls_vbak-vbeln.
ENDFORM. " ORDER_SHOW_DETAILS
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "ORDERS"
SET TITLEBAR 'xxx'.
Refresh display of detail ALV list
CALL METHOD go_grid2->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
EXCEPTIONS
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.
ENDIF.
Refresh display of detail ALV list
CALL METHOD go_grid3->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
EXCEPTIONS
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.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
move sy-ucomm to gd_okcode.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
User has pushed button "Display Orders"
WHEN 'ORDERS'.
PERFORM customer_show_orders.
WHEN 'ORDERS_DET'.
PERFORM order_show_details.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
endmodule.
Regards,
Ry -
Error accessing constnt public attribute of a class in an overwrite method.
Hi Gurus,
I am facing an error while accessing a constant public attribute while using it in the overwrite-exit of a methods.
The constant which is declared as public in the attribute section of the class is not available in the overwrite-exit of the method.
Please suggest me how to access the public attributes in the overwtire exits of the methods.
Thanks.Hi Ramneek,
Let me explain you the entire scenario:
Actually we are trying to ehance the SAP standard class : CL_FITV_POWL_FEEDER_TRIPS in ECC 6.0 EHP 5 .
We tried to create and overwrite-exit of the method "IF_POWL_FEEDER~GET_ACTIONS".
Overwrite-exit of a method is just like a method which will be called instead of the standard method : IF_POWL_FEEDER~GET_ACTIONS.
But the problem which we are facing here is that the Attributes which are defined in the class CL_FITV_POWL_FEEDER_TRIPS, are getting accessed from the overwrite-exit method.
Becuase of this we are not able to implement our custom logic. -
Access to class attributs by coding in its mother class method definition
Hi all,
How can I retrieve information about a class attributs by coding?
And is it possible to access to the attributs of the Child class from the Mother class?
REPORT ztest_method.
****** CLASS mother DEFINITION
CLASS mother DEFINITION.
PUBLIC SECTION.
METHODS: get_data.
ENDCLASS. "mother DEFINITION
****** CLASS child DEFINITION
CLASS child DEFINITION inheriting from mother.
ENDCLASS. "child DEFINITION
******* CLASS mother IMPLEMENTATION
CLASS mother IMPLEMENTATION.
METHOD get_data.
***Can I access to child class attributs here?
ENDMETHOD. "get_data
ENDCLASS. "mother IMPLEMENTATION
DATA oref TYPE REF TO CHILD.
DATA: method TYPE string.
DATA: cla_name(20).
START-OF-SELECTION.
CREATE OBJECT oref .
CALL METHOD oref->method). "Here I want to access to this class's attribut without redefine itHi,
a very easy way is to define an attribute TYPE REF TO DATA in the super class and write generic access methods which work with it by dereferencing it and assigning a field symbol. This might even save you the effort of creating a class hierarchy, because one class may be able to handle all the data objects whose types are only known at run-time.
In the below example, the only specific thing about the sub class is the constructor in which the data object is created and typed:
REPORT ztesta.
* CLASS lcl_mother DEFINITION
CLASS lcl_mother DEFINITION.
PUBLIC SECTION.
METHODS get_data EXPORTING es_data TYPE any.
METHODS set_data IMPORTING is_data TYPE any.
PROTECTED SECTION.
DATA mr_data TYPE REF TO data.
ENDCLASS. "lcl_mother DEFINITION
* CLASS lcl_child1 DEFINITION
CLASS lcl_child1 DEFINITION INHERITING FROM lcl_mother.
PUBLIC SECTION.
METHODS constructor.
ENDCLASS. "lcl_child1 DEFINITION
DATA:
lr_child TYPE REF TO lcl_mother,
ls_but000_in TYPE but000,
ls_but000_out type but000.
START-OF-SELECTION.
CREATE OBJECT lr_child TYPE lcl_child1.
ls_but000_in-partner = '0000004711'.
lr_child->set_data( ls_but000_in ).
lr_child->get_data( IMPORTING es_data = ls_but000_out ).
write: / ls_but000_out-partner.
* CLASS lcl_mother IMPLEMENTATION
CLASS lcl_mother IMPLEMENTATION.
METHOD get_data.
FIELD-SYMBOLS:
<fs_data> TYPE ANY.
ASSIGN mr_data->* TO <fs_data>.
MOVE-CORRESPONDING <fs_data> TO es_data.
ENDMETHOD. "get_data
METHOD set_data.
FIELD-SYMBOLS:
<fs_data> TYPE ANY.
ASSIGN mr_data->* TO <fs_data>.
MOVE-CORRESPONDING is_data TO <fs_data>.
ENDMETHOD. "set_data
ENDCLASS. "lcl_mother IMPLEMENTATION
* CLASS lcl_child1 IMPLEMENTATION
CLASS lcl_child1 IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
CREATE DATA mr_data TYPE but000.
ENDMETHOD. "constructor
ENDCLASS. "lcl_child1 IMPLEMENTATION
Another variant would be to define an attribute MV_DATA which is typed individually in each sub class and program dynamically against it in the super class using field symbols.
*& Report ZTESTA
REPORT ztesta.
* CLASS lcl_mother DEFINITION
CLASS lcl_mother DEFINITION.
PUBLIC SECTION.
METHODS get_data EXPORTING es_data TYPE any.
METHODS set_data IMPORTING is_data TYPE any.
ENDCLASS. "lcl_mother DEFINITION
* CLASS lcl_child1 DEFINITION
CLASS lcl_child1 DEFINITION INHERITING FROM lcl_mother.
PUBLIC SECTION.
DATA: ms_data TYPE but000.
METHODS constructor.
ENDCLASS. "lcl_child1 DEFINITION
* CLASS lcl_child2 DEFINITION
CLASS lcl_child2 DEFINITION INHERITING FROM lcl_mother.
PUBLIC SECTION.
DATA: ms_data TYPE t000.
METHODS constructor.
ENDCLASS. "lcl_child1 DEFINITION
DATA:
lr_child1 TYPE REF TO lcl_mother,
lr_child2 TYPE REF TO lcl_mother,
ls_but000 TYPE but000,
ls_t000 TYPE t000.
START-OF-SELECTION.
CREATE OBJECT lr_child1 TYPE lcl_child1.
lr_child1->get_data( IMPORTING es_data = ls_but000 ).
WRITE: / ls_but000-partner.
CREATE OBJECT lr_child2 TYPE lcl_child2.
lr_child2->get_data( IMPORTING es_data = ls_t000 ).
WRITE: / ls_t000-mwaer.
* CLASS lcl_mother IMPLEMENTATION
CLASS lcl_mother IMPLEMENTATION.
METHOD get_data.
FIELD-SYMBOLS:
<fs_data> TYPE ANY.
ASSIGN ('MS_DATA') TO <fs_data>.
es_data = <fs_data>.
ENDMETHOD. "get_data
METHOD set_data.
FIELD-SYMBOLS:
<fs_data> TYPE ANY.
ASSIGN ('MS_DATA') TO <fs_data>.
<fs_data> = is_data.
ENDMETHOD. "set_data
ENDCLASS. "lcl_mother IMPLEMENTATION
* CLASS lcl_child1 IMPLEMENTATION
CLASS lcl_child1 IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
SELECT SINGLE * FROM but000 INTO ms_data.
ENDMETHOD. "constructor
ENDCLASS. "lcl_child1 IMPLEMENTATION
* CLASS lcl_child2 IMPLEMENTATION
CLASS lcl_child2 IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
SELECT SINGLE * FROM t000 INTO ms_data.
ENDMETHOD. "constructor
ENDCLASS. "lcl_child2 IMPLEMENTATION
I hope this helps!
Regards,
Thorsten -
PL/SQL Entity Object - Accessing Out parameter values in insertRow method
Hi,
I have the following pl/sql code which takes 4 input parameter and 1 out parameter.
create or replace procedure xxfwk_emp_create(p_person_id IN NUMBER, p_first_name IN VARCHAR2, p_last_name IN VARCHAR2, p_sal IN NUMBER) is
cursor c1 is select EMPLOYEE_ID from fwk_tbx_employees;
v_status varchar2(1) := 's';
BEGIN
for v_c1 in c1 loop
if v_c1.employee_id = p_person_id then
p_error_msg:= 'Person with this id already exist';
v_status := 'e';
end if;
exit when c1%notfound OR v_status='e' ;
end loop;
if v_status = 'e' then
goto error;
end if;
INSERT INTO FWK_TBX_EMPLOYEES(EMPLOYEE_ID,
FIRST_NAME,
LAST_NAME,
FULL_NAME,
SALARY,
CREATION_DATE,
CREATED_BY,
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
LAST_UPDATE_LOGIN)
VALUES(p_person_id,
p_first_name,
p_last_name,
P_first_name||' '||p_last_name,
p_sal,
sysdate,
fnd_global.user_id,
sysdate,
fnd_global.user_id,
fnd_global.login_id);
<<error>>
null;
END xxfwk_emp_create;
I have following code in EO Impl class
public void insertRow()
try
OADBTransactionImpl oadbTrans = (OADBTransactionImpl)getDBTransaction();
String s = "begin xxfwk_emp_create(p_person_id=>:1, p_first_name=>:2, p_last_name=>:3, p_sal=>:4, p_error_msg=>:5);end;";
OracleCallableStatement oraCall = (OracleCallableStatement)oadbTrans.createCallableStatement(s,-1);
oraCall.setNUMBER(1,getEmployeeId());
oraCall.setString(2,getFirstName());
oraCall.setString(3,getLastName());
oraCall.setNUMBER(4,getSalary());
*< How to access Out Parameter from The procedure >*
oraCall.execute();
catch(SQLException sqlException)
throw OAException.wrapperException(sqlException);
catch(Exception exception)
throw OAException.wrapperException(exception);
In this insertRow i want to get the error message (out param) and throw this message as exception in OA page.
What changes i need to do in my page?
Regards,
RamThanks sumit..
I changed the code as below still i am not getting the error message on the page.
In jdeveloper i am successfully printing the error message.
here is the code..
try
OADBTransactionImpl oadbTrans = (OADBTransactionImpl)getDBTransaction();
String s = "begin xxfwk_emp_create(p_person_id=>:1, p_first_name=>:2, p_last_name=>:3, p_sal=>:4, p_error_msg=>:5);end;";
OracleCallableStatement oraCall = (OracleCallableStatement)oadbTrans.createCallableStatement(s,-1);
oraCall.setNUMBER(1,getEmployeeId());
oraCall.setString(2,getFirstName());
oraCall.setString(3,getLastName());
oraCall.setNUMBER(4,getSalary());
String p_error_msg = null;
System.out.println("Error message before call "+p_error_msg);
Types OracleTypes;
oraCall.registerOutParameter(5,OracleTypes.VARCHAR);
if (p_error_msg!=null)
throw new OAException(p_error_msg,OAException.ERROR);
oraCall.execute();
p_error_msg = oraCall.getString(5);
System.out.println("Error message after call "+p_error_msg);
catch(SQLException sqlException)
throw OAException.wrapperException(sqlException);
catch(Exception exception)
throw OAException.wrapperException(exception);
Regards,
Ram -
Enhance standard class with event handler method
In trying to enhance a standard class with a new event handler class, I find that the ECC 6.0 EHP4 system does not appear to recognise the fact the method is an event handler method. The specific example is a new method to handle the event CL_GUI_ALV_GRID->USER_COMMAND.
I notice that the flag called Active has not been ticked - see image below. Perhaps this is the reason why the event handler is not being triggered.
Note that there is an event handler for the same event in the standard class which obviously is executed as expected. Any ideas on limitations in the system or I am missing a step?
Thanks
JohnThank you for your replies.
There is a bug in the ALV handler of a standard SAP class (when executed in ITS WebGUI) and I was hoping to create a custom event handler as an Enhancement to execute some custom code to sort of "handle the bug".
I agree - ideally it should be done in a Z class but that will not give me access to the object methods and attributes of the enhanced class.
Cheers,
John -
Problem while sending mail through posprocess event hadler inOIM 11g r2
Hi,
i am sending mail through posprocess event hadler inOIM 11g r2 when user is created.But i am getting following error in resolver class.
java.lang.NullPointerException
at oracle.iam.identity.usermgmt.impl.UserDetailsProviderImpl.getUserDetails(UserDetailsProviderImpl.java:102)
at oracle.iam.notification.impl.util.NotificationUtil.getUserPreferences(NotificationUtil.java:83)
at oracle.iam.notification.impl.NotificationServiceImpl.notify(NotificationServiceImpl.java:523)
at oracle.iam.notification.impl.NotificationServiceImpl.notify(NotificationServiceImpl.java:271)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at oracle.iam.platform.utils.DMSMethodInterceptor.invoke(DMSMethodInterceptor.java:25)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at oracle.iam.notification.impl.util.NotificationUtil.getUserPreferences(NotificationUtil.java:83)
at oracle.iam.notification.impl.NotificationServiceImpl.notify(NotificationServiceImpl.java:523)
at oracle.iam.notification.impl.NotificationServiceImpl.notify(NotificationServiceImpl.java:271)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at oracle.iam.platform.utils.DMSMethodInterceptor.invoke(DMSMethodInterceptor.java:25)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
Edited by: 853559 on Sep 25, 2012 6:27 AMIf you are using Custom Notification XML, make sure to have StaticData element in it. StaticData defines the entitites that can be used in the notification template, and these entities attributes are used to define substitution tokens in the template.
-
Error in event handler method in window
Hi,
I have created configuration in SEFVISU, to receive the workitem i have created a parameter in event handler method in window
but it is throwing dump The ASSERT condition was violated, if i remove that parameter means application executing properly but i am not able to pass the unique, values please guide me.
Regards,
Srini.Hello Srini,
are you talking about the default event handler method of the window? if so then you need to ensure that the parameter name defined in the event and passed in name are same. And also its better to go for the parameter type as STRING.
other option would be instead of defining the static parameters in the event handler method, you can get the parameters from the WDEVENT itself by accessing WDEVENT->PARAMETERS table.
hope this helps.
BR, Saravanan -
Repetitive call of event handler method
hi,
i ve some 8 screens with alv grid controls on each...i'm using
same subroutine for event handling for all the controls...the problem
is whenever i navigate from 1 to the other and return back to the same,
after data change, the event handler method is getting called as many times
i ve navigated....for toolbar actions i used befor user command event and
overcame but for data changed i got struck... Plz tel me the reason and how can we avoid.....
Thanks
Swaminathan.Hello Swami
The following sample report shows how to handle the same event for different control instances. The crucial point is to check for the sending control.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING
e_row_id
e_column_id
es_row_no
sender. " sending control !!!
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_hotspot_click.
* define local data
DATA:
ls_knb1 TYPE knb1,
ls_col_id TYPE lvc_s_col.
CASE sender. " check for the sending control (this is known!!!)
WHEN go_grid1.
READ TABLE gt_customer1 INTO ls_knb1 INDEX e_row_id-index.
MESSAGE 'Do event handling for 1st ALV grid!' TYPE 'I'.
WHEN go_grid2.
READ TABLE gt_customer2 INTO ls_knb1 INDEX e_row_id-index.
MESSAGE 'Do event handling for 2nd ALV grid!' TYPE 'I'.
WHEN OTHERS.
RETURN.
ENDCASE.
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
The sample report contains two screens showing two parts of the selected data (just for demonstration). Please do note that it does not matter at all whether the ALV lists are on the same screen or on different screens or whether they are displayed in subscreens of the same dynpro.
*& Report ZUS_SDN_ALVGRID_EVENTS_4
* Both screens have the same flow logic and do not contain any elements:
*PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
*PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
REPORT ZUS_SDN_ALVGRID_EVENTS_4.
DATA:
gd_okcode TYPE ui_func,
gt_fcat TYPE lvc_t_fcat,
go_docking1 TYPE REF TO cl_gui_docking_container,
go_docking2 TYPE REF TO cl_gui_docking_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid.
DATA:
gt_customer1 TYPE STANDARD TABLE OF knb1,
gt_customer2 TYPE STANDARD TABLE OF knb1.
PARAMETERS:
p_bukrs TYPE bukrs DEFAULT '2000' OBLIGATORY.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING
e_row_id
e_column_id
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_hotspot_click.
* define local data
DATA:
ls_knb1 TYPE knb1,
ls_col_id TYPE lvc_s_col.
CASE sender.
WHEN go_grid1.
READ TABLE gt_customer1 INTO ls_knb1 INDEX e_row_id-index.
MESSAGE 'Do event handling for 1st ALV grid!' TYPE 'I'.
WHEN go_grid2.
READ TABLE gt_customer2 INTO ls_knb1 INDEX e_row_id-index.
MESSAGE 'Do event handling for 2nd ALV grid!' TYPE 'I'.
WHEN OTHERS.
RETURN.
ENDCASE.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
CASE e_column_id-fieldname.
WHEN 'KUNNR'.
SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
WHEN 'ERNAM'.
* SET PARAMETER ID 'USR' FIELD ls_knb1-ernam.
* NOTE: no parameter id available, yet simply show the priciple
CALL TRANSACTION 'SU01' AND SKIP FIRST SCREEN.
WHEN OTHERS.
* do nothing
ENDCASE.
* Set active cell to field BUKRS otherwise the focus is still on
* field KUNNR which will always raise event HOTSPOT_CLICK
ls_col_id-fieldname = 'BUKRS'.
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
is_row_id = e_row_id
is_column_id = ls_col_id.
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_customer1
WHERE bukrs = p_bukrs
AND kunnr <= '0000300000'.
SELECT * FROM knb1 INTO TABLE gt_customer2
WHERE bukrs = p_bukrs
AND kunnr > '0000300000'.
* Create docking container
CREATE OBJECT go_docking1
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_docking2
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create ALV grid
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_docking1
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_docking2
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Set event handler
SET HANDLER:
lcl_eventhandler=>handle_hotspot_click FOR ALL INSTANCES.
* Build fieldcatalog and set hotspot for field KUNNR
PERFORM build_fieldcatalog_knb1.
* Display data
CALL METHOD go_grid1->set_table_for_first_display
CHANGING
it_outtab = gt_customer1
it_fieldcatalog = gt_fcat
EXCEPTIONS
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.
ENDIF.
CALL METHOD go_grid2->set_table_for_first_display
CHANGING
it_outtab = gt_customer2
it_fieldcatalog = gt_fcat
EXCEPTIONS
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.
ENDIF.
* Link the docking container to the target dynpro
CALL METHOD go_docking1->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
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.
ENDIF.
CALL METHOD go_docking2->link
EXPORTING
repid = syst-repid
dynnr = '0200'
* CONTAINER =
EXCEPTIONS
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.
ENDIF.
* ok-code field = GD_OKCODE
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
CASE syst-dynnr.
WHEN '0100'.
SET SCREEN 0. LEAVE SCREEN.
WHEN '0200'.
SET SCREEN 100. LEAVE SCREEN.
ENDCASE.
WHEN 'NEXT'.
SET SCREEN 200. LEAVE SCREEN.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form BUILD_FIELDCATALOG_KNB1
* text
* --> p1 text
* <-- p2 text
FORM build_fieldcatalog_knb1 .
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'KNB1'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT gt_fcat INTO ls_fcat
WHERE ( fieldname = 'KUNNR' OR
fieldname = 'ERNAM' ).
ls_fcat-hotspot = abap_true.
MODIFY gt_fcat FROM ls_fcat.
ENDLOOP.
ENDFORM. " BUILD_FIELDCATALOG_KNB1
Regards
Uwe -
How to Call Event Handler Method in Another view
Hi Experts,
Can anybody tell me how to call Event handler Method which is declared in View A ,it Should be Called in
view B,Thanks in Advance.
Thanks & Regards
Santhoshhi,
1) You can make the method EH_ONSELECT as public and static and call this method in viewGS_CM/ADDDOC using syntax
impl class name of view GS_CM/DOCTREE=>EH_ONSELECT "method name.
or
2)The view GS_CM/ADDDOC which contains EH_ONSELECT method has been already enhanced, so I can't execute such kind of operation one more time.
or
3)If both views or viewarea containing that view are under same window , then you can get the instance ofGS_CM/DOCTREE from view GS_CM/ADDDOC through the main window controller.
lr_window = me->view_manager->get_window_controller( ).
lv_viewname = 'GS_CM/DOCTREE '.
lr_viewctrl ?= lr_window ->get_subcontroller_by_viewname( lv_viewname ).
Now you can access the method of view GS_CM/DOCTREE .
Let me know in case you face any issues.
Message was edited by: Laure Cetin
Please do not ask for points, this is against the Rules of Engagement: http://scn.sap.com/docs/DOC-18590 -
Accessing Sender Agreement details in Module
Hi,
How can we access(read and then modify) the sender agreement details from SOAP header in from ModuleData in the Module interface?
One way I can think of is to read the SOAP message and parse it. The problem lies with accessing the SOAP message in the process method.
I would really appreciate your help.
Thanks.
SK/people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules
via that blog you can see how dynamic conf. is done ... via the dynamic conf. you can access mapping runtime too...
Maybe you are looking for
-
Dreamweaver thinks my images are in a folder
I've set up a site with many images in the root folder. When I drag an image to the page (also in the root folder, not a sub-folder) the src box in the properties inspector has a slash in front of the filename as though the image is in a sub-folder.
-
Killing a sub process from it's parent process
does any one know if ther's a way of killing a sub process from it's parent process?
-
Default values for variable in a report not possible
Dear Experts, I have desinged a query which is having a variable for Fiscal Period and that is mandatory. Again in my key figures i have restriced a key figure with this variable and offseted it for previous year and also few more offsettings have b
-
Problem with downloading from iTunes on iPhone4
I bought an album on iTunes and downloaded it via 3G. But when I go to music there are only 6 tracks from the album available. When I try to download any of the other songs from the album it overwrites one of the songs that was previously downloaded
-
Oracle RAC ONE Node ! Inquiry
Hi, Good Day. In my understanding Oracle 11gr2 RAC ONE Node "online database relocation" ability can address ONLY "Planned downtime Maintenance window". I mean in case of any catastrophic event i.e "failover / un-planned downtime" a production downti