Howdy SAP experts,
I am currently working on a requirement which asks FTR_CREATE transaction from TRM module to have attachments enabled to it. Namely, after creating a transaction with TM01 (which is called by FTR_CREATE).
I have already developed a script button in which enables the user to upload files by means of SAP webGUI file browser which works perfectly. The problem is, as it happens with other GOS-enabled create transactions such as VA01 or FMX1, after saving and commiting the business object, the temporarily GOS is copied to a GOS which key now uses the effectively commited Business Object's keys.
Therefore I am trying to execute another script that now saves the attachments after the transaction is closed, i.e., it commits and saves the corresponding created business object.
The problem is, I only know this key after the document is created, in which transaction TM01 leads us back to FTR_CREATE. I have tried scripting from TM01 with an event in the save button where it would call the RFC that manipulates the attachments after saving but i had no sucess in doing that.
The first version of this script was
var oRfc = session.createRFC("ZTRM_DISP_ANEXO_DOC");
where this script was attached to onClick property of save button in TM01. The problem is that the default save activity happens only after the script executes, i.e., hits the backend when the document has not been created effectively.
Then i found the following wiki article (https://wiki.scn.sap.com/wiki/display/Img/GuiUtils.executeScriptAsync%28%29%3A+Executing+Personas+Scripts+asynchronously+or+triggered+by+Non-Personas+Sources) which talks about asynchronous scripting, but I also had no sucess in acheiving the desired scenario (got an error saying: "control not found" in which makes me think that it is not possible to "script between transactions in SAP Screen Personas").
In short, I am trying to have a script that will only execute when the button "save" is pressed in TM01 (with no errors) which will call the RFC "ZTRM_DISP_ANEXO_DOC".
Any help or pointers is greatly appreciated.
Thanks in Advance,