cancel
Showing results for 
Search instead for 
Did you mean: 

Meaning of POST_FIND for script target

Former Member
0 Kudos

Hi SAP Guru,

I have a legacy script someone implemented in our team before.

It's target is POST_FIND and its class id 607, supplier.

Do you know when this script is called? Is it possible other script to call this one implicitly?

Thank you for your help.

Regards,

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Namsoo,

Post find is called when the object is loaded. For example, if you have a post find script on a supplier, the script will be fired when a supplier record is loaded, for instance, by clicking on a supplier from the supplier list page. I’d suggest taking a look at the scripting and workflow guide available on the SMP. There is a lot of good information there.

Regards,

Vikram

Former Member
0 Kudos

Hi Vikram,

Thank you for your response.

In addition to it, I'm wondering if a script contains the following line

VendorIBeanIfc vendor = (VendorIBeanIfc) vendorHome.find(ref);

then does it call the script with POST_FIND as target?

BTW, I have the document regarding scripting and workflow, but it does not describe all information used in script and workflow. I feel that SAP document lacks of completeness.

Thank you again.

Regards,

0 Kudos

Hi Namsoo,

The code you mentioned will not call the POST_FIND script.

Thanks for your feedback. We constantly try to improve our documentation. It will be helpful if you could let us know exactly what you are looking for and what is lacking in the documentation.

You could also consider taking the TSO150 technical training where scripting is covered in more detail.

Hope this helps.

Regards,

Vikram

Former Member
0 Kudos

Hi Vikram,

"The code you mentioned will not call the POST_FIND script."

If this sentence above is true, then our system has an very strange behavior. One of end user in our company tried to save a project. One custom script is invoked when the project is saved. And system returned an exception. When I traced a log file I identified the API I mentioned above called the another script. How come this kind of thing is possible?

Regarding document, I could not find POST_FIND information in SAP script and workflow document. If the document covers Target column then it would be better. I will provide the feedback when I have it.

Thank you for your attention.

Regards,

0 Kudos

Hi Namsoo,

POST_FIND and find method are 2 different things. POST FIND is a script Target(Loaded) which gets triggered when an object is loaded. Whereas the homeibean’s find method is used to find a particular object from within a script definition. In your example above, if the script is triggered on a project, the find method can be used to get the ibean of the supplier on that project.

Calling the find method doesn’t explicitly call another script definition.

Regarding documentation on this, please refer to the Document Life Cycle section of the Scripting and Workflow guide. It explains each target. 

Hope this helps.

Regards,

Vikram

Former Member
0 Kudos

Hi Vikram,

Thank you for your response again.

Regarding POST_FIND and find method, that's my original guess.

But in reality, it may not be true or something mystery happened.

Please see a log exceprt below:

