I've been messing around with this but need some help.
Many times we want to return all items from a specific manufacturer. Instead on manually entering all the items I figured we can call a report to populate the line table. I can't seem to get the doc no & doc type from the form to my variables on the report.
I'm trying to develope a report that can be accessed from a purchase order (for now, eventually sales order, purch credit, etc). I want to insert items into the puchase line table.
I have made an export dataport & an import dataport of the item table which works fine but I was thinking one report that based upon some selections made in the request form that I could just insert these items without creating a file & importing a file.
So the plan is that if I access the report from the functions of a puchase order I need to pass:
the order Number :ex.123456
the document type:ex. "Credit Memo"
to some variables in my report vDocNo & VDocType
RESET;
PurchHeader.SETRANGE("Document Type","Document Type");
PurchHeader.SETRANGE("No.","No.");
REPORT.RUNMODAL(50061,TRUE,FALSE,PurchHeader);
send the type & no IF I use Puchase header as a dataitem - but I'm only using Item table.
the report will basically insert lines in the purchlin table
this is just real raw to get the idea accross!
purchline."Document Type" := VDocType --> Gotten by passed parameter from form
purchline."Document No." := vDocNo --> Gotten by passed parameter from form
purchline."line no." := vLineNo + 10000;
purchline.type := 'Item';
purchline."no." := item."no.";
purchline.quantity := item.quantity;
purchline.insert;
if I add purchheader as a non linked dataitem - the fields are populated but a can't get them to the request form.
so to stess again when I call the eport from a specific purch order I would like the vDocNo variable on the request form to be filled. I can manulatt fill it - but that's not fun. and once I figure out how to get the doc no - it will allow me to also eliminate the doc type from having to choose it on the request form too.
Answers
REPORT.RUNMODAL(50061,TRUE,FALSE,PurchHeader);
call
CLEAR(myReportVariable);
myReportVariable.SetParameters(ParamList);
myReportVariable.SETTABLEVIEW(...);
myReportVariable.RUNMODAL;
Then in SetParameters you can fill the variable you use on the request form.
Do I understand correctly you want to have ONE report which can handle different tables ?
like: Try to make one report having all necessary table type variables on indent level 0, in every section on OnPreDataItem collect all requires parameters from (using GETFILTER("FIELD")), then the latest section might be based on Integer/whatever and do the all necessary job.
Or just process each table in its own section.
Parameters can be passed using filters.
Inside the code where you need it just run the report against different tables as in the exampe: and in another place (the same report called with two different tables)
Read this viewtopic.php?f=5&t=26550 - might be a better explanation of the idea
Regards,
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
but It still requires the user to enter the doc no and make selections from the request form.
I'm trying to help fill those line to kind of make it idiot proof
I'll try your suggestion - I was thinking getfilters too.
Edit**Corrected & Working Code
http://www.BiloBeauty.com
http://www.autismspeaks.org
http://www.BiloBeauty.com
http://www.autismspeaks.org
hope i understand it correct (after 3 private moves in the last 2 weeks i'm very powerless) ...
in your Report you need a function like
on Sales Order or Purch Order you run the Report and call there before the new Function
Now if you only need to filter some items, you can also send this Item Filter to your report.
Regards
Now I can create a Sales Order, Sales Credit, Puchase order or Puchase Credit header.
go to functions "Get Items" it calls the report based on the item table where I can Insert any items I want with a click.
I can also determine the Qty to be inserted either a User Defined Value or the Qty on hand.
For Sales orders on Function (button) I added "Get Items" Menu Item using code
Add global=> GetItemForIns - Type REPORT - 50061
For Puchase orders/Credits on Function (button) I added "Get Items" Menu Item using code
Add global=> GetItemForIns - Type REPORT - 50061
This will come in hand many times. If we need to pull 1 pc from a specific vendor from inventory for samples - Click DONE!
For our yearly merchandise show - create a picking ticket for vendor A B & C or specific items - click DONE!
If a vendors merch isn't selling and we want to create a return to the vendor - Click DONE!
I'm sure I'll find more & More Uses - thanks to all that helped!
Note: I edited the post above that had the reports code in case someone wanted to try it. The code is correct!
http://www.BiloBeauty.com
http://www.autismspeaks.org