Switch from OINV to ODRF in Crystal Report layout for print the Invoice?
I have imported in Sap Business One some standard report developed by Sap with Crystal Report (like Sales Invoice).
I have try to print my Invoices and all is OK, then I have try to print a Draft Invoice and, even in this case, is all ok. Then I have open the Crystal Report designer for this print module, and the entry point is the OINV table. How can he print succesful the Draft Invoice (that is in the ODRF table ObjType = 13)? Formula Field? I don't understand!!
Thank for the help!!
You only need a single Crystal report for this. Base it on a stored procedure which has two INT type parameters @DocKey and @ObjectId. Within your SQL create IF blocks to handle different @ObjectId values:
IF @ObjectId = 13 then use the invoices tables OINV/INV1 etc.
IF @ObjectId = 112 then use the draft tables ODRF/DRF1 etc.
Don't forget to put the @ symbol at the end of the parameter in the report itself. That is all that is needed to create a single report that works for both added invoices and draft invoices. You could extend the SQL to handle other @ObjectId values like 14 for AR Credit Notes and so on.