2012-10-26 01:44:27.772 ERROR local4 ScriptEnvironment execute RequestHandler.RqThread: fullsave QzfsQKhQTbWTfTbBDbnn6GSrhxqvPXwwmG1QyvFvb7xJxvLGHGVj!-1430183280!1351229792194 aa65307 Sourced file: inline evaluation of: ``/*   * This script checks all vendors that are in the state of CASP Review Pendi . . . '' : target exception : at Line: 10 : in file: inline evaluation of: ``/*   * This script checks all vendors that are in the state of CASP Review Pendi . . . '' : .get ( )

Target exception: java.lang.NumberFormatException: For input string: "1 "
Sourced file: inline evaluation of: ``/*   * This script checks all vendors that are in the state of CASP Review Pendi . . . '' : target exception : at Line: 10 : in file: inline evaluation of: ``/*   * This script checks all vendors that are in the state of CASP Review Pendi . . . '' : .get ( ) |Target exception: java.lang.NumberFormatException: For input string: "1 "| at bsh.BSHPrimarySuffix.doSuffix(Unknown Source)| at bsh.BSHPrimaryExpression.eval(Unknown Source)| at bsh.BSHPrimaryExpression.eval(Unknown Source)| at bsh.BSHIfStatement.evaluateCondition(Unknown Source)| at bsh.BSHIfStatement.eval(Unknown Source)| at bsh.Interpreter.eval(Unknown Source)| at bsh.Interpreter.eval(Unknown Source)| at bsh.Interpreter.eval(Unknown Source)| at com.frictionless.comp.scripting.ScriptEnvironment.execute(ScriptEnvironment.java:143)| at com.frictionless.comp.scripting.ScriptManager.executeDocumentEventScript(ScriptManager.java:969)| at com.frictionless.doc.ContainerBo.executeDocumentEventScript(ContainerBo.java:5238)| at com.frictionless.doc.ContainerBo.postFind(ContainerBo.java:1955)| at com.frictionless.doc.ContainerDocBo.postFind(ContainerDocBo.java:583)| at com.frictionless.doc.AbsDocBo.postFind(AbsDocBo.java:1658)| at com.frictionless.doccommon.masterdata.VendorBo.postFind(VendorBo.java:895)| at com.frictionless.common.db.AbstractDb.postFind(AbstractDb.java:6247)| at com.frictionless.common.db.AbstractDb.processFetchedObject(AbstractDb.java:6995)| at com.frictionless.common.db.AbstractDb.processFetchedObjects(AbstractDb.java:6982)| at com.frictionless.common.db.AbstractDb.findCommon(AbstractDb.java:5812)| at com.frictionless.common.db.AbstractDb.find(AbstractDb.java:4748)| at com.frictionless.common.db.AbstractDb.find(AbstractDb.java:4633)| at com.frictionless.common.db.AbstractDb.find(AbstractDb.java:4613)| at com.frictionless.doc.AbsDocDb.findDocCommon(AbsDocDb.java:187)| at com.frictionless.doc.AbsDocDb.findDocCommon(AbsDocDb.java:150)| at com.frictionless.doc.AbsDocDb.find(AbsDocDb.java:130)| at com.frictionless.doc.ContainerHome.find(ContainerHome.java:333)| at com.frictionless.api.ibean.common.AbsIBeanHome.find(AbsIBeanHome.java:114)| at sun.reflect.GeneratedMethodAccessor25988.invoke(Unknown Source)| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)| at java.lang.reflect.Method.invoke(Method.java:585)| at bsh.Reflect.invokeOnMethod(Unknown Source)| at bsh.Reflect.invokeObjectMethod(Unknown Source)| at bsh.Name.invokeMethod(Unknown Source)| at bsh.BSHMethodInvocation.eval(Unknown Source)| at bsh.BSHPrimaryExpression.eval(Unknown Source)| at bsh.BSHPrimaryExpression.eval(Unknown Source)| at bsh.BSHCastExpression.eval(Unknown Source)| at bsh.BSHVariableDeclarator.eval(Unknown Source)| at bsh.BSHTypedVariableDeclaration.eval(Unknown Source)| at bsh.BSHBlock.evalBlock(Unknown Source)| at bsh.BSHBlock.eval(Unknown Source)| at bsh.BSHBlock.eval(Unknown Source)| at bsh.BSHEnhancedForStatement.eval(Unknown Source)| at bsh.Interpreter.eval(Unknown Source)| at bsh.Interpreter.eval(Unknown Source)| at bsh.Interpreter.eval(Unknown Source)| at com.frictionless.comp.scripting.ScriptEnvironment.execute(ScriptEnvironment.java:143)| at com.frictionless.comp.scripting.ScriptManager.executeCollectionScript(ScriptManager.java:1189)| at com.frictionless.doc.collection.GeneralCollnBo.validateCollection(GeneralCollnBo.java:1899)| at com.frictionless.doc.collection.SubCollnBo.validateCollection(SubCollnBo.java:1166)| at com.frictionless.doc.ContainerBo.execValidate(ContainerBo.java:3737)| at com.frictionless.doc.BizDocBo.execValidate(BizDocBo.java:1965)| at com.frictionless.doc.ContainerBo.validate(ContainerBo.java:1257)| at com.frictionless.doc.ContainerDocBo.validate(ContainerDocBo.java:1299)| at com.frictionless.doc.AbsDocBo.validate(AbsDocBo.java:3138)| at com.frictionless.doc.BizDocBo.validate(BizDocBo.java:2110)| at com.frictionless.common.db.AbstractDb.validate(AbstractDb.java:6217)| at com.frictionless.common.db.AbstractDb.save(AbstractDb.java:3255)| at com.frictionless.doc.ContainerDb.save(ContainerDb.java:213)| at com.frictionless.doc.AbsDocDb.save(AbsDocDb.java:874)| at com.frictionless.common.db.AbstractDb.save(AbstractDb.java:3215)| at com.frictionless.doc.ContainerHome.save(ContainerHome.java:294)| at com.frictionless.doc.AbsDocHome.save(AbsDocHome.java:446)| at com.frictionless.doc.display.util.DisplayStateManager.saveDoc(DisplayStateManager.java:1017)| at com.frictionless.doc.display.util.DisplayStateManager.saveDoc(DisplayStateManager.java:994)| at com.frictionless.doc.display.util.SaveDocRQ.processSave(SaveDocRQ.java:452)| at com.frictionless.doc.display.util.SaveDocRQ.processRequestHook(SaveDocRQ.java:151)| at com.frictionless.doc.display.util.AbsDocRQ.processRequest(AbsDocRQ.java:196)| at com.frictionless.doc.display.util.AbsRQ.run(AbsRQ.java:110)| at java.lang.Thread.run(Thread.java:595) Sourced file: inline evaluation of: ``/*   * This script checks all vendors that are in the state of CASP Review Pendi . . . '' : target exception
2012-10-26 01:44:27.772 ERROR local4 ScriptManager executeDocumentEventScript RequestHandler.RqThread: fullsave QzfsQKhQTbWTfTbBDbnn6GSrhxqvPXwwmG1QyvFvb7xJxvLGHGVj!-1430183280!1351229792194 aa65307   Document Lifecycle Event (masterdata.Vendor. Loaded) script exception: Error executing script: Sourced file: inline evaluation of: ``/*   * This script checks all vendors that are in the state of CASP Review Pendi . . . '' : target exception.
2012-10-26 01:44:27.782 ERROR local4 ScriptEnvironment execute RequestHandler.RqThread: fullsave QzfsQKhQTbWTfTbBDbnn6GSrhxqvPXwwmG1QyvFvb7xJxvLGHGVj!-1430183280!1351229792194 aa65307 Sourced file: inline evaluation of: ``import com.frictionless.api.doccommon.masterdata.VendorIBeanHomeIfc; import com. . . . '' : Typed variable declaration : Method Invocation vendorHome.find : at Line: 129 : in file: inline evaluation of: ``import com.frictionless.api.doccommon.masterdata.VendorIBeanHomeIfc; import com. . . . '' : vendorHome .find ( ref )

Target exception: com.frictionless.api.common.exception.ApplicationException: Error executing script: Sourced file: inline evaluation of: ``/*   * This script checks all vendors that are in the state of CASP Review Pendi . . . '' : target exception.
Sourced file: inline evaluation of: ``import com.frictionless.api.doccommon.masterdata.VendorIBeanHomeIfc; import com. . . . '' : Typed variable declaration : Method Invocation vendorHome.find : at Line: 129 : in file: inline evaluation of: ``import com.frictionless.api.doccommon.masterdata.VendorIBeanHomeIfc; import com. . . . '' : vendorHome .find ( ref ) |Target exception: com.frictionless.api.common.exception.ApplicationException: Error executing script: Sourced file: inline evaluation of: ``/*   * This script checks all vendors that are in the state of CASP Review Pendi . . . '' : target exception.| at bsh.BSHMethodInvocation.eval(Unknown Source)| at bsh.BSHPrimaryExpression.eval(Unknown Source)| at bsh.BSHPrimaryExpression.eval(Unknown Source)| at bsh.BSHCastExpression.eval(Unknown Source)| at bsh.BSHVariableDeclarator.eval(Unknown Source)| at bsh.BSHTypedVariableDeclaration.eval(Unknown Source)| at bsh.BSHBlock.evalBlock(Unknown Source)| at bsh.BSHBlock.eval(Unknown Source)| at bsh.BSHBlock.eval(Unknown Source)| at bsh.BSHEnhancedForStatement.eval(Unknown Source)| at bsh.Interpreter.eval(Unknown Source)| at bsh.Interpreter.eval(Unknown Source)| at bsh.Interpreter.eval(Unknown Source)| at com.frictionless.comp.scripting.ScriptEnvironment.execute(ScriptEnvironment.java:143)| at com.frictionless.comp.scripting.ScriptManager.executeCollectionScript(ScriptManager.java:1189)| at com.frictionless.doc.collection.GeneralCollnBo.validateCollection(GeneralCollnBo.java:1899)| at com.frictionless.doc.collection.SubCollnBo.validateCollection(SubCollnBo.java:1166)| at com.frictionless.doc.ContainerBo.execValidate(ContainerBo.java:3737)| at com.frictionless.doc.BizDocBo.execValidate(BizDocBo.java:1965)| at com.frictionless.doc.ContainerBo.validate(ContainerBo.java:1257)| at com.frictionless.doc.ContainerDocBo.validate(ContainerDocBo.java:1299)| at com.frictionless.doc.AbsDocBo.validate(AbsDocBo.java:3138)| at com.frictionless.doc.BizDocBo.validate(BizDocBo.java:2110)| at com.frictionless.common.db.AbstractDb.validate(AbstractDb.java:6217)| at com.frictionless.common.db.AbstractDb.save(AbstractDb.java:3255)| at com.frictionless.doc.ContainerDb.save(ContainerDb.java:213)| at com.frictionless.doc.AbsDocDb.save(AbsDocDb.java:874)| at com.frictionless.common.db.AbstractDb.save(AbstractDb.java:3215)| at com.frictionless.doc.ContainerHome.save(ContainerHome.java:294)| at com.frictionless.doc.AbsDocHome.save(AbsDocHome.java:446)| at com.frictionless.doc.display.util.DisplayStateManager.saveDoc(DisplayStateManager.java:1017)| at com.frictionless.doc.display.util.DisplayStateManager.saveDoc(DisplayStateManager.java:994)| at com.frictionless.doc.display.util.SaveDocRQ.processSave(SaveDocRQ.java:452)| at com.frictionless.doc.display.util.SaveDocRQ.processRequestHook(SaveDocRQ.java:151)| at com.frictionless.doc.display.util.AbsDocRQ.processRequest(AbsDocRQ.java:196)| at com.frictionless.doc.display.util.AbsRQ.run(AbsRQ.java:110)| at java.lang.Thread.run(Thread.java:595) Sourced file: inline evaluation of: ``import com.frictionless.api.doccommon.masterdata.VendorIBeanHomeIfc; import com. . . . '' : Typed variable declaration : Method Invocation vendorHome.find

The first exception haviing at Line: 10 is the scrpt whose target is POST_FIND and the second exception having at Line 129 (VendorHome.find() invoked) is the script. It seems that two exceptions were chanined. The second script whose target is VALIDATE is called when a project is saved. If your explanation is correct, then I could not understand this.

Do you have any idea?


Regarding document, do you point where I can find POST_FIND (find) information? I searched Find word in the document, but I could not find it. I really appreciate your response.

Best Regards,

0 Kudos

Hi Namsoo,

Without seeing the actually scripts and their targets it's hard to tell what exactly is going on.

But note that potentially there could be multiple script definitions(with different targets) on an object. So for instance, if you have a Loaded and Validated targets on Vendor object, then the Loaded script will first get fired when the vendor is loaded (when the user clicks on the vendor record on the UI) and when the user clicks on the Save button, the Validated script will get fired. Just calling the find() method in a script should not trigger another script definition.

In the documentation, search for “Loaded”. It should be under Document Life Cycle section.

Regards,

Vikram

Former Member
0 Kudos

Hi Viram,

The class of two scripts are different, one is Project(1100) and the other is Supplier (607).

The target is collection validation for Project - Project Vendor Sync Script in attached and the target is loaded for Supplier - Vendor Loaded in attached. I attached script screen shot and code snippet where exceptions happened.

As I mentioned before exceptions happened when a project was saved.

I really appreciate if you shed a light on this.

Best Regards,

P.S: Thank you for identifying the document.

0 Kudos

Hi Namsoo,

I did some testing and you are absolutely right. When you do a find(), the data is loaded from the DB into memory and it does trigger the Loaded script, not just when the data is loaded via the UI.

I’m sorry about the confusion.

Regards,

Vikram

Former Member
0 Kudos

Hi Vikram,

Thank you for the confirmation.

Best Regards,

Answers (0)