Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

select statement in FM

waqar_ahmed
Contributor
0 Likes
690

Hi All,

I am extracting data from two tables (EKKO,EKPO)using Function module. I have created extract structure on these tables, there is component AEDAT in both tables with same name and I am not able to create field in structure with same name. So I created one as zAEDAT, If I create one with zAEDAT than I am not able to use select as there is not standard component as ZAEDAT.

Can some please tell me the select statement to fetch both of these dates in single select, below statement will not work as there is no component as ZAEDAT. I am using cursors to fetch this data, not using any internal tables.

Please suggest.

SELECT EKKO~EBELN EKKO~AEDAT EKPO~ZAEDAT


          FROM EKKO
          INNER JOIN EKPO ON EKKO~EBELN= EKPO~EBELN

           Where EKKO~EBELN IN PONO.


Regards,

Ray

4 REPLIES 4
Read only

Former Member
0 Likes
644

Hi

SELECT EKKO~AEDAT as ZAEDAT
          
FROM ekko

  INNER JOIN EKPO ON EKKO~EBELN= EKPO~EBELN

           Where EKKO~EBELN IN PONO.

Regards
Shaik

Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
644

SELECT EKKO~EBELN EKKO~AEDAT as ZEDAT EKPO~ZAEDAT as ZEDAT1


          FROM EKKO
          INNER JOIN EKPO ON EKKO~EBELN= EKPO~EBELN

           Where EKKO~EBELN IN PONO.

Read only

Former Member
0 Likes
643

Hello Ray,

first thing is you can create a field AEDAT in your table or structure with same name .

i dono why you going with zaedat field .

As above suggested you can use,

SELECT EKKO~AEDAT as ZAEDAT
          
FROM ekko

  INNER JOIN EKPO ON EKKO~EBELN= EKPO~EBELN

           Where EKKO~EBELN IN PONO.

Read only

Former Member
0 Likes
643

types : begin of ty_tab,

ebeln type ebeln,

aedat type aedat,

zaedat type aedat,

end of ty_tab.

data: itab type standard table of ty_tab.

since AEDAT is in both tables u can write join as below

SELECT EKKO~EBELN EKKO~AEDAT EKPO~AEDAT

          FROM EKKO
          INNER JOIN EKPO ON EKKO~EBELN = EKPO~EBELN

           INTO TABLE itab
           WHERE EKKO~EBELN IN PONO.