JSObject call() method problem
Hi,
I created an applet and I call a javascript function from the applet using call() method of jsobject.
JSObject jsoWindow=Jmol.jsoWindow;
String[] args = {"Fred"};
jsoWindow.call("f", args);
and i wrote an alert in the js function "f". It is working nicely in IE6, IE7 and Mozilla 2.x.x.x. But when I run it in Mozilla 1.5, it is nor working. I didn't get any alert.
What is the problem? Anybody can tell me a soltn for this?
Is any other method to call a js function from applet?
Im waiting for ur reply.
thanks
ani
Thanks for your reply.
Then what can I do? Is I want to do any settings?
Pls reply
Similar Messages
-
Listener call method problem(
Hello.
I am using a Listener class with method getLogger(). When I call it from JSP file I get such an error:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 4 in the jsp file: /SiteLoggerAdmin.jsp
SiteLogger cannot be resolved
1: <%@ page import="java.util.logging.*, java.io.*"%>
2: <%
3: // get logger
4: Logger logger = SiteLogger.getLogger();
5: // get request parameters
6: String level = request.getParameter("level");
7: if (level != null && !level.equals("")) {
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:93)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)SiteLogger.java
import java.io.*;
import java.util.logging.*;
import javax.servlet.*;
public class SiteLogger implements ServletContextListener {
// Site Logger
private static Logger logger;
public static Logger getLogger() throws IOException {
return logger;
public void contextInitialized(ServletContextEvent e) {
ServletContext sc = e.getServletContext();
// Get an instance of a Logger
logger = Logger.getLogger("global");
logger.setLevel(Level.INFO);
try {
FileHandler fh = null;
String root = sc.getRealPath("/");
fh = new FileHandler(root+"WEB-INF/log.txt");
fh.setFormatter(new CustomFormatter());
logger.addHandler(fh);
} catch (IOException ee) {
System.err.println("Can't load logger: " +ee.getMessage());
sc.setAttribute("SiteLogger", logger);
public void contextDestroyed(ServletContextEvent e) {
ServletContext sc = e.getServletContext();
sc.removeAttribute("SiteLogger");
logger = null;
}SiteLoggerAdmin.jsp
<%@ page import="java.util.logging.*, java.io.*"%>
<%
// get logger
Logger logger = SiteLogger.getLogger();
// get request parameters
String level = request.getParameter("level");
if (level != null && !level.equals("")) {
logger.setLevel(Level.parse(level));
// set current level
request.setAttribute("l", logger.getLevel());
// set current log
StringWriter sw = new StringWriter();
request.setAttribute("log", sw);
// parse in current log
InputStream is =
application.getResourceAsStream("/WEB-INF/log.txt");
if (is != null) {
for (int i = is.read();i!=-1;i=is.read()) {
sw.write((char)i);
} else {
sw.write("Can't load log file!");
%>
<html>
<head>
<title>Site Logging Configuration</title>
</head>
<body>
<h3>Set the site's logging level:</h3>
<b>Current level:</b> ${l}<br><br>
<form>
<select name="level">
<option value="SEVERE">Severe</option>
<option value="WARNING">Warning</option>
<option value="INFO">Info</option>
<option value="CONFIG">Config</option>
</select><br>
<input type="submit" value="Update Level"><br>
</form>
<h3>Current Log:</h3>
<pre>${log}</pre>
</body>
</html>The Listener works properly (initialization is successful) and I have the error only when calling Listener's method. How can I fix this?
I use Eclipse 3.4.2, Tomcat 5.5, JDK 6, Arch Linux.
Thanks in advance.+As of JSP 2.0, referring to any classes from the unnamed or default package is not allowed. This can result in a translation error on some containers, specifically those that run in a JDK 1.4 or greater environment which will also break compatibility with some older JSP applications. However, as of JDK 1.4, importing classes from the unnamed package is not valid. See Java 2 Platform, Standard Edition Version 1.4.2 Compatibility with Previous Releases for details. Therefore, for forwards compatibility, applications must not rely on the unnamed package. This restriction also applies for all other cases where classes are referenced, such as when specifying the class name for a tag in a Tag Library Descriptor (TLD) file.+ (excerpt from [http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/topic/com.ibm.websphere.express.doc/info/exp/ae/rweb_jsp_migration.html] )
-
Problem while sending ByteArray from as3 client through netconnection call method to red5 server
Hi to all,
I'm trying to send from as3 client a ByteArray of more or less 3 MB using NetConnection's call method but I am unable to do it, cause I get a timeout on the server and the client get disconnected (I have also increased the timeout limit in red5.properties but nothing changed). If I try to send a smaller ByteArray I don't have problem, even if the trasfer is really slow.
Any solution?
thanksput it in code tags so it's readable
CLIENT
public void sendLoginData(String data)
int c=0;
byte loginData[]=new byte[data.length()];
loginData=data.getBytes();
try
out.write(loginData);
System.out.println(client.isClosed());
// here i want 2 receive the 1 byte data whch i hv sent frm server's RUN() method
//following code is not working :( it gets hanged
while((c=in.read())!=-1)
System.out.print(c);
System.out.print("hi");
catch(Exception e)
System.out.println("Caught:" + e);
finally
out.close();
}SERVER
public void run()
boolean flag;
try
flag=verifyLoginData(ID); //this function verifies the login data by connecting to DB
System.out.println(flag);
if(flag==true)
//send login valid
bos.write(1);
bos.close();
else
//send login invalid
bos.write(0);
bos.close();
catch(Exception e)
System.out.println("caught " + e);
} -
*ERROR IN OLE CALL - METHOD CALL ERROR...*
HI ..
When trying to Upload a file using BDC with Vista OS, we are getting the following error..
ERROR IN OLE CALL - METHOD CALL ERROR...
There is no problem with BDC as its working fine with XP & other OS.
Pls help!!Seems that you are working with microsoft files.
Maybe you are using deprecated functions like WS_EXCEL -
How to call methods from within run()
Seems like this must be a common question, but I cannot for the life of me, find the appropriate topic. So apologies ahead of time if this is a repeat.
I have code like the following:
public class MainClass implements Runnable {
public static void main(String args[]) {
Thread t = new Thread(new MainClass());
t.start();
public void run() {
if (condition)
doSomethingIntensive();
else
doSomethingElseIntensive();
System.out.println("I want this to print ONLY AFTER the method call finishes, but I'm printed before either 'Intensive' method call completes.");
private void doSomethingIntensive() {
System.out.println("I'm never printed because run() ends before execution gets here.");
return;
private void doSomethingElseIntensive() {
System.out.println("I'm never printed because run() ends before execution gets here.");
return;
}Question: how do you call methods from within run() and still have it be sequential execution? It seems that a method call within run() creates a new thread just for the method. BUT, this isn't true, because the Thread.currentThread().getName() names are the same instead run() and the "intensive" methods. So, it's not like I can pause one until the method completes because they're the same thread! (I've tried this.)
So, moral of the story, is there no breaking down a thread's execution into methods? Does all your thread code have to be within the run() method, even if it's 1000 lines? Seems like this wouldn't be the case, but can't get it to work otherwise.
Thanks all!!!I (think I) understand the basics.. what I'm confused
about is whether the methods are synced on the class
type or a class instance?The short answer is; the instance for non-static methods, and the class for static methods, although it would be more accurate to say against the instance of the Class for static methods.
The locking associated with the "sychronized" keyword is all based around an entity called a "monitor". Whenever a thread wants to enter a synchronized method or block, if it doesn't already "own" the monitor, it will try to take it. If the monitor is owned by another thread, then the current thread will block until the other thread releases the monitor. Once the synchronized block is complete, the monitor is released by the thread that owns it.
So your question boils down to; where does this monitor come from? Every instance of every Object has a monitor associated with it, and any synchronized method or synchonized block is going to take the monitor associated with the instance. The following:
synchronized void myMethod() {...is equivalent to:
void myMethod() {
synchronized(this) {
...Keep in mind, though, that every Class has an instance too. You can call "this.getClass()" to get that instance, or you can get the instance for a specific class, say String, with "String.class". Whenever you declare a static method as synchronized, or put a synchronized block inside a static method, the monitor taken will be the one associated with the instance of the class in which the method was declared. In other words this:
public class Foo {
synchronized static void myMethod() {...is equivalent to:
public class Foo{
static void myMethod() {
synchronized(Foo.class) {...The problem here is that the instance of the Foo class is being locked. If we declare a subclass of Foo, and then declare a synchronized static method in the subclass, it will lock on the subclass and not on Foo. This is OK, but you have to be aware of it. If you try to declare a static resource of some sort inside Foo, it's best to make it private instead of protected, because subclasses can't really lock on the parent class (well, at least, not without doing something ugly like "synchronized(Foo.class)", which isn't terribly maintainable).
Doing something like "synchronized(this.getClass())" is a really bad idea. Each subclass is going to take a different monitor, so you can have as many threads in your synchronized block as you have subclasses, and I can't think of a time I'd want that.
There's also another, equivalent aproach you can take, if this makes more sense to you:
static final Object lock = new Object();
void myMethod() {
synchronized(lock) {
// Stuff in here is synchronized against the lock's monitor
}This will take the monitor of the instance referenced by "lock". Since lock is a static variable, only one thread at a time will be able to get into myMethod(), even if the threads are calling into different instances. -
CALL METHOD ABAP run SQL wrong
Dear All
I have a problem in ABAP connect SQL,Below is my code snippet sentence.
CONCATENATE 'Insert Into [timportcortrol]'
'(zucode,zstate,zdate,zkind) Values('''
VG_PCID ''','''
'1'','''
SY-DATUM ''','''
'1' ''')'
INTO SQL.
CALL METHOD OF REC 'Execute'
EXPORTING #1 = SQL
#2 = CON
#3 = '1'.
IF NOT SY-SUBRC = 0.
MESSAGE I000 WITH 'Download to [timportcortrol] failure,Please Check the SQL Connect!!! '.
EXIT.
ENDIF.
Con:is the connect SQL String ,the connect SQL is Okay.
I debug this code,when I used u2018Select u2026sentenceu2019,the program can work.if I use u2018insert intou2019 then canu2019t work,but I copied the SQL of the u2018inset Into sentenceu2026u2019run it into SQL server then it can work also.
And I found the SY-SUBRC eq u20182u2019.whatu2019s mean about of the sy-subrc eq u20182u2019.
I think the insert into sentence in abap I have write the wrong ,but I canu2019t assurance.
The Insert Into Sentence is:u2019 Insert Into [timportcortrol](zucode,zstate,zdate,zkind) Values('20080807094713','1','20080807','1')u2019
Could you give me some advice for this issue?
Thanks of all
Sun.Have you checked whether it's a problem with mixed case? Some SQL dialects are case sensitive.
The not very helpful meanings of the sy-subrc value can be found in ABAP help.
0 Successful processing of the method meth.
1 Communication Error to SAP GUI.
2 Error when calling method meth.
3 Error when setting a property.
4 Error when reading a property
matt -
NullPointer when GUI calls method in Client
Hi, I'm relatively new to Java programming and this conference.
I hope the following is not too long winded.
I'm trying to programme a FTP Client which is controlled by a GUI.
My JBuilder project has three classes:
ClientGUI.java and ClientFrame.java (produced with JBUilder's New Application option)
plus AClient.java (this is the 'engine' of the project).
ClientGUI constructs an instance 'frame' of ClientFrame which in turn constructs an instance 'client' of AClient.
The call to the AClient constructor has to be in a try/catch statement,
and takes a JTextArea as a parameter from ClientFrame to allow 'client' to display messges in my GUI.
The AClient constructor opens the Socket connection to a simple server on the same computer.
This part works.
However, when I attempt to use events generated by buttons in my GUI ('frame')to call methods in 'client', I get the following null-pointer exception:-
java.lang.NullPointerException
at ClientFrame.jButton1_actionPerformed(ClientFrame.java:219)
at ClientFrame_jButton1_actionAdapter.actionPerformed(ClientFrame.java:274)
etc...
etc...
These refer to code blocks:-
if ( client.isAlive() ) { /*line 219*/
System.out.println("client alive");
}where isAlive() is a simple test method that returns true,
and
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e); /*line 274*/
}'client' is listed as a public field in ClientFrame and is instanciated, so why do I have this problem?
Enclosing the call in a try/catch statement doesn't help.
Thanks in advance. LaurenceThe NullPointer means that the client was not instantiated, though you may think it has been.
Make sure that you are instantiating the correct variable, for instance, if you have a class-level field called client you would do something like this:
public class WhateverClass {
private AClient client;
//other stuff
public WhateverClass(...) {
client = //assignment either
//with new AClient(...)
//or something else
}You would NOT do:
public class WhateverClass {
private AClient client;
//other stuff
public WhateverClass(...) {
AClient client = //assignment either
//with new AClient(...)
//or something else
}Since this would create a second variable of name client that only has scope within the constructor.
Also, if the client is being assigned through a parameter in the constructor, check to make sure that that you are not passing a null value along... Do a System.out.println(client) after the assignement and see what you get. Then you know if the problem occurs in this class or in the class that creates the AClient reference to begin with... -
Call method cl_crm_documents- create_with_file not creating attachment
Hi,
I am trying to create attachment in a transaction type using cl_crm_documents->create_with_file. But it is not creating the same, instead gives error "Error loading file &".
I am uploading a file with fields object_id, text, file name, description and category.
I have passed the parameters as follows:
data: gref_obj type ref to cl_crm_documents.
create object gref_obj.
gw_prop_attr-name = 'BDS_KEYWORD'.
gw_prop_attr-value = gw_attach-category.
append gw_prop_attr to gt_prop_attr.
gs_business_object-instid = gw_guid-guid.(object guid)
gs_business_object-typeid = gv_object_type.(object type)
gs_business_object-catid = 'BO'.
call method gref_obj->create_with_file
exporting
file_name = gw_attach-f_name (name as provided in my uploaded file, in my case it is test)
directory = p_floder (C:\Attachment\)
properties = gt_prop_attr
business_object = gs_business_object
importing
phio = gs_phio_id
loio = gs_loio_id
error = ls_error.
Please help me on this. I doubt the directory that I am giving is wrong.
Thanks.Hi,
Please go through this...
Re: Problem attach document with the FileUpload UI.
Cheers,
Kris. -
How to call methods at selection screen?
Hi all,
I am developing a program in object oriented abap.
i have defined a class and implementated, and we have to instantiate the class in start of selection.
now the problem is how to call a method at selection screen event.
i want to validate the inputs entered by users. so can i create a static method which can be called without instantiating a class?
please guide me
thanksHello Mr A,
Define the method as a Static Method and that will solve your problem. Static methods can be called directly and does not need the class to be instantiated before it can be called.
Data: my_class type ref to zcl_report_utilities.
At Selection-Screen.
Call Method zcl_report_utilities=>check_selections
exporting
iv_repnm = sy-cprog
importing
et_messages = lt_msgs.
Start-Of-Selection.
Create Object my_class
exporting
im_pernr = ls_e1plogi-objid
im_begda = c_lowdate
im_endda = c_hidate.
Call Method my_class->read_infotypes
exporting
im_infty = c_org_assn
changing
et_infty = it_infty.
Here you can see how the method check_selections is called before the class zcl_report_utilities is instantiated. The best part about the Static Methods is if you are writing the class in the Class Library (SE24), any other programs can call them directly (if they need to) without needing to instantiating the entire class before the call.
Also note the difference in syntax when calling the static method check_selections to when calling the Instance method read_infotypes.
Hope this solves your issue and please do not forget to reward points.
Cheers,
Sougata.
p.s. if you are defining your class locally (program specific) then use Class-Methods to define a static method.
Edited by: Sougata Chatterjee on May 1, 2008 9:53 AM -
Calling method of a custom infotype from ABAP
Hi Experts,
I am working on an application where i need to call a method of a custom defined infotype.
I have done this -->
1. Create a custom infotype 9111
2. SAP creates a class of that infotype ZCL_HRPA_INFOTYPE_9111
3. Inside this method there are few inherited method which provide me functionality of insert , update , delete
i want to call methods IF_HRPA_INFTY_BL~MODIFY,
IF_HRPA_INFTY_BL~INSERT
However when i call these method from abap report this method does not work.
where as when i try to insert an entry using PA30 transaction it works.
Does anyone know why does this happen and what is the solution?
Regards,
Ashish ShahHad the same problem (probably copied from the same program). The answer is that you need to commit the work at the end using something like
* Commit
CALL METHOD busilog->flush
EXPORTING
no_commit = space.
Here is an example of my code for IT0002 which works.
*& Report Z_TEST2
REPORT z_test2.
DATA: a_masterdata_bl TYPE REF TO if_hrpa_masterdata_bl,
p0002 TYPE p0002,
lo_0002 TYPE REF TO cl_hrpa_infotype_0002,
ls_p0002_ref TYPE REF TO data,
container_tab TYPE hrpad_infty_container_tab,
container TYPE REF TO if_hrpa_infty_container,
message_handler TYPE REF TO cl_hrpa_message_list,
infotype_logic TYPE REF TO if_hrpa_infty_bl,
update_mode TYPE hrpad_update_mode VALUE 'XXX',
lt_0002_container TYPE REF TO cl_hrpa_infotype_container,
key TYPE pskey,
l_is_ok TYPE boole_d.
FIELD-SYMBOLS <p0002> TYPE p0002.
* get business logic from masterdata factory
CALL METHOD cl_hrpa_masterdata_factory=>get_business_logic
IMPORTING
business_logic = a_masterdata_bl.
* CATCH cx_hrpa_violated_assertion .
*ENDTRY.
*TRY.
CALL METHOD a_masterdata_bl->read
EXPORTING
tclas = 'A'
pernr = '508'
infty = '0002'
begda = sy-datum
endda = sy-datum
no_auth_check = 'X'
message_handler = message_handler
IMPORTING
container_tab = container_tab
is_ok = l_is_ok
* CATCH cx_hrpa_violated_assertion .
*ENDTRY.
READ TABLE container_tab INTO container INDEX 1.
lt_0002_container ?= container.
TRY.
CALL METHOD lt_0002_container->primary_record_ref
IMPORTING
pnnnn_ref = ls_p0002_ref.
CATCH cx_hrpa_violated_assertion.
ENDTRY.
ASSIGN ls_p0002_ref->* TO <p0002>.
MOVE-CORRESPONDING <p0002> TO key.
break stantric.
<p0002>-vorna = 'Rick'.
container ?= lt_0002_container->modify_primary_record( <p0002> ).
TRY.
CREATE OBJECT lo_0002
EXPORTING
tclas = 'A'
infty = '0002'.
CATCH cx_hrpa_violated_assertion .
ENDTRY.
CREATE OBJECT message_handler.
TRY.
CALL METHOD lo_0002->get_specific_bl
EXPORTING
versionid = '01'
tclas = 'A'
pskey = key
IMPORTING
infotype_logic = infotype_logic.
CATCH cx_hrpa_violated_assertion .
ENDTRY.
TRY.
CALL METHOD infotype_logic->modify
EXPORTING
old_container = lt_0002_container
massn = space
massg = space
update_mode = update_mode
no_auth_check = 'X'
message_handler = message_handler
IMPORTING
is_ok = l_is_ok
CHANGING
container = container.
CATCH cx_hrpa_violated_assertion .
ENDTRY.
* Commit
CALL METHOD a_masterdata_bl->flush
EXPORTING
no_commit = space. -
Oop report programme: call method
hi, i need ur guys advice about my oop report. its contain 2 class, lcl_main (main programme), lcl_disp(display report), lcl_update (upload report). all 3 class defination as below:
* C.L.A.S.S D.E.F.I.N.I.T.I.O.N
class lcl_main definition.
public section.
methods: init,
get_filename,
load_data,
chk_col,
chk_data,
chk_mandatory,
disp_status.
endclass.
class lcl_disp definition inheriting from lcl_main.
public section.
methods: chk_9700,
disp_success.
endclass.
class lcl_update definition inheriting from lcl_main.
public section.
methods: update9700.
endclass.
the idea was, i planned to put all methods which will be access by lcl_disp and lcl_update into lcl_main. i currently cofious to call method at lcl_main. currently i done as below, which if want to display (user will choose radio button display - p_view) i will create the object for lcl_disp and call all method in lcl_main and lcl_disp , for example o_disp-> init ... o_disp->loaddata .. and etc. the problem was if i want to choose the update , i need to object for lcl_update and call again the lcl_main with: o_update-> init ... o_update->loaddata .. and etc. the code as below.
the question , the programme can be successfully run with this method but i faced the problem when i tried to create a call method inside others method because at the START-OF-SELECTION i need to identify with object (lcl_disp or lcl_update) first.
2nd, i tried to figure out how at the start-of-selection , i no need to repeat to call method init, loaddata repeatly for different class (lcl_disp and lcl_update). really need advice. thank you.
*---------------------------------------------------------------------|
* INITIALIZATION |
*---------------------------------------------------------------------|
initialization.
data: o_main type ref to lcl_main.
create object: o_main.
* START OF SELECTION *
start-of-selection.
data: o_disp type ref to lcl_disp,
o_update type ref to lcl_update.
create object: o_disp, o_update.
if p_view = 'X'. "for view report
set handler o_handler->handle_event for all instances.
call method o_disp->init.
call method o_disp->load_data.
call method o_disp->chk_col.
"only proceeed if initial - col header and pernr syntax (pre 100 and length = 8)
if o_disp->status = 0.
call method o_disp->chk_data.
endif.
if o_disp->status = 0.
call method o_disp->chk_mandatory.
endif.
if o_disp->status = 0.
call method o_disp->chk_9700.
endif.
call method o_disp->disp_status.
elseif p_upld = 'X'."for update report
set handler o_handler->handle_event for all instances.
call method o_update->init.
call method o_update->load_data.
call method o_update->chk_col.
"only proceeed if initial - col header and pernr syntax (pre 100 and length = 8)
if o_update->status = 0.
call method o_update->chk_data.
endif.
if o_update->status = 0.
call method o_update->update9700.
endif.
call method o_update->disp_status.
endif.
class lcl_main implementation.
method get_filename.
endmethod.
method init.
endmethod.
method load_data.
endmethod.
method chk_col.
endmethod.
method chk_data.
endmethod.
method chk_mandatory.
endmethod.
method disp_status.
endmethod.
endclass.
class lcl_disp implementation.
method chk_9700.
endmethod.
method disp_success.
endclass.
class lcl_update implementation.
method update9700.
endmethod.
endclass.
Edited by: firdaus hashim on Nov 23, 2009 11:01 AMHello Sam,
Go to the class CL_DD_DOCUMENT (trxn SE24).
In the 'Attributes' tab, check for the attributes with SDYDO_ATTRIBUTE as the associated type.
It gives all the available attributes.
BR,
Suhas -
Hello experts:
I have a little problem, I want to create an ALV field with 4 decimales, it's a dinamic table, but when the alv report shows the fields it shows only 2 decimals, here the main code for explaining me better:
Here the code for create the field with decimals:
* Netpr
lv_cols = lv_cols + 1.
MOVE lv_cols TO wa_it_fldcat-col_pos.
MOVE 'NETPR' TO wa_it_fldcat-fieldname.
MOVE 'Net Price' TO wa_it_fldcat-scrtext_l.
MOVE 'Net Price' TO wa_it_fldcat-scrtext_m.
MOVE 'Net Pr' TO wa_it_fldcat-scrtext_s.
MOVE 'CURR' TO wa_it_fldcat-datatype.
MOVE 'P' TO wa_it_fldcat-inttype.
MOVE 11 TO wa_it_fldcat-intlen.
MOVE 4 TO wa_it_fldcat-decimals.
MOVE '' TO wa_it_fldcat-ref_field.
MOVE '' TO wa_it_fldcat-ref_table.
APPEND wa_it_fldcat TO t_fldcat.
After create more fields, here the code for create the dinamic ALV table:
* Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fldcat
IMPORTING
ep_table = t_newtable.
ASSIGN t_newtable->* TO <t_dyntable>.
* Create dynamic work area and assign to FS
CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
ASSIGN t_newline->* TO <fs_dyntable>.
After this method, the structure of the work area having the data type of the fields and all the atributes, the decimals of the NETPR fields just have 2 decimals =(
I hope my explanation it's clear.
Any help with this issue it's very welcome, thank you very much for your time.
MiriamHi
Xiaonan Hu is right: u need to delete the row where u transfer CURR as type:
* Netpr
lv_cols = lv_cols + 1.
MOVE lv_cols TO wa_it_fldcat-col_pos.
MOVE 'NETPR' TO wa_it_fldcat-fieldname.
MOVE 'Net Price' TO wa_it_fldcat-scrtext_l.
MOVE 'Net Price' TO wa_it_fldcat-scrtext_m.
MOVE 'Net Pr' TO wa_it_fldcat-scrtext_s.
*MOVE 'CURR' TO wa_it_fldcat-datatype.
MOVE 'P' TO wa_it_fldcat-inttype.
MOVE 11 TO wa_it_fldcat-intlen.
MOVE 4 TO wa_it_fldcat-decimals.
MOVE '' TO wa_it_fldcat-ref_field.
MOVE '' TO wa_it_fldcat-ref_table.
APPEND wa_it_fldcat TO t_fldcat.
If you transfer CURR, the method will defined a type p with 2 decimals by default, so it's useless to indicate the decimals in this case.
Infact the method calls the fm ALV_TABLE_CREATE, and here the abap code is:
- for CURR type:
elseif ls_fieldcat-datatype = 'CURR'.
concatenate 'DATA:'
ls_fieldcat-fieldname
'TYPE'
ls_fieldcat-inttype
'DECIMALS 2.'
into lt_source-line separated by space.
- for P type
if ls_fieldcat-inttype = 'P' and not ls_fieldcat-decimals is
initial.
replace '.' with 'DECIMALS' into lt_source-line.
concatenate lt_source-line ls_fieldcat-decimals '.' into
lt_source-line separated by space.
endif.
Max -
About calling method with arguments
Hi,
I have a problem about calling method using reflection. my method is like follows:
public myMethod(Integer var1, MyObject mobj) {
I've tried to call the method using the following code,
Class[] parameterTypes = new Class[] {Integer.class, MyObject.class};
Object[] arguments = new Object[] {new Integer(2), mobj};
Method met=cl.getMethod("myMethod", parameterTypes);
But the in the last line NoSuchMethodException is thrown.
How can I send the reference of MyObject to myMethod()?
Thanx
ronyShould work ok:
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class Test {
static class MyObject {}
public static void main(String[] args) throws Exception {
Class c = Test.class;
Class[] parameterTypes = new Class[] {Integer.class, MyObject.class};
try {
Object[] arguments = new Object[] {new Integer(2), new MyObject()};
Method met = c.getMethod("myMethod", parameterTypes);
met.invoke(new Test(), arguments);
} catch (NoSuchMethodException e) {
System.out.println(e);
} catch (IllegalAccessException e) {
System.out.println(e);
} catch (InvocationTargetException e) {
System.out.println(e);
public void myMethod(Integer var1, MyObject mobj) {
System.out.println("myMethod");
} -
CALL METHOD g_editor- get_text_as_r3table
Hi everyone!!!,
I have some problems with CALL METHOD g_editor->get_text_as_r3table, I can't retrieve the text from my custom editor. Can anyone please help me with this issue?.
DATA: g_mytable(line_length) TYPE c OCCURS 0.
CALL METHOD g_editor->get_text_as_r3table
IMPORTING
table = g_mytable.
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
add your handling
ENDIF.
Regards...Check this code...
data:
dockingleft type ref to cl_gui_docking_container,
text_editor type ref to cl_gui_textedit,
repid type syrepid.
data: itext type table of tline-tdline,
xtext type tline-tdline.
parameters: p_check.
at selection-screen output.
repid = sy-repid.
create object dockingleft
exporting repid = repid
dynnr = sy-dynnr
side = dockingleft->dock_at_left
extension = 1070.
create object text_editor
exporting
parent = dockingleft.
xtext = 'http:\\www.sap.com'.
append xtext to itext.
call method text_editor->set_text_as_r3table
exporting
table = itext
exceptions
others = 1.
start-of-selection.
call method text_editor->get_text_as_r3table
importing
table = itext
exceptions
others = 1.
loop at itext into xtext.
write:/ xtext.
endloop.
Kindly stolen from Rich Heilman -;)
Greetings,
Blag. -
Error when calling method INIT in class cl_hrxss_rem for salary statements
after configuring the our hrform to work with the new ess system in ecc 6.0 we configured the hrfor decision tree to $cedt$ and pointed the form variant to the edtin feature.
Now we are getting a class error.
com.sap.pcuigp.xssfpm.java.FPMRuntimeException: Error when calling method INIT of class CL_HRXSS_REM
at com.sap.pcuigp.xssfpm.java.MessageManager.raiseException(MessageManager.java:111)
at com.sap.pcuigp.xssfpm.java.MessageManager.raiseException(MessageManager.java:121)
at com.sap.xss.hr.rep.fcrfw.FcRepFramework.reportBapiRet2Error(FcRepFramework.java:525)
at com.sap.xss.hr.rep.fcrfw.FcRepFramework.callRfcExecAction(FcRepFramework.java:374)
at com.sap.xss.hr.rep.fcrfw.FcRepFramework.initModel(FcRepFramework.java:292)
at com.sap.xss.hr.rep.fcrfw.wdp.InternalFcRepFramework.initModel(InternalFcRepFramework.java:256)
at com.sap.xss.hr.rep.fcrfw.FcRepFrameworkInterface.initModel(FcRepFrameworkInterface.java:136)
at com.sap.xss.hr.rep.fcrfw.wdp.InternalFcRepFrameworkInterface.initModel(InternalFcRepFrameworkInterface.java:198)
at com.sap.xss.hr.rep.fcrfw.wdp.InternalFcRepFrameworkInterface$External.initModel(InternalFcRepFrameworkInterface.java:258)
at com.sap.xss.hr.rem2.selection.VcRem2Selection.onInit(VcRem2Selection.java:245)
at com.sap.xss.hr.rem2.selection.wdp.InternalVcRem2Selection.onInit(InternalVcRem2Selection.java:249)
at com.sap.xss.hr.rem2.selection.VcRem2SelectionInterface.onInit(VcRem2SelectionInterface.java:161)
at com.sap.xss.hr.rem2.selection.wdp.InternalVcRem2SelectionInterface.onInit(InternalVcRem2SelectionInterface.java:144)
at com.sap.xss.hr.rem2.selection.wdp.InternalVcRem2SelectionInterface$External.onInit(InternalVcRem2SelectionInterface.java:220)
at com.sap.pcuigp.xssfpm.wd.FPMComponent.doProcessEvent(FPMComponent.java:564)
at com.sap.pcuigp.xssfpm.wd.FPMComponent.doEventLoop(FPMComponent.java:438)
at com.sap.pcuigp.xssfpm.wd.FPMComponent.wdDoInit(FPMComponent.java:196)
at com.sap.pcuigp.xssfpm.wd.wdp.InternalFPMComponent.wdDoInit(InternalFPMComponent.java:110)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.doInit(DelegatingComponent.java:108)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.init(ClientComponent.java:430)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:362)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.initApplication(ApplicationSession.java:748)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:283)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingPortal(ClientSession.java:733)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:668)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:250)
at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
at com.sap.tc.webdynpro.clientserver.session.core.ApplicationHandle.doProcessing(ApplicationHandle.java:73)
at com.sap.tc.webdynpro.portal.pb.impl.AbstractApplicationProxy.sendDataAndProcessActionInternal(AbstractApplicationProxy.java:860)
at com.sap.tc.webdynpro.portal.pb.impl.AbstractApplicationProxy.create(AbstractApplicationProxy.java:220)
at com.sap.portal.pb.PageBuilder.updateApplications(PageBuilder.java:1246)
at com.sap.portal.pb.PageBuilder.createPage(PageBuilder.java:354)
at com.sap.portal.pb.PageBuilder.init(PageBuilder.java:547)
at com.sap.portal.pb.PageBuilder.wdDoRefresh(PageBuilder.java:591)
at com.sap.portal.pb.PageBuilder$1.doPhase(PageBuilder.java:822)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processPhaseListener(WindowPhaseModel.java:755)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doPortalDispatch(WindowPhaseModel.java:717)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:136)
at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:313)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:684)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:250)
at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
ThanksHi,
Maintain the EDTIN feature
&CEDT$
And UR problem solve
Maybe you are looking for
-
I have been using the same username for my iTunes for years. I use it on iCloud, the App Store...everything. About a year ago, I completed an iTunes update on my Toshiba Satellite laptop and was unable to listen to any music on my iTunes after that
-
I just update fcpx 10.2 and it crashed when i open updated library
i just update fcpx 10.2 and it asked for updating libraries, so i did. after that i can never open my library again, as long as i open fcpx, it crashed
-
Bar Code works fine in one App Svr, but does NOT work in identical server?
We use the FREE3OF9.TTF bar-code to generate bar codes. We tested on this http://www.freeimagehosting.net/uploads/7c901bc198.gif development environment and it works fine. Problem is, when we install the font and report in the live environment, which
-
My video won't play in IE/Windows though it works fine in other browsers. Can anyone please explain in very simple terms exactly what I need to do to get it to work? (I can tell that Dreamweaver doesn't like the way it's coded, but letting Dreamweave
-
Errors after 2.2.1 upgrade
Hi All, We recently upgraded to 2.2.1 from 1.6. We are getting "Page cannot be found" errors in couple of the pages. The same application works fine in 1.6. The errors in the Apache error log are [Wed Nov 22 01:01:44 2006] [error] [client 130.35.20.1