on 03-22-2007 11:23 AM
hi guys,
i am retrieving,updating the data via jco in sap r/3 tables....
ok fine, but i want alert message from sap , if any updation happens in sap table
how can i get but i am using jco.. is it possible? yes means
plz send me steps ....
thanks
tony
Hi Tony
import com.sap.mw.jco.IFunctionTemplate;
import com.sap.mw.jco.JCO;
import com.sap.mw.jco.JCO.ParameterList;
import com.sap.mw.jco.JCO.Table;
/**
* @author Techedge
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class AlertDispatcher
{
private JCO.Repository jcoRepository;
public boolean dispatch_alert(String strClient, String strLogin, String strPassword, String strLanguage, String strHostName, String strSysNo, String strMessage, String strAlrtCategory) throws Exception
{
try
{
JCO.Client jcoConnection = JCO.createClient(strClient, strLogin, strPassword, strLanguage, strHostName, strSysNo);
if (jcoConnection == null)
return false;
jcoConnection.connect();
jcoRepository = new JCO.Repository("ARAsoft", jcoConnection);
if (jcoRepository == null)
return false;
JCO.Function function;
try
{
function = createFunction("SALERT_CREATE");
if (function == null)
return false;
}
catch (Exception e)
{
}
ParameterList impParameters = function.getImportParameterList();
ParameterList tblParameters = function.getTableParameterList();
Table tblContainer = tblParameters.getTable("IT_CONTAINER");
if (tblContainer == null)
return false;
tblContainer.insertRow(1);
tblContainer.setValue("ERROR_DESCRIPTION", "ELEMENT");
tblContainer.setValue(strMessage.length(), "ELEMLENGTH");
tblContainer.setValue("C", "TYPE");
tblContainer.setValue(strMessage, "VALUE");
tblContainer.appendRow();
impParameters.setValue(strAlrtCategory, "IP_CAT");
function.setExportParameterList(impParameters);
function.setTableParameterList(tblParameters);
jcoConnection.execute(function);
jcoConnection.disconnect();
return true;
}
catch (Exception e)
{
}
}// end dispatch_alert
public JCO.Function createFunction(String name)
{
IFunctionTemplate ft = jcoRepository.getFunctionTemplate(name.toUpperCase());
return (ft == null) ? null : ft.getFunction();
}// end createFunction
}// end class
Hope it help
Francesco
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.