Is it possible to call a class method using pattern in ABAP editor.
Hi,
Is it possible to call a class method using pattern in ABAP editor.
Thank U for Ur time.
Cheers,
Sam
Yes,
Click patterns.
Then choose Abap objects patterns.
Click on the Tick
It will give a new screen
Here Give the name of the class first.
Then the object (instance of the calss)
And finally the method ..
it will give you the pattern
Hope this helps.
Similar Messages
-
Is it possible to call a class in a jar file from JNI environment?
Hi
Is it possible to call a class in a jar file from JNI environment?
Thanks in advance.Could you explain a bit more what you are trying to do? (In other words, your question is vague.)
o If your main program is written in C, you can use JNI to start a JVM, load classes from the jar of your choice, and call constructors and methods of the objects defined in the jar.
o If your main program is java, and has been laoded from a jar, a JNI routine can call back into java to use the constructors and methods of classes defined in the jar(s). -
I suffer problems understanding how to call up class methods from within my programs and would like to see further examples of coding and a lending hand with the problem below, program one ProductClass works out stock item lines of a product, the program then needs to ask for the StaticProduct Class(the second program attached) to check for a valid barcode length and for how many odds and even numbers are within it a valid barcode would be 5000127062092
I would very much appreciate some help:
* This is a program to Enter and check product codes and prices
* and give a summary of values at the end
* @author (Jeffrey Jones)
* @version (version 2 5th April 2003)
public class ProcessProduct
public static void main(String args[])
StaticProduct Product = new StaticProduct();
//declare variables
String manuf;
String name;
int sLength;
String p;
String barcode;
int price;
int quantity;
int totalPrice=0;
int transactions=1;
int totalQuantity=0;
int totalValue=0;
int averageCost=0;
//Input Details
System.out.print("Enter Product Manufacturer : ");
manuf = UserInput.readString();
//start of while loop checking for 0 to exit loop
while (!manuf.equals("0"))
System.out.print("Enter Product Name : ");
name = UserInput.readString();
System.out.print("Enter Bar Code : ");
barcode = UserInput.readString();
//check for invalid data
if (StaticProduct.isValidBarcode(barcode))
{barcode = new code();
p = new Product("manuf","name","quantity","price");
}//closing bracket of if
else
{//error handling
}//closing bracket of if
//check for quantity input and errors
System.out.print("Enter Quantity : ");
quantity = UserInput.readInt();
if (quantity<=0)
{ System.out.print(" Error, invalid value ");
System.exit(0);
}// check for invalid entries
System.out.print("Enter Price :");
price = UserInput.readInt();
//check for price input and errors
if (price<=0)
{ System.out.print(" Error, invalid value ");
}// check for invalid entries
//total price value
totalPrice=price*quantity;
//Output of correctly inputted data
System.out.println(manuf+":"+name+":"+barcode+":"+price);
System.out.println(quantity+" @ "+price+" = "+totalPrice);
//update variables quantities
//update total quantity
totalQuantity = (totalQuantity + quantity);
//keep count of total value
totalValue = (totalValue + totalPrice);
//keep count of totqal no of transactions
transactions = (transactions++);
//Input Details
System.out.print("Enter Product Manufacturer : ");
manuf = UserInput.readString();
}//closure of loop
//display final totals
System.out.println("Transactions: "+transactions);
System.out.println("Total quantity: "+totalQuantity);
System.out.println("Total value: "+totalValue);
System.out.println("Average Cost: "+totalValue/totalQuantity);
System.exit(0);
}//closing bracket input and output of data
}//end class
* Write a description of class StaticProduct here.
* @author Jeffrey Jones
* @version 1 1st April 2003
public class StaticProduct
* isValidBarcode method - to check for correct barcode and length
* @return boolean
public static boolean isValidBarcode(String barcode) {
barcode = new barcode();
// validateBarcode length
if ( barcode.length() != 13 ) {
System.out.println("Invalid barcode " + barcode + " not 13 characters");
return false;
}//if
for ( int i = 0; i < barcode.length(); i++ ){// Check every char a digit
if ( ! Character.isDigit( barcode.charAt(i) ) ){
System.out.println("Invalid barcode " + barcode + " not all digits");
return false;
}//if
}//endfor
int sum1 = 0; // Sum first + third + etc.
for ( int i = 0; i < barcode.length() - 1; i += 2 ){
sum1 += barcode.charAt(i) - '0';
}//endfor
int sum2 = 0; // Sum second + fourth + etc.
for ( int i = 1; i < barcode.length() - 1; i += 2 ){
sum2 += barcode.charAt(i) - '0';
}//endfor
int check = sum1 + 3 * sum2; // 1st sum + three times 2nd sum.
check = check % 10; // Remainder on division by 10.
if ( check != 0 ){
check = 10 - check;
}//endif
if (check != barcode.charAt(12) - '0'){
System.out.println("Invalid barcode " + barcode + " check digit error");
}//endif
return ( check == barcode.charAt(12) - '0' );
}//end isValidBarcode
public static void main(String[] argv) {
System.out.println(isValidBarcode("1234567890123"));
System.out.println(isValidBarcode("123"));
System.out.println(isValidBarcode(""));
System.out.println(isValidBarcode("5018374496652"));
}//end main
}//end classRead through your text book or some java tutorials from this site to understand what classes are, what are methods, etc.
Your program is full of wrong initializations (as you rightly said you dont understand how to call up class method I would add that you dont understand how to call classes and what do they return e.g.
You have declared
String p;
then you go ahead and do this
p = new Product("manuf","name","quantity","price"); This is syntax for calling a class is this class returning a String? :s
Please go through the basics of Object Oriented Programming and then start with the coding part else you will face such very many difficulties and waste more time of yours in just coding with no results.
Look for the tutorials on this site and read through them and do example as given in them. -
Is it possible to call a custom method in App Module from a backing bean?
I would like to know if a custom method in App Module can be called from inside a backing bean.
I am not sure if it is logically right to call, from a backing bean, a custom method in App Module. But would like to know if that makes sense or if it is possible.Hi..
Yes it is possible.You have to add that method for client interface of AppModule.Now you can see that method in Data Controls(Refresh the data control). To call this method using bean it should add as method action to bindings(Click Bindings>+>methodAction>and Create action binding).
Now you can call this method in bean class.
Check following example use this concept to execute view criteria
http://adf-lk.blogspot.com/2011/05/oracle-adf-create-view-criteria-and_4727.html -
Can you call a class method as an RFC function
Hi
I would like to know whether it is possible to instantiate a class in another system via RFC and then call a method eg. cl_abap_typedescr=>describe_by_name, of that class in the other system like you can with an RFC enabled function.
Thanks
FaaiezIts not possible to call a method like RFC.
What you could do is write a RFC and within that instantiate the class and call desired method .
And now you can call this RFC from the other system.
Regards
Raja -
Code to call friends class method
Hello,
Please can someone help me with friends class method call. in global classes
Thanks
Megh
Moderator message: please search for available information/documentation before asking.
Edited by: Thomas Zloch on Nov 2, 2010 5:29 PMWhat is your exact problem?
The class whose private and protected section you want to use, needs declaration of its friends. You do it in Friends tabstrip. All these classes are allowed then to access these "hiden" sections from outside of the class. Below example how it works with local classes. For global ones the principle stays the same
CLASS lcl_main DEFINITION DEFERRED.
CLASS lcl_other DEFINITION FRIENDS lcl_main. "only LCL_MAIN can use may hiden sections
PROTECTED SECTION.
METHODS prot_meth.
PRIVATE SECTION.
METHODS priv_meth.
ENDCLASS.
CLASS lcl_other IMPLEMENTATION.
METHOD prot_meth.
WRITE / 'This is protected method of class lcl_other'.
ENDMETHOD. "prot_meth
METHOD priv_meth.
WRITE / 'This is private method of class lcl_other'.
ENDMETHOD. "priv_meth
ENDCLASS.
CLASS lcl_main DEFINITION.
PUBLIC SECTION.
METHODS call_friends_methods.
PRIVATE SECTION.
DATA mr_my_friend TYPE REF TO lcl_other.
ENDCLASS.
CLASS lcl_main IMPLEMENTATION.
METHOD call_friends_methods.
CREATE OBJECT mr_my_friend.
mr_my_friend->prot_meth( ).
mr_my_friend->priv_meth( ).
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA gr_main TYPE REF TO lcl_main.
CREATE OBJECT gr_main.
gr_main->call_friends_methods( ).
Regards
Marcin -
Dynamic Call Function/Class Method
Hi,
I have a requirement for which I need your help.
I want to Call a Method dynamically inside a program. how to do it?
My another quary is that how to call more than one class method dynamicaly in the program one at a time, based on certain conditions.
All the requirements mentioned above feels awakward to me, but are they feasible. Eagerly waiting for a reply.
Regards,
Pulokesh
Moderator message - Cross post locked
Edited by: Rob Burbank on Oct 26, 2009 9:48 AMHello,
you can call a Method like this where the name of the method is concatenated.
CONCATENATE 'SC_' me->gf_scenario '_SAVE' INTO lf_method.
CALL METHOD me->(lf_method).
Than I can imagine to loop over a tabele with all the Method Call to be executes un there:
Loop at gt_meth_calls into ls_meth_call.
ls_meth_call-object_instance->(ls_meth_call-meth_name).
endloop.
The table should be structured such that the first component contains a reference to the instance and the second component will be the Method name to run. -
Call enhancement class method from Bus. workflow task
Hi all,
I recently enhanced a global class from SAP (add a new method). Now I would like to call it from a workflow task (ABAP Class object used in the task). So it seems that only "native" methods from the class itself can be selected for the object method of the task.
Same issue if I try to call it via secondary methods options...
Last idea I have before the repair is: retrieve the instance saved into the WF container via a custom class interfacing IF_IFS_SWF_CONTAINER_EXIT (program exit) and call the enhanced method from the method proposed in this interface.
Maybe someone had the same issue? Anyone could help or propose solution?
Many thanks in advance for your help,
KR,
OlivierI think it might qualify for an OSS message.
There was simmilar note for BADIs which was corrected: https://service.sap.com/sap/support/notes/1156392
CL_SWF_UTL_DEF_SERVICES which is used in PFTC to determine callable methods doesn't include enhancements when calling function SEO_CLASS_TYPEINFO_GET (parameter WITH_ENHANCEMENTS is default FALSE) -
How to call inner class method in one java file from another java file?
hello guyz, i m tryin to access an inner class method defined in one class from another class... i m posting the code too wit error. plz help me out.
// test1.java
public class test1
public test1()
test t = new test();
public class test
test()
public int geti()
int i=10;
return i;
// test2.java
class test2
public static void main(String[] args)
test1 t1 = new test1();
System.out.println(t1.t.i);
i m getting error as
test2.java:7: cannot resolve symbol
symbol : variable t
location: class test1
System.out.println(t1.t.geti());
^There are various ways to define and use nested classes. Here is a common pattern. The inner class is private but implements an interface visible to the client. The enclosing class provides a factory method to create instances of the inner class.
interface I {
void method();
class Outer {
private String name;
public Outer(String name) {
this.name = name;
public I createInner() {
return new Inner();
private class Inner implements I {
public void method() {
System.out.format("Enclosing object's name is %s%n", name);
public class Demo {
public static void main(String[] args) {
Outer outer = new Outer("Otto");
I junior = outer.createInner();
junior.method();
} -
Unable to call Java class method within Embedding Java Activity in BPEL
Hi ,
I have written Java Class named 'Class3' .
When I am creating and trying to call these classes whithin Embedding Java Activity , compile time error is coming. Compiler is not finding class . Error message is like this one.
uildfile: C:\Oracle\Middleware\jdeveloper\bin\ant-sca-compile.xml
scac:
[scac] Validating composite : 'C:\JDeveloper\mywork\Application7\Embedded15\composite.xml'
[scac] C:\JDeveloper\mywork\Application7\Embedded15\SCA-INF\bpel\BPELEmbedded15\src\orabpel\bpelembedded15\ExecLetBxExe0.java:73: cannot find symbol
[scac] symbol : class Class3
[scac] location: class orabpel.bpelembedded15.ExecLetBxExe0
[scac] C:\JDeveloper\mywork\Application7\Embedded15\SCA-INF\bpel\BPELEmbedded15\src\orabpel\bpelembedded15\ExecLetBxExe0.java:73: cannot find symbol
[scac] symbol : class Class3
[scac] location: class orabpel.bpelembedded15.ExecLetBxExe0
[scac] Note: C:\JDeveloper\mywork\Application7\Embedded15\SCA-INF\bpel\BPELEmbedded15\src\orabpel\bpelembedded15\BPEL_BIN.java uses unchecked or unsafe operations.
[scac] Note: Recompile with -Xlint:unchecked for details.
[scac] FATAL_ERROR: location {ns:composite/ns:component[@name='BPELEmbedded15']}(20,36): Failed to compile bpel generated classes.
[scac] failure to compile the generated BPEL classes for BPEL process "BPELEmbedded15" of composite "default/Embedded15!1.0"
[scac] The class path setting is incorrect.
[scac] Ensure that the class path is set correctly. If this happens on the server side, verify that the custom classes or jars which this BPEL process is depending on are deployed correctly. Also verify that the run time is using the same release/version.
[scac]
BUILD FAILED
C:\Oracle\Middleware\jdeveloper\bin\ant-sca-compile.xml:264: Java returned: 1 Check log file : C:\JDeveloper\mywork\Application7\Embedded15\SCA-INF\classes\scac.log for errors
Total time: 8 seconds
I am creating Class3 directly in Application Resources folder indide Project Folder in Jdeveloper without creating any package. Code of the class is .......
public class Class3 {
public Class3() {
super();
public String getValue(){
return "BBBBBBB";
Can any one help?
Regards
Yogendra Rishishwar
9867927087Hi ,
In your java project frm jdev..right click and choose general and then choose deployment profiles and then choose Jar ..and then give some appropriate name(abc) and then click ok.
Then under resources file u get a abc.deploy file right click and say deploy to jar ..u will find the jar in that director.Now include this jar in your prjct libraries.
have a look at the link http://niallcblogs.blogspot.com/search/label/embedded%20Java -
Calling sub class method from superclass constructure
hi all
i have seen a program in which a super class constructure class methods of sub class before initialization of fields in subclass ,i want how this is posibble ?
thanks in advanceHear is the code n other thing i have used final variable without initialization n compiler dosen't report error
abstract class Test
public Test()
System.out.println("In DemoClass Constructer");
this.show();
public void show()
System.out.println("In DemoClass Show() method");
class Sub1 extends Test
private final float number;
public Sub1(float n)
this.number=n;
System.out.println((new StringBuilder()).append("Number is==").append(number).toString());
int j;
public void show()
System.out.println("In Sub1 Class Show method ");
public class DemoClass
public static void main(String s[])
Sub1 obj1=new Sub1(5);
Sub1 obj2=new Sub1(6);
thanks for reply -
Is it possible to call a SOAP webservice using HTTP POST adapter
Hello Experts,
Is it possible to call a webservice using a HTTP adapter with POST method? If yes, how?
Regards,
DipteeNo this will not work since you have additional SOAP information (i.e. SOAP envelope, security information) in addition to the payload. If you need a simple HTTP-Post for example, then you don't need SOAP, you can use the more simple http protocol without the additional features of SOAP.
Also refer to this link for differences: Difference b/w SOAP and HTTP -
Calling managed bean method using ajax on jsp page loading
Hello,
I am using jsf1.1 i want to call managed bean method when page gets loaded using ajax.
Thanks
K.RamuUse an ajaxical JSF framework, for example Ajax4jsf (part of RichFaces).
But why don´t you just use the constructor of the bean class to do some stuff prior to page loading? -
Call java class by using servlet
i written simple servlet with doGet(0. I need call java class when i run servlet
my requirement is when i start the server i will call servlet it will redirect to another page.
but before that servlet will run java class. which i have written externally.
i need to run java class by using servlet then it will redirect to another page.
could you give the proper solutionYou don't call classes - you call methods.
There's nothing special about servlets except the requirement that they implement HttpServlet. Servlets and other classes they interact with all get compiled into WEB-INF/classes on the server.
To forward a request to, say, "other.jsp" you do:
getServletContext().getRequestDispatcher("/other.jsp").forward(request,response); -
How to call a WebService method using HttpsURLConnection?
Hi,
I want to know how i could use HttpsURLConnection to call a WebService method.
I can use the following:
String endpoint = "https://xyz:8443/axis/services/MSecurity";
System.setProperty("javax.net.ssl.keyStore", keyStorepath);
System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");
System.setProperty("javax.net.ssl.keyStorePassword", keyStorePassword);
System.setProperty("javax.net.ssl.trustStore", trustStorePath);
System.setProperty("javax.net.ssl.trustStoreType", "JKS");
System.setProperty("javax.net.ssl.trustStorePassword", trustpass);
//Call Web Service
URL url = new URL(endpoint);
MSecuritySoapBindingStub service = new MSecuritySoapBindingStub(url, null);
//get list of people
String[] vo = service.getVO();
for (int i = 0; i < vo.length; i++) {
System.out.println(vo);
However, loading my cert. this way is not flexible. Therefore, I am using SSLContext to initialize my keystore and truststore and then I am using the following to connect to my webservice:
SSLContext sc = SSLContext.getInstance("SSLv3");
sc.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
SSLSocketFactory ssf = sc.getSocketFactory();
URL url = new URL(endpoint);
HttpsURLConnection htp = (HttpsURLConnection) url.openConnection();
htp.setSSLSocketFactory(ssf);
However, I do not know how I could use the "htp" object to call the getVO() method above.Use Apache Axis to do SOAP in Java.
Nobody can just mail you the code. You first have to create java source files from the web service via its WSDL file.
Maybe you are looking for
-
How to use different essbase member combinations in columns in obiee
Hello, I am trying to build a report in obiee which has an essbase ASO cube in the background. We have a measure 'A' that exists in BegBalance and a measure 'B' that exists in months Jan through Dec. So in my criteria, i set the dimensions i need alo
-
Match A/P invoices to G/L journal lines
A user requested a change to a query called posting actual journal entries which uses the following three Oracle G/L base tables: gl_je_batches, gl_je_headers, and gl_je_lines. The user asked for related document information such as the purchase orde
-
Where do I go to find which JVMs are still supported?
We're using some pretty old JVMs at my company. I fear they are so old they are unsupported by Sun. To get modernized, I need to let someone know this. If someone could direct me to a resource where I could determine this I'd appreciate it.
-
Get photos from Photoshop Album Starter Edition 3.2
We have some images stored in Photoshop Album Starter edition 3.2. When we now try to open the photos, we are told to register us for an unlocking code, which we never get. I have also tried to call Adobe support, but they could not help us with this
-
Warning displayed at every obtar execution on OSB 10.3
Hi, I am currently trying my backup and restore scripts with OSB 10.3 on Solaris 10 with a single tape drive (SDLT320). I've been using the scripts with OSB 10.1 previously. At every obtar execution I have the following warning: Warning: problem rese