cancel
Showing results for 
Search instead for 
Did you mean: 

How to list only one record with sales order/deliver and /invoice number?

0 Kudos

I created the infoset with VBAP and LIPS. They are joined using VBAP.VBEL and LIPS.VGBEL. Since I have multiple items for each sales order, my query shows the same line multiple times.See below an example:

I would like to show only one line per SO, for instance

100392380101340blank

1003928801013410091001205

100392980101342blank

And so on.

The invoice number is not a table defined in the query but is an extra field with this code.

Is there a way in the infoset to do this and obtain only one line?

Thank you in advance.

0 Kudos

Hello,

How I can change tag?

Thank you for your time.

Jelena
Active Contributor
0 Kudos

There is a tiny button Actions right underneath the question title, it has an option to edit the question:

Accepted Solutions (0)

Answers (6)

Answers (6)

Jelena
Active Contributor
0 Kudos

First of all, the document flow is always at the line level, so it simply will not be accurate to present the information the way you're asking. Even if it is how, de facto, process works in your system there is nothing preventing anyone from creating multiple references.

That aside, in a query obviously you can't just JOIN line item tables and then expect to see the result at the header level. To achieve what you are asking you'd need to start with the header level table (e.g. VBAK) and then add entries using ABAP code in Extras. But it'd be much more efficient to do this in an ABAP report.

0 Kudos

Unfortunately the sales order number is not in LIKP. The sales order number is in LIPS (field VGBEL=Reference doc).

Lakshmipathi
Active Contributor
0 Kudos

Did you try VBAK and LIKP ? If you want to have Billing reference also, then, add VBRK. In fact, the easy method is Table Join in SQVI

0 Kudos

Hi,

any suggestions at my question?

0 Kudos

Hi Vibhor,

thank you for the suggestion.

You suggested to use VBFA table instead of LIPS. If I set VBAP.VBELN (sale document) = VBFA.VBELV (preceding doc), I still have multiple records because of the items. Could you please tell me the correct link of the two tables?

former_member184701
Active Contributor
0 Kudos

when you use the VBFA also restrict your selection by VBFA-VBTYP_N

it should be 'R' for delivery

and 'J' for invoice

please take into account the VBFA-POSNN - it is your item number

as already mentioned below, use the correct tool to build your report, drop the query way and drive the ABAP

Jelena
Active Contributor
0 Kudos

Please also use "Comment on this answer" when replying to an answer. Otherwise the person you're replying to will not get notified and it's confusing to the readers as well.

Thank you.

former_member232581
Active Participant
0 Kudos

Hi Daniel

You are querying item level tables so if you don't want multiple line you might want to limit it by selecting only first item number on LIPS.

Why don't you use VBFA table to get this data?

Thanks

Vibhor.

Jelena
Active Contributor
0 Kudos

VBFA is also at the line item level, it won't help OP in any way, sorry.