Print PrintDefinition after Adding Invoice
berbericz
Hello Experts,I have read a lot of different topics in this forum but I'm still not able to create an optimizer-rule executed when pressing Add-Button of "AR Invoice" which should open (or even better print) my defined printdefinition.
Maybe I only do not understand when to use which Method and what are the required parameters!?
What is the difference between "ExecutePrintDef" which doesn't work (!?) and "OpenLayout" which will open the "choose printdefinition" if I have defined different printdefinitions for that form-type (even if I try to put the correct printdefinition into the parameters!?).
Please explain each parameter in that method (the first one doesn't work but I found in forum):
A)
[CODE]
LayoutHelper.LayoutOpener.ExecutePrintDef("Z_GLS_Label",true, LayoutHelper.LayoutOpener.OpenLayoutModes.Preview, "133","U0000057", "DocNum", docNum.ToString());
[/CODE]
[CODE]
LayoutHelper.LayoutOpener.OpenLayout(LayoutHelper.LayoutOpener.OpenLayoutModes.Preview, "133", "Z_GLS_Label", "U0000057", "DocNum", docNum.ToString());
[/CODE]
I also need the DocEntry instead of the DocNum which won't be available before Adding document.
In forum they recommend to use "pVal.BusinessObjectKeyString" instead but if I print this in a messagebox I have no result. How can I get the DocEntry?
My EventType is "FormDataAdd" and Form Mode "Add".
Thanks for your help!
Regards,
GB
Lorenz Stierlin
Hello,Thanks for your request.
If I understood your use-case in the right way - I think there is a much more comfortable solution for it... You can just use the new EasyFunctions command.
Try this one:
[CODE]
ExecutePrintDef("DocARInvoice|Preview|DocEntry;$[$8.0.0]");
[/CODE]
- "DocDelivery" is the NameId of the PrintDefinition, you find this in the Printdefinition under the Tab "Extended Defintion" - "Name Id"
- "Preview" is the mode you want to handle the report -> supported are: Print, Preview, Email, Fax, Word, Excel, PDF, Design, PrnAfterSave, UserQuery
- "DocEntry" is the name of the key
- "$[$8.0.0]" is the actual key, it reads out the "Item 8" from the SAP Form which is the DocNum field
I hope this will help you.
Kind Regards,
Lorenz
berbericz
Thanks Lorenz,that works fine with the exception that "Item 8" is the DocNum and I need the DocEntry (before Adding) or can you explain me how I have to change the parameter in the Layoutdefinition (?) so it works with the Docnum?
Thanks
berbericz
solved.... the before-event was ticked and that's why I can not receive the after-event docentry. thanks
0
Please sign in to leave a comment.
Comments
0 comments