Application Development 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: 

Required help in table joins for EKKO,EKPO,LFA1,ADRC,EBAN

Former Member
0 Kudos

Hi ABAP experts,

I am desgining a smartform with PR data , PO data and vendor details like address,city,etc....

pls find my code below which i joined ekpo,adrc and lfa1.

DATA: BEGIN OF itab OCCURS 0,

ebeln LIKE ekko-ebeln,

lifnr LIKE ekko-lifnr,

adrnr LIKE lfa1-adrnr,

name1 LIKE adrc-name1,

house_num1 LIKE adrc-house_num1,

str_suppl1 LIKE adrc-str_suppl1,

str_suppl2 LIKE adrc-str_suppl2,

str_suppl3 LIKE adrc-str_suppl3,

building LIKE adrc-building,

END OF itab.

SELECT ekkoebeln ekkolifnr lfa1adrnr adrcname1 adrc~house_num1

adrcstr_suppl1 adrcstr_suppl2 adrcstr_suppl3 adrcbuilding

FROM ekko

JOIN lfa1 ON

lfa1lifnr = ekkolifnr

JOIN adrc ON

adrcaddrnumber = lfa1adrnr

INTO CORRESPONDING FIELDS OF TABLE itab

WHERE ebeln = p_ebeln.

now i want to join eban and ekpo with the above internal table itab and display the result in a final internal table.....

plss....pls help me the continuation code, i am in the middle of a critical issue....

i need to display the values from final internal table in the smartform layout for PO,PR and vendor details.....

thanks in advance

joti

2 REPLIES 2

former_member156446
Active Contributor
0 Kudos

This message was moderated.

Former Member
0 Kudos

Dear Joti,

Welcome to SCN !!

You can join EBAN and EKPO on the basis of banfn and bnfpo.

see the below sample code

types: BEGIN OF ty_itab1,

banfn LIKE eban-banfn,

bnfpo LIKE eban-bnfpo,

ebeln LIKE ekpo-ebeln,

ebelp LIKE ekpo-ebelp,

END OF ty_itab1.

data: itab1 type standard table of ty_itab1.

IF itab[] IS NOT INITIAL.

SELECT ebanbanfn ebanbanfn

ekpoebeln ekpoebelp

FROM eban INNER JOIN ekpo

ON ebanbanfn = ekpobanfn

AND ebanbanfn = ekpobanfn

INTO TABLE itab1

FOR ALL ENTRIES IN itab

WHERE ekpo~ebeln = itab-ebeln.

ENDIF.

you have data in ITAB and ITAB1 now move this data into final internal table and do whatever you want.

Hope this will help you.