Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's a bit confusing, it was dificult to me how to figure this too.</p> <p>All you need is an object of type java.util.Properties to fill the desired fields, but it's up to ou how to fill this object.</p> <p>I dit it through a ValueObject, I can fill this VO from a file, database, web form...</p> <pre><code> JCOProvider jcoProvider = null; SAPVO sap = new SAPVO(); // Value Object Properties properties = new Properties(); if(jcoProvider == null) { // Get SAP config from DB try { sap = SAPDAO.getSAPConfig(); // DAO object that gets conn data from DB } catch (Exception ex) { throw new ConexionSAPException(ex.getMessage()); } // Create new conn jcoProvider = new JCOProvider(); } properties.setProperty(DestinationDataProvider.JCO_ASHOST, sap.getJCO_ASHOST()); properties.setProperty(DestinationDataProvider.JCO_SYSNR, sap.getJCO_SYSNR()); properties.setProperty(DestinationDataProvider.JCO_CLIENT, sap.getJCO_CLIENT()); properties.setProperty(DestinationDataProvider.JCO_USER, sap.getJCO_USER()); properties.setProperty(DestinationDataProvider.JCO_PASSWD, sap.getJCO_PASSWD()); properties.setProperty(DestinationDataProvider.JCO_LANG, sap.getJCO_LANG()); // properties.setProperty(DestinationDataProvider.JCO_TRACE, "10"); try { jcoProvider.changePropertiesForABAP_AS(properties); } catch (Exception e) { throw new ConexionSAPException(e.getMessage()); } </code></pre> <p>The JCOProvider class:</p> <pre><code>import com.sap.conn.jco.ext.DestinationDataEventListener; import com.sap.conn.jco.ext.DestinationDataProvider; import com.sap.conn.jco.ext.Environment; import es.grupotec.ejb.util.ConexionSAPException; import java.util.Properties; public class JCOProvider implements DestinationDataProvider { private String SAP_SERVER = "SAPSERVER"; private DestinationDataEventListener eventListener; private Properties ABAP_AS_properties; public JCOProvider() { } @Override public Properties getDestinationProperties(String name) { if (name.equals(SAP_SERVER) &amp;&amp; ABAP_AS_properties != null) { return ABAP_AS_properties; } else { return null; } // if(ABAP_AS_properties!=null) return ABAP_AS_properties; // else throw new RuntimeException("Destination " + name + " is not available"); } @Override public boolean supportsEvents() { return true; } @Override public void setDestinationDataEventListener(DestinationDataEventListener eventListener) { this.eventListener = eventListener; } public void changePropertiesForABAP_AS(Properties properties) throws ConexionSAPException { try { if (!Environment.isDestinationDataProviderRegistered()) { if (ABAP_AS_properties == null) { ABAP_AS_properties = properties; } Environment.registerDestinationDataProvider(this); } if (properties == null) { if (eventListener != null) { eventListener.deleted(SAP_SERVER); } ABAP_AS_properties = null; } else { ABAP_AS_properties = properties; if (eventListener != null) { eventListener.updated(SAP_SERVER); } } } catch (Exception ex) { throw new ConexionSAPException(ex.getMessage()); } } } </code></pre> <p>Regards</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload