Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

Hi, I am a kind beginner in writig sql querries, but this is quite chellenging.

Every end of week I choose invoice, add BP + choode to create invoice from many Delivery Note (say 30 pcs) (deelivery notes from last week). This is a kind of long invoice. In this moment I am ready to add invoice. However in order to have dates in the infoice right want to create querry that will get me he latest DocDate from these 30 delivery notes. The problem is that in this moment the data I see in the invoice are not in any table (temporary dokument). Please help. Maybe there is posibility to get max() from docdates on this temp dok.

PS. I have Sap B1 SQL 9.2 version.


Regmards, Tomek

asked 02 Sep '17, 01:55

tsznajder's gravatar image

accept rate: 0%

Before we start imagining about your Schema, can you please give us the table definition, sample data, and what you expect? Based on your description I would suggest you to look at window functions (to extract the first record from the group), but I want to be sure what you expect.


And yes, I am not the expert you are looking for :( the experts are so rare and ordinary people have to somehow survive.

(02 Sep '17, 02:24) Vlad

Creating the invoice is standard process so no need to add table names I think. The issue is this: - is there any possibility to to get date from temporary document (temporary invoice)?

I tried to use this $[$38.44.0] which refers to DeliveryNote Docnum in ODLN. however with this $[$38.44.0] I get only Docnum (of delivery note) in first row (row = 1). While I need to have the highest docnum in the whole temporary invoice, not the maximum from first row only :) I hope this will help to understand the problem better. Thanks!

(02 Sep '17, 03:17) tsznajder
Replies hidden

No, it won't, but thank you for the answer. I see that you need the real expert, who knows the standard process. Let us wait if somebody helps you.

p.s. friends-experts, I know that you are aware of the business processes, but here is a small tip that I have googled.

(02 Sep '17, 03:43) Vlad

I don't have the answer, either, and without any table definition and sample data I can't provide one, but as you are not using the database system SQL Anywhere but SAP B1, I would recommend to ask your question on the general SAP Q&A site - or better, search if it isn't already contained:

Find Questions & Answers

A first search lists hundreds of questions there to that system, so I hope you'll find the according experts there.

permanent link

answered 02 Sep '17, 05:59

Volker%20Barth's gravatar image

Volker Barth
accept rate: 34%

converted 02 Sep '17, 06:00

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 02 Sep '17, 01:55

question was seen: 1,330 times

last updated: 02 Sep '17, 06:00