Skip to Content
0

SQL Query sap b1

Aug 18, 2017 at 06:46 AM

40

avatar image
Former Member

Select DocEntry, Taxcode From PCH1

Where DocEntry = '5684'

Resuls

DocEntry Taxcode

5684 Tax@5

5684 Tax@12

5684 Tax@18 .... may be etc

.

I would like to return the results in one row, so like this:

DocEntry Taxcode

5684 Tax@5,Tax@12,Tax@18,......etc

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

avatar image
Former Member Aug 22, 2017 at 08:37 AM
0

any one can help me?????????????

Share
10 |10000 characters needed characters left characters exceeded
Anand Singh Aug 24, 2017 at 01:04 PM
0

Akhil,

You can use below logic to get desire result.

Select distinct DocEntry,
 (select Taxcode from opch T0 where T0.Docentry =pch1.docentry and T0.taxcode = 'Tax@5' )  'TAX@5' ,
(select Taxcode from opch T1 where T1.Docentry =pch1.docentry and T1.taxcode = 'Tax@12' ) 'TAX@12',
(select Taxcode from opch T2 where T2.Docentry =pch1.docentry and T2.taxcode = 'Tax@18' ) 'TAX@18'.......
From PCH1
Where DocEntry = '5684'

Regards,

Anand

Share
10 |10000 characters needed characters left characters exceeded