Skip to Content
avatar image
Former Member

SQL Query sap b1

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

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

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

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 24, 2017 at 01:04 PM

    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

    Add comment
    10|10000 characters needed characters exceeded