Hi,
I am trying to write a dexterity code to make an action (e.g. warning "Printing SOP Blank Invoice Form"; ) instead of printing specific GP default report like "SOP Blank Invoice Form".
I am not sure which trigger I should use, and what would be the piece of code to fire this up.
Also, what would be the function which will close the report form before it starts. reject script; or Report_End() does not work.
Any suggestions would be appreciated.
Thank you
Hany
*This post is locked for comments
Registering trigger against "SOP_DP_Print_Forms" wouldn't help you, because once it is called you can not reject the printing process. You can try this.
l_result = Trigger_RegisterProcedure(script SOP_DP_Print_Forms, TRIGGER_AFTER_ORIGINAL, script TriggerScript); if l_result <> SY_NOERR then warning "Procedure trigger registration failed"; end if;
TriggerScript local integer i; i=GetReportID (SOP_INVOICE,1,false) of form SOP_Print_Options; if Resource_GetResourceName(0, 23, i)="SOP Blank Invoice Form" then warning "call your report"; reject script; end if;
Since you have to call your SSRS report, why not try this.
Register a trigger on pre of Print Button of SOP Print Option window.
check if SOP Blank Invoice is selected then print you SSRS report and reject script.
Hany,
Sorry if I misunderstood your original question. The procedure signature for the SOP_DP_Print_Forms (GP 2016 R2) is as follows:
{ Procedure: SOP_DP_Print_Forms } in integer IN_Print_Group_Box; in integer IN_Type; in 'SOP Number' IN_Doc; in 'Batch Number' IN_Batch; in boolean fPrintingList; in 'SOP Number' IN_Start_Doc, IN_End_Doc; in date IN_Start_Doc_Date, IN_End_Doc_Date; in 'Batch Number' IN_Start_Batch, IN_End_Batch; in 'SOP Status' IN_Start_SOP_Status, IN_End_SOP_Status; in integer IN_Doc_Sort; in integer IN_File_Source; in integer IN_Match_Packing_Slip; in integer IN_Match_Picking_Ticket; in boolean IN_Print_PS_Line_Comments; in boolean IN_Print_PT_Line_Comments; in boolean IN_Print_PS_Per_Site; in boolean IN_Print_PT_Per_Site; in boolean IN_ReprintPS; in boolean IN_ReprintPT; in boolean IN_IncludeDSItems; in boolean IN_IncludeBackOrderedItems; in boolean IN_Print_Kit_Components; in boolean IN_Include_Tax_Details; in boolean IN_Print_Dual_Currencies; in integer IN_Tax_Print_Options; in boolean IN_Print_Inclusive_Tax; in boolean IN_Print_Tax_Invoice; in boolean IN_Print_Adjustment_Note; in boolean IN_Print_Prev_Printed; in integer IN_Format[8]; inout boolean IN_Print_Doc[9]; in boolean IN_Screen[9]; in boolean IN_Printer[9]; in integer IN_Export[9]; in string IN_Filename[9]; in integer IN_Which_Currency; in 'Sequence Number' nSeqNum; in boolean IN_Print_Customer_Item_Document, IN_Print_Picking_Instructions, IN_Include_Kit_Components_PT, IN_Bin_Sequened, IN_Sort_Kit_Components, IN_Include_Kit_Components_PS, IN_Print_Customer_Item_PS, IN_Include_Incomplete_Documents_PT, IN_Include_Incomplete_Documents_PS; in boolean IN_PrintShipToAddrWithLines; in boolean IN_PrintPTShipToAddrWithLines; inout ListObjState ListObj; in boolean IN_Print; {can Print or Send Email or both} in boolean IN_SendEmail; {can Print or Send Email or both} optional inout integer nProcessID = 0; optional inout boolean fValidDocsToEmail = false;
Mariano, Thank you for your response.
All what I need to do is to create an action when printing specific report. For example, I want to print an SSRS report of a SOP invoice and ignore printing the GP default report (SOP Blank Invoice Form). My question is how to trigger the action of printing this report (no Trigger_Register for report writer reports). I found the procedure "SOP_DP_Print_Forms" which calls the SOP reports and it looks like that I can use it to achieve my purpose (reject original script and calling the SSRS report). Since this procedure works for both "SOP Blank Invoice Form" and "SOP Blank History Invoice Form", I want to be specific and determine which report is being printed. I created a "Trigger_RegisterProcedure" which calling the script that has all required parameters as per the GP SDK, then I would know which report is being called by getting the value of the passed parameters. Unfortunately, the trigger is not registered due to an error. I took a Log Script of the Print Sales Invoice and noticed in the log, that the SOP_DP_Print_Forms has 2 more parameters than what is given in the SDK. I tried to fill the missing ones but no luck (This is GP 2016 R2).
Any idea how I can register the "SOP_DP_Print_Forms" procedure..?
Thank you
The first question is a bit tricky as there are two Report Destination windows: one in the Dynamics.dic dictionary and one in the Dex.dic dictionary. For the one in the Dex dictionary, you would have to use the Trigger_RegisterFocusByName() function to set the trigger against the OK button - the Dex.dic dictionary is product Id 1. For the one in the Dynamics dictionary, well, that's pretty easy peasy!
As for your second question, re: closing the report before it starts, once the run report statement is executed, I don't know that you can prevent the report from not being displayed. At least, I haven't found a way.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,228 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156