Report Sales - Shipment: No of copies

tompynationtompynation Member Posts: 398
Hi, when you run report 208 'Sales - Shipment' you can enter the
NoOfCopies inside the option tab on the Request form.

Now i added a Field to the customer card, nl. "No. of Sales Shipment Copies".

So my goal is that when the report is Run, it should automatically fill in the NoOfCopies on the request form with the value of the Customer field "No. of Sales Shipment Copies"

So i added this functionallity to the print button in the "Posted Sales Shipment" form:

lv_Customer.GET(Rec."Sell-to Customer No.");
lv_SalesShptRpt.SetNoOfCopies := lv_Customer."No. of Deliveries";
lv_SalesShptRpt.SETTABLEVIEW(Rec);
lv_SalesShptRpt.RUNMODAL;

Now the problem is that the NoOfCopies is not set when it opens the request form and the TableView is not working cause it just prints the report for every sales shipment there is...

Whats going wrong here?

That SetNoOfCopies function inside the report looks like this:

SetNoOfCopies(varNoOfCopies : Integer)
NoOfCopies := varNoOfCopies;

So it just fills up the Global Variable inside the report which is displayed in the "No of Copies" field on the request form

Answers

  • tompynationtompynation Member Posts: 398
    sorry the No of Copies gets filled in properly...

    It's just the tableview which is not working.

    It now prints for every sales shipment a Report, while it should just do this for the Sales Shipment which was selected in te Form when i pressed print
  • tompynationtompynation Member Posts: 398
    ok stupid mistake from me :oops:

    Just had to create a variable and set a filter on that variable instead of passing the Current Rec to the tableview
  • SavatageSavatage Member Posts: 7,142
    How about on the dataitem integer - Copy Loop
    you add
    Variable->Customer->Record->Customer

    OnPreDataItem()
    Customer.GET("Sales Shipment Header"."Sell-to Customer No.");
    If NoCopies = 0 then NoCopies := Customer."No Of Deliveries";

    ...
    NoLoops := 1 + ABS(NoCopies);
    IF NoLoops <= 0 THEN
    NoLoops := 1;
    CopyNo := 0;

    Tested & works fine
    This way the reqest form can override the settings in the cust card if needed
  • tompynationtompynation Member Posts: 398
    Well, isnt this overriding the NoOfCopies on the Request form?

    Imagine that on the Customer Card the No of Copies is set to 5.
    But for one special occasion you just only need 2 copies.

    You press print and there will be a 5 displayed on the Request form.
    Now the user can easily change this to 2.

    When i would declare the No of Copies inside the DataItem i guess this 2 will get changed to 5 copies?
  • SavatageSavatage Member Posts: 7,142
    NoCopies is a variable on the request form so if it isn't filled then it will look at the customer card and use that number else it will use the number from the request form.

    this is just a quick example of where you can put the code this code doesn't fill the request form
Sign In or Register to comment.