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.
Similar Messages
-
Trying to access a private attribute of a class in the same package
Hi,
I have defined a private attribute in a class
class Sample {
private String newString = "hello";
in another class I am trying to access newString attribute using reflection api. It is throwing hte following exception
java.lang.NoSuchFieldException: value
at java.lang.Class.getDeclaredField(Unknown Source)
at refletionpack.mainclass.main(mainclass.java:20)
any ideas how to do it exactly? Should stringclass.getDeclaredField("value")
have the field name(newString) as a parameter?
public class mainclass {
static Class stringclass = Sample.class;
static Field stringCharsField = null;
public static void main(String args[]){
try{
stringCharsField = stringclass.getDeclaredField("value");
stringCharsField.setAccessible(true);
char[] stringChars = (char[])stringCharsField.get("newString");
System.out.println(stringChars);
}catch(NoSuchFieldException ex){
ex.printStackTrace();
}catch(IllegalAccessException ex){
ex.printStackTrace();
}Hi,
to obtain the value of your private attribute you have to change two lines of code. At first you have to tell your class and not the field that private attributes can be accessed by using stringClass.setAccessible(true);After that you have to specify the name of the attribute to obtain which is called newString in your class which results in
stringCharsField = stringClass.getDeclaredField("newString");For the invocation of the method get(Object) you need an object first that is an instance of the analyzed class by calling Object sample = stringClass.newInstance.
Then you can retrieve the actual data of the requested field by calling String string = (String) stringCharsField.get(sample);A simpler solution would be when you make your attribute newString static. Then you can omit the necessary object for the retrieval of the attribute data and the line would result in String string = (String) stringCharsField.get(null);.
For further issues considering reflection you should read the appropriate API.
Hope it helps. -
Accessing a public array from extra class.
I am trying to access a public array that I declared in my main class from a separate class. I am a bit confused about why this is not working.
The method search in the extra class is called in the extra class in part one of the nextKeystream method. How can I get it to use the int array "key". That I declared in the MainSolitaireDriver?
Thanks
My main class:
import java.util.*;
import java.io.*;
import java.util.Scanner;
public class MainSolitaireDriver
int pcount = 0;
public int[] key = new int[26];
public MainSolitaireDriver()
getValues();
public void getValues()
try
Scanner inFile = new Scanner(new File("input.txt"));
for (int counter = 0; counter < key.length; counter++ )
key[counter]= inFile.nextInt();
System.out.print(key[counter]+" ");
catch(FileNotFoundException e )
e.printStackTrace();
System.err.print("Failure- File Not Found");
public static void main (String[] args)
/*String whereInTheWorldMyFileShouldBe = new File("input.txt").getAbsolutePath();
System.out.println(whereInTheWorldMyFileShouldBe); */
}My extra class:
public class Solitaire
private Deck deck;
* Initialize the deck from the current key deck ordering.
public Solitaire (int[] shuffle)
deck = new Deck(shuffle);
public void getArray(int[] Array)
public int search(int [] span, int target)
for (int indexcount = 0; indexcount < span.length; indexcount++)
if (span[indexcount]==target)
return indexcount;
public void getArray(int[] a)
* Returns the next keystream generated by the Solitaire Algorithm
public int nextKeystream()
// Step one: Move Joker A one card down.
int jokerAindex = search(MainSolitaireDriver(key), 27);
System.out.print(jokerAindex);
// Step two: Move Joker B two cards down.
// Step three: Perform a triple cut.
// Step four: Perform a count cut.
// Step five: Find the output card.
return 0;
* Returns the ciphertext corresponding to the specified
* plaintext, according to the current key deck ordering.
public String encrypt(String plaintext)
return "";
* Returns the plaintext corresponding to the specified
* ciphertext, according to the current key deck ordering.
public String decrypt(String ciphertext)
return "";
}Main Class
import java.util.*;
import java.io.*;
import java.util.Scanner;
public class MainSolitaireDriver
int pcount = 0;
public int[] key = new int[26];
public MainSolitaireDriver()
getValues();
public void getValues()
try
Scanner inFile = new Scanner(new File("input.txt"));
for (int counter = 0; counter < key.length; counter++ )
key[counter]= inFile.nextInt();
System.out.print(key[counter]+" ");
catch(FileNotFoundException e )
e.printStackTrace();
System.err.print("Failure- File Not Found");
public static void main (String[] args)
/*String whereInTheWorldMyFileShouldBe = new File("input.txt").getAbsolutePath();
System.out.println(whereInTheWorldMyFileShouldBe); */
}Solitaire Class (not main)
public class Solitaire
private Deck deck;
* Initialize the deck from the current key deck ordering.
public Solitaire (int[] shuffle)
deck = new Deck(shuffle);
public void getArray(int[] Array)
public int search(int [] span, int target)
for (int indexcount = 0; indexcount < span.length; indexcount++)
if (span[indexcount]==target)
return indexcount;
public void getArray(int[] a)
* Returns the next keystream generated by the Solitaire Algorithm
public int nextKeystream()
// Step one: Move Joker A one card down.
int jokerAindex = search(MainSolitaireDriver.key, 27);
System.out.print(jokerAindex);
// Step two: Move Joker B two cards down.
// Step three: Perform a triple cut.
// Step four: Perform a count cut.
// Step five: Find the output card.
return 0;
* Returns the ciphertext corresponding to the specified
* plaintext, according to the current key deck ordering.
public String encrypt(String plaintext)
return "";
* Returns the plaintext corresponding to the specified
* ciphertext, according to the current key deck ordering.
public String decrypt(String ciphertext)
return "";
} -
Accessing the attributes of a class using field symbols?
An option to pulll a variable into a user exit that otherwise would be out of reach is detailed [here|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/208811b0-00b2-2910-c5ac-dd2c7c50c8e8]
Can a similar approach involving field symbols or otherwise, be used to pull in the attributes of a class into the exit? For now, I'm trying to access the A_FRONTEND_INDEX attribute of the class CL_HRXSS_REM.
any ideas?
~SureshHi,
Have you already tried (PROGRAM)(OBJECT)->A_FRONTEND_INDEX in your code? I prepared small testing scenario with two programs and it works.
REPORT zmv_test1.
FORM test.
FIELD-SYMBOLS: <fs> TYPE ANY.
ASSIGN '(ZMV_TEST2)zip->crc32_map' TO <fs>.
IF sy-subrc EQ 0.
<fs> = 'Test'.
ENDIF.
ENDFORM. "test
REPORT zmv_test2.
DATA: zip TYPE REF TO cl_abap_zip.
START-OF-SELECTION.
CREATE OBJECT zip.
PERFORM test IN PROGRAM zmv_test1.
Cheers, -
How to access Instance Attribute in a Class Interface from FM ?
Hi Experts
I have the following function module code, that passes the syntax, however in the class interface ABC, I have an attribute IJK that is Instance Attribute (Public). When I modify the code like ABC->IJK but it does not like it, the error is :-
Field "ABC" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement. "DATA" statement.
Question : How do I declare the Class Interface ABC in my Function Module that will allow me to access the Instance Attribute ?
Thanks in advance.
FUNCTION XYZ.
if not ABC=>EFG is initial.
output = ABC=>EFG.
shift output left deleting LEADING space.
endif.
ENDFUNCTION.Hello
You question only makes sense if
(1) the class / interface is part of the FM's interface (i.e. an IMPORTING - or perhaps CHANGING - parameter)
(2) the class / interface is defined as global variable in the TOP include of the function group
If either of these two options is applicable then the coding may look like this:
" (1) IMPORTING parameter: e.g. IO_INSTANCE TYPE REF TO class / interface name
IF ( io_instance IS BOUND ).
io_instance->abc = 'New value'.
ENDIF.
" (2) Global variable of function group, e.g. GO_INSTANCE TYPE REF TO class / interface name:
IF ( go_instance IS BOUND ).
go_instance->abc = 'New value'.
ENDIF.
Obviously, the public attribute ABC must be changeable (i.e. not READ-ONLY).
Regards
Uwe -
Error while accessing a public method of applet from javascript.
Hi,
I am getting "Object doesn't support this property or method" error
when accessing a public method of applet from javascript in IE 6 using
document.applets[0].myMethod();
The same is working in IE 7.
Thanks in advance.
Regards,
PhanikanthI don't know why it happens, but this works for me in both versions:
<applet ..... name="MyApplet">
</applet>and in javascript use
document.MyApplet.myMethod() -
Trying to access our public library's ebooks. Downloaded the software,(Overdrive Media Console) but am getting an error saying: Current version of MP Security is 2.5.0.0 and I need 2.5.0.1. How do I do that so I can read the ebooks? People have suggested to use IE but I much prefer Firefox HELP!
Try updating the Media Player while using Internet Explorer. The Windows Updates site uses ActiveX to perform its' functions. Firefox doesn't support ActiveX.
-
I have all these errors, can anyone help with this all means? trying to get my book published in iBooks. Nedd your help. Thanks, Jo
ERROR ITMS-9000: "index_split_000.html(257): attribute "name" not allowed here; expected attribute "accesskey", "charset", "class", "coords", "dir", "href", "hreflang", "id", "rel", "rev", "shape", "style", "tabindex", "target", "title", "type" or "xml:lang"" at Book (MZItmspBookPackage)
Use of the block quote element can cause ePubecheck to give the error "text not allowed here". Text must not be alone inside of a body tag and if it is not enclosed in some other block level tag, this may lead to the error you are receiving.I have all these errors, can anyone help with this all means? trying to get my book published in iBooks. Nedd your help. Thanks, Jo
ERROR ITMS-9000: "index_split_000.html(257): attribute "name" not allowed here; expected attribute "accesskey", "charset", "class", "coords", "dir", "href", "hreflang", "id", "rel", "rev", "shape", "style", "tabindex", "target", "title", "type" or "xml:lang"" at Book (MZItmspBookPackage)
Use of the block quote element can cause ePubecheck to give the error "text not allowed here". Text must not be alone inside of a body tag and if it is not enclosed in some other block level tag, this may lead to the error you are receiving. -
Accessing private attribute of a class from its Friend Class
Hi Experts ,
Please help me to understand how can i access private attribute of one class from its friend class.
I am coding in Method (DO_SAVE) of class /BOBF/CL_TRA_TRANSACTION_MGR.
I need to access private variable ( MO_BOPF) of class /BOBF/CL_TRA_SERVICE_MGR ( Friend of /BOBF/CL_TRA_TRANSACTION_MGR ).
Regards,
Reny RichardHi Reny,
You should be able to access by creating object of friend class.
Sample:
data lo_frnd TYPE REF TO /BOBF/CL_TRA_SERVICE_MGR.
data lo_compl type REF TO /BOBF/IF_TRA_TRANS_MGR_COMPL.
create OBJECT lo_frnd
exporting
iv_bo_key = '111'
IO_COMPL_TRANSACTION_MANAGER = lo_compl.
"access the private object of friend class
clear lo_frnd->MO_BOPF.
Note: need to provide iv_bo_key & IO_COMPL_TRANSACTION_MANAGER while creating object.
Hope this helps you.
Regards,
Rama -
How to access private attribute of a class from its Friend Class
Hi Experts ,
I am coding in Method (DO_SAVE) of class /BOBF/CL_TRA_TRANSACTION_MGR.
I need to access private variable ( MO_BOPF) of class /BOBF/CL_TRA_SERVICE_MGR ( Friend of /BOBF/CL_TRA_TRANSACTION_MGR ).
Please help me to understand how can i access private attribute of one class from its friend class.
Regards- AbhishekHi Reny,
You should be able to access by creating object of friend class.
Sample:
data lo_frnd TYPE REF TO /BOBF/CL_TRA_SERVICE_MGR.
data lo_compl type REF TO /BOBF/IF_TRA_TRANS_MGR_COMPL.
create OBJECT lo_frnd
exporting
iv_bo_key = '111'
IO_COMPL_TRANSACTION_MANAGER = lo_compl.
"access the private object of friend class
clear lo_frnd->MO_BOPF.
Note: need to provide iv_bo_key & IO_COMPL_TRANSACTION_MANAGER while creating object.
Hope this helps you.
Regards,
Rama -
Accessing a public variable between classes
Hi there,
I've got two classes running...one is a document class (EgoGame.as) and another is a class linked to several similar movie clips (Ball.as).
I'm trying to access a public variable from Ball.as which has been declared in the doucment class EgoGame.as.
When I run the test the outputs states the following...
1120: Access of undefined property _ballPlaced.
Here's my code. What I'm trying to do is remove the event listeners from the Ball.as when the _ballPlaced variable is true, so that the user can't drag and drop the balls after they've been placed in a zone....any pointers greatly appreciated!
Document Class
EgoGame.as
package
import flash.display.MovieClip;
import flash.display.DisplayObject;
import flash.events.MouseEvent;
import Ball;
public class EgoGame extends MovieClip
public var __zoneFull:Array = new Array(false, false, false);
public var __ballPlaced:Array = new Array(false, false, false);
public function EgoGame()
ball0_mc.addEventListener(MouseEvent.MOUSE_DOWN, zoneEmpty);
ball1_mc.addEventListener(MouseEvent.MOUSE_DOWN, zoneEmpty);
ball2_mc.addEventListener(MouseEvent.MOUSE_DOWN, zoneEmpty);
ball0_mc.addEventListener(MouseEvent.MOUSE_UP, zoneFill);
ball2_mc.addEventListener(MouseEvent.MOUSE_UP, zoneFill);
ball1_mc.addEventListener(MouseEvent.MOUSE_UP, zoneFill);
ball0_mc.addEventListener(MouseEvent.MOUSE_UP, playMovie);
ball1_mc.addEventListener(MouseEvent.MOUSE_UP, playMovie);
ball2_mc.addEventListener(MouseEvent.MOUSE_UP, playMovie);
private function zoneEmpty(event:MouseEvent):void
if(event.target.hitTestObject(zone0_mc) && _zoneFull[0] == true)
_zoneFull[0] = false;
_ballPlaced[event.target.name.substring(4,5)] = false;
else if(event.target.hitTestObject(zone1_mc) && _zoneFull[1] == true)
_zoneFull[1] = false;
_ballPlaced[event.target.name.substring(4,5)] = false;
else if(event.target.hitTestObject(zone2_mc) && _zoneFull[2] == true)
_zoneFull[2] = false;
_ballPlaced[event.target.name.substring(4,5)] = false;
else
event.target.x = event.target._startX;
event.target.y = event.target._startY;
_ballPlaced[event.target.name.substring(4,5)] = false;
private function zoneFill(event:MouseEvent):void
if(event.target.hitTestObject(zone0_mc) && _zoneFull[0] == false)
event.target.x = zone0_mc.x;
event.target.y = zone0_mc.y;
_zoneFull[0] = true;
_ballPlaced[event.target.name.substring(4,5)] = true;
else if(event.target.hitTestObject(zone1_mc) && _zoneFull[1] == false)
event.target.x = zone1_mc.x;
event.target.y = zone1_mc.y;
_zoneFull[1] = true;
_ballPlaced[event.target.name.substring(4,5)] = true;
else if(event.target.hitTestObject(zone2_mc) && _zoneFull[2] == false)
event.target.x = zone2_mc.x;
event.target.y = zone2_mc.y;
_zoneFull[2] = true;
_ballPlaced[event.target.name.substring(4,5)] = true;
else
event.target.x = event.target._startX;
event.target.y = event.target._startY;
_ballPlaced[event.target.name.substring(4,5)] =false;
private function playMovie(event:MouseEvent):void
if (_ballPlaced[0] == true)
ball0_mc.gotoAndPlay(2);
else
ball0_mc.gotoAndStop(1);
if (_ballPlaced[1] == true)
ball1_mc.gotoAndPlay(2);
else
ball1_mc.gotoAndStop(1);
if (_ballPlaced[2] == true)
ball2_mc.gotoAndPlay(2);
else
ball2_mc.gotoAndStop(1);
Ball.as
package
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.display.DisplayObject;
import EgoGame;
public class Ball extends MovieClip
// public var _hitTarget:MovieClip;
public var _startX:Number;
public var _startY:Number;
public function Ball()
_startX = this.x;
_startY = this.y;
this.buttonMode = true;
this.addEventListener(MouseEvent.MOUSE_DOWN, dragIt);
this.addEventListener(MouseEvent.MOUSE_UP, dropIt);
private function dragIt(event:MouseEvent):void
this.startDrag();
public function dropIt(event:MouseEvent):void
this.stopDrag();
public function lockBall(event:MouseEvent):void
if(_ballPlaced[this.name.substring(4,5)] == true)
this.removeEventListener(MouseEvent.MOUSE_DOWN, dragIt);
this.removeEventListener(MouseEvent.MOUSE_UP, dropIt);every place you have a ball reference you can access the lockBall() method. so, if ball0_mc is a Ball class member, you can use:
ball0_mc.lockBall(); -
OOABAP-How to access the protected methos from a class
How to access the protected methos from a class..There is a built in class..For tht class i have created a object..
Built in class name : CL_GUI_TEXTEDIT
method : LIMIT_TEXT.
How to access this..help me with codehi,
If inheritance is used properly, it provides a significantly better structure, as common components only
need to be stored once centrally (in the superclass) and are then automatically available to subclasses.
Subclasses also profit immediately from changes (although the changes can also render them invalid!).
Inheritance provides very strong links between the superclass and the subclass. The subclass must
possess detailed knowledge of the implementation of the superclass, particularly for redefinition, but also in
order to use inherited components.
Even if, technically, the superclass does not know its subclasses, the
subclass often makes additional requirements of the superclass, for example, because a subclass needs
certain protected components or because implementation details in the superclass need to be changed in
the subclass in order to redefine methods.
The basic reason is that the developer of a (super)class cannot
normally predict all the requirements that subclasses will later need to make of the superclass.
Inheritance provides an extension of the visibility concept: there are protected components. The visibility of
these components lies between that of the public components (visible to all users, all subclasses, and the class itself), and private (visible only to the class itself). Protected components are visible to and can be used by all subclasses and the class itself.
Subclasses cannot access the private components particularly attributes) of the superclass. Private
components are genuinely private. This is particularly important if a (super)class needs to make local
enhancements to handle errors: it can use private components to do this without knowing or invalidating
subclasses.
Create your class inse24 and inherit this CL_GUI_TEXTEDIT
class in yours. You can then access the protected methods.
Hope this is helpful, <REMOVED BY MODERATOR>
Edited by: Runal Singh on Feb 8, 2008 1:08 PM
Edited by: Alvaro Tejada Galindo on Feb 19, 2008 2:19 PM -
Error While creating Security Attributes (QueryFilterPlugin)
Hi,
I am developing a QueryFilterPlugin. For this I need to define security attributes over documents fetched from remote repository(during crawl time). When I try to create a security attribute from an instance of DocumentAcl using method addSecurityAttribute("", "") I get following ProcessingException
EQG-31202: Security attribute not allowed in identity-based access control crawl.
What configurations should exist on SES before creating a security attribute.
Need help
Regards,
ShaktiSorry about the delay in getting an answer on this...
<p>
It seems that your crawler manager class has to implement the "UserDefinedSecurityModel" interface. If it does that, then it will run in attribute-based security mode, whereas if it doesn't it will run in identity-based security mode.
<p>
So the declaration for your manager will look something like this:
<p>
<br>
public class MyCrawlerMgr implements CrawlerPluginManager, UserDefinedSecurityModel<br>
{<br>
...<br>
}<br>
<p>
See: javadoc
<p>
I raised doc bug 6666752 for this issue, since it's not at all well documented. Our apologies for the difficulty this has caused you!
<p>
- Roger -
Getting error "Access via null" when running the web dynpro application
Hi experts,
I am getting the below error while executing my web dynpro application
500 SAP Internal Server Error
ERROR: Access via 'NULL' object reference not possible. (termination: RABAX_STATE)
I am getting the error only when I am calling a method create manufacturer from my web dynpro program. If i comment this code my application works fine
CALL METHOD wd_this->mo_ch_instance->create_manufacturer
EXPORTING
gi_manufacturer = ls_manufacturer
IMPORTING
lv_message = lv_status
i have created a attribute mo_ch_instance of type YSRM70CL_CH_SW_MD where YSRM70CL_CH_SW_MD is the class which has the create_manufacturer method that i am using in my code.
Kindly let me know whats the issue.
Regards,
VinodHi,
if wd_this->mo_ch_instance is not initial.
CALL METHOD wd_this->mo_ch_instance->create_manufacturer
EXPORTING
gi_manufacturer = ls_manufacturer
IMPORTING
lv_message = lv_status
endif.
Check wether you have created the object for that class r not.
Regards,
Lekha. -
A problem with accessing the public variable inside the function
Hi,
I have got this package and I get error 1120: 1120: Access of undefined property aa
Could you explain why I get this error?
package somepackage {
import flash.display.DisplayObject;
import mx.containers.Canvas;
public class SoundPictureSigns extends Canvas {
public var aa:int = 12;
public function SoundPictureSigns():void {
public static function setUpSignSizes():void {
trace("aa="+aa); /// ERROR here: 1120: Access of undefined property aa
Can you help?
RegardsWhen you write
class C
var v;
you are defining a variable that lives inside each instance of C. In other words, you can write code like
var c:C = new C();
c.v = 1;
If you don't have an instance, you can't access v.
When you write
class C
static var v;
you are defining a variable that lives inside the class itself, and you can access it without having an instance.
Gordon Smith
Adobe Flex SDK Team
Maybe you are looking for
-
ASA IPSEC VPN Design Question; ARP Between ASA
I"ve a requirement to put two ASA between two sites. The second site has hosts within the same network as the first site (conflict of fundamental routing principles). Can you put an ASA inline between the router and distribution switch at each site,
-
q1]] What is the difference between LOGICAL DATABASE and VIEWS? q2]] Why are <b>alphaneumeric characters</b> called so ?
-
I am creating a digital approval coversheet for my PDFs that I can fill out with form data and then proof editors can then add form data them self and also ad a digital signature... however I will need to put some instructions on the form to help the
-
How to display a .txt file?
i would like to ask if JAVA can open and display a text file by issuing a command from my application is it possible to do it without using a JEditorPane? something else too, how can i set the background for my application to be a .jpg image? i searc
-
Can I call a Java program from a SQL Server Trigger?
Hello, I want to encrypt some data in a database column in SQL Server. Today I am using java code to encrypt the value and store it in the database using JDBC. Now I want to use a VB client to store the encrypted value in the SQL Server DB. Since the