How to perform validity checks just before form data is saved?
hello all,
i need to perform some checks on various fields just before data on a standard form is saved, and to eventually rollback the transaction.
if the checks are succesful i have to perform some db operation in transaction with main data.
solution ( if existent! ) has to be addin only -> no triggers / no procedures / no sbo_transaction thingies
scenario:
involved tables:
OITM
USERDEFINEDTABLE1
USERDEFINEDTABLE2
involved forms:
Items - OITM - formtypeex = "150"
logic:
an user defined field U_UDFCHECKACTIVE has been added to OITM, a combo box has been added to items form containing values Y and N, bound to OITM.U_UDFCHECKACTIVE.
when the user saves an item, if OITM.U_UDFCHECKACTIVE == Y we have to perform additional checks on USERDEFINEDTABLE1
if the check result is true we have to save OITM current data and insert a record in USERDEFINEDTABLE2 containing itmgrp value ( )
if the check result is false we have to block save operation
if OITM.U_UDFCHECKACTIVE == N no check is performed and everything works normally
we started hooking the form data event for oitm / form type 150:
Application.SBO_Application.FormDataEvent += new SAPbouiCOM._IApplicationEvents_FormDataEventEventHandler(FormDataEventHandler.SBO_Application_FormDataEvent);
then we filtered the event
switch (BusinessObjectInfo.FormTypeEx)
case "150":
if (BusinessObjectInfo.BeforeAction &&
(BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE ||
BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD))
BL.Items_BusinessLogic.SBO_Application_FormDataEvent(ref BusinessObjectInfo, out BubbleEvent);
in our business logic class i don't know how to correctly check the values just before they are saved to db
for example i tried using oitm.browser :
if (oitm.Browser.GetByKeys(BusinessObjectInfo.ObjectKey))
String value = oitm.UserFields.Fields.Item("U_UDFCHECKACTIVE ").Value as String;
//perform checks
//if ok insert records and bubbleevent = true
//if ko rollback the bubbleevent = false
//if checks are not to be performed then bubbleevent = true....
but it's wrong, as it populates oitm object from db, and not from the form. i have old values stored in the object, values tha are to be overwritten with those present on form.
i tried inspecting the form for data sources but i don't know how to navigate to the right one, i found only system generated objects with SYS_##, with no clue about the related dbfield
i tried getting the values directly from the form, but in object BusinessObjectInfo i don't have anything that identifies univocally the form i'm editing.
i mean if i have 2 item forms open, i don't know which one is the one i'm saving.
i'm expecting to find somewhere a temporary oitm business object containing values that are to be saved, values that i can easily check.
so i'm asking you how to find those values in order to perform my bl checks
thank you in advance
Hi Christian,
The values that are about to be saved should be in the datasources:
form.DataSources.DBDataSources.Item("OITM");
form.DataSources.DBDataSources.Item("ITM1");
The form variable should be form 150.
Best regards,
Pedro Magueija
Similar Messages
-
How do I enable a LiveCycle PDF form to be saved in Adobe Reader?
I have an interactive PDF form that I created in LiveCycle. However, when it is opened with Adobe Reader, the user is unable to save it. They can only print from Reader. How do I enable the LiveCycle PDF form to be saved in Adobe Reader?
You have to add save rights with Acrobat.
Open you form in Acrobat and then save it via File > Save As Other > Reader Extended PDF > Enable More Tools. -
How to check the validation in UI before committing data?
Hi,
I'm using Jdev 11.1.2.1.0 version .
I needed to check whether there is duplication of values in Boolean check box before committing the data into the Database.
But this validation rule is to be checked based on the value selected in the Select One Choice drop down list in the page.
I did it with adding a ValueChangeEvent in the drop down list and checking the values in the Boolean check box. It worked , but only in the case of earlier committed data in the database.
How can i actually verify the data entered in the table in the page before it being committed into the DB ?
Nigel.Hi,
an improvement to your solution would be to move the major part of your code from the backing bean into a method on the ApplicationModuleImpl file (you create this from the AM editor)
public boolean checkForDuplicate(){
ViewObject vo = this.findViewObject("ResponseVO");
int numRows;
int j=0;
numRows = vo.getRowCount();
String rowValue = "a";
//the part below of your code I don't like at all. Why do you need to increase a flag
//and use an if statement ?
for (int i=0; i<numRows; i++){
rowValue = (String)vo.getCurrentRow().getAttribute("ResponseFlag");
if(rowValue.equals("Y")){
j++;
if(j>1)
return true;
return false;
}This code you then expose on the AM as a client interface (same AM editor --> Java menu option)
In the PageDef file (double click it to access the visual editor) click the plus icon next to the Bindings header. Choose "Generic Binding" --> method binding and point it to the AM and the exposed method. This creates a method binding "checkForDuplicate"
Change your managed bean code to
BindingContext bctx = BindingContext.getCurrent();
BindingContainer bindings = bctx.getCurrentBindingsEntry();
OperationBinding checkForDuplicate = (OperationBinding ) bindings.get("checkForDuplicate");
checkForDuplicate.execute();
boolean isDuplicate = checkForDuplicate.getResult();
if(isDuplicate){
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, null, "Two same respones!");
FacesContext.getCurrentInstance().addMessage(null, msg);
Frank -
How do I perform an action just before someone saves a data block?
Hi,
I need a trigger to attach to a datablock to perform some processing before the record is saved. I can't find anything suitable - I can see WHEN-VALIDATE-RECORD but this can run without you saving can't it? The code must only be executed when the user saves.
Can anyone help?
(Forms 6i)
Thanks AdamWhatever you do, DO NOT use a KEY-COMMIT trigger !
There are many ways a commit can be performed without firing that trigger.
There is also POST-FORMS-COMMIT, which despite its name, fires before commit, ie if form_trigger failure is raised in it, then the commit does not happen. -
Whats the best way to check table before form deletion or update ?
Hi, I have a func_staff table made up of a composite key - func_no and staff_id. I have a form where the datablock references this table.
I need to be able to check that before a func_no and staff_id combination on the form are written to the database that that combination does not already exist in the table.
What would be the code for that ? I've tried stuff like IF EXIST statements and even a select statement but I totally worded it it wrongly.
To DELETE an entry in that same table, would the best way to be create an LOV for both func_no and staff_id, the problem with that would be if a user selected a combination that does not exist ? Could I create a combined LOV that would populate each field ?? (this way I could be 100% sure that the selected combination is valid)
Thanks Peeps.hi,
you can try and use the count(*), before deleting and updating
lets say
select count(*)
into l_count
from table_name
where column1 = :block.column1
and column2 = :block.column2;
if l_count <> 1
then
insert into..........
else
show error message;
raise form trigger failure;
end if;
similarly u can use l_count before deleting.
regards,
Mayank -
How to automatically spell check emails before sending
Hi. I have a Q10, and I was wondering how I can automatically spell and grammar check emails before sending. Currently, if a word is misspelled, I get a red underline, and most of the time, if I click on that word, I get this magnifying glass, which I have no idea what the magnifying glass is, and why that comes up instead of options for the spell check. Any help or advice would be greatly appreciated! Thanks!
BB decided it would be nice to take this feature away. I do not think that there is ONE phone left on the market (other than an old BB) that has a good old fashioned spell check. There are A LOT of unhappy BB users who really miss and relied on spell check/check spelling before sending. Little things like this are what made BB's stand apart from other phones. Now it's just a wanna be iphone
-
How to solve java.io.IOException: Corrupt form data: premature ending
hei evryone!
Does anyone knows how to solve this bug?
java.io.IOException: Corrupt form data: premature ending
Im using Oreilly's cos.jar MultipartRequest
here is my form :
<FORM METHOD="POST" NAME="uploadform" action="mbbfile" ENCTYPE="multipart/form-data">
<TR>
<TD>Select a File:</TD>
<TD><INPUT TYPE="FILE" NAME="srcfile" style="width:400px"/></TD>
</TR>
<TR><TD><INPUT TYPE="SUBMIT" VALUE="Send"/></TD></TR>
</FORM>
HERE IS mbbfile which is a servlet :
package mbb.servlet;
import java.io.IOException;
import java.sql.Connection;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.oreilly.servlet.MultipartRequest;
import org.jconfig.Configuration;
import org.jconfig.ConfigurationManager;
public class MBBFileServlet extends HttpServlet{
private static final Configuration conf = ConfigurationManager.getConfiguration("ConfigFile");
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
String filePath = conf.getProperty("FilePath", "", "test");
try{
MultipartRequest multi = new MultipartRequest(req,filePath,5*1024*1024);
}catch(Exception e){
System.out.println("MBBFileServlet Exception ---> "+e.getMessage());
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
doGet(req,res);
Sometimes it works meaning the file is uploaded in the directory without any exception, sometimes the file is uploaded but with exception on the log saying "MBBFileServlet Exception ---> Corrupt form data: Premature Ending". and sometimes the files is not uploaded at all and when i check the error is : "MBBFileServlet Exception ---> Corrupt form data: Premature Ending". Can anyone please help me on this matter. Thx!
Your response would be deeply appreciated.
br,
TACHi all!
Since I've spent some days now trying to figure out what was wrong with my file upload in Struts 1.1, I would like to share my solution with the rest of you in order to spare you for the same amout of wasted time I've spent :-)
My platform is Resin 3.0.8 and Struts 1.1. My problem was that JPEG's got corrupted when arriviving at the server. After a few days searching on the net, I tried with a plain servlet and the O'Reilly package, and the app worked perfect.
Here is my servlet:
package no.yourcompany.yourapp.servlet;
import com.oreilly.servlet.multipart.MultipartParser;
import com.oreilly.servlet.multipart.Part;
import com.oreilly.servlet.multipart.FilePart;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletException;
import javax.servlet.ServletContext;
import javax.servlet.RequestDispatcher;
import java.io.IOException;
import java.io.ByteArrayOutputStream;
public class ImageUpload extends HttpServlet {
private static final String PAGE_RECEIPT = "/popImageUploadReceipt.do";
private static final int MAX_FILE_SIZE_IN_BYTES = 10000000; // 10 M
* Extracts image from request and puts it into person form.
* @see HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// custom beans from my project, not defined here
PersonRegistrationForm personRegistrationForm = null;
PortraitImage portraitImage = null;
ByteArrayOutputStream outputStream = null;
Part currentPart = null;
FilePart currFilePart = null;
personRegistrationForm = (PersonRegistrationForm) request.getSession().getAttribute(DsnSessionKeyConstantsIF.KEY_PERSON_FORM);
portraitImage = personRegistrationForm.getPortraitImage();
try {
MultipartParser parser = new MultipartParser(request, MAX_FILE_SIZE_IN_BYTES);
while ((currentPart = parser.readNextPart()) != null) {
if (currentPart.isFile()) {
currFilePart = (FilePart) currentPart;
outputStream = new ByteArrayOutputStream();
currFilePart.writeTo(outputStream);
// portraitImage is just a bean for encapsulating image data, not defined in this posting
portraitImage.setContentType(currFilePart.getContentType());
portraitImage.setImageAsByteArray(outputStream.toByteArray());
portraitImage.setOriginalFileName(currFilePart.getFileName());
break;
} // if (currentPart.isFile())
} // while ((currentPart = parser.readNextPart()) != null)
} catch (IOException ioe) {
// noop
// redirect to receipt page
ServletContext servletContext = this.getServletContext();
RequestDispatcher requestDispatcher = servletContext.getRequestDispatcher(PAGE_RECEIPT);
requestDispatcher.forward(request, response);
} // doPost
} // ImageUpload
AND ADD THIS TO YOUR WEB.XML
<servlet>
<servlet-name>ImageUpload</servlet-name>
<servlet-class>no.yourcompany.yourapp.servlet.ImageUpload</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ImageUpload</servlet-name>
<url-pattern>imageUpload.do</url-pattern>
</servlet-mapping>
AND THE HTML-FORM IS HERE
<form action="/yourapp/imageUpload.do" method="post" enctype="multipart/form-data" accept="image/*">
<p>
<input type="file" name="portraitImage" />
</p>
<p>
<input type="image" src="/dsn/img/btn_last_bilde.gif" border="0">
</p>
</form> -
How to run recordset SQL query in FORM DATA event
How can I run recordset SQL query in FORM DATA event upon clicking on Add button in the document?
Hi Slamet,
When you receive a form data event you have a class containing inside it a ObjectKeys xml info regarding the object added/modified,...
With the objects keys you can then use the DI API method called GetByKeys to obtain the DI Object.
There is some information about it in the SDK Help file, mainly in the "FormDataEvent" class definition:
<i>The event provides the unique ID (BusinessObjectInfo.ObjectKey) of the modified business object. You can use the value of this property as an input parameter in the DI API DataBrowser.GetByKeys method to get a DI object.</i>
Pay attention you don't have this information in the Before=True event of the Add as it is not yet in the database.
Hope it helps
Trinidad. -
How to create Reports for the infopath form data
Hi All,
I have a requirement to generate reports in SharePoint based on InfoPath form data which is submitted into form library. Do I need to store each InfoPath form data into SQL Database/MS Access Database. if yes, can any one help me on this how
to save InfoPath form data into DB while submitting into "Form Library". based on the data stored in DB how to create and view the report in SharePoint?.
Thanks in Advance,
Satish
Thanks & Regards Satish DugasaniThank you for asking the questions for clarification, my requirement is like below
1. Need to insert all infopath form fields data into Access Database when i am submitting to the Form library
2. Create Access Reports like based on time period, based on submitter name, based on state, city, and combination of these etc.
3. Sync Access Database every time i am updating the form
4. View Access Reports in share point site
PS: I worked on this like below approch
1. Written Web Service to Sync Access Database for the Infopath form
2. Create Access Reports
3. Publish using "Publish to Access Services" by providing site URL it will create a subsite there i can able to see reports, tables, macros etc. but that is not an user friendly like i am not able to apply my branding because it is pointing to /_Layouts/accsrv/Modifyapplication.aspx.
could any one suggest me on this.
Thanks & Regards Satish Dugasani -
How do I connect a LiveCycle PDF form data to an Excel File
I have a Livecycle Time sheet form that's being distributed in the field, what we want to do is be able to save the data directly to an EXCEL database, we want the data to auto populate the excel sheet with the forma data once the field user hit submit or email button.
Thanks.Hi,
You should have a look at Stefan Cameron's site, which has many solutions for setting up data connections. Search for spreadsheet generally and here: http://forms.stefcameron.com/2006/09/18/connecting-a-form-to-a-database/.
However please note that if the users have Reader, then the form would need to be Reader Enabled using the full LC Reader Extensions server component. Extending the form in Acrobat will not work.
Hope that helps,
Niall -
Mandatory check box before form submission
I want users to accept my 'Terms & Conditions' statement on an application form before they are allowed to submit it by the e-mail button.
I want to place a required check box which produces an error message and prevents form submission until it is checked.
I have read hordes of the postings but none of the solutions seem to do quite what I want.
Any advice would be gratefully receivedHi,
I used the script you provided in the above post, and it worked perfectly, but my situation is a little different: I have two checkboxes, but I only want the message to appear if one of them isn't selected. If the other checkbox is selected, I need the fake submit button to go ahead and generate the email to send the form. I'm new to LiveCycle Designer, and I'm unsure of how to correctly use the "if" and "else" javascript. I need the message to appear when clicking the WebExYes checkbox, but I don't want it to appear when the user clicks the IntercallCheckBox.
Here's what my script looks like so far:
if
(form1.subForm1.WebEx.WebExYes.rawValue != "1"){ xfa.host.messageBox("You must read the FHEG WebEx Usage Standards and select the Yes checkbox before submitting.");
else
{ SubmitButton.execEvent("click");
if
(form1.subForm1.AccountRequest.IntercallCheckBox.rawValue != "1")
else
{SubmitButton.execEvent ("click");
Can someone tell me what I'm doing wrong or if I can even make this happen?
Thank you,
Hannah -
How to disable spell checker in editable forms?
Hello, everyone,
Asking for an advice.
I want to disable spell checking in an editable PDF form, since I don't have the dictionary of my language.
Spell checking in this case is bit annoying and slows down the editing.
I have the checker disabled in the preferences. However the checker still tries to do it's job.
How do I disable it?
Greetings,
VytasThanks for checking it out.
If anybody has ideas about this, please share
Cheers,
Vytas -
How to perform auth check on Web Service calling BAPI in R/3 via XI?
Hi all,
We are running Net weaver PI 7.0 SPS11 and 4.6C R/3 and working on proof-of-concept project using BAPIs exposed on XI as Web Services and called from external SOAP client (MS SharePoint). We got it working fine with HTTPS and SOAP protocol as Sender and RFC Adapter as Receiver to R/3.
Now we want to add authentication and authorization to this scenario...authentication will probably be SSO and SSL/HTTPS, but we are wondering how to handle authorizations in R/3? RFC Adapter channel is configured with system user, so once BAPI is called this use runs transactions in R/3 and in R/3, where the authorization is checked, we have no visibility which user requested Web service
Is there any way we could extract user is from HTTP header and have it dynamically used in RFC Adapter channel config? Or maybe there is another way to handle this?
Any insights how to resolve this issue will be greatly appreciated.
Thanks
MargaretWe found solution, PP can be configured on XI to have user running transaction known on R/3 backend system, so authorizations can be invoked.
-
How does Weblogic 7 check for well-formed xmls
Hello,
I am having trouble deploying my applications with WLS 7.0. The error I am getting
is that my web.xml is not well-formed, but I have double-checked everything and
I think it is correct.
I have read that weblogic 7.00 does not deploy an application which xmls are not
well-formed (whereas earlier versions of weblogic would do so).
My question is: against what dtds does WLS 7 check the web.xml, the weblogic.xml
, etc.? I would think that it would check it against the dtd in the head of the
xnl file, i.e., http://java.sun.com/dtd/web-app_2_3.dtd for the web.xml, is this
correct?
If this was true, what about intranet applications that are not connected to the
Internet? could this be the reason?
TIA Cristina CeballosDocument doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(xmlString)));try/catch this ugly line, if no parse exception and a non -null doc exists then your XML is well-formed.
of course if your XML contains namespaces, you would have to setup correctly the document builder. -
How to associate an uploaded file with form data
I have a "ticketing" app which stores a ticket no. as well as allows users to upload multiple files per ticket. The problem I am having is how to associate an uploaded file with a particular ticket no. As you can guess this becomes complicated when the same user can potentially update multiple tickets using the same file names. I am having difficulty trying to understand how to associate a ticket no with one or more uploaded files. I do have a custom table which I update with the attachments but I am unsure how to, or when to, update the ticket information on this custom table. I only want to retrieve attachments for a given ticket, not all attachments uploaded by a user.Does anyone have any ideas?
Hi,
My question is bit related to this topic.
I am having a requirement to upload the CSV files so that they will store in a database table and later on wards when they search on that table it needs to pull the information and display on the form. I am a new bee to application express. Could some body tell me how to start this process with??. Just give me an overvoew/hints so that I will try to carry on my own.
Cheers,
Krishna.
Maybe you are looking for
-
How do i use my time capsule as a network to store files, etc.?
How do i use my time capsule as a network to store files, etc.?
-
Problem with sending emails on my iPad 2?
Hi, I'm unable to send emails using my iPad 2 but I'm using all the correct account settings from my macbook pro which works perfectly. I have deleted and re-set my accounts but still dose not work, please help? Thanks Darren
-
How do I change the email font size when I get to my inbox in Yahoo?
I was forwarding emails to several people on my contacts list, clicking on each one while holding ctrl down. Then, all of a sudden the font size changed and I can't read it. My emails are now in this font size.
-
Download Install Adobe X Standard
How do I download Acrobat X Standard?
-
I'm frustrated: I followed the instructions in the printed manual p 91 when trying to connect my two keyboards. The "bottom one" functions perfectly on MIDI ch 1 - giving a piano sound. The second one doesn't give any sound - Mainstage's MIDI informa