MUNDOSAP

Regresar   MUNDOSAP > DESARROLLO > Otros lenguajes: VB, JAVA
Nombre de Usuario
Contraseña
Home Descargas Registrar FAQ Miembros Calendario Buscar Temas de Hoy Marcar Foros Como Leídos




 
Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Viejo 13/03/07, 22:58:15
maescobarl maescobarl is offline
Member
 
Fecha de Ingreso: abr 2006
Mensajes: 60
Acertijo Java - SAP

Hola a todos,

Pues me pusieron un acertijo....

Tengo que obtener una información de SAP desde JAVA, la bronca es como me conecto a SAP desde JAVA.... el RFC ya lo hice solo me falta la parte de JAVA.
Alguno de ustedes ha hecho algo similar, que me pueda orientar??? podrian mandarme un ejemplo, porfa.

Ahora si estoy angustiado!!!! pues no se que hacer...

Espero sus apreciables comentarios u observaciones.

Gracias y saludos
Responder Con Cita
  #2  
Viejo 27/03/07, 14:05:42
bisonye bisonye is offline
Senior Member
 
Fecha de Ingreso: ago 2006
Mensajes: 635
Si es java puro y duro no se pero podrías intentar hacerlo creando un webservice y llamandolo.

Un saludo
Responder Con Cita
  #3  
Viejo 27/03/07, 22:09:51
Toko Toko is offline
Junior Member
 
Fecha de Ingreso: abr 2006
Localización: Chile
Mensajes: 20
Java - SAP

Mira este es un ejemplo de conexion desde JAva a SAP que baje hace en la red, no recuerdo de donde, pero solo tienes que modificar con los datos de tu sistema

client = JCO.createClient( " ", // SAP client
" ", // userid
" ", // password
" ", // language
" ", // host name
" " ); // system number


codigo de ejemplo:

package busqueda.util;

/**
* Example1.java - call the rfc module 'STFC_CONNECTION' with custom definition
* of function metadata. Please notice, the communication with static
* metadata interface definitions is dangerous. The inconsistencies in the
* interface definitions may cause corrupted data, errors while communication or
* even application crashes. In Example2 you can see, how to avoid these problems.
*
* Property of SAP AG, Walldorf
* (c) Copyright SAP AG, Walldorf, 2000-2003.
* All rights reserved.
*/
import com.sap.mw.jco.*;

/**
* Example1 - start a simple call with static metadata definition
*
* @version 1.0
* @author SAP AG, Walldorf
*/
public class Example1 {

public static void main(String[] argv)
{
JCO.Client client = null;

try {

// Print the version of the underlying JCO library
System.out.println("\n\nVersion of the JCO-library:\n" +
"---------------------------\n" + JCO.getMiddlewareVersion());

// Create a client connection to a dedicated R/3 system
client = JCO.createClient( " ", // SAP client
" ", // userid
" ", // password
" ", // language
" ", // host name
" " ); // system number

// Open the connection
client.connect();

// Get the attributes of the connection and print them

JCO.Attributes attributes = client.getAttributes();
System.out.println("Connection attributes:\n" +
"----------------------\n" + attributes);
boolean is_backend_unicode = attributes.getPartnerCodepage().equals("4102") ||
attributes.getPartnerCodepage().equals("4103");

// Create metadata definition of the input parameter list
JCO.MetaData input_md = new JCO.MetaData("INPUT");
input_md.addInfo("REQUTEXT", JCO.TYPE_CHAR, 255, 255 * (is_backend_unicode? 2 : 1 ),
-1, 0, null, null, 0, null, null);

// Create the input parameter list from the metadata object
JCO.ParameterList input = JCO.createParameterList(input_md);

// Set the first (and only) input parameter
input.setValue("This is my first JCo example.", "REQUTEXT");

// Create metadata definition of the output parameter list
JCO.MetaData output_md = new JCO.MetaData("OUTPUT");

// Specify the parameters types of the function will be returned
output_md.addInfo("ECHOTEXT", JCO.TYPE_CHAR, 255, 255 * (is_backend_unicode? 2 : 1 ),
-1, 0, null, null, 0, null, null);
output_md.addInfo("RESPTEXT", JCO.TYPE_CHAR, 255, 255 * (is_backend_unicode? 2 : 1 ),
-1, 0, null, null, 0, null, null);

// Create the output parameter list from the metadata object
JCO.ParameterList output = JCO.createParameterList(output_md);

// Call the function
client.execute("STFC_CONNECTION", input, output);

// Print the result
System.out.println("The function 'STFC_CONNECTION' returned the following parameters:\n" +
"-----------------------------------------------------------------");
for (int i = 0; i < output.getFieldCount(); i++) {
System.out.println("Name: " + output.getName(i) + " Value: " + output.getString(i));
}//for

// All done
System.out.println("\n\nCongratulations! It worked.");
}
catch (Exception ex) {
System.out.println("Caught an exception: \n" + ex);
}
finally {
// do not forget to close the client connection
if (client != null) client.disconnect();
}
}
}


este ejemplo llama a la Fx: 'STFC_CONNECTION' .


atte
Toko
Responder Con Cita
  #4  
Viejo 02/04/07, 22:53:56
maescobarl maescobarl is offline
Member
 
Fecha de Ingreso: abr 2006
Mensajes: 60
Fantastico, muchisismas gracias, estuve angustiado.

Gracias y saludos
Responder Con Cita
  #5  
Viejo 05/05/08, 22:39:10
lgsantos lgsantos is offline
Junior Member
 
Fecha de Ingreso: may 2008
Mensajes: 1
conexion java con sap

Hola
necesito ayuda, ya que tengo que obtener información de sap, lo unico que es que me dieron una bapi, como realizo el llamado a esa bapi desde java
Responder Con Cita
  #6  
Viejo 06/05/08, 06:57:55
bisonye bisonye is offline
Senior Member
 
Fecha de Ingreso: ago 2006
Mensajes: 635
Tienes un ejemplo completo arriba que ha puesto el compañero Toko.....
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Reglas de Mensajes
no puedes crear nuevos temas
no puedes responder temas
no puedes adjuntar archivos
no puedes editar tus mensajes

El código vB está On
Las caritas están On
Código [IMG] está On
Código HTML está Off
Saltar a Foro


Husos Horarios son GMT. La hora en este momento es 15:35:40.


www.mundosap.com 2006 - Spain
software crm, crm on demand, software call center, crm act, crm solutions, crm gratis, crm web