Accessing FFS on Simens modules from Java
Hi.
I wish to open a file for writing from Java on Siemens XT75 module flash file system. This should be possible.
The only class I can find for this is
com.siemens.icm.io.File
which is deprecated, so I'd like to aviod it if possible in any way...
Any ideas? I couldn't find anything useful, please help.
Cheers
Reading is not to hard, is it?
+Cla
Deprecated. Use javax.microedition.io.FileConnection instead*
Similar Messages
-
Problem calling two perl modules from java in seperate threads(JVM CRASHES)
Dear Friends,
I have one severe problem regarding calling perl modules from java
I had to call two perl modules simultaneously (i.e.) from two threads,,, but jvm crashes when one of the perl calls is exiting earlier
I am unable to spot out why ....
For calling perl from java ...., We are first calling C code from java using JNI and then Perl code from C
All works fine if we call only one perl call at a time.... If we call them in a synchronized manner the JVM is not crashing .... But we don't want blocking..
The following is the code snippet
<JAVA FILE>
class Sample
static {
System.loadLibrary("xyz"); // Here xyz is the library file generated by compiling c code
public native void call_PrintList();
public native void call_PrintListNew();
Sample()
new Thread1(this).start();
public static void main(String args[])
System.out.println("In the main Method");
new Sample().call_PrintList();
class Thread1 extends Thread
Sample sample;
Thread1(Sample sam)
sample=sam;
public void run()
sample.call_PrintListNew();
}<C FILE>
#include <EXTERN.h>
#include <perl.h>
static PerlInterpreter *my_perl;
static char * words[] = {"alpha", "beta", "gamma", "delta", NULL } ;
static void
call_PrintList(){
printf("\nIn the Call method of string.c\n");
char *wor[] = {"hello", "sudha", NULL } ;
char *my_argv[] = { "", "string.pl" };
PERL_SYS_INIT3(&argc,&argv,&env);
my_perl = perl_alloc();
PL_perl_destruct_level = 1; //// We have mentioned this also and tried removing destruct call
perl_construct( my_perl );
perl_parse(my_perl, NULL, 2, my_argv, (char**)NULL);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_run(my_perl);
dSP ;
perl_call_argv("PrintList", G_DISCARD, wor) ;
PL_perl_destruct_level = 1;
// perl_destruct(my_perl);
// perl_free(my_perl);
// PERL_SYS_TERM();
static void
call_PrintListNew(){
printf("In the new call method\n");
char *wor[] = {"Hiiiiiiiiiiiiiii", "Satyam123333", NULL } ;
char *my_argv[] = { "", "string.pl" };
PERL_SYS_INIT3(&argc,&argv,&env);
my_perl = perl_alloc();
PL_perl_destruct_level = 1;
perl_construct( my_perl );
perl_parse(my_perl, NULL, 2, my_argv, (char**)NULL);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_run(my_perl);
dSP ;
perl_call_argv("PrintListNew", G_DISCARD, wor) ;
PL_perl_destruct_level = 1;
// perl_destruct(my_perl);
// perl_free(my_perl);
// PERL_SYS_TERM();
void callNew()
call_PrintListNew();
void call ( )
call_PrintList();
//char *wor[] = {"hello","sudha",NULL};
/* char *my_argv[] = { "", "string.pl" };
PERL_SYS_INIT3(&argc,&argv,&env);
my_perl = perl_alloc();
perl_construct( my_perl );
perl_parse(my_perl, NULL, 2, my_argv, (char**)NULL);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_run(my_perl);*/
// call_PrintList(); /*** Compute 3 ** 4 ***/
/* perl_destruct(my_perl);
perl_free(my_perl);
PERL_SYS_TERM();*/
}And Finally the perl code
sub PrintList
my(@list) = @_ ;
foreach (@list) { print "$_\n" }
sub PrintListNew
my(@list) = @_ ;
foreach (@list) { print "$_\n" }
}Please help me in this regardDear Friends,
I have one severe problem regarding calling perl modules from java
I had to call two perl modules simultaneously (i.e.) from two threads,,, but jvm crashes when one of the perl calls is exiting earlier
I am unable to spot out why ....
For calling perl from java ...., We are first calling C code from java using JNI and then Perl code from C
All works fine if we call only one perl call at a time.... If we call them in a synchronized manner the JVM is not crashing .... But we don't want blocking..
The following is the code snippet
<JAVA FILE>
class Sample
static {
System.loadLibrary("xyz"); // Here xyz is the library file generated by compiling c code
public native void call_PrintList();
public native void call_PrintListNew();
Sample()
new Thread1(this).start();
public static void main(String args[])
System.out.println("In the main Method");
new Sample().call_PrintList();
class Thread1 extends Thread
Sample sample;
Thread1(Sample sam)
sample=sam;
public void run()
sample.call_PrintListNew();
}<C FILE>
#include <EXTERN.h>
#include <perl.h>
static PerlInterpreter *my_perl;
static char * words[] = {"alpha", "beta", "gamma", "delta", NULL } ;
static void
call_PrintList(){
printf("\nIn the Call method of string.c\n");
char *wor[] = {"hello", "sudha", NULL } ;
char *my_argv[] = { "", "string.pl" };
PERL_SYS_INIT3(&argc,&argv,&env);
my_perl = perl_alloc();
PL_perl_destruct_level = 1; //// We have mentioned this also and tried removing destruct call
perl_construct( my_perl );
perl_parse(my_perl, NULL, 2, my_argv, (char**)NULL);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_run(my_perl);
dSP ;
perl_call_argv("PrintList", G_DISCARD, wor) ;
PL_perl_destruct_level = 1;
// perl_destruct(my_perl);
// perl_free(my_perl);
// PERL_SYS_TERM();
static void
call_PrintListNew(){
printf("In the new call method\n");
char *wor[] = {"Hiiiiiiiiiiiiiii", "Satyam123333", NULL } ;
char *my_argv[] = { "", "string.pl" };
PERL_SYS_INIT3(&argc,&argv,&env);
my_perl = perl_alloc();
PL_perl_destruct_level = 1;
perl_construct( my_perl );
perl_parse(my_perl, NULL, 2, my_argv, (char**)NULL);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_run(my_perl);
dSP ;
perl_call_argv("PrintListNew", G_DISCARD, wor) ;
PL_perl_destruct_level = 1;
// perl_destruct(my_perl);
// perl_free(my_perl);
// PERL_SYS_TERM();
void callNew()
call_PrintListNew();
void call ( )
call_PrintList();
//char *wor[] = {"hello","sudha",NULL};
/* char *my_argv[] = { "", "string.pl" };
PERL_SYS_INIT3(&argc,&argv,&env);
my_perl = perl_alloc();
perl_construct( my_perl );
perl_parse(my_perl, NULL, 2, my_argv, (char**)NULL);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_run(my_perl);*/
// call_PrintList(); /*** Compute 3 ** 4 ***/
/* perl_destruct(my_perl);
perl_free(my_perl);
PERL_SYS_TERM();*/
}And Finally the perl code
sub PrintList
my(@list) = @_ ;
foreach (@list) { print "$_\n" }
sub PrintListNew
my(@list) = @_ ;
foreach (@list) { print "$_\n" }
}Please help me in this regard -
CNTL_ERROR while calling a function module from Java webdynpro
I am calling a RFC function module from javawebdynpro app
which inturn calls a function module performing BDC on CAPP transaction. When I run this from SE37 of the same system or a different system everything works fine. But when called from Java webdynpro app, it raises a CNTL_ERROR exception and creates a short dump.
Any help on this is highly appreciatedGood catch, BI Learner. This was exactly it: when assigning the values from SOURCEFIELDS directly to the import/export parameters, you have to make sure that the types are EXACTLY the same, otherwise it will not work (the routine stops with an error when calling the FM, but there is no dump).
Therefore, to solve my problem, I created the declarations precisely as expected by the FM and assigned the values to these fields:
DATA:
SOURCEVAL TYPE /BIC/OIINVQTY,
SOURCEUOM TYPE /BIC/OIUSUOM,
USITM TYPE /BIC/OIUSITM,
TARGETUOM TYPE /BIC/OIUSUOM,
CONVERTED_COST TYPE /BIC/OIINVQTY.
DATA PRODUCTION_UOM TYPE /BIC/OIUSUOM.
" get the Production UOM
SELECT SINGLE I~/BIC/USPRDUOM
FROM /BIC/PUSITM AS I
INTO PRODUCTION_UOM
WHERE I~/BIC/USITM = SOURCE_FIELDS-/BIC/USITM AND I~OBJVERS = 'A'.
IF ( SY-SUBRC = 4 ). " no records found
"RAISE PARTNO_NOT_FOUND.
RAISE EXCEPTION TYPE CX_RSROUT_SKIP_RECORD.
ENDIF.
" load the parameters
SOURCEVAL = SOURCE_FIELDS-/BIC/USFRZMFC.
SOURCEUOM = SOURCE_FIELDS-BASE_UOM.
USITM = SOURCE_FIELDS-/BIC/USITM.
" then you can call the FM
CALL FUNCTION 'Z_CA_CONVERT_US_COST'
EXPORTING
PSOURCEVAL = SOURCEVAL
PSOURCEUOM = SOURCEUOM
PUSITM = USITM
PTARGETUOM = PRODUCTION_UOM
IMPORTING
PTARGETVAL = CONVERTED_COST
EXCEPTIONS
CONVERSION_NOT_MAINTAINED = 1
PARTNO_NOT_FOUND = 2
OTHERS = 3.
" ... [do the rest]
Thanks for your help,
Dennis -
Accessing XI Tables (ABAP Stack) from Java code
Hi,
IS it possible to access tables like SXMSPMAST, SXMSPEMAS directly from Java code without the use of any RFC or BAPI in between?
Cheers,
EarlenceI think it is technically possible, as you can get access to the JDBC Connector service using J2EE's JNDI feature ... Then you can use the internal DB datasource to read data from tables (read ONLY, cuz I'm not sure it is a good idea to update data "outside" the box, and reading can also have potiential perf or stability issue) ... Some (better) methods can also exist !
Chris
Edited by: Christophe PFERTZEL on Jan 15, 2010 3:07 PM -
How to access database file on CDROM from Java Programe??
Hello friends,
I am making online exam application.
I want my question database to be reside on CDROM.
but i am not getting any idea how to make DSN or static path that resolute the path that i have mentioned for CDROM.
basically i want to know how to access CDROM from Java Programe????
Thanks in advance
Navik PathakOnce you mounted the CDROM (something maybe as /media/cdrom) as a file system (or assigned a drive letter to it like D: or F: or whatever), the files are accessible normally.
-
Need to access/connect Remote Unix server from Java
Please any one give me a direct solution for connecting a remote Unix server through telnet connection from java application. Thanks in advance..
If I run the below program codes, in the console it is asking to enter username and password in manual but I need to give it automatically.
The highlighted "root" is entered by the user manually using keyboard.
Expected:
I mean the username, password and some action is set to be automatic, so that it should not ask the user to enter the input from keyboard.
import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.commons.net.telnet.TelnetClient;
import org.apache.commons.net.telnet.TelnetNotificationHandler;
import org.apache.commons.net.telnet.SimpleOptionHandler;
import org.apache.commons.net.telnet.EchoOptionHandler;
import org.apache.commons.net.telnet.TerminalTypeOptionHandler;
import org.apache.commons.net.telnet.SuppressGAOptionHandler;
import org.apache.commons.net.telnet.InvalidTelnetOptionException;
import java.util.StringTokenizer;
* This is a simple example of use of TelnetClient.
* An external option handler (SimpleTelnetOptionHandler) is used.
* Initial configuration requested by TelnetClient will be:
* WILL ECHO, WILL SUPPR
* ESS-GA, DO SUPPRESS-GA.
* VT100 terminal type will be subnegotiated.
* <p>
* Also, use of the sendAYT(), getLocalOptionState(), getRemoteOptionState()
* is demonstrated.
* When connected, type AYT to send an AYT command to the server and see
* the result.
* Type OPT to see a report of the state of the first 25 options.
* <p>
* @author Bruno D'Avanzo
public class UnixConnect implements Runnable, TelnetNotificationHandler
static TelnetClient tc = null;
* Main for the TelnetClientExample.
public static void main(String[] args) throws IOException
FileOutputStream fout = null;
/*if(args.length < 1)
System.err.println("Usage: TelnetClientExample1 <remote-ip> [<remote-port>]");
System.exit(1);
String remoteip = "192.168.20.11";
int remoteport;
if (args.length > 1)
remoteport = (new Integer(args[1])).intValue();
else
remoteport = 23;
try
fout = new FileOutputStream ("spy.log", true);
catch (Exception e)
System.err.println(
"Exception while opening the spy file: "
+ e.getMessage());
tc = new TelnetClient();
TerminalTypeOptionHandler ttopt = new TerminalTypeOptionHandler("VT200", false, false, true, false);
EchoOptionHandler echoopt = new EchoOptionHandler(true, false, true, false);
SuppressGAOptionHandler gaopt = new SuppressGAOptionHandler(true, true, true, true);
try
tc.addOptionHandler(ttopt);
tc.addOptionHandler(echoopt);
tc.addOptionHandler(gaopt);
catch (InvalidTelnetOptionException e)
System.err.println("Error registering option handlers: " + e.getMessage());
while (true)
boolean end_loop = false;
try
tc.connect(remoteip, remoteport);
Thread reader = new Thread (new UnixConnect());
tc.registerNotifHandler(new UnixConnect());
reader.start();
OutputStream outstr = tc.getOutputStream();
byte[] buff = new byte[1024];
int ret_read = 0;
do
try
ret_read = System.in.read(buff);
if(ret_read > 0)
outstr.write(buff, 0 , ret_read);
outstr.flush();
catch (Exception e)
System.err.println("Exception while reading keyboard:" + e.getMessage());
end_loop = true;
while((ret_read > 0) && (end_loop == false));
try
tc.disconnect();
catch (Exception e)
System.err.println("Exception while connecting:" + e.getMessage());
catch (Exception e)
System.err.println("Exception while connecting:" + e.getMessage());
System.exit(1);
* Callback method called when TelnetClient receives an option
* negotiation command.
* <p>
* @param negotiation_code - type of negotiation command received
* (RECEIVED_DO, RECEIVED_DONT, RECEIVED_WILL, RECEIVED_WONT)
* <p>
* @param option_code - code of the option negotiated
* <p>
public void receivedNegotiation(int negotiation_code, int option_code)
String command = null;
if(negotiation_code == TelnetNotificationHandler.RECEIVED_DO)
command = "DO";
else if(negotiation_code == TelnetNotificationHandler.RECEIVED_DONT)
command = "DONT";
else if(negotiation_code == TelnetNotificationHandler.RECEIVED_WILL)
command = "WILL";
else if(negotiation_code == TelnetNotificationHandler.RECEIVED_WONT)
command = "WONT";
System.out.println("Received " + command + " for option code " + option_code);
* Reader thread.
* Reads lines from the TelnetClient and echoes them
* on the screen.
public void run()
InputStream instr = tc.getInputStream();
try
byte[] buff = new byte[1024];
int ret_read = 0;
do
ret_read = instr.read(buff);
if(ret_read > 0)
System.out.print(new String(buff, 0, ret_read));
while (ret_read >= 0);
catch (Exception e)
System.err.println("Exception while reading socket:" + e.getMessage());
try
tc.disconnect();
catch (Exception e)
System.err.println("Exception while closing telnet:" + e.getMessage()); -
Calling New Function Module from JAVA ISA b2b
I need to call a new function module which accepts some parameters as input and
returns some result parameters back as output.
These returned value needs to be displayed on the JSP pages of ISA B2B applications.
Can someone please guide me and provide code snippet on how to do this?
Thanks in advance.
Points will be awarded for all relevant and helpful answers.Stride,
I did this on CRM ISA 4.0... I used the dev and extension guide as a basis - I think the ISA 5.0 guide has the examples and tutorials in a separate document that can also be downloaded from service.sap.com.
Heres some info on how to do it although I can't guarantee this is the full solution or that it will work the same for ISA 5.0, and I will probably forget a lot of stuff as its been a few years since I did it! I also cant guarantee it is the correct way to do it but it worked! Basically, we built a link into the order overview page to display urls to order tracking websites using an RFC on the backend CRM system. Hope it helps anyway.
1. Create RFC enabled function module in backend.
2. Edit file backendobject-config.xml in folder project_root\b2b_z\WEB-INF\xcm\customer\modification:-
[code] <backendobject
xmlns:isa="com.sapmarkets.isa.core.config"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xml="http://www.w3.org/XML/1998/namespace">
<configs>
<!-- customer changes in backendobject-config should be done here by extending/overwriting the base configuration-->
<xi:include
href="$
Template for backend object in customer projects
Concrete implementation of a backend object
This implemenation demonstrates how a backend object
is used to communicate with the CRM system
@see com.ao.isa.backend.boi.Z_AOFuncBackend#getOrderDeliveryTrackingData(java.lang.String)
Interface used to communicate with a backend object
The purpose of this interface is to hide backend implementation details
from the business objects
Returns a vector of Z_OrderDeliverTracking objects containing data to link
to external delivery tracking websites
@param orderNo The sales order document number
@return A vector of order tracking objects
@return
@return
@return
@return
@return
@param string
@param string
@param string
@param string
@param string
/modification/backendobject-config.xml#xpointer(backendobject/configs/*)"/>
<!-- This is an example customer extension. A new Backend Object is registered in the framework using XCM extension mechanism. -->
<!-- If you write customer extensions you should register your backend objects in the same way. -->
<!-- Please make sure that you use the correct base configuration (e.g. crmdefault for CRM or r3default, r3pidefault for R/3) -->
<config
isa:extends="../config[@id='crmdefault']">
<businessObject
type="Z_AO_Custom"
name="Z_AO_Custom"
className="com.ao.isa.backend.crm.Z_AOFuncCRM"
connectionFactoryName="JCO"
defaultConnectionName="ISAStateless"/>
</config>
</configs>
</backendobject>
[/code]
File com.ao.isa.backend.crm.Z_AOFuncCRM.java looks like this :-
[code] package com.ao.isa.backend.crm;
//jco imports
import java.util.Vector;
import com.ao.isa.backend.boi.Z_AOFuncBackend;
import com.ao.isa.businessobject.order.Z_OrderDeliveryTrackingItem;
import com.sap.mw.jco.JCO;
import com.sap.mw.jco.JCO.ParameterList;
import com.sapmarkets.isa.core.eai.BackendException;
import com.sapmarkets.isa.core.eai.sp.jco.BackendBusinessObjectBaseSAP;
import com.sapmarkets.isa.core.logging.IsaLocation;
public class Z_AOFuncCRM
extends BackendBusinessObjectBaseSAP
implements Z_AOFuncBackend
// initialize logging
private static IsaLocation log =
IsaLocation.getInstance(Z_AOFuncCRM.class.getName());
/* (non-Javadoc)
public Vector getOrderDeliveryTrackingData(String orderNo)
Vector urlData = new Vector();
try
// get Java representation of function module
JCO.Function func =
getDefaultJCoConnection().getJCoFunction(
"Z_BAPI_CRM_ORDER_TRACKING_URLS");
// provide export parameters
ParameterList params = func.getImportParameterList();
params.setValue(orderNo, "ORDER_NO");
func.setExportParameterList(params);
// execute function
getDefaultJCoConnection().execute(func);
// get result table
JCO.Table table =
func.getTableParameterList().getTable("TRACKING_DATA");
int numRows = table.getNumRows();
for (int i = 0; i < numRows; i++)
// get row
table.setRow(i);
// create a new Z_orderdeliverytracking object
Z_OrderDeliveryTrackingItem trackItem =
new Z_OrderDeliveryTrackingItem(
table.getString(0),
table.getString(1),
table.getString(2),
table.getString(3),
table.getString(4));
urlData.addElement(trackItem);
trackItem = new Z_OrderDeliveryTrackingItem();
return urlData;
catch (BackendException bex)
// The following key has to be added to WEB-INF/classes/ISAResources.properties
// in order to see the exception correctly
log.config("ao.b2b.order.error.getOrderTrackingURLs", bex);
return null;
[/code]
And file com.ao.isa.backend.boi.Z_AOFuncBackend.java looks like this:-
[code] package com.ao.isa.backend.boi;
//package java.ao.com.ao.isa.backend.boi;
import java.util.Vector;
import com.sapmarkets.isa.core.eai.sp.jco.JCoConnectionEventListener;
public interface Z_AOFuncBackend
public Vector getOrderDeliveryTrackingData(String orderNo);
[/code]
Whilst file com.ao.isa.businessobject.order.Z_OrderDeliveryTrackingItem.java looks like this:-
[code]
package com.ao.isa.businessobject.order;
// Referenced classes of package com.sapmarkets.isa.businessobject.order:
// PaymentType
public class Z_OrderDeliveryTrackingItem // extends SalesDocument implements OrderData
private String deliveryDocNo;
private String goodsIssuedDate;
private String consignmentNo;
private String status;
private String url;
public Z_OrderDeliveryTrackingItem()
public Z_OrderDeliveryTrackingItem(
String delDocNo,
String GIDate,
String consNo,
String status,
String url)
this.setDeliveryDocNo(delDocNo);
this.setGoodsIssuedDate(GIDate);
this.setConsignmentNo(consNo);
this.setStatus(status);
this.setUrl(url);
public String getConsignmentNo()
return consignmentNo;
public String getDeliveryDocNo()
return deliveryDocNo;
public String getGoodsIssuedDate()
return goodsIssuedDate;
public String getStatus()
return status;
public String getUrl()
return url;
public void setConsignmentNo(String string)
consignmentNo = string;
public void setDeliveryDocNo(String string)
deliveryDocNo = string;
public void setGoodsIssuedDate(String string)
goodsIssuedDate = string;
public void setStatus(String string)
status = string;
public void setUrl(String string)
url = string;
[/code]
3. Edit file bom-config.xml in folder project_root\b2b_z\WEB-INF\xcm\customer\modification :-
[code] <BusinessObjectManagers
xmlns:isa="com.sapmarkets.isa.core.config"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xml="http://www.w3.org/XML/1998/namespace">
<!-- customer changes in bom-config should be done here by extending/overwriting the base configuration-->
<xi:include
href="$/modification/bom-config.xml#xpointer(BusinessObjectManagers/*)"/>
<!-- This is an example Business Object Manager. It can act as template for customer written Business Object Managers -->
<BusinessObjectManager
name="Z_AO-BOM"
className="com.ao.isa.businessobject.Z_AOBusinessObjectManager"
/>
</BusinessObjectManagers>
[/code]
File com.ao.isa.businessobject.Z_AOBusinessObjectManager.java looks like this:-
[code] package com.ao.isa.businessobject;
// Internet Sales imports
import com.sapmarkets.isa.core.businessobject.management.BOManager;
import com.sapmarkets.isa.core.businessobject.management.DefaultBusinessObjectManager;
import com.sapmarkets.isa.core.businessobject.BackendAware;
Template for a custom BusinessObjectManager in customer projects
public class Z_AOBusinessObjectManager
extends DefaultBusinessObjectManager
implements BOManager, BackendAware {
// key used for the backend object in customer version of backendobject-config.xml
public static final String CUSTOM_BOM = "Z_AO-BOM";
// reference to backend object
private Z_AOFunc mCustomBasket;
constructor
public Z_AOBusinessObjectManager() {
Method is called by the framework before the session is invalidated.
The implemenation of this method should free any allocated resources
public void release() {
Returns custom business object
public Z_AOFunc getCustomBasket() {
if (mCustomBasket == null) {
mCustomBasket = new Z_AOFunc();
assignBackendObjectManager(mCustomBasket);
return mCustomBasket;
[/code]
And uses file com.ao.isa.businessobject.Z_AOFunc.java which looks like this:-
[code]
package com.ao.isa.businessobject;
// Internet Sales imports
import com.sapmarkets.isa.core.businessobject.BOBase;
import com.sapmarkets.isa.core.businessobject.BackendAware;
import com.sapmarkets.isa.core.eai.BackendObjectManager;
import com.sapmarkets.isa.core.eai.BackendException;
import com.sapmarkets.isa.core.logging.IsaLocation;
// custom imports
import com.ao.isa.backend.boi.Z_AOFuncBackend;
import java.util.Vector;
Template for business object in customer projects
public class Z_AOFunc extends BOBase implements BackendAware
// initialize logging
private static IsaLocation log =
IsaLocation.getInstance(Z_AOFunc.class.getName());
private BackendObjectManager bem;
private Z_AOFuncBackend backendAOBasket;
Returns a reference to the backend object. The backend object
is instantiated by the framework.
@return a reference to the backend object
private Z_AOFuncBackend getCustomBasketBackend()
if (backendAOBasket == null)
//create new backend object
try
backendAOBasket =
(Z_AOFuncBackend) bem.createBackendBusinessObject(
"Z_AO_Custom");
// the backend object is registered in customer version
// of backendobject-config.xml using the 'Z_AO_Custom' type
catch (BackendException bex)
// The following key has to be added to WEB-INF/classes/ISAResources.properties
// in order to see the exception correctly
log.config("ao.b2b.order.error.getOrderTrackingURLs", bex);
return backendAOBasket;
This method is needed when a business object has a corresponding
backend object.
public void setBackendObjectManager(BackendObjectManager bem)
this.bem = bem;
Returns a vector of url links for tracking
@return vector of urls
public Vector getOrderDeliveryTrackingData(String orderNo)
// the call is delegated to the CRM aware backend object
return getCustomBasketBackend().getOrderDeliveryTrackingData(orderNo);
[/code]
4. Edit file config.xml in folder project_root\b2b_z\WEB-INF to add custom actions (the section below is just the custom stuff added at the end of the file the Z_orderTracking is the relevant one) :-
[code] <!-- Begin of custom AO action definitions -->
<action path="/b2b/Z_orderTracking" type="com.ao.isa.order.actions.Z_OrderTrackingAction">
<forward name="success" path="/b2b/order/Z_orderTracking.jsp"/>
</action>
<action path="/catalog/Z_displaySVGPage" type="com.ao.isa.catalog.actions.Z_SVGPageAction">
<forward name="success" path="/catalog/Z_SVG_fs.jsp"/>
</action> [/code]
Which points at Java file com.ao.isa.order.actions.Z_OrderTrackingAction.java which looks like this :-
[code] package com.ao.isa.order.actions;
// internet sales imports
import com.sapmarkets.isa.core.BaseAction;
import com.sapmarkets.isa.core.UserSessionData;
// struts imports
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
// servlet imports
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
// Internet Sales imports
import com.ao.isa.businessobject.Z_AOBusinessObjectManager;
import java.util.Vector;
This action acts as a template for customer extensions
public class Z_OrderTrackingAction extends BaseAction
This method is called by the ISA Framework when the
action is executed
public ActionForward doPerform(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
// get user session data object
UserSessionData userSessionData =
UserSessionData.getUserSessionData(request.getSession());
// gettting custom BOM
Z_AOBusinessObjectManager myBOM =
(Z_AOBusinessObjectManager) userSessionData.getBOM(
Z_AOBusinessObjectManager.CUSTOM_BOM);
// get the order number being processed
String orderDocNumber = request.getParameter("orderNo");
// pass the order number back to the page
request.setAttribute("orderNo", orderDocNumber);
if (orderDocNumber != null)
// Get a vector of delivery tracking objects from lower layers (Business Object layer =>
// Business Logic Service Layer)
Vector trackingTable =
myBOM.getCustomBasket().getOrderDeliveryTrackingData(
orderDocNumber);
String error = "";
if (trackingTable != null)
if (trackingTable.size() == 0)
error = "true";
else
error = "false";
else
error = "true";
request.setAttribute("errorMessage", error);
request.setAttribute("trackingTable", trackingTable);
return mapping.findForward("success");
[/code]
5. I added the call to the function module for page orderstatusdetail.jsp in folder project_root\b2b_z\b2b\order to display a custom page Z_orderTracking.jsp in the same folder. To do this I added a link into the HTML to call a JavaScript function that passed the current order number to the /b2b/Z_orderTracking.do actionhandler mapped in the config.xml file.
So, in summary! Create an RFC; define business managers for it in the XML files; create a new Strut action and supporting Java class; create all the Java class for the managers.
I hope this makes some sense!
Gareth. -
Accessing components in a module from my applciation
Hey all, I have this simple module:
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" implements="fo_ImoduleInterface">
<mx:Script>
<![CDATA[
import mx.controls.MenuBar;
public function test():String {
return "Test String";
public function getMenuBar():Array {
return myMenuBar.menus;
]]>
</mx:Script>
<mx:ApplicationControlBar dock="true" paddingTop="0"
paddingBottom="0">
<mx:MenuBar id="myMenuBar" labelField="@label">
<mx:XMLList>
<menuitem label="menu" >
<menuitem label="sub 1" />
<menuitem label="sub 1" />
</menuitem>
</mx:XMLList>
</mx:MenuBar>
</mx:ApplicationControlBar>
</mx:Module>
Now I want to access getMenuBar from my application to create
a 'general' menu in my main application (much like what OSX does).
I can successfully access the function test and get my test
string back, so I know my module is loaded (I can see it on the
screen to) but trying to get access to the component always fails.
What is the proper solution to let my main application access
a component in a module?
Riesquote:
Originally posted by:
Sreenivas R
The way I would do it would be to create a interface and add
necessary APIs to it. Make the module implement the interface.
In the main app convert the module instance to the interface
and access things.
Isn't this what the module does???
see here : <mx:Module .....
implements="fo_ImoduleInterface">
fo_ImoduleInterface implements to correct function aswell,
it's created like this:
package
import flash.events.IEventDispatcher;
public interface fo_ImoduleInterface extends
IEventDispatcher {
function getMenuBar():Array; -
Access to JSTL localization data from java/javascript
The core problem is very basic - I need to have access to same localization data both from JSP and Javascript code.
I successfully localized JSP data using
fmt:setLocale and fmt:message that read from messages_xx.properties files.
I want to have access to same locale strings (messages_xx.properties) data from javascript code. I am going to use code like -
<script language="JavaScript" type="text/javascript">
var LocalizedStrings = {
<%
// Here we obtain strings from .properties files
// maybe using something like
// some_bundle = some_context.getBundle("???")
out.println("key1: \"String 1\"");
// printing out data from our bundle
%>
Could anybody point me how can I obtain the needed data, or maybe I have used the wrong library for achieving my purpose? I didn't find any such example for current libraryAnd finally I found an evident solution, that didn't come into my mind, cause I am new to java resources -
<script language="JavaScript" type="text/javascript">
var LocalizedStrings = {
<%
ResourceBundle mybundle = ResourceBundle.getBundle("Messages",new Locale("en"));
Enumeration en = mybundle.getKeys();
while(en.hasMoreElements()){
String key = (String) en.nextElement();
String value = mybundle.getString(key);
out.print(key);out.print(":");out.println("'"+value+"',");
%>
</script>
where XX is the set locale like "en" -
Calling RFC Function module from JAVA
Hi All,
We have created a RFC Function Module for Billing Plan tab in Sales order (BDC). The function Module contains BDC. When we are running the same function module in SAP it is working fine. But when the FM is called in Java , it is allowing only maximum of 5 entries , when we trying to insert at 6th position in billing plan tab, we are getting an error.
Can any one help on this.
Points will be rewarded for helpful answers.
Thanks & Regards,
Kiran II think the problem is because of the number of lines displayed on the screen in the BDC session in the Billing Plan.
You might have to add the page down logic to your BDC program. -
Accessing variable of a datatable from Java Code
Hello,
I am trying to present a list of objects with a jsf datatable. However, each object needs to be rendered differently, so, I am including another JSP fragment, depending on the datatype.
JSP code follows:
<h:dataTable value="#{pc_ConsultaCliente.dadosCliente.historicoCliente}" var="varhistoricoCliente" styleClass="dataTable" >
<h:column>
<f:facet name="header">
<h:outputText styleClass="outputText" value="HistoricoCliente"/>
</f:facet>
<%
String toinclude="";
try {
toinclude=FragmentsHandler.getFragmentForBinding(
javax.faces.context.FacesContext.getCurrentInstance(),
"#{varhistoricoCliente}" ,
Contacto.class);
} catch (Exception ex) { throw new RuntimeException(ex); }
%>
<h:panelGroup>
<jsp:include page="<%= toinclude %>"/>
</h:panelGroup>
</h:column></h:dataTable>
The problem is, when I try to access the varhistoricoCliente from the FragmentsHandler class, I simply can't reach it (I keep on getting null):
In it, I use (I get fc as a Faces Context from the JSP):
public static String getFragmentForBinding(FacesContext fc, String valueBinding, Class defaultClass) throws IOException {
Object o=fc.getApplication().createValueBinding(valueBinding).getValue(fc), defaultClass);
//After this, o just gets null
Is this this right? How can I access the var from the datatable component?
Many thanks!I'm no JSF expert but I'm not sure your approach can work at all.
I would simplify everything by entering a different tag for each different type of object, and enabling the right one with the "rendered" attribute.
Something like:
<table>
<column>
<tag1 rendered="#{myResult.isType1}">...
<tag2 rendered="#{myResult.isType2}">...
... -
Accessing Windows dial-up connections from java
Hello,
Anyone has any idea how to go about accessing Windows existing dialup connections and instruct windows to dial-up to internet using the selected connection profile?1. why are you using java for a Windows only program?
2. why are you attempting to do something windows specific for
a non-os specific language
WOW!
I've been using java for applications I only run on Windows, Didn't know this is frowned own. You gotta be kidding me right? Do you really think all java programs are written in mind for it be be platform independant? I've been programming in java for around 3 years and we only run it on Windows systems. Non-os specific is nice, but everyone that programs using java isn't looking for that feature. If everyone else out there is only using java because it's platform independance please correct me, I'll be very surprised. One more question, just becaus he is possibly only going to use for a windows program, he should go learn another language? Sorry this post really surprised me. -
Executing perl/c modules from java appln
Hi,
I need to integrate some modules written in Perl/C/C++ , which take a filename as input and stores the ouput in a file. I need to provide the interface in Java. Plz let me know how to execute perl or c++ file with input parameters.
Thanks in advanceRuntime.exec()
-
How to call a perl module from Java program.
Hi,
I create a simple java program as follows
class test{
public static void main(String args[])
{try {
Runtime r = Runtime.getRuntime();
r.exec("perl test.pl");
catch(Exception e)
{e.printStackTrace();}
and test.pl is located in the same directory as the java program. The program compiles but with no return as I execute it. I am not sure what is wrong.
Thanks,I think the wrong line is here; r.exec("perl test.pl");
Usually the JVM needs the full path.If the path for either the executable or the script was wrong then, given the code posted, it would not hang.
>
To automatticaly get the path (if the file is in the
class path) use
System.getProperty("java.class.path")
That gets paths(plural).
Try this:
r.exec("perl " +
System.getProperty("java.class.path") + "\test.pl");I am rather certain that that won't work on any standard operating system. -
Access address book of yahoo from Java Progam
I am working on an application for which I need help.
The application retrieves the contents of 'address book' when provided with login information of yahoo or any other email account. Can somebody let me know the way to do it??
I believe that for different email service providers, the method to access the address-book would be different. Can anybody leads to any of the service providers??
Thanksaneez_backer wrote:
The application retrieves the contents of 'address book' when provided with login information of yahoo or any other email account. Can somebody let me know the way to do it??
Yahoo might...
I believe that for different email service providers, the method to access the address-book would be different. Can anybody leads to any of the service providers??
It likely would be, if it's supported at all. Ask the support department of your service provider.
Maybe you are looking for
-
Error while excise invoice creation thru J1IJ
Dear All, Scenario: Stock transfer from Excise depo to other plant. Problem : Excise Invoice is not getting Generate in Transation J1IJ. i am getting following error "Excise invoice selection not complete for the item 000010" Also Please tell me the
-
I need help this is getting extremely frustrating.
-
Hard drive crash, want to recover photo's from iPhone.
Hello, Since I've my iPhone, I have no backups of my iPhoto directory. I thought that two places (PC & iPhone) would be enough for a 100% cover. Now the worst happened, my HD bailed on me. Bought a new HD, reinstalled OS X. But when I connected my iP
-
Applying patches to PI 7.0 SP6
Hi Experts I am totally new to this XI technical side so please help me out in a step by step way. Actually we are trying to install XI 7.0 and the initial installation like from the master installation DVD and the exports and all are complete. So th
-
Will I increase my Buffer Cache ?
Oracle 9i Shared Pool 2112 Mb Buffer Cache 1728 Mb Large Pool 32Mb Java Pool 32 Mb Total 3907.358 Mb SGA Max Size 17011.494 Mb PGA Aggregate PGA Target 2450 Mb Current PGA Allocated 3286059 KB Maximum PGA Allocated (since Startup) 3462747 KB Cache Hi