04-21-2007 5:57 AM
Hi all,
i have following select statements. i had to get the out put as follows.
output:
pspid posid banfn ebeln lblni.
my select queries are:
select pspid werks from proj into table p_proj.
select posid werks from prps into table p_prps for all entries in p_proj where werks = p_proj-werks.
select banfn werks lblni from eban into table p_eban for all entries in p_prps where werks = p_prps-werks.
select lblni ebeln banfn from essr into table p_essr for all entries in p_eban where lblni = p_eban-lblni.
select ebeln from ekko into table p_ekko for all entries in p_essr where ebeln = p_essr-ebeln.
thing is i need to loop them to get output as mentioned above,can any body provide me code for this.
thanks in advance
siva
04-21-2007 10:53 AM
Hi
Try this code.
DATA:
BEGIN OF ITAB OCCURS 0,
PSPID LIKE PROJ-PSPID,
POSID LIKE PRPS-POSID,
BANFN LIKE EBAN-BANFN,
EBELN LIKE ESSR-EBELN,
LBLNI LIKE ESSR-LBLNI,
END OF ITAB.
SELECT P1~PSPID
P2~POSID
P3~BANFN
P4~EBELN
P3~LBLNI
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM PROJ AS P1 INNER JOIN PRPS AS P2 ON P1WERKS = P2WERKS
INNER JOIN EBAN AS P3 ON P2WERKS = P3WERKS
INNER JOIN ESSR AS P4 ON P3LBLNI = P4LBLNI.
Reward points if u find it helpful.