SAP for Utilities Discussions
Connect with fellow SAP users to share best practices, troubleshoot challenges, and collaborate on building a sustainable energy future. Join the discussion.
cancel
Showing results for 
Search instead for 
Did you mean: 

Table aliasing for IFLOT

Former Member
0 Kudos

Hi Gems,

I need to write a select query in IFLOT table to display fields TPLMA(superior Loc) & TPLNR(Func location_.

This is based on 2 inputs in where clause like:

a) the field TPLNR = somve value

where IWERK EQ 'DGMT'

AND FLTYP EQ 'L'.

b) the field TPLMA = value of TPLNR.

How do i write this.? Do i need to do using table aliasing?

Is the one below correct?

SELECT TPLNR IWERK TPLMA

FROM IFLOT

INTO CORRESPONDING FIELDS OF TABLE IT_TECH

FOR ALL ENTRIES IN IT_BUS[]

WHERE TPLMA = IT_BUS-HAUS

AND IWERK EQ 'DGMT'

AND FLTYP EQ 'L'.

Please suggest.

Thanks

Dan

6 REPLIES 6

Former Member
0 Kudos

SELECT TPLNR TPLMA IWERK

FROM IFLOT

INTO CORRESPONDING FIELDS OF IT_TECH

FOR ALL ENTRIES IN IT_BUS

WHERE TPLMA = IT_BUS-HAUS

AND FLTYP EQ 'L'

AND IWERK EQ 'DGMT'.

Try like this

Regards,

Shiva Kumar

0 Kudos

So my select query is correct or not?

0 Kudos

Yes.It is correct but change the order in the select and the where condition.

0 Kudos

Hi Shiva Kumar,

I am sorry ....actually i had wriiten two queries as below. Can you tell me how do i combine this into one query?

  • get the func location

IF NOT IT_BUS[] IS INITIAL.

SELECT TPLNR IWERK

FROM IFLOT

INTO CORRESPONDING FIELDS OF TABLE IT_TECH

FOR ALL ENTRIES IN IT_BUS[]

WHERE TPLNR = IT_BUS-HAUS

AND FLTYP EQ 'C'.

IF IT_TECH[] IS NOT INITIAL.

  • obtain the Superior Func location(TPLMA) again from IFLOT

SELECT TPLNR TPLMA IWERK

FROM IFLOT

INTO CORRESPONDING FIELDS OF TABLE IT_TECH2

FOR ALL ENTRIES IN IT_TECH[]

WHERE TPLMA = IT_TECH-TPLNR

AND IWERK = P_WERKS

AND FLTYP = 'L'.

Please suggest.

thanks

Dany

0 Kudos

We can't combine these 2 queries in to 1 query.

If you see the table you will get to know.

As you menctioned your queries are correct.

Let me know if you need any more information.

Regards,

Shiva Kumar

Former Member
0 Kudos

we cannot combine them into one as per the requirement.