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

INNERJOINS

Former Member
0 Likes
685

Hi all ,

i need to retrieve INFNR(purchasing info record number) using tables EINA and EINE using EINA-MATNR, EINE-EKORG, AND EINA-LIFNR.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
642

Hi,

No need inner join.

You can read directly from database view V_EINA.


REPORT ZTEST.
               
TABLES: V_EINA.
               
DATA: BEGIN OF ITAB OCCURS 0,
        INFNR LIKE EINA-INFNR.
DATA: END OF ITAB.
               
SELECT-OPTIONS: S_MATNR FOR V_EINA-MATNR,
                S_EKORG FOR V_EINA-EKORG,
                S_LIFNR FOR V_EINA-LIFNR.
               
SELECT INFNR
INTO TABLE ITAB
FROM V_EINA
WHERE MATNR IN S_MATNR
  AND EKORG IN S_EKORG
  AND LIFNR IN S_LIFNR.
             
LOOP AT ITAB.
  WRITE: / ITAB-INFNR.
ENDLOOP.

Regards,

Ferry Lianto

4 REPLIES 4
Read only

RaymondGiuseppi
Active Contributor
0 Likes
642

Try this code (and adapt)

SELECT F1~LIFNR  F1~MATNR  F2~MATKL  F1~INFNR  F3~EKORG
    INTO CORRESPONDING FIELDS OF JOIN
    FROM EINA AS F1  JOIN MARA AS F2
           ON F1~MATNR = F2~MATNR
           JOIN EINE AS F3
           ON F1~INFNR = F3~INFNR
    WHERE F1~LIFNR = O_LIFNR AND
          F2~MATKL = O_MATKL AND
          F3~EKORG = O_EKORG

Look at <a href="http://jplamontre.free.fr/SAP/TrucAstuceSAP.htm">Trucs et Astuces ABAP et SapScripts</a>

Regards

Read only

Former Member
0 Likes
643

Hi,

No need inner join.

You can read directly from database view V_EINA.


REPORT ZTEST.
               
TABLES: V_EINA.
               
DATA: BEGIN OF ITAB OCCURS 0,
        INFNR LIKE EINA-INFNR.
DATA: END OF ITAB.
               
SELECT-OPTIONS: S_MATNR FOR V_EINA-MATNR,
                S_EKORG FOR V_EINA-EKORG,
                S_LIFNR FOR V_EINA-LIFNR.
               
SELECT INFNR
INTO TABLE ITAB
FROM V_EINA
WHERE MATNR IN S_MATNR
  AND EKORG IN S_EKORG
  AND LIFNR IN S_LIFNR.
             
LOOP AT ITAB.
  WRITE: / ITAB-INFNR.
ENDLOOP.

Regards,

Ferry Lianto

Read only

0 Likes
642

how can we know the database view for respective tables.

For the question below :

i need to retrieve INFNR(purchasing info record number) using tables EINA and EINE using EINA-MATNR, EINE-EKORG, AND EINA-LIFNR.

you valuabel advise is perectly right:

No need inner join.

You can read directly from database view V_EINA.

can i please know the related database view for other tabels also.

Thanks In advance

Read only

0 Likes
642

how can we know the database view for respective tables.

For the question below :

i need to retrieve INFNR(purchasing info record number) using tables EINA and EINE using EINA-MATNR, EINE-EKORG, AND EINA-LIFNR.

you valuabel advise is perectly right:

No need inner join.

You can read directly from database view V_EINA.

can i please know the related database view for other tabels also.

Thanks In advance