Updating user table (type document) via api
hi!
i need to update an user table that is of type document.
that table is also used as the client table in an udo.
i have tried the following code, but that of course doesn't work as the table is not a plain table but is of document type:
Dim objUserTable As SAPbobsCOM.UserTable
Set objUserTable = objCom.UserTables.Item("MP_TABLE_LINE")
If objUserTable.GetByKey(objMatrix.Columns.Item("U_MP_BEnt").Cells.Item(lngRow).Specific.Value) Then
objUserTable.UserFields.Fields.Item("U_Qty").Value = _
objUserTable.UserFields.Fields.Item("U_Qty").Value - dblDiff
If Not objUserTable.Update() <> 0 Then
Call objApp.SetStatusBarMessage(objCom.GetLastErrorDescription())
Call objApp.MessageBox(objCom.GetLastErrorDescription())
Else
objMatrix.Columns.Item("U_MP_BQty").Cells.Item(lngRow).Specific.String = _
objMatrix.Columns.Item("11").Cells.Item(lngRow).Specific.String
End If
End If
Set objUserTable = Nothing
then i tried to use a dbdatasource which i would expect to work:
Dim objDataSource As DBDataSource
Set objDataSource = objForm.DataSources.DBDataSources.Item("@MP_TABLE_LINE")
Dim objConditions As New SAPbouiCOM.Conditions
Dim objCond As SAPbouiCOM.Condition
<just setting up conditions here>
Call objDataSource.Query(objConditions)
Call objDataSource.SetValue("U_Qty", 0, objDataSource.GetValue("U_Qty", 0) - dblDiff)
but this only results in an error code "-7006", message:
"Item - The item is not a user defined item"
how can the update be done?
regards,
thomas
Hi Thomas,
U are using UserTabel Obejct , just try to Use UserTabelMD object
i am sending to how to create the User Table,
Hope it will help to
oUTb = mobjCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserTables)
If Not oUTb.GetByKey("SPH_FORMS") Then
oUTb.TableName = "SPH_FORMS"
oUTb.TableDescription = "Activity Forms"
oUTb.TableType = SAPbobsCOM.BoUTBTableType.bott_MasterData
If oUTb.Add <> 0 Then
mobjCompany.GetLastError(lRet, sErrMsg)
Else
oUTb = Nothing
end if
be carefull before using MD object , bcoz at a time only one MD object should be in memory else it will give to Error
Thanks
Ankush Vachher
Similar Messages
-
Opening User defined Fields Form via API
Hi
Is there a posiibility to open those user defined field - forms via API. If yes is it possible to check if it is already open?
TIA
PhileHi,
In your eventhandler, you can use this:
Set oSboForm = Sbo_application.Forms.GetFormByTypeAndCount(-pval.FormType, pval.FormTypeCount)
form and udf-form are linked through a minus sign.
I do not know of a nice way to check if they are anebled. What I'm currently doing is running the above line of code contained in an error handler. The error handler does a sendkeys of control shift u (which enables the udf-form) and displays a message. Problem is after control shift u, screen is not yet updated so your code cannot continue immediatelly. Development knows of this problem, but I never received a promise when this will be fixed.
Hope this helps,
Jacques -
Hi I've created a matrix in a new tab on the Item Master data form. It loads data from a user table called @Test. This table has 2 udf U_Model and U_Engine. The matrix uses a datatable to query the table. Is there a way to update the table? this is my code:
// Adding a Matrix item
oNewItem = oForm.Items.Add( "Matrix1", SAPbouiCOM.BoFormItemTypes.it_MATRIX );
oNewItem.Left = 5;
oNewItem.Width = 400;
oNewItem.Top = 200;
oNewItem.Height = 150;
oNewItem.FromPane = 8;
oNewItem.ToPane = 8;
oMatrix = ( ( SAPbouiCOM.Matrix )( oNewItem.Specific ) );
oColumns = oMatrix.Columns;
// Adding Culomn items to the matrix
oColumn = oColumns.Add( "#", SAPbouiCOM.BoFormItemTypes.it_EDIT );
oColumn.TitleObject.Caption = "#";
oColumn.Width = 30;
oColumn.Editable = false;
oColumn = oColumns.Add("Code", SAPbouiCOM.BoFormItemTypes.it_EDIT);
oColumn.TitleObject.Caption = "Code";
oColumn.Width = 20;
oColumn.Editable = true;
oColumn = oColumns.Add("Name", SAPbouiCOM.BoFormItemTypes.it_EDIT);
oColumn.TitleObject.Caption = "Name";
oColumn.Width = 20;
oColumn.Editable = true;
oColumn = oColumns.Add("Model", SAPbouiCOM.BoFormItemTypes.it_EDIT);
oColumn.TitleObject.Caption = "Model";
oColumn.Width = 20;
oColumn.Editable = true;
// Add a column for Name
oColumn = oColumns.Add( "Engine", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX );
oColumn.TitleObject.Caption = "Engine";
oColumn.Width = 20;
//Add Valid Values
oColumn.ValidValues.Add("10", "");
oColumn.ValidValues.Add("12", "");
oColumn.ValidValues.Add("32", "");
oColumn.ValidValues.Add("42", "");
oColumn.ValidValues.Add("52", "");
oColumn.ValidValues.Add("62", "");
dbDatasource = (oForm.DataSources.DBDataSources.Add("@Test"));
DBTable = (oForm.DataSources.DataTables.Add("MyDataTable"));
oMatrix.SelectionMode = SAPbouiCOM.BoMatrixSelect.ms_Single;
oItem = oForm.Items.Item("5");
oEdit = ((SAPbouiCOM.EditText)(oItem.Specific));
string item = oEdit.Value.ToString();
oForm.DataSources.DataTables.Item( 0 ).ExecuteQuery( "SELECT Code, Name, U_Model, U_Engine from [@Test] where U_ItemCd = '" + item +"' ");
oColumn = oColumns.Item("Code");
oColumn.DataBind.Bind("MyDataTable", "Code");
oColumn = oColumns.Item("Name");
oColumn.DataBind.Bind("MyDataTable", "Name");
oColumn = oColumns.Item( "Model" );
oColumn.DataBind.Bind("MyDataTable", "U_Model");
oColumn = oColumns.Item("Engine");
oColumn.DataBind.Bind("MyDataTable", "U_Engine");
oMatrix.Clear();
oMatrix.AutoResizeColumns();
oMatrix.LoadFromDataSource();Hi Costas,
You can use Matrix.FlushToDataSource() to save the data in the Matrix into the datasource.
But if you want to update the data in the DB, you have to use DI API.
Regards,
Jay. -
Adding & updating user tables with DI
Hi, how to I add & update records of a user defined table with DI? Is there an object for this, or do I just do a DoQuery(insert etc) ?
Thank you.
Jose.Hi José,
In the DI API you can use the UserTable object to add, update or delete records as long as the user table is not part of a UDO.
Example:
// Link to the UDT - Note: table name does not include @ prefix
SAPbobsCOM.UserTable sboTable = (SAPbobsCOM.UserTable)_sboCompany.UserTables.Item("Test2");
// To add a record
sboTable.Code = "12345678"; // must be unique
sboTable.Name = "My New Record";
sboTable.UserFields.Fields.Item("U_MyUDF").Value = "TEST";
if (sboTable.Add() != 0)
_sboApp.SetStatusBarMessage("Record add failed: " + _sboCompany.GetLastErrorDescription(), SAPbouiCOM.BoMessageTime.bmt_Medium, true);
else
_sboApp.SetStatusBarMessage("Record added successfully.", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
// To update a record
if(sboTable.GetByKey("12345678"))
sboTable.UserFields.Fields.Item("U_MyUDF").Value = "UPDATED";
if (sboTable.Update() != 0)
_sboApp.SetStatusBarMessage("Record update failed: " + _sboCompany.GetLastErrorDescription(), SAPbouiCOM.BoMessageTime.bmt_Medium, true);
else
_sboApp.SetStatusBarMessage("Record update successfully.", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
else
_sboApp.SetStatusBarMessage("Record 12345678 not found.", SAPbouiCOM.BoMessageTime.bmt_Medium, true);
Kind Regards,
Owen -
Error updating User Table (ODBC - 2035)
Hello all.
Im having a problem when I try to update an user table @tbldoc and @tbldetail.
"This entry already exist in the following tables 'table' (@tbldoc)"
First time I have this issue was using my UI addon, my form is auto managed... then I try to use the default user object created by SBO, but same error appears when updating.
This issue never show up before, my addon work fine months ago. Now I have this error.
I read that for the documents numbering, SBO 2005 have an option to restore numbering, but in 2007 is missing or doesn't exist.
Can any one tell me how to fix this issue.
Thanks for the help.
Best regards.
GABHello,
I am also facing the similar error message.
I have created an Auto managed form and also within my add-on have provided an option to user to create record in that table(INSERT).
BR
Samir Gandhi
Edited by: Rui Pereira on Dec 23, 2008 4:20 PM -
Hi,
I need some clarification on the following. If i were to call an update in the in the DoQuery(RS.DoQuery("<update statement>")) method am i violating SAP rules? I am basically updating my own user table. I know for sure i cant do that with system tables as business objects are provided for that but can i do it for user defined tables?
Please reply at the earliest.
Regards
Aris.Actually it is because this is for a master data row table.. If you check the thread on Updating master tables that i posted u'l understand what im looking to do.. Thanks for the reply..
Regards
Aris -
Update the table when Document successfull with BDC
Hi,
I am changing the Billing document header and item level using BDC call Transaction. When the document is success fulley saved at that time I have to modify the flag in the table with 'X', when it fails or if it has errors I have to set the Flag as 'F'. Could please any body tell me how can I do this.
Thanks & Regards
VenkatHi,
In the call transaction do the following :
Data : it_msg type standard table of bdcmsgcoll.
CALL TRANSACTION VA01 USING it_bdcdata
MODE 'N'
UPDATE 'A'
MESSAGES INTO it_msg.
READ TABLE it_msg INTO wa_msg WITH KEY msgtyp = 'E'
msgtyp = 'W'.
if sy-subrc eq 0.
update ZTABLE set flag = `F`
where <condition>.
else.
update ZTABLE set flag = `X`
where <condition>.
endif.
Best regards,
Prashant
Message was edited by: Prashant Patil
Message was edited by: Prashant Patil -
Stock update Update ic_whse_inv table is there any API is avaible?
Hi,
I have to update the Item stock at inventory level based on the Plant.
ic_whse_inv in this table, In APPS is there any API is available to update the base table/ suggest me is there any other way to update the stock information at inventory level.
Thanks in advance.
-- Pavan Kalyan --Hi,
Oracle Apps 11i APIs can be found in [Oracle Integration Repository |http://irep.oracle.com/] website. In R12, Oracle Integration Repository is shipped as part of the E-Business Suite (as a responsibility).
Please post your question in [SCM - Process Manufacturing (OPM)|http://forums.oracle.com/forums/forum.jspa?forumID=120] forum, you would probably get a better/faster response there.
Regards,
Hussein -
Avoid users to upload especific document via data transfer DTW
Dear Experts,
Anyone know how to avoid users uploading especific documents via DTW (Data Transfer WorkBench), for example giving them authorization to upload User Defined tables via DTW, but avoiding them to upload Purchase Invoices, due to an Approval template for Purchase Invoices.
Hope you'll be able to help me.
Best Regards,That would be too hard to do even if it is possible.
My suggest is: if you give your user the power for DTW, train them fully. Let them know what they can or can not do.
Thanks,
Gordon -
Hi,
Is it possible to Add combo box in the existing field on User table form through UI API? I want to add combo box in UDT for selecting Item code.
thanks in advance
DenisHi Denis,
The first approach I would try is a formatted search fired when Shift+F2 is clicked. Cheap and easy.
In a user defined form, you could use datasources to get this. But in the default form I don´t think you could do it using datasources. Perhaps I´m wrong.
If you are in 2005, you could try the ChooseFromList object to get what you need. More elegant, but more work.
Hope helps,
Ibai Peñ -
Creating table types for procedures at design time: Where is the "Local Table Type" tab?
Hello,
I want to write a stored procedure (development perspective, repository object) and need to create a table type for the result table.I am working on HANA Studio 1.80.1 and the documentation tells me that I should open the "Local Table Types" tab. However, I do not see where this tab is.
I get an SQLScript tab nothing else. Any hints?
Regards,
AndreasHi ,
Have a look on this discussion:
Table type creation via HS repository / CDS / DDl Source
Regards,
Krishna Tangudu -
Creating a User Table via DI API
Hi all,
I'm using
SAP Business One 2004A (6.70.185) SP: 00 PL: 07
and corresponding SAP Business One DI API 2004
I want to create a user table.
I try to create it this way:
I have two functions
First function to create the table
Private Function AP_AddOn_CreateTable() As Boolean
AP_AddOn_CreateTable = True
Dim oUDT As SAPbobsCOM.UserTablesMD
Dim sErrMsg As String
Dim iErrCode As Integer
Dim iReturn As Integer
oUDT = oDIComp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserTables)
oUDT.TableName = "AP_tbItemCalc"
oUDT.TableDescription = "ItemCalculation"
iReturn = oUDT.Add
If iReturn <> 0 Then
oDIComp.GetLastError(iErrCode, sErrMsg)
Message
AP_AddOn_CreateTable = False
End If
oUDT = Nothing
End Function
This works fine
Then I call a second function to create the user fields
Private Function AP_AddOn_CreateFields() As Boolean
AP_AddOn_CreateFields = False
Dim oUDF As SAPbobsCOM.UserFieldsMD
Dim sErrMsg As String
Dim iErrCode As Integer
Dim iReturn As Integer
oUDF = oDIComp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)
oUDF.TableName = "@AP_tbItemCalc"
'Field1
oUDF.Name = "ItemCode"
oUDF.Description = "ItemCode"
oUDF.Type = SAPbobsCOM.BoFieldTypes.db_Alpha
oUDF.Size = 20
iReturn = oUDF.Add()
If iReturn <> 0 Then
oDIComp.GetLastError(iErrCode, sErrMsg)
Message
Exit Function
End If
'Field2
oUDF.Name = "ItemName"
oUDF.Description = "ItemName"
oUDF.Type = SAPbobsCOM.BoFieldTypes.db_Alpha
oUDF.Size = 100
iReturn = oUDF.Add()
If iReturn <> 0 Then
oDIComp.GetLastError(iErrCode, sErrMsg)
Message
Exit Function
End If
next fields
AP_AddOn_CreateFields = True
End Function
The second function returns on adding the first field, an error, errCode -1120, errMsg Ref count for this object is higher than 0
If i close the application after creating the table and then restart the application only executing the second function it works.
I also tried the example as provided in MetaDataOperations and it shows the same behaviour.
Besides, Im the only user on the system and no other application is running.
Kind regards,
EduardHi,
See Add userfield to usertable 1120 Error SOLUTION
HTH
Ribeiro Santos -
Adding new record in user table via DI API
Dear all,
I created in SAP B1 two user tables (Master data and master data rows)
I need to add a new header record in my master data user table by DI code.
This is my source code...
Dim sboDestTable As SAPbobsCOM.UserTable = oCompany.UserTables.Item("MY_HEAD_TABLE")
sboDestTable.Code = newCode
sboDestTable.ArchiveDate = Now
sboDestTable.UserFields.Fields.Item("u_userfield1").Value = "new value 1"
Dim ErrCode As Integer = sboDestTable.Add()
but I have an exception error message on the Add() command: "SAP B1 Cannot add rows to a MasterData type UserTable"
Can someone help me, please?
How can I add a new record in a user master data table?
Best regards
EmanueleHi,
Try this :
SAPbobsCOM.GeneralService oGeneralService;
SAPbobsCOM.GeneralData oGeneralData;
SAPbobsCOM.GeneralData oChild;
SAPbobsCOM.GeneralDataCollection oChildren;
SAPbobsCOM.GeneralDataParams oGeneralParams;
oCompService = SBO_Company.GetCompanyService();
SBO_Company.StartTransaction();
oGeneralService = oCompService.GetGeneralService("UDOCODE");
oGeneralData = (SAPbobsCOM.GeneralData)oGeneralService.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData);
//Setting Data to Master Data Table Fields
oGeneralData.SetProperty("Code", CodeHeader);
oGeneralData.SetProperty("U_ProjectC", ProjectCodeHeader);
oGeneralData.SetProperty("U_ProjectN", ProjectNameHeader);
oGeneralData.SetProperty("U_StartDate", StartDateHeader);
oGeneralData.SetProperty("U_EndDate", EndDateHeader);
//Setting Data to Child Table Fields
oChildren = oGeneralData.Child("DETAILTABLENAMEWITHOUT@");
oChild = oChildren.Add();
oChild.SetProperty("U_Code", ActivityCodeRow);
oChild.SetProperty("U_Name", NameRow);
oChild.SetProperty("U_DESC", DescriptionRow);
oChild.SetProperty("U_Building", NumberOfBuildings);
oChild.SetProperty("U_STDT1", StartDateRow);
oChild.SetProperty("U_ENDT1", EndDateRow);
oChild.SetProperty("U_ESTMTDY1", DaysFinal);
//Attempt to Add the Record
oGeneralService.Add(oGeneralData);
if (SBO_Company.InTransaction)
{ SBO_Company.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit);
Hope it helps.
Thanks & Regards
Ankit Chauhan -
How to trigger xml publisher API (ex:Delivering Documents via e-Mail)?
Dear All:
How to use xml publisher API ?
In user's guide always talk API's code.(ex:Delivering Documents via e-Mail
// create delivery manager instance
DeliveryManager dm = new DeliveryManager();
// create a delivery request
DeliveryRequest req =
dm.createRequest(DeliveryManager.TYPE_SMTP_EMAIL);
// set email subject
req.addProperty(DeliveryPropertyDefinitions.SMTP_SUBJECT, "Invoice");
// set SMTP server host
req.addProperty(
DeliveryPropertyDefinitions.SMTP_HOST, "mysmtphost");
// set the sender email address
req.addProperty(DeliveryPropertyDefinitions.SMTP_FROM,
"[email protected]");
// set the destination email address
req.addProperty(
DeliveryPropertyDefinitions.SMTP_TO_RECIPIENTS,
"[email protected], [email protected]" );
// set the content type of the email body
req.addProperty(DeliveryPropertyDefinitions.SMTP_CONTENT_TYPE,
"text/html");
// set the document file name appeared in the email
req.addProperty(DeliveryPropertyDefinitions.SMTP_CONTENT_FILENAME,
"body.html");
// set the document to deliver
req.setDocument("/document/invoice.html");
// submit the request
req.submit();
// close the request
req.close(); )
Not say how to use this code to account effect !!
Having anybody to use API before?
Please tell me how to use that,thanks!!
BY Emily_yeHi Emily
I had the same question. After much research and a lot of deduction I produced the following:
import oracle.apps.fnd.cp.request.*;
import java.io.*;
import java.sql.*;
import java.util.Vector;
import oracle.apps.fnd.util.*;
import oracle.apps.xdo.XDOException;
import oracle.apps.xdo.common.pdf.util.PDFDocMerger;
import oracle.apps.xdo.delivery.DeliveryException;
import oracle.apps.xdo.delivery.DeliveryManager;
import oracle.apps.xdo.delivery.DeliveryPropertyDefinitions;
import oracle.apps.xdo.delivery.DeliveryRequest;
import oracle.jdbc.driver.OracleCallableStatement;
public class RunTravProgram implements JavaConcurrentProgram {
CpContext mCtx; // global reference to concurrent program context
LogFile logFile; // global reference to context logfile
OutFile outFile; // global reference to context outfile
Connection mConn = null;
ReqCompletion lRC;
//File Separator
private String mFileSeparator;
// globals for template
String XDOAppShortName = "";
String XDOtemplateCode = "";
// hard-wired constants for template addition
final String XDOLanguage = "en";
final String XDOTerritory = "US";
final String XDOFinal_format = "PDF";
final String XDOtemplateType = "TEMPLATE_SOURCE";
String PDFFile = "";
String outFilePath = "";
String progShortName = "";
String progDesc = "";
Integer iRequestID = 0;
String sWatermark = ""; // watermark text
String emailAddress = ""; // Not Implemented
String emailServer = "";
public static final String M_SUCCESS = "SUCCESS";
public static final String M_ERROR = "ERROR";
public static final String M_WARNING = "WARNING";
* Create a Java FND ConcurrentRequest objec to call fnd_request.submit_request
* The first three parameters are:
* Application Short Name -- Application Short name (ie. WAHC)
* Current Program Short Name -- Concurrent Program being called
* Current Program Description -- description for above
* These should be the first three parameters passed by the concurrent
* program in this order. The next two are constants set to null
* These are followed by the parameters passed by the first concurrent
* program that are being passed to the next concurrent program.
* I am limiting the parameter list to ten for now.
// Dynamic PLSQL statement used to get a concurrent request completion status
// This is necessary because the java class does not provide this method :-(
String mGetCompleteStatus =
"DECLARE R_VAL BOOLEAN; " + "b_phase VARCHAR2 (80) := NULL; " +
"b_status VARCHAR2 (80) := NULL; " +
"b_dev_phase VARCHAR2 (80) := NULL; " +
"b_dev_status VARCHAR2 (80) := NULL; " +
"b_message VARCHAR2 (240) := NULL; " + "BEGIN " +
"r_val := fnd_concurrent.wait_for_request (:1,5,1000," +
"b_phase,b_status,b_dev_phase,b_dev_status,b_message); " +
":2 := b_phase; " + ":3 := b_status; " + ":4 := b_message; " + "end;";
public RunTravProgram() {
// no constructor necessary for now
* Concurrent Processing provides an interface 'JavaConcurrentProgram' with abstract method
* runProgram() which passes the concurrent processing context 'CpContext'. The concurrent
* program developer will implement all of their business logic for a concurrent program in
* runProgram(). The main() method, implemented by AOL, will call runProgram() after
* performing all of the required initialization for the concurrent program, including
* establishing a database connection, initializing the required contexts, and setting up
* the log and output files. CpContext will have the request specific log and output
* file input methods
public void runProgram(CpContext pCpContext) {
mCtx = pCpContext;
OracleCallableStatement lStmt = null;
boolean bCompletion = true;
String sPhase = "";
String sStatus = "";
String sMessage = "";
//get handle on request completion object for reporting status
lRC = pCpContext.getReqCompletion();
// assign logfile
logFile = pCpContext.getLogFile();
// assign outfile
outFile = pCpContext.getOutFile();
// assign fileseparator
mFileSeparator = getFileSeparator();
// get the JDBC connection object
mConn = pCpContext.getJDBCConnection();
outFilePath =
((new File(outFile.getFileName())).getParent() == null ? "" :
(new File(outFile.getFileName())).getParent() +
mFileSeparator);
logFile.writeln("OutFile File Path: -> " + outFilePath, 0);
// get parameter list object from CpContext
// these come from the concurrent program
ParameterList lPara = pCpContext.getParameterList();
// create a temporary array and retrieve the parameters created by
// the program. Currently limiting the number of parameters to 10 for now
String pvals[] = new String[10];
int pcount = 0;
while (lPara.hasMoreElements()) {
NameValueType aNVT = lPara.nextParameter();
pvals[pcount] = aNVT.getValue();
pcount++;
if (pcount > 9)
break;
// send parameter values to the log file
logFile.writeln("Arg 1: APPL_SHORT_NAME -> " + pvals[0], 0);
logFile.writeln("Arg 2: CURR_PROG_SHORT_NAME -> " + pvals[1], 0);
logFile.writeln("Arg 3: CURR_PROG_DESCRIPTION -> " + pvals[2], 0);
logFile.writeln("Arg 4: TEMPLATE_CODE -> " + pvals[3], 0);
logFile.writeln("Arg 5: P_PLANT_CODE -> " + pvals[4], 0);
logFile.writeln("Arg 6: P_BATCH_NO -> " + pvals[5], 0);
logFile.writeln("Arg 7: P_SHOW_PROMISE -> " + pvals[6], 0);
logFile.writeln("Arg 8: P_WATERMARK -> " + pvals[7], 0);
XDOtemplateCode = pvals[3]; // store the template name globally
progShortName = pvals[1]; // store the program short name globally
XDOAppShortName = pvals[0]; // store the application short name
sWatermark = pvals[7]; // store the watermark globally
progDesc = pvals[2];
try {
// create a concurrent request object
ConcurrentRequest cr = new ConcurrentRequest(mConn);
// use the parameters to call fnd_request.submit_request
cr.addLayout(XDOAppShortName, XDOtemplateCode, XDOLanguage,
XDOTerritory, XDOFinal_format);
Vector param = new Vector();
param.add(pvals[4]); // plant code
param.add(pvals[5]); // batch ID
param.add(pvals[6]); // Show SO info flag
iRequestID =
cr.submitRequest(XDOAppShortName, progShortName, progDesc,
null, false, param);
mConn.commit();
// send the request ID to the log file
logFile.writeln("-- Request ID: ->" + Integer.toString(iRequestID),
0);
// call fnd_concurrent.wait_for_request to wait until the request
// has ended - use this to check the request status before proceeding
lStmt =
(OracleCallableStatement)mConn.prepareCall(mGetCompleteStatus);
lStmt.setInt(1, iRequestID);
lStmt.registerOutParameter(2, java.sql.Types.VARCHAR, 0, 255);
lStmt.registerOutParameter(3, java.sql.Types.VARCHAR, 0, 255);
lStmt.registerOutParameter(4, java.sql.Types.VARCHAR, 0, 255);
lStmt.execute();
// get the results of the completion
sPhase = lStmt.getString(2);
sStatus = lStmt.getString(3);
sMessage = lStmt.getString(4);
lStmt.close();
// send the results of the request processing to the log file
logFile.writeln("-- Phase: -> " + sPhase, 0);
logFile.writeln("-- Status: -> " + sStatus, 0);
logFile.writeln("-- Message: -> " + sMessage, 0);
// test here to make sure it completed correctly
if (sPhase.equals("Completed") && sStatus.equals("Normal")) {
// construct the PDF file name generated by the called request
PDFFile = progShortName + "_" + iRequestID + "_1.pdf";
// add a watermark to the generated PDF
// create an output stream for the existing PDF
// and set ouput to append
OutputStream pdfout =
new FileOutputStream(outFilePath + PDFFile, true);
// create an inputstream array (required by calling method)
InputStream pdfin[] = new InputStream[1];
pdfin[0] = new FileInputStream(outFilePath + PDFFile);
// add the watermark passed as a parameter
bCompletion = addWatermark(pdfin, pdfout);
// assign the modified file to the context out
// this will print using this request
if (bCompletion)
outFile.setOutFile(outFilePath + PDFFile);
// release the connection object
// and set the completion status for the request
if (bCompletion) {
pCpContext.getReqCompletion().setCompletion(ReqCompletion.NORMAL,
} else {
lRC.setCompletion(ReqCompletion.WARNING, M_WARNING);
pCpContext.releaseJDBCConnection();
} catch (SQLException s) {
logFile.writeln("SQL Error: Exception thrown w/ error message: " +
s.getMessage(), 0);
lRC.setCompletion(ReqCompletion.WARNING, M_WARNING);
pCpContext.releaseJDBCConnection();
} catch (IOException ioe) {
logFile.writeln("IO Error: Exception thrown w/ error message: " +
ioe.getMessage(), 0);
lRC.setCompletion(ReqCompletion.WARNING, M_WARNING);
pCpContext.releaseJDBCConnection();
} catch (Exception e) {
logFile.writeln("General Exception: " + e.getMessage(), 0);
lRC.setCompletion(ReqCompletion.WARNING, M_WARNING);
pCpContext.releaseJDBCConnection();
} finally {
try {
if (lStmt != null)
lStmt.close();
pCpContext.releaseJDBCConnection();
} catch (SQLException e) {
logFile.writeln(e.getMessage(), 0);
lRC.setCompletion(ReqCompletion.WARNING, M_WARNING);
* addWatermark()
* @param pdfin
* @param pdfout
* @return boolean
* This method will work for an existing document or a newly generated
* one. Set the outputstream append flag to false for a new document
* and true for an existing one.
* NOTE: PDFDocMerger requires an inputstream array even if it only
* contains one document.
private boolean addWatermark(InputStream[] pdfin, OutputStream pdfout) {
if (!sWatermark.equals("")) {
try {
PDFDocMerger docMerger = new PDFDocMerger(pdfin, pdfout);
//docMerger.setTextDefaultWatermark(sWatermark);
docMerger.setTextWatermark(sWatermark, 80f, 50f);
docMerger.setTextWatermarkAngle(25);
docMerger.setTextWatermarkColor(1.0f, .50f, .50f);
docMerger.setTextWatermarkFont("Garamond", 100);
docMerger.process();
docMerger = null;
return true;
} catch (XDOException e) {
logFile.writeln("Watermark process Failed: " + e.getMessage(),
0);
return false;
return true;
* Returns the file separator
private String getFileSeparator() {
return (System.getProperty("file.separator"));
* EBSEmailDelivery
* @return
* Just for testing right now.
private boolean EBSEmailDelivery() {
if (!emailAddress.equals("")) {
try {
// create delivery manager instance
DeliveryManager delMgr = new DeliveryManager();
// create a delivery request
DeliveryRequest delReq =
delMgr.createRequest(DeliveryManager.TYPE_SMTP_EMAIL);
// set email subject
delReq.addProperty(DeliveryPropertyDefinitions.SMTP_SUBJECT,
"EBS Report:" + progDesc +
" for request: " + iRequestID);
// set SMTP server host
delReq.addProperty(DeliveryPropertyDefinitions.SMTP_HOST,
emailServer); // need to supply the email smtp server
// set the sender email address
delReq.addProperty(DeliveryPropertyDefinitions.SMTP_FROM,
emailAddress);
// set the destination email address
delReq.addProperty(DeliveryPropertyDefinitions.SMTP_TO_RECIPIENTS,
emailAddress);
// set the content type of the email body
delReq.addProperty(DeliveryPropertyDefinitions.SMTP_CONTENT_TYPE,
"application/pdf");
// set the document file name appeared in the email
delReq.addProperty(DeliveryPropertyDefinitions.SMTP_CONTENT_FILENAME,
PDFFile);
// set the document to deliver
delReq.setDocument(outFilePath + PDFFile);
// submit the request
delReq.submit();
// close the request
delReq.close();
return true;
} catch (DeliveryException de) {
logFile.writeln("email process Failed: " + de.getMessage(), 0);
return false;
return true;
This is the class for a JCP I created to perform the following:
1) Launch an existing Concurrent Program that produces PDF output
2) Grab the PDF and apply a watermark based on user input or conditions
3) associate the modified PDF to CP output for PASTA printing
It isn't elegant but it is fairly simple. I added the email capability and tested it but am not implementing it at the present time.
there is a fair amount of information out there that explains how to create a JCP councurrent program but very little that demonstrates the class needed.
I hope this helps -
Not all tables are updated in a .xlf document
One table from 6 is updated only in a .xlf document via Life Office connection. Why?
Hi,
if im nt wrong ..
u have 6 quiries which take date range as input ie from today to last month first date.
Now:
is the date format in excel cell same as the date format of ur query !
coz query will be triggered only if u give date in its specific format.
are you taking i/p from dash board!
range also should be same as ur query range( to - from or from - to )
if you have different date formats for 6 quiries
take the dates seperately for all those which are not same
suppose query1,query2,query3 takes i/p as DD.MM.YYYY and
query4,query5,query6 takes i/p as DD.MM.YYYY hh.mm then take 2 date ranges seperately
if ur using live office connection to refresh the dashboards concatenate the cells and give the concatenated cell to refresh your data.
Range 1 DD.MM.YYYY to DD.MM.YYYY --->concatenate both the dates and give the concatenated cell to refresh the corressponding query liveoffice connection.
similarly DD.MM.YYYY.hh.mm to DD.MM.YYYY.hh.mm --->concatenate both the dates and give the concatenated cell to refresh the corressponding query liveoffice connection
@Sri
Maybe you are looking for
-
I downloaded ios7 and now some apps won't open even after resetting don't won't to lose my info by deleting and starting over.. What to do?
-
What is the best software (not imovie) for converting photos to a DVD slideshow that will also allow you to insert video. Software needs to work with both iPhoto and Apperture. iMovie is basic and I want to be able to do more with transitions and pre
-
Problem while starting tomcat 5.0.28
During the startup of apache-tomcat-5.0.28 i receive the following errors in localhost.2006-03-30.log Mar 30, 2006 4:12:11 PM org.apache.catalina.core.StandardContext filterStart SEVERE: Exception starting filter Compression Filter java.lang.ClassNot
-
Enhancement request: Entity Properties - Sort order/alphabetize
You know the product is getting seriously good when enhancement request are for non-critical items. Thank you to all the team for a great useable product. Now that I've buttered you up... As a general question, where should enhancement requests such
-
What can I do using bluetooth with my macbook pro
I paired my macbook pro with my iPhone 5s but can't do anything else. tell me it doesn't have the necessary services??