on 08-25-2013 7:52 AM
Hi Experts,
can any one explain me why I am getting duplicate entries for billing doc no ( vbeln ) for this join statement.
SELECT vbrk~fkdat vbrk~spart
vbrk~vbeln
vbrk~fkart
vbrk~kunag
vbrk~kunrg
vbrk~vkorg
vbrk~vtweg
vbrk~netwr
vbrk~sfakn
vbrk~knkli
vbrp~posnr
vbrp~vkbur
INTO CORRESPONDING FIELDS OF TABLE it_vbrk
FROM vbrk JOIN vbrp ON vbrk~vbeln = vbrp~vbeln
WHERE vbrk~fkdat IN so_fkdat.
so_fkdat is the select options for date field.
Regards,
Marina.
Hi Marina,
If you have duplicate entries in the final internal table, then
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi.
instead of join you can use for all entries also to get values from multiple table. Still if duplicate entries are there just sort the internal table and delete the duplicates
With reagards
Suneesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi ,
I think you have to sort the Final internal table then use keyword DELETE ADJACENT DUPLICATES
to delete multiple items in the Table.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Marina,
VBRK Table is Billing header table.
VBRP is Billing Line item table.
when you do inner join both the table Based on the header table fetch line item multiple entries.
If for billing only one line item, will get only one entry other wise if it is more than one line item will get multiple entry.
Please check on VF03 pass your billing number and check the line item.
Thanks and Regards,
buz_sap
Hi Marina,
You are Joining the Line item and Header level table, and hence you will be getting multiple lines with same VBELN, provided they are appearing as multiple line items in the VBRP Table.
The best method would be to sort the final internal table based on VBELN and then do a DELETE ADJACENT DUPLICATES.
Although I doubt if you would want to get Just a single entry for VBELN. But again, it depends on the logic in question :-).
Best Regards,
Anish Oommen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
How can i avoid getting duplicate entries?
Will delete adjacent duplicates comparing vbeln will be a long lasting solution?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
first of all...its not duplicates. field like posnr is item specific and will have different values for each item so if you want to display such fields you have to display items also and in turn billing doc. number may appear more than once. try to visualize it as header(vbeln) and items (posnr) level you will know the significance of both.
Rgds
Hi Marina,
You have multiple entries for a VBELN in VBRP based on Item number POSNR, for example
VBELN POSNR
123456 10
123456 20
123456 30
And you want VBRP-VKBUR irrespective of POSNR (Item Number), if 'am correct, it means you can have multiple entries for VBELN in VBRP based on VKBUR, that is for example;
VBELN POSNR VKBUR
123456 10 a
123456 20 b
123456 30 a
Here you can sort the entries of the itab based on VBELN and VKBUR.
And DELETE ADJACENT DUPLICATES FROM itab COMPARING vbeln vkbur.
Hope this will help you
Thanks
Hi Marina,
The multiple records with same VBELN will carry different line Items of that particular VBELN. So that you cannot delete duplicates comparing VBELN.
There won't be question of deleting duplicate entries in your case as you said you need VKBURs in the output.
If you are getting the multiple entries with same VBELN, POSNR and VKBURS then you can delete records comparing these three fields. This might not be happen actually.
Thanks & Regards,
-Vijay
Hi Marina,
You are joining Header and Item table, hence you will get duplicate entries for VBELN.
Check the POSNR fields....
Thanks & Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you are getting duplicate billing docs because for each billing doc. in vbrk there could be multiple items in vbrp (POSNR). so when this query executes it will fetch all items of billing docs. fall under your where condition.
Rgds
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to write
FROM vbrk INNER JOIN vbrp ON vbrk~vbeln = vbrp~vbeln
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
6 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.