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 vendor :: Purchasing Organization & Company Code

Former Member
0 Likes
1,949

Hi,

I need to select Vendor BUT with:

Purchasing Organization(EKORG) = 2000 and 4000

AND

Company Code(BUKRS) = 1000 and 2000

Which TABLES do I have to use?

This is what I have now:


  SELECT *
     FROM lfm1
     INTO TABLE ta_lfm1
     FOR ALL ENTRIES IN ta_lfa1
    WHERE lifnr EQ ta_lfa1-lifnr
    AND   ekorg IN ('2000', '4000').

tnx. Adibo.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,054

Hi!

You'll need LFB1 also, which contains the BUKRS relevant data.

LFA1 and LFM1 are fine already.

Regards

Tamá

3 REPLIES 3
Read only

Former Member
0 Likes
1,055

Hi!

You'll need LFB1 also, which contains the BUKRS relevant data.

LFA1 and LFM1 are fine already.

Regards

Tamá

Read only

Former Member
0 Likes
1,054

Hi,

You can try this piece of code.

SELECT a~lifnr

a~ekorg

b~bukrs

.................. Fields you need.

FROM lfm1 AS a INNER JOIN lfb1AS b

ON alifnr = blifnr

INTO CORRESPONDING FIELDS OF TABLE ta_lfm1

FOR ALL ENTRIES IN ta_lfa1

WHERE a~lifnr = ta_lfa1-lifnr

AND a~ekorg IN ( '2000' , '4000' )

AND b~bukrs IN ( '1000' , '2000').

Plz reward if useful.

Thanks,

Dhanashri

Read only

Former Member
0 Likes
1,054

My Solution:


  SELECT
        lfa1~lifnr  lfa1~adrnr  lfa1~erdat  lfa1~stkzu  lfa1~gbort  lfa1~sperz  lfa1~profs  lfa1~stenr
        lfa1~land1  lfa1~mcod1  lfa1~ernam  lfa1~telbx  lfa1~gbdat  lfa1~scacd  lfa1~stgdl  lfa1~psofg
        lfa1~name1  lfa1~mcod2  lfa1~esrnr  lfa1~telf1  lfa1~sexkz  lfa1~sfrgr  lfa1~emnfr  lfa1~psois
        lfa1~name2  lfa1~mcod3  lfa1~konzs  lfa1~telf2  lfa1~kraus  lfa1~lzone  lfa1~lfurl  lfa1~pson1
        lfa1~name3  lfa1~anred  lfa1~ktokk  lfa1~telfx  lfa1~revdb  lfa1~xlfza  lfa1~j_1kfrepre lfa1~pson2
        lfa1~name4  lfa1~bahns  lfa1~kunnr  lfa1~teltx  lfa1~qssys  lfa1~dlgrp  lfa1~j_1kftbus  lfa1~pson3
        lfa1~ort01  lfa1~bbbnr  lfa1~lnrza  lfa1~telx1  lfa1~ktock  lfa1~fityp  lfa1~j_1kftind  lfa1~psovn
        lfa1~ort02  lfa1~bbsnr  lfa1~loevm  lfa1~xcpdk  lfa1~pfort  lfa1~stcdt  lfa1~confs  lfa1~psotl
        lfa1~pfach  lfa1~begru  lfa1~sperr  lfa1~xzemp  lfa1~werks  lfa1~regss  lfa1~updat  lfa1~psohs
        lfa1~pstl2  lfa1~brsch  lfa1~sperm  lfa1~vbund  lfa1~ltsna  lfa1~actss  lfa1~uptim  lfa1~psost
        lfa1~pstlz  lfa1~bubkz  lfa1~spras  lfa1~fiskn  lfa1~werkr  lfa1~stcd3  lfa1~nodel
        lfa1~regio  lfa1~datlt  lfa1~stcd1  lfa1~stceg  lfa1~plkal  lfa1~stcd4  lfa1~qssysdat
        lfa1~sortl  lfa1~dtams  lfa1~stcd2  lfa1~stkzn  lfa1~duefl  lfa1~ipisp  lfa1~podkzb
        lfa1~stras  lfa1~dtaws  lfa1~stkza  lfa1~sperq  lfa1~txjcd  lfa1~taxbs  lfa1~fisku
     INTO CORRESPONDING FIELDS OF TABLE ta_lfa1
     FROM lfa1
     INNER JOIN lfb1 ON
      lfb1~lifnr = lfa1~lifnr
     INNER JOIN lfm1 ON
      lfm1~lifnr = lfa1~lifnr
    WHERE lfa1~lifnr IN so_lifnr
      AND lfb1~bukrs IN ('1000', '2000')
      AND lfm1~ekorg IN ('2000', '4000').