Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

Dexterity code to make an action instead of printing specific GP default report like "SOP Blank Invoice Form"

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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

  • Pam Robertson Profile Picture
    Pam Robertson 199 on at
    Dexterity code to make an action instead of printing specific GP default report like "SOP Blank Invoice Form"
    Mariano,
     
    Do you know if the parameters for this procedure changed between this post and version 18.6.1728?  I'm getting an error 2 when registering a procedure trigger using these parameters.  It worked in a previous version, but not in 18.6.1728.
     
    Or can you point me to any documentation that lists the parameters of procedures in the current version?
     
    Thank you!
     
    Pam
  • Verified answer
    Almas Mahfooz Profile Picture
    Almas Mahfooz 11,003 User Group Leader on at
    RE: Dexterity code to make an action instead of printing specific GP default report like "SOP Blank Invoice Form"

    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.

     

     

  • Verified answer
    Mariano Gomez Profile Picture
    Mariano Gomez 26,225 on at
    RE: Dexterity code to make an action instead of printing specific GP default report like "SOP Blank Invoice Form"

    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;
    


  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dexterity code to make an action instead of printing specific GP default report like "SOP Blank Invoice Form"

    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

  • Mariano Gomez Profile Picture
    Mariano Gomez 26,225 on at
    RE: Dexterity code to make an action instead of printing specific GP default report like "SOP Blank Invoice Form"

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